logic_timer

From Valve Developer Community
Jump to: navigation, search
English (en)русский (ru)
... Icon-Important.png
logic_timer
Logic timer.png
TypePoint entity
EngineSource Source
AvailabilityIn all games
 

logic_timer fires an output at regular or random intervals. It can optionally alternate between a "high" and a "low" output.

class hierarchy
CTimerEntity defined in logicentities.cpp
CLogicalEntity
CServerOnlyEntity
CBaseEntity
Note.pngNote:Enabling the entity resets its timer.
Tip.pngTip:Use with logic_case for extremely random events.

Keyvalues

Use Random Time (UseRandomTime) <boolean>
Makes the entity fire at random intervals. Range of values is restricted by the next two KVs.
Minimum Random Interval (LowerRandomBound) <float>
If "Use Random Time" is set, this is the minimum time between timer fires. The time will be a random number between this and the "Maximum Random Interval".
Maximum Random Interval (UpperRandomBound) <float>
If "Use Random Time" is set, this is the maximum time between timer fires. The time will be a random number between the "Minimum Random Interval" and this.
Refire Interval (RefireTime) <float>
If "Use Random Time" isn't set, this is the time between timer fires, in seconds. Make sure output delay times are less than this value.

EnableDisable:

Start Disabled (StartDisabled) <boolean>
Stay dormant until activated (with theEnableinput).

Targetname:
Name (targetname) <string>
The targetname that other entities refer to this entity by.

Flags

  •  [1] : Oscillator
       (alternates between OnTimerHigh and OnTimerLow outputs)

Inputs

RefireTime <float>
Set a new Refire Interval.
ResetTimer
Reset the timer. It will fire after the Refire Interval expires.
FireTimer
Force the timer to fire immediately.
Enable
Enable the timer.
Disable
Disable the timer.
Toggle
Toggle the timer on/off.
LowerRandomBound <float>
Set a new Minimum Random Interval.
UpperRandomBound <float>
Set a new Maximum Random Interval.
AddToTimer <float>
Add time to the timer if it is currently enabled. Does not change the Refire Interval.
SubtractFromTimer <float>
Subtract time from the timer if it is currently enabled. Does not change the Refire Interval.

EnableDisable:

Enable
Disable
Enable/disable this entity from performing its task. It might also disappear from view.

Outputs

OnTimer
Fired when the timer expires.
OnTimerHigh
Fired every other time for an oscillating timer.
OnTimerLow
Fired every other time for an oscillating timer.

See also