Timer

The Timer behavior simply triggers its On timer condition regularly or once after a delay. This is like using the system Every X seconds conditions, or the system Wait action, except that times are kept for each instance individually. The rate of On timer triggering is affected by the time scale. The timer behavior is a more convenient alternative to adding dt to an instance variable every tick.

Tags

A single Timer behavior can keep track of multiple timers. To distinguish between then, a tag is used. A tag is simply a string, which can be anything. For example, starting a timer with tag "attack" will trigger On timer "attack", but not On timer "defend".

When a timer is stopped, or after a one-off timer triggers, it no longer exists and the timer expressions cannot be used to retrieve any information about it.

Timer conditions

On timer
Triggers either regularly, or once off, after a timer that was started with the same tag has reached its duration. NOTE: this trigger can fire with multiple instances picked, if their timers all reach their time in the same tick. This can sometimes work unexpectedly if the actions expect there to be just one instance picked. The workaround is to add a For each condition after this trigger to ensure the actions run once per instance.

Timer actions

Start timer
Set a new timer, or if the timer exists, re-start it with new options. Duration is the time until On timer triggers. If Type is Once, On trigger will fire once and not again until Start timer is used again; if Regular, On timer will keep firing every Duration seconds. The tag allows multiple timers to run at once. The corresponding On timer condition must use the same tag.

Stop timer
Stop a timer with a specific tag. On timer will no longer trigger after this action.

Timer expressions

CurrentTime(tag)
The time in seconds since On timer last triggered, for a timer with a specific tag.

Duration(tag)
The duration in seconds for a timer with a specific tag.

TotalTime(tag)
The time in seconds since a timer with a specific tag was started with the Start timer action. This is only useful with regular timers, since it will always equal the CurrentTime expression for one-off timers (after which they fire and the timer no longer exists, so these expressions return 0).

Tags: