DamarStiehl Posted September 30, 2014 Share Posted September 30, 2014 Created a Hostile magic effect, type script, area 100, fire and forget, on self. Attached this script: Scriptname zzApplyEffectoTargetsinAreaScript extends ActiveMagicEffect Spell property EffectToApply Auto event onEffectStart(Actor akTarget, Actor akCaster) Debug.Trace("Magic effect was started on " + akTarget) EffectToApply.cast (none, akTarget) endEvent The property EffecttoApply is populated with Fireball spell. Added this magic effect to a spell. When I cast it, NPCs react to it as a hostile action (I get a bounty, NPCs get in fighting stance, etc). But nothing else happens. I don't see a debug message, and theoretically everyone should have a fireball cast on them, but it doesn't happen either. What am I doing wrong? Help appreciated. Link to comment Share on other sites More sharing options...
lofgren Posted October 1, 2014 Share Posted October 1, 2014 You need a caster. "None" can't cast a spell. I don't know why the debug message isn't appearing. Link to comment Share on other sites More sharing options...
DamarStiehl Posted October 1, 2014 Author Share Posted October 1, 2014 Fair point. By the way of testing, I changed caster from "None" to "player" and fireballs were lobbed in the general direction of affected NPCs (though imprecisely). That's not entirely what I was going for though. Here's what I did next: 1. Created an invisible (meshless) activator, named it zzSpellCaster and stuck it in the Unowned Cell.2. Created a reference for this activator, zzSpellCasterRef.3. Wrote this: Scriptname zzApplyEffectoTargetsinAreaScript extends ActiveMagicEffect Spell property EffectToApply Auto ObjectReference property zzSpellCasterRef Auto actor target event onEffectStart(Actor akTarget, Actor akCaster) target = akTarget endEvent event onUpdate() Debug.Notification ("there should be a cast now") int random = Utility.RandomInt(1, 5) utility.wait(random) zzSpellCasterRef.moveTo (target) EffectToApply.Cast(zzSpellCasterRef, target) endEvent The way I see it, the activator should randomly move between affected NPCs and casting the EffectToApply on them (fireball). But it does not happen. NPCs react as being affected by the hostile spell, but the rest of it never happens. Any more pointers? Thanks very much for help thus far. Link to comment Share on other sites More sharing options...
lofgren Posted October 1, 2014 Share Posted October 1, 2014 You have an onupdate event but I don't see where you register for the update. Link to comment Share on other sites More sharing options...
steelfeathers Posted October 1, 2014 Share Posted October 1, 2014 To make sure the scripted fireballs hit the target, change the fireball magiceffect to type "target actor" instead of "aimed". Link to comment Share on other sites More sharing options...
Recommended Posts