ositools icon indicating copy to clipboard operation
ositools copied to clipboard

NRD_CharacterSetPermanentBoostInt does not apply properly when used with statuses

Open Anacroniqa opened this issue 6 months ago • 0 comments

Extender Version

v59

Game Version

v3.6.117.3735

Bug Summary

First of all, this is the first time I report a bug of this type and I have zero formation in programming, so sorry if I don't give all the needed information. The issue is related to the NRD_CharacterSetPermanentBoostInt((CHARACTERGUID)_Character, (STRING)_Stat, (INTEGER)_Value) call. I am using it to give boosts to armor and magic armor from Finesse/Strength and Intelligence and it works perfectly in most instances, except for when those stats are modified by statuses. When a status is applied, the bonus registers correctly in the character sheet and the maximum quantity of magic armor/armor you are supposed to be able to have increases accordingly. However, the actual quantity of armor/magic armor (what would be the CurrentArmor/CurrentMagicArmor stats) do not increase and cannot be filled either. It only fills once another status is applied. I found a workaround to make things work by having a "sincronizing" status applied each time a status is applied, but I thought I should report the issue regardless. I leave here a sample of the code in case it is useful.

IF CharacterStatusApplied(_Character, _StatusId, _Causee) AND DB_IsPlayer(_Character) AND NRD_StatusGetHandle((CHARACTERGUID)_Character, _StatusId, _StatusHandle) AND NRD_StatusGetReal((CHARACTERGUID)_Character, _StatusHandle, "CurrentLifeTime", _CurrentLifeTime) AND NRD_StatusGetReal((CHARACTERGUID)_Character, _StatusHandle, "LifeTime", _LifeTime) AND _CurrentLifeTime == _Lifetime AND NRD_CharacterGetComputedStat(_Character, "Strength", 0, _SValue) AND NRD_CharacterGetComputedStat(_Character, "Finesse", 0, _FValue) AND NRD_CharacterGetComputedStat(_Character, "Intelligence", 0, _IValue) AND _FValue > _SValue AND IntegerSubtract(_FValue, 4, _ArmorValue) AND IntegerSubtract(_IValue, 4, _MagicArmorValue) THEN NRD_CharacterSetPermanentBoostInt(_Character, "Armor", _ArmorValue); NRD_CharacterSetPermanentBoostInt(_Character, "MagicArmor", _MagicArmorValue); CharacterAddAttribute(_Character, "Dummy", 0);

I iterated that a lot trying to find what the issue was, so I can tell there is no difference between using the NRD_CharacterGetComputedStat or the CharacterGetAttribute query, nor between using the CharacterStatusApplied or the NRD_StatusIteratorEvent. It doesn't make any difference if you give more or less conditions either.

This is the code for the workaround. The sincronize status needs to modify a stat, It cannot give, for example, 0 Intelligence. Any modification, from resistances, to attributes seem to work for the armor/magic armor values to update properly: not only what would be the MaxArmor / MaxMagicArmor increases, the CurrentArmor/CurrentMagicArmor does so accordingly.

IF NRD_StatusIteratorEvent(_Event, (CHARACTERGUID)_Character, _StatusId, _StatusHandle) AND DB_IsPlayer(_Character) AND _StatusId != "AMS_Sincronize" AND NRD_StatusGetReal((CHARACTERGUID)_Character, _StatusHandle, "CurrentLifeTime", _CurrentLifeTime) AND NRD_StatusGetReal((CHARACTERGUID)_Character, _StatusHandle, "LifeTime", _LifeTime) AND RealSubtract(_LifeTime, _CurrentLifeTime, _TiempoAplicado) AND _TiempoAplicado == 5.0 THEN ApplyStatus((CHARACTERGUID)_Character, "AMS_Sincronize", 0.0,1);

Links

No response

Anacroniqa avatar Aug 24 '24 12:08 Anacroniqa