SeraphimKensai Posted March 26, 2018 Share Posted March 26, 2018 Greetings its been awhile, but such is the nature of skyrim it ropes you back time and again. This time I'm trying to make a custom spell fire a script which then does 1 of 2 things:1. cast the spell effect, and set a global to 1.2. alternatively if the global is 1, dispel the spell effect, and return the global to 0. I've thrown in a couple debug messages in each side of the if/then conditional to see where my issues are occuring, and I'm guessing I just need a minor tweak at this point as the script compiles, however in game when testing it displays both debug messages, so if the spell effect is going into effect from the first message, its immediately being dispelled with the second. So it seems to me anyways that somehow the script is applying the first part where the global is equal to 0, and then hopping to the second where the global is 1, and then resets back to zero so the conditional loops. I don't have a lot of scripting experience and I'm rusty as the last time I've scripted anything was back in 2013. Here's the example that I'm working with: Scriptname z2018mjhToggleSpellSCR extends activemagiceffect GlobalVariable Property ToggleSpellGlobal Auto Spell Property ToggleSpell Auto float ToggleSpellGlobal Event OnEffectStart(Actor Caster, Actor Target) if ToggleSpellGlobal.GetValue() == 0 as Float ToggleSpellGlobal.SetValue(1 as Float) utility.Wait(0.250000) ToggleSpell.Cast(Caster as ObjectReference, Caster as ObjectReference) debug.MessageBox("Toggle Spell Effect should be ON.") else ToggleSpellGlobal.SetValue(0 as Float) Caster.DispelSpell(ToggleSpell) debug.MessageBox("Toggle Spell Effect should be OFF.") endIf endEvent I have the global created in CK, The Spell is created as well, and I've linked them to the script via the properties window inside the Magic Effects of the casting spell's page. Any suggestions? Please and thank you. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted March 26, 2018 Share Posted March 26, 2018 The spell assigned to the ToggleSpell property. Is that the same spell as the one with the magic effect holding this script? If so, remove the line where you cast the spell. Cause that would produce the results you are seeing. Link to comment Share on other sites More sharing options...
SeraphimKensai Posted March 26, 2018 Author Share Posted March 26, 2018 Ishara thanks. Just flat out thanks. Your comment led me to double check the property's spell point which seemed to be cycling back on itself rather then firing the dummy spell to apply the actual effect. You just saved me a highball of 15 year old Glenfiddich, but then again now I'll drink it to your health. Link to comment Share on other sites More sharing options...
Recommended Posts