Spell cast from object to object. How?

Post » Mon Apr 27, 2015 4:03 am

bool property playerOnly auto{if true, only works on the player}bool property doOnce auto{fire multiple times?}float property delayBetween auto{seconds to wait between shots.  Only relevant if doOnce == false}spell property mySpell auto{spell to cast onTriggerEnter}auto STATE active	EVENT onTriggerEnter(ObjectReference actronaut)		if playerOnly == true && actronaut == game.getPlayer() || playerOnly == false			mySpell.Cast(getLinkedRef(), actronaut)			gotoState ("inactive")  ; don't cast subsequent spells until told to do so			if doOnce == true				; and don't come back!			else				utility.wait(delayBetween)				gotoState("active")			endif		endif	endEVENTendSTATESTATE inactive	; nothing happens here.endSTATE

I've been using the default script to cast spells onto the player and it works good. What I'd like, possibly amending the above script, is that a spell casts from an object to another object with a repeat time delay property. Imagine a lightning bolt shooting across the ceiling of a cave from one side to the other then repeating using the time delay property. Help with this appreciated, thanks.

User avatar
A Boy called Marilyn
 
Posts: 3391
Joined: Sat May 26, 2007 7:17 am

Post » Mon Apr 27, 2015 6:20 am

This is the line that casts the spell:

You can change the two parameters of the cast function to cast between two different things (like two objects).

Example with timer:

float property delayBetween auto{seconds to wait between casts.}spell property mySpell auto{spell to cast}bool property isConcentration auto{set to true if this is a concentration-type spell (like flames)}float property concentrationTime auto{time to fire the concentration effect. Only relevant if isConcentration == true}Event OnLoad()    If (getLinkedRef())        RegisterForSingleUpdate(delayBetween)    EndIfEndEventEvent OnUnload()    UnregisterForUpdate()EndEventEvent OnUpdate()    mySpell.Cast(self, getLinkedRef())    If (isConcentration)        utility.wait(concentrationTime)        self.InterruptCast()    EndIf    RegisterForSingleUpdate(delayBetween)EndEvent

Attach this script to an object and link that object to the second object that you want to cast toward.

User avatar
Tinkerbells
 
Posts: 3432
Joined: Sat Jun 24, 2006 10:22 pm


Return to V - Skyrim