pyrotx Posted October 19, 2015 Share Posted October 19, 2015 I recently started trying to create a new type of spell that would automatically attack enemies within a radius, but without using the cloak spells. I want to reuse the candlelight effect archetype and then attach a script to it. The script is similar to the lightning storm shout effect, mainly because that is the script I am trying to copy. So far the script compiles, but in game it doesn't do anything.Here is the script so far. Also I have a condition in the spell effect that says it must be hostile to the caster, would that prevent it from working due to it being a remote cast?Can anyone help me with the script? Scriptname LightDestructionSpellScript extends ActiveMagicEffect ;========================================================= ; PROPERTIES ;=========== Spell Property SpellRef Auto Activator Property PlacedActivator Auto Sound Property SoundFX Auto Float Property PosX Auto Float Property PosY Auto Float Property PosZ Auto Float Property fHeight Auto Float Property fDelay Auto Float Property fRange Auto Float Property fRandomVar Auto Bool KeepUpdating = True ;========================================================= ; VARIABLES ;=========== ObjectReference CasterRef ObjectReference ActivatorRef Actor CasterActor Actor TargetActor Actor Player ;========================================================= ; EVENTS ;=========== Event OnEffectStart(Actor akTarget, Actor akCaster) TargetActor = akTarget CasterActor = akCaster CasterRef = CasterActor ActivatorRef = CasterRef.PlaceAtMe(PlacedActivator) RegisterForSingleUpdate(fDelay) ; or (fDelay + RandomFloat(0.0, fRandomVar) EndEvent ;========================================================= Event OnUpdate() PosX = CasterRef.GetPositionX() PosY = CasterRef.GetPositionY() PosZ = CasterRef.GetPositionZ() + fHeight ActivatorRef.SetPosition(PosX,PosY,PosZ) if TargetActor.GetDistance(CasterRef) <= fRange SpellRef.RemoteCast(ActivatorRef,CasterActor,TargetActor) SoundFX.play(TargetActor) endIf if KeepUpdating == true RegisterForSingleUpdate(fDelay) endIf EndEvent ;========================================================= Event OnEffectFinish(Actor akTarget, Actor akCaster) KeepUpdating = false if (ActivatorRef != none) ActivatorRef.disable() ActivatorRef.delete() endIf EndEvent Link to comment Share on other sites More sharing options...
pyrotx Posted October 24, 2015 Author Share Posted October 24, 2015 Nevermind, I got it working for the most part. Link to comment Share on other sites More sharing options...
Recommended Posts