Can someone please explain why this timer script doesn't wor

Post » Fri Dec 02, 2011 5:23 pm

I've used timers dozens upon dozens of times and now this script does not work, the timer doesn't work. The action happens immediately.

scn Scriptshort timershort dooncebegin gamemodeif doonce != 1set timer to 60set doonce to 1endifif timer > 0set timer to timer - getsecondspassedelsestartconversation playerendifend


It's on an NPC. I'm stumped to the fact that I think I broke the CS, Oblivion, the internet, etc.
User avatar
Nick Swan
 
Posts: 3511
Joined: Sat Dec 01, 2007 1:34 pm

Post » Sat Dec 03, 2011 12:45 am

scn ObjectScriptFloat fTimer ; Should be a float variableInt iStage ; Like a DoOnce with a tailBegin GameMode		If (iStage == 2)		Return ; Reduce 'cost' when NPC is loaded after the code has done its thing	ElseIf (iStage == 1)		If (fTimer <= 0) ; '<=' vs. '>' operator			Set fTimer to 0			Set iStage to 2			StartConversation Player		Else			Set fTimer to (fTimer - GetSecondsPassed) ; Count down from 60		End	Else		Set iStage to 1		Set fTimer to 60			EndIf	End


p.s. It appears the internet is still alive! :P
User avatar
Madeleine Rose Walsh
 
Posts: 3425
Joined: Wed Oct 04, 2006 2:07 am

Post » Sat Dec 03, 2011 1:14 am

I'm an idiot. Just changing the timer var to a float fixed everything. I'm up way too late.

Thanks!
User avatar
Jessica Raven
 
Posts: 3409
Joined: Thu Dec 21, 2006 4:33 am


Return to IV - Oblivion