So, im trying to make a debuff that decreases other attributes.
However, if the decreased attribute goes lower than zero, and the debuff is removed, you actually "gain" the "decreased" attribute after the debuff is gone.
If mindrot decreases spellpower, under zero, and mindrot is removed, i will gain however much it was below zero.
Is there any sneaky way around this? I presume its because it "adds" the attribute when the behaviour is added (in this case decreases)
and "subtract" (in this case increases) when its removed?
Any idea of a work around?
Or will i have to "kill my darling" here?
Depending on the choice of stacking of the "mindrot" ability this can be done easily with triggers.
The stack count of the attribute behaviour represents the current number of it. You can read this in with triggers when the "mindrot" dummy buff is applied. Push it through a minimum function of the current attribute amount and the amount you want to remove and store in a local. Remove that calculated amount from the attribute and then wait until the buff expires. The waiting could be done by polling if it still has the buff every frame and this is perfectly acceptable if only a few units have the buff at a time. If you want something more efficient you might need to give the mindrot buff dummy stacks to keep track of the amount removed so that the appropriate buff removal trigger can add the correct amount back.
Depending on the stack count of the stats involved you could also apply 1 stack of "mind rot" per attribute point, and stop applying at 0 stat points. The basic version is a Persistent effect with Period Count=max stat reduction, Period Duration=0, Periodic Validator="target has >= 1 stack of reduced attribute", Periodic Effect="reduce attribute by 1".
So, im trying to make a debuff that decreases other attributes. However, if the decreased attribute goes lower than zero, and the debuff is removed, you actually "gain" the "decreased" attribute after the debuff is gone.
If mindrot decreases spellpower, under zero, and mindrot is removed, i will gain however much it was below zero.
Is there any sneaky way around this? I presume its because it "adds" the attribute when the behaviour is added (in this case decreases) and "subtract" (in this case increases) when its removed? Any idea of a work around? Or will i have to "kill my darling" here?
Depending on the choice of stacking of the "mindrot" ability this can be done easily with triggers.
The stack count of the attribute behaviour represents the current number of it. You can read this in with triggers when the "mindrot" dummy buff is applied. Push it through a minimum function of the current attribute amount and the amount you want to remove and store in a local. Remove that calculated amount from the attribute and then wait until the buff expires. The waiting could be done by polling if it still has the buff every frame and this is perfectly acceptable if only a few units have the buff at a time. If you want something more efficient you might need to give the mindrot buff dummy stacks to keep track of the amount removed so that the appropriate buff removal trigger can add the correct amount back.
Depending on the stack count of the stats involved you could also apply 1 stack of "mind rot" per attribute point, and stop applying at 0 stat points. The basic version is a Persistent effect with Period Count=max stat reduction, Period Duration=0, Periodic Validator="target has >= 1 stack of reduced attribute", Periodic Effect="reduce attribute by 1".
@Sendlirn: Go
I thank both of you for the answer! Very helpfull! Will try it immediately.
Will credit you both even if i only use one of the ways :)