SCTX |
ScriptName SEAbBaliwogScript
Short RegenOn ; flag, set when the water regen ability is on
Begin ScriptEffectStart
RemoveSpell SEAbBaliwogRegenWater ; because the base object is being modified, the spell must always be removed on start
End
Begin ScriptEffectUpdate
; If the Baliwog is swimming, give him a regen health ability
If RegenOn == 0
If IsSwimming == 1
RemoveSpell SEAbBaliwogRegenWater ; because the base object is being modified, the spell must always be removed
AddSpell SEAbBaliwogRegenWater ; before it is added. Otherwise the addspell will fail.
Set RegenOn to 1
EndIf
Else
If IsSwimming == 0
RemoveSpell SEAbBaliwogRegenWater ; if the baliwog has left the water, removed the regen
Set RegenOn to 0
EndIf
EndIf
End
Begin ScriptEffectFinish
RemoveSpell SEAbBaliwogRegenWater ; cleaning up by removing the spell from the base object when the script terminates
End ; This way newly created references won't start with the ability on.
|