Logic timer: Difference between revisions
Jump to navigation
Jump to search
Note:Enabling the entity resets its timer.
Tip:Use with logic_case for extremely random events.
Warning:This entity uses a high amount of server bandwidth, especially with low refire intervals. Use a I/O loop with an entity such as logic_relay for those cases.
1416006136 (talk | contribs) mNo edit summary |
(-added class hierarchy, concise page, added AddThinkToEnt to see also) |
||
Line 1: | Line 1: | ||
{{lang|Logic timer}} | {{lang|Logic timer}} | ||
{{CD|CTimerEntity|file1=logicentities.cpp}} | |||
{{base point|logic_timer|sprite=1}} It fires an [[output]] at regular or random intervals. It can optionally alternate between a "high" and a "low" output. | {{base point|logic_timer|sprite=1}} It fires an [[output]] at regular or random intervals. It can optionally alternate between a "high" and a "low" output. | ||
{{note|Enabling the entity resets its timer.}} | {{note|Enabling the entity resets its timer.}} | ||
{{tip|Use with [[logic_case]] for extremely random events.}} | {{tip|Use with [[logic_case]] for extremely random events.}} | ||
{{warning|This entity uses a high amount of server bandwidth, especially with low refire intervals. Use a [[I/O]] loop with an entity such as {{ent|logic_relay}} for those cases.}} | {{warning|This entity uses a high amount of server bandwidth, especially with low refire intervals. Use a [[I/O]] loop with an entity such as {{ent|logic_relay}} for those cases.{{how|How would using io loop make a difference ?}}}} | ||
== Keyvalues == | == Keyvalues == | ||
Line 18: | Line 16: | ||
== Flags == | == Flags == | ||
{{fl|1|Oscillator|(alternates between <code>OnTimerHigh</code> and <code>OnTimerLow</code> outputs)}} | |||
== Inputs == | == Inputs == | ||
Line 31: | Line 29: | ||
{{IO|AddToTimer|Add time to the timer if it is currently enabled. Does not change the Refire Interval.|param=float}} | {{IO|AddToTimer|Add time to the timer if it is currently enabled. Does not change the Refire Interval.|param=float}} | ||
{{IO|SubtractFromTimer|Subtract time from the timer if it is currently enabled. Does not change the Refire Interval.|param=float}} | {{IO|SubtractFromTimer|Subtract time from the timer if it is currently enabled. Does not change the Refire Interval.|param=float}} | ||
{{I EnableDisable}} | {{I EnableDisable}} | ||
Line 38: | Line 35: | ||
{{IO|OnTimerHigh|Fired every other time for an oscillating timer.}} | {{IO|OnTimerHigh|Fired every other time for an oscillating timer.}} | ||
{{IO|OnTimerLow|Fired every other time for an oscillating timer.}} | {{IO|OnTimerLow|Fired every other time for an oscillating timer.}} | ||
== See Also == | |||
* [[List of L4D2 Script Functions/AddThinkToEnt]] | |||
[[Category:IO System]] | [[Category:IO System]] |
Revision as of 16:34, 5 November 2022
![]() |
---|
CTimerEntity |
![]() |
Template:Base point It fires an output at regular or random intervals. It can optionally alternate between a "high" and a "low" output.



How?: How would using io loop make a difference ?
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.
- Start Disabled (StartDisabled) <boolean>
- Stay dormant until activated (with the
Enable
input).
- Name (targetname) <string>[ Edit ]
- The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g.
parentname
ortarget
).
Also displayed in Hammer's 2D views and Entity Report.See also: Generic Keyvalues, Inputs and Outputs available to all entities
Flags
- Oscillator : [1]
- (alternates between
OnTimerHigh
andOnTimerLow
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.