» Thu Jun 21, 2012 7:19 am
The debuff would be a Script archetype magic effect with the duration set in the spell that applies it. When it is applied, it would increment a global "Stack" variable (Just a global variable indicating how many of these debuffs are currently stacked on the player) Make a function that the potion's script calls that makes the debuff reverse it's debuffs for the duration of the potion. In the debuff's OnEffectStart() event, it would increment the stacking variable, and in it's OnEffectEnd() it would decrement the stacking variable. The debuffs would need to be made non-cumulative of course (the Effect of the debuff would remain the same regardless of how many are stacked, but if the stacking variable ever reached, say, 10, it would toggle a "Permanent" boolean to indicate the character will always have the debuff from then on when the potion isn't in effect.
Once the "Permanent" boolean is True, when the OnEffectEnd() event fires, it would check the stack variable, and if it was "1" (Meaning this is the last debuff) it would Re-Cast another debuff on the player.