Logic timer: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(cleanup)
(Undo revision 122450 by TomEdwards (Talk))
Line 1: Line 1:
[[File:Logic timer.png|left]] {{DISPLAYTITLE:logic_timer}} __NOTOC__
{{wrongtitle|title=logic_timer}}
{{base_point}}


{{base point|logic_timer}} It fires an [[output]] at regular or random intervals. It can optionally alternate between a "high" and a"low" output.
==Entity Description==
[[Image:{{PAGENAME}}.png|right]]An entity that fires a timer event at regular, or random, intervals. It can also be set to oscillate between a high and low end, in which case it will fire alternating high/low outputs each time it fires.
* An oscillator's first output will be an OnTimerHigh output.
* Use with [[logic_case]] for extremely random events.
* Could be used to deploy [[env_headcrabcanister]]s at random intervals, instead of using fixed delays on the inputs.{{clr}}


{{note|Enabling the entity resets its timer.}}
==Keyvalues==


{{tip|Use with [[logic_case]] for extremely random events.}}
* {{KV Targetname}}


==KeyValues==
* {{KV EnableDisable}}


; Use Random Time <code><[[bool]]></code>
* '''UseRandomTime'''
: Makes the entity fire at random intervals. Range of values is restricted by the next two KVs.
: {{boolean}} If set, fires randomly at an interval from the last trigger.
; Minimum Random Interval <code><[[float]]></code>
 
; Maximum Random Interval <code><float></code>
* '''LowerRandomBound'''
: If "Use Random Time" is enabled, these values define the range of values, in seconds, that the entity can choose from for random firing.
: <float> If '''UseRandomTime''' is set, this is the minimum time between timer fires. The time will be a random number between this and the '''UpperRandomBound'''.
; Refire Interval <code><float></code>
 
: If "Use Random Time" is disabled, this is the interval between outputs in seconds.
* '''UpperRandomBound'''
{{KV EnableDisable}}
: <float> If '''UseRandomTime''' is set, this is the maximum time between timer fires. The time will be a random number between the '''LowerRandomBound''' and this.
{{KV Targetname}}
 
* '''RefireTime'''
: <float> If '''UseRandomTime''' isn't set, this is the interval between timer fires, in seconds.


==Flags==
==Flags==


* Oscillator (Alternates between <code>OnTimerHigh</code> and <code>OnTimerLow</code> outputs. <code>OnTimerHigh</code> comes first.)
* 1 : Oscillator (alternates between OnTimerHigh and OnTimerLow outputs)


==Inputs==
==Inputs==


; <code>Toggle</code>
* {{I Targetname}}
: Toggle the timer on or off, resetting it in the process.
* {{I EnableDisable}}
; <code>RefireTime <[[int]]></code>
 
: Set a new refire interval.
* '''Toggle'''
; <code>FireTimer</code>
: Toggle the timer on/off.
 
* '''RefireTime <integer>'''
: Set a new Refire Interval.
 
* '''FireTimer'''
: Force the timer to fire immediately.
: Force the timer to fire immediately.
; <code>LowerRandomBound <[[float]]></code>
 
; <code>UpperRandomBound <float></code>
* '''LowerRandomBound <float>'''
: Set a new min/max random interval.
: Set a new Minimum Random Interval.
; {{EP2 add|<code>ResetTimer</code>}}
 
: Starts counting from zero. You could also use <code>enable</code>.
* '''UpperRandomBound <float>'''
; {{EP2 add|<code>AddToTimer <float></code>}}
: Set a new Maximum Random Interval.
; {{EP2 add|<code>SubtractFromTimer <float></code>}}
 
: Adds/removes time if the timer is enabled. No effect if disabled.
* '''{{EP2 add|ResetTimer}}'''
; {{EP2 add|<code>UseRandomTime</code>}}
* '''{{EP2 add|AddToTimer <float>}}'''
{{I EnableDisable}}
* '''{{EP2 add|SubtractFromTimer <float>}}'''
{{I Targetname}}
* '''{{EP2 add|UseRandomTime}}'''


==Outputs==
==Outputs==


; <code>OnTimer</code>
* {{O Targetname}}
: Fired when a non-oscillating timer expires.
 
; <code>OnTimerHigh</code>
* '''OnTimer'''
; <code>OnTimerLow</code>
: Fired when the timer expires.
: Alternatively fired every time an oscillating timer expires, starting with <code>OnTimerHigh</code>.
 
{{O Targetname}}
* '''OnTimerHigh'''
: Fired every other time for an oscillating timer.
 
* '''OnTimerLow'''
: Fired every other time for an oscillating timer.

Revision as of 17:53, 12 August 2009

Template:Wrongtitle Template:Base point

Entity Description

Logic timer.png

An entity that fires a timer event at regular, or random, intervals. It can also be set to oscillate between a high and low end, in which case it will fire alternating high/low outputs each time it fires.

  • An oscillator's first output will be an OnTimerHigh output.
  • Use with logic_case for extremely random events.
  • Could be used to deploy env_headcrabcanisters at random intervals, instead of using fixed delays on the inputs.

Keyvalues

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Start Disabled (StartDisabled) <boolean>
Stay dormant until activated (with theEnableinput).
  • UseRandomTime
<boolean> If set, fires randomly at an interval from the last trigger.
  • LowerRandomBound
<float> If UseRandomTime is set, this is the minimum time between timer fires. The time will be a random number between this and the UpperRandomBound.
  • UpperRandomBound
<float> If UseRandomTime is set, this is the maximum time between timer fires. The time will be a random number between the LowerRandomBound and this.
  • RefireTime
<float> If UseRandomTime isn't set, this is the interval between timer fires, in seconds.

Flags

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

Inputs

  • EnableDisable:
Enable / Disable
Enable/disable this entity from performing its task. It might also disappear from view.
  • Toggle
Toggle the timer on/off.
  • RefireTime <integer>
Set a new Refire Interval.
  • FireTimer
Force the timer to fire immediately.
  • LowerRandomBound <float>
Set a new Minimum Random Interval.
  • UpperRandomBound <float>
Set a new Maximum Random Interval.

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.