Jollypolly Posted January 26, 2020 Share Posted January 26, 2020 Hello,I'm trying to cast a simple ward spell when I equip a certain item. The code I tried is as follows : Scriptname TQspell extends ObjectReference SPELL Property WardSpell AutoActor Property Player Auto Event OnEquipped(Actor Player) WardSpell.Cast(Player,Player)EndEvent Nothing happens.I just need the ward visuals to appear for a certain amount of time when I equip the object.Any Idea how I can do this?Thanks Link to comment Share on other sites More sharing options...
Rizalgar Posted January 27, 2020 Share Posted January 27, 2020 Use Actor Property PlayerRef Auto Then If Player == PlayerRef Ward.Cast(PlayerRef)EndIf Sorry for not containing, on mobile. Link to comment Share on other sites More sharing options...
Jollypolly Posted January 28, 2020 Author Share Posted January 28, 2020 UseActor Property PlayerRef Auto Then If Player == PlayerRefWard.Cast(PlayerRef)EndIf Sorry for not containing, on mobile.Thanks Rizalgar for your reply.The spell does trigger but it doesn't maintain itself. Any Idea how to keep it going for a defined amount of time?I looked in the .nif of the effect with nifskope and it seems to have different stages : among those are CastStart, Cast and CastEnd. It seems when you use the .Cast() function through script, it only triggers the CastStart phase which only lasts a second or so.I tried using a while loop to recast the ward every 0.5 sec but the ward just pops on and off and you don't get a continuous ward effect. Changing the duration in the creation kit of the magic effect doesn't do anything either. Link to comment Share on other sites More sharing options...
Rizalgar Posted January 28, 2020 Share Posted January 28, 2020 I haven't done much work with it... But check in to using the effect shader via Play. Find the effect your ward uses, then do something like WardEffect.Play(PlayerRef, x.x) ;Replace x.x with float time, or remove to play indefinitely until told to stop using .Stop() Link to comment Share on other sites More sharing options...
Jollypolly Posted January 28, 2020 Author Share Posted January 28, 2020 Hmmm creation kit doesn't recognise Play().I can't find such a function in the CKwiki or any similar one to apply directly a magic effect to the player with a timer. Link to comment Share on other sites More sharing options...
Rizalgar Posted January 28, 2020 Share Posted January 28, 2020 Odd. It's not listed as an SKSE function, so not sure why it wouldn't recognise it... Maybe it has to do with the extend. https://www.creationkit.com/index.php?title=Play_-_EffectShader Link to comment Share on other sites More sharing options...
Jollypolly Posted January 28, 2020 Author Share Posted January 28, 2020 Also, the ward spell doesn't use a shader but only an animated object. Link to comment Share on other sites More sharing options...
Jollypolly Posted January 28, 2020 Author Share Posted January 28, 2020 Hmmm creation kit doesn't recognise Play().I can't find such a function in the CKwiki or any similar one to apply directly a magic effect to the player with a timer.Ah sorry, I was using a magic effect property and not an effect shader one, thats why Play() didn't work. Still, that won't do the trick since the ward doesn't call any shader. Link to comment Share on other sites More sharing options...
SurfsideNaturals Posted January 28, 2020 Share Posted January 28, 2020 (edited) Is this the exact code you have on the item? If it is, I am not sure it would even compile. You have an actor set as Player twice. You are also going to have an issue because of the type of spell a ward is. It is not fire and forget it is a spell an actor needs to cast continuously. How does the game know how long to keep the ward up? You may need to create a new ward spell to get it to work like this. Scriptname TQspell extends ObjectReference SPELL Property WardSpell Auto Actor Property Player Auto Event OnEquipped(Actor Player) WardSpell.Cast(Player,Player) EndEvent Try this and let me know what happens. Make sure you have the properties filled. Scriptname TQspell extends ObjectReference SPELL Property WardSpell Auto Event OnEquipped(Actor akActor) Debug.Notification("Equipped") if akActor == Game.GetPlayer() WardSpell.cast(akActor) endIf endEvent Edited January 28, 2020 by SurfsideNaturals Link to comment Share on other sites More sharing options...
Jollypolly Posted January 28, 2020 Author Share Posted January 28, 2020 (edited) hi SurfSide, this is my script : Scriptname TQspell extends ObjectReferenceSPELL Property WardSpell AutoActor Property PlayerRef AutoEvent OnEquipped(Actor akActor) if akActor == PlayerRef WardSpell.cast(PlayerRef) EndIfEndEvent Yes the Ward triggers but dissipates immediately after. What I'm trying to figure out is if there is a way to keep it going through script or at least through the creation kit. But at this point i'm thinking the only way is by modifying the nif animated object which seems like a tedious task given the cryptic data structure of the nif file. Edited January 28, 2020 by Jollypolly Link to comment Share on other sites More sharing options...
Recommended Posts