oh, I understand all, but can't I increase the periodic time to not cause lag
The periodic time shouldn't cause lag, go ahead and try.
If it does, the reason why it is so quick is because it is suppose to " out-pace " the mana regen rate of the unit.
If you move the check to like .5 or 1 second, the unit may gain a couple points, but the trigger will still reset it correctly. So if you don't want to be overly technical and just have it sort of work, go ahead and modulate the timer.
ok ok +rep
when you detect that the unit uses an item or a magic you forget that the mana is only uses 0.00 seconds after all trigger runs.
which means, you have to use a timer of 0.00 seconds to detect the mana that was lost by using an item or ability.
when a unit uses an item it loses mana.
so, you have to store the NEW mana value to make the unit to be unable to renerate more than it.
<3 glen
<3 this is a heart.
It makes blood flow throug our veins and kills us if stops beating.