wcrfe Posted October 8, 2024 Posted October 8, 2024 (edited) Title Say I want to make the fire cloak spell disappear after i sheathe my sword, how would I go about doing it? I tried this, but it didn't work. Event OnActorAction(int actionType, Actor akActor) If Game.GetPlayer().HasMagicEffect(FireCloak) && actionType == 9 Dispel() EndIf EndEvent magicEffect Property FireCloak Auto Edited October 8, 2024 by wcrfe
MTB Posted October 9, 2024 Posted October 9, 2024 Two main observations; You need to register for the event and that can only be done on a form (from the code you give, guessing this is part of an activemagiceffect (note that that is not a form). When you want to start listening, you need to have some form, let's say in variable F, that will do the listening and then you call: F.RegisterForActorAction( 9 ) ; or 10 to start receiving the event on F. Somewhere it the code that triggers the effect to begin with seems logical. On the form F you will then need to have a script containing e.g. : Event OnActorAction(int actionType, Actor akActor) Game.GetPlayer().DispellSpell( FireCloakSpell ) ; Checks not really needed if you only register for one event type. ; UnregisterforActorAction(9) ; Optionally: Stop listening for now... EndEvent spell property FireCloakSpell auto If you want it to work for all actors I would try (not sure it will work) putting it in an activemagiceffect script on (an effect of) the spell itself and using the animation event that comes with sheathe-weapon to detect sheathe events. I don't know what the exact name is but let's assume: "BeginSheatheWeapon" then have: RegisterForAnimationEvent( GetCasterActor() , "BeginSheatheWeapon" ) in the oneffectstart and the above code in the OnAnimationEvent.
DarkBlade13 Posted October 11, 2024 Posted October 11, 2024 This might sound stupid but did you try asking chatgpt?
Tlam99 Posted October 11, 2024 Posted October 11, 2024 (edited) Put this condition into the spells magic effect. Not into the effect but the part of effect used by the spell. https://ck.uesp.net/wiki/IsWeaponOut Edited October 11, 2024 by Tlam99
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now