Jump to content

Scripted Stop Timer?


Robinsage

Recommended Posts

Basically - Is there a script that will stop a timer from running?

 

Specifically - I enter trigger box A, it does something, and when I leave it sets a timer for an event to happen after 60 seconds. I enter trigger box B while the timer from trigger box A is still counting. The event from trigger box A will occur while I'm still standing in trigger box B, which I don't want to happen. So I'm looking for a way to stop the timer in box A from running when I enter box B. I can't find a solution anywhere =\

 

Thanks for any help! =)

Link to comment
Share on other sites

There are probably many ways to do this. You could send an activate event from trigger B to trigger A to stop the timer.

 

Place this script on trigger A:

Scriptname TriggerAScript extends ObjectReference  


Event OnTriggerEnter(ObjectReference akActionRef)
	if akActionRef == Game.GetPlayer()
		; do something
	endif
EndEvent

Event OnTriggerLeave(ObjectReference akActionRef)
	if akActionRef == Game.GetPlayer()
		RegisterForSingleUpdate(60)        ; prepare to do something after 60 seconds
	endif
EndEvent

Event OnUpdate()
		; after 60 seconds, do this
EndEvent

Event OnActivate(ObjectReference akActionRef)
		UnregisterForUpdate()   ; if activated by trigger B, stop timer
EndEvent

 

On trigger B, put this script:

Scriptname TriggerBScript extends ObjectReference

Event OnTriggerEnter(ObjectReference akActionRef)
	if akActionRef == Game.GetPlayer()
		Activate(self)
	endif
EndEvent

 

For trigger A, choose trigger B as activate parent. This way you don't even need a property.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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