Jump to content

Delaying spells with timers


VirtualSpace

Recommended Posts

I'm trying to delay spells using a timer within a magic effect script. The first bunch of fireballs will be cast down at the target, and usually kill the target, though, when the target has not been killed, the timer comes into effect when it exceeds 10 seconds. If the target has been killed, on the other hand, the script will stop. The magic effect duration is long enough for the timer to get to 10 seconds.

 

This is bad, I want the script effect to come into effect even if the target is dead.

Link to comment
Share on other sites

I can't find anything saying so, but I think dead actors can't run magic scripts.

 

If that's so, then what you should do is to have one spell move an activator over to the target, and then have the activator cast the spell that actually shoots the fireballs.

 

For example, something like this:

 

 

scriptname fg109MeteorShower2Script

ref source
short initiate
short stimer
float ftimer
float tempvar1
float tempvar2
float tempvar3
float tempvar4

Begin OnActivate

set source to GetSelf
set initiate to 1

End

Begin GameMode

if initiate == 0
	Return
endif

if initiate == 1
	if ftimer < 15
		if ftimer >= stimer
			set stimer to (stimer + 1)
			set tempvar1 to (Rand 25 250)
			set tempvar2 to (Rand 25 250)
			set tempvar3 to (Rand 25 250)
			set tempvar4 to (Rand 25 250)
			fg109targetmarker1.MoveTo source, tempvar1, tempvar2, -500
			fg109targetmarker2.MoveTo source, tempvar3, tempvar4, -500
			source.Cast fg109fireball fg109targetmarker1
			source.Cast fg109fireball fg109targetmarker2
		endif
		set ftimer to (ftimer + GetSecondsPassed)
	endif
	if ftimer >= 15
		set initiate to 0
		set ftimer to 0
		set stimer to 0
	endif
endif

End

I thought this up after reading your other topic about GetDistance. This object script should be attached to an activator. If this works right, it should cast 2 (custom) fireballs every second for the next 15 seconds at random spots between 25 and 250 units away from the activator, which should be 500 units above the ground.

 

Edited by fg109
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...