TriggerSleepAction

Parameters
timeout real
comment

Makes a trigger execution sleep for a given duration. The thread will yield so other threads can do their work.

bug

This works only in a trigger action execution context, not in trigger conditions nor for example in timer functions or ForGroup functions. However, it also works in ExecuteFunc contexts, even if the ExecuteFunc call is not in a trigger action execution context. If this is called in the wrong context, it crashes the thread.

note

This has many implications, see other trigger-related natives.

note

This ticks while the game was paused with the PauseGame native, unlike timers.

note

This does not tick while the game was paused by the user, neither in singleplayer nor in multiplayer. (But the Trigger Editor of the World Editor denotes it as a real-time wait. Is this a bug?)

note

This ticks independently from game speed, i.e., in Fast mode, it will be about the same as a game time, in Normal mode, it will be about 25% faster than game time and in Slow mode, it will be about 67% faster than game time, see table below.

Game speed TSA speed (%) game speed (%)
Fast 100% 100%
Normal 100% 80%
Slow 100% 60%

Example elapsed game time after TSA with timeout = 30:

Game speed game time elapsed
Fast 30s
Normal 24s
Slow 18s
patch

1.00

Source
common.j
return type
nothing
Source code
native TriggerSleepAction   takes real timeout returns nothing