AuxTimerStart

From GECK
Jump to: navigation, search


A function added by the ShowOff NVSE Plugin version 1.55.

Description

Creates and starts Auxiliary Timer on an owning form to start counting down from timeToCountdown with the specified flags. If the timer exists already, will instead restart it, and it will be unpaused if it was paused.

If no owner form for the AuxTimer is specified, PlayerRef will be used.

Once the timer for an AuxTimer runs out, it will will trigger the OnAuxTimerStop event. Afterwards, the AuxTimer will be deleted automatically unless the Auto Restarts flag is on. In that case, the timer will restart, triggering the OnAuxTimerStart event.

AuxTimer Flags:

Bit# 	 Value 	 Description
0 	 1 	 Run In MenuMode
1 	 2 	 Run In GameMode
2 	 4 	 Count In Seconds (if off, counts down in frames)
3 	 8 	 Auto-Remove On Load And MainMenu (has no effect on permanent AuxTimers, only temporary ones)
4 	 16 	 Auto Restarts
5 	 32 	 Is Paused
6 	 64 	 Ignore TimeMult In MenuMode (only used for seconds-based timers)
7 	 128 	 Don't Run When Paused (won't run in main menu, pause menu, console menu)
8 	 256 	 Run OnTimerUpdate Event (see SetOnAuxTimerUpdateHandler) - v1.65
9 	 512 	 Ignore Turbo - If on, seconds-based timers that don't ignore TimeMult won't be slowed down by turbo - v1.80
10 	 1024 	 Ignore TimeMult In GameMode (only used for seconds-based timers) - v1.80

The default-enabled flags are Run In MenuMode, Run In GameMode, and Count In Seconds.
Therefore, default timers obey TimeMult, and are slowed down by the Turbo slow-mo effect (unlike the player).

The Ignore Turbo flag is recommended to be enabled if the timer should run according to the player's perspective of time, not the world's. This is because the player isn't slowed down by Turbo, but the rest of the world is.

  • This flag only has an effect if the Ignore TimeMult flags aren't enabled. Otherwise, it is ignored.

For UI mods, it is usually recommended to enable the Ignore TimeMult flags, as most UI features in the vanilla game aren't affected by TimeMult.

If the AuxTimer's owner form becomes invalid at any time while it is counting down, the AuxTimer will be deleted. This will NOT fire the OnAuxTimerStop event.

Syntax

[help]
(success:bool) ownerRefr.AuxTimerStart timerName:string timeToCountdown:float{-1.0} flags:int{1+2+4} owner:baseForm

Example

RaulRef.AuxTimerStart "someTimerName" 5

Will create a private-permanent AuxTimer belonging to RaulRef that will count down for 5 seconds before stopping. It will count down in both GameMode and MenuMode.

AuxTimerStart "*_someTimerName" 3 2  ; 2 means only the "Run In GameMode" flag is on.

Will create a temporary-public AuxTimer belonging (implicitly) to PlayerRef that will count down for 3 frames before stopping. It will count down only in GameMode.

See Also