gitsas Posted March 9, 2021 Share Posted March 9, 2021 (edited) Hi everyone, I'm new to scripting and for the love of God I just cant figure out how to solve this one. I'd really appreciate your help! I've created a togglable Heal (Lesser Power, Voice). It Heals the Caster for 10p per Second while draining 10p Magicka per second. I want the spell to Dispel when Magicka drops below a certain number or when the user runs out of Magicka. So far the spell works perfectly, It's toggleable, it Heals, and it Drains Magicka as planned. I've used this script: Scriptname toggleability extends activemagiceffect Spell Property AbilityToBeToggled Auto Event OnEffectStart(Actor akTarget, Actor akCaster) If akTarget.HasSpell(AbilityToBeToggled) akTarget.DispelSpell(AbilityToBeToggled) akTarget.RemoveSpell(AbilityToBeToggled) Else akTarget.AddSpell(AbilityToBeToggled, False) EndIf EndEventThe problem is this: When Magicka depletes, the spell is still active. It keeps draining Magicka instead of ending. I've tried adding an additional script: Scriptname AAAOutOfMagicka extends activemagiceffect Event OnEffectStart(Actor akTarget, Actor akCaster) akTarget.GetActorValue("Magicka") If akTarget.GetActorValue("Magicka") < 10 akTarget.DispelAllSpells() EndIf EndEventThe Script compiles, but it doesn't work, the spell is still active. I was thinking maybe a While Loop would be the answer but I don't know how to go about it. I'd appreciate your help! Edited March 9, 2021 by gitsas Link to comment Share on other sites More sharing options...
dylbill Posted March 9, 2021 Share Posted March 9, 2021 You can put the condition directly on your ability spell in the creation kit. Put GetActorValue Magicka >= 10. Then in your script you can use OnEffectFinish to dispel your spell. I wouldn't use DispellAllSpells as that dispels all active spells on the target. Link to comment Share on other sites More sharing options...
Recommended Posts