Simplest way to set timers?

Post » Sat May 28, 2011 1:28 pm

is this the simplest way to put a delay into a script?

Lifted from the GECK page:
float timerbegin gamemode   if timer < 5      set timer to timer + GetSecondsPassed   else      ;5 seconds have passed, do something special      set timer to 0   endifend


Does this function any differently if injected into the middle of a Begin OnActivate?
User avatar
josie treuberg
 
Posts: 3572
Joined: Wed Feb 07, 2007 7:56 am

Post » Sat May 28, 2011 4:47 pm

I think it might require a second activate. If that's the case, then you could write the timer start in the OnActivate and the timer end in the GameMode. Activating the activator starts the timer, then when the time is up the code s run in the GameMode block. But I'm no expert on this.
User avatar
danni Marchant
 
Posts: 3420
Joined: Sat Oct 07, 2006 2:32 am

Post » Sat May 28, 2011 5:07 am

if there was any way to see a simple example of how to get a delay to occur within an activate, I'd really appreciate it
User avatar
Hilm Music
 
Posts: 3357
Joined: Wed Jun 06, 2007 9:36 pm

Post » Sat May 28, 2011 1:19 pm

SCN MyTimerShort StartTimerFloat TimerBegin OnActivate	Set StartTimer to 1	Set Timer to 10 	;or what ever you want your timer to beEndBegin GameMode	If StartTimer		If Timer > 0			Set Timer to Timer - GetSeccondsPassed		Else			;DoStuff			Set StartTimer to 0		Endif	EndifEnd

User avatar
Angela
 
Posts: 3492
Joined: Mon Mar 05, 2007 8:33 am

Post » Sat May 28, 2011 5:59 pm

Timers do not work inside an OnActivate block of code. These only run one time and will not capture time passing.
You set a variable in the OnActivate and then check for that variable in the GameMode block. Like what pkleiss has above.
User avatar
Nathan Maughan
 
Posts: 3405
Joined: Sun Jun 10, 2007 11:24 pm


Return to Fallout 3