Using a cloak spell and an extended script to fire at multip

Post » Sun Mar 31, 2013 8:52 pm

So I'm working on this nifty little spell idea I had, it's a cast on self which places an effect above the caster, which then throws ice spikes at up to a certain amount of targets around the caster.

Originally I was trying to do this with a quest and referencealias', then I realised I could make it WAY more simple and simply extend a script.

So the way I've been implementing it so far is I have a scripted cloak on self, the cloak positions my effect above the caster and sets the maximum amount of targets to 5, then cleans the effects up later. Next I have the spell that's associated with the cloak, also a scripted effect that checks for ishostile or a negative faction reaction, then checks the targets variable in the parent script, then casts the ice spike from the objectreference in the parent script at the target.

I only have one problem, no matter what I try, my child script always reports the targets variable as 0 and fires nothing, I've also tried using a global instead and get the same results, so in a last ditch effort I decided to post my scripts and see if any of you lovely ladies and gents can point out my very clear mistakes. :smile:

Spoiler

Scriptname CFIceRuneEffectScript extends activemagiceffect  Int Property Targets AutoObjectReference Property IceRune AutoActor Property Caster AutoActivator Property CFIceRuneActivator AutoSpell Property CFIceRuneSpike AutoEvent OnEffectStart(Actor akTarget, Actor akCaster)Caster = akCasterTargets = 5Debug.Trace("Targets set to:" + Targets)IceRune = Caster.PlaceAtMe(CFIceRuneActivator)IceRune.MoveTo(Caster, 0.0, 0.0, 0.0 + (Caster.GetHeight() * 1.10))IceRune.SetAngle(180.0, 0, 0)RegisterForSingleUpdate(1)EndEventEvent OnUpdate()IceRune.Disable()IceRune.Delete()EndEvent

And the child script:
Scriptname CFIceRunePainterScript extends CFIceRuneEffectScriptEvent OnEffectStart(Actor akTarget, Actor akCaster)if (akTarget.GetFactionReaction(akCaster) == 1 || akTarget.IsHostileToActor(akCaster))Debug.Trace("Hostiles detected")if (Targets &--#62; 0)CFIceRuneSpike.RemoteCast(IceRune, Caster, akTarget)Targets -= 1Debug.Trace("Suppressing Fire! Remaining targets:" + Targets)elseDebug.Trace(Targets)Debug.Trace("Too many targets or I am broken!")Self.Dispel()EndIfEndIfEndEvent

And of course I get nothing but a reliable "Targets set to 5" in my log for the parent, while also "0" "Too many targets or I am broken!" for my child. Imma so confoosed.
User avatar
Alyna
 
Posts: 3412
Joined: Wed Aug 30, 2006 4:54 am

Return to V - Skyrim