math_counter
class hierarchy |
---|
CMathCounter defined in logicentities.cpp
|
math_counter
is a point entity available in all Source 2 games. It stores and manipulates a numerical value. It can trigger on reaching user-defined maximum or minimum values, or output its value every time it changes. It also has the ability to perform simple mathematical functions. When the math_counter is disabled, it will become read-only until re-enabled.
Contents
Keyvalues
- Name
(targetname)
<string> - The targetname that other entities refer to this entity by.
- Initial Value
(startvalue)
<integer> - Starting value for the counter.
- Minimum Legal Value
(min)
<integer> - Minimum legal value for the counter. If min=0 and max=0, no clamping is performed.
- Maximum Legal Value
(max)
<integer> - Maximum legal value for the counter. If min=0 and max=0, no clamping is performed.
EnableDisable:
- Start Disabled
(StartDisabled)
<boolean> - Stay dormant until activated (with the
Enable
input).
Inputs
Add
<integer>- Add an amount to the counter and fire the
OutValue
output with the result.
Divide
<integer>- Divide the counter by an amount and fire the
OutValue
output with the result.
Note:If this causes a division by zero, the counter will ignore the input.
Multiply
<integer>- Multiply the counter by an amount and fire the
OutValue
output with the result.
SetValue
<integer>- Set the counter to a new value and fire the
OutValue
output with the result.
SetValueNoFire
<integer>- Set the counter to a new value without firing any outputs.
Subtract
<integer>- Subtract an amount from the counter and fire the
OutValue
output with the result.
SetHitMax
<integer>- Set the upper bound of the counter and fire the
OutValue
output with the current value.
SetHitMin
<integer>- Set the lower bound of the counter and fire the
OutValue
output with the current value.
GetValue
- Causes the counter to fire its
OnGetValue
output with the current value of the counter. Used for polling the counter when you don't want constant updates from theOutValue
output.
EnableDisable:
Enable
Disable
- Enable/disable this entity from performing its task. It might also disappear from view.
Base:
RunScriptFile
- Load and execute a script file.
RunScriptCode
- Execute a fragment of script code.
CallScriptFunction
- Call a script function.
CallPrivateScriptFunction
- Calls a script function from this entity's private script scope.
CallGlobalScriptFunction
- Calls a script function in the global script scope.
Kill
- Removes this entity from the world.
KillHierarchy
- Removes this entity and all its children from the world.
AddOutput
- Adds an entity I/O connection to this entity. Parameter format: OutputName→TargetName→InputName→Parameter→Delay→MaxRefires
FireUser1
toFireUser4
- Fires the respective
OnUser
outputs; see User Inputs and Outputs.
Outputs
OutValue
<integer>- Fired when the counter value changes.
If the Target Input's parameters is left empty, the math_counter's value is used.Tip:Useful for entities such as:logic_case
,math_remap
,logic_compare
.
OnHitMin
- Fired when the counter value meets or goes below the min value. The counter must go back above the min value before the output will fire again.
OnHitMax
- Fired when the counter value meets or exceeds the max value. The counter must go below the max value before the output will fire again.
OnGetValue
<integer>- Fired in response to the
GetValue
input; used when you don't want constant updates from theOutValue
output.
If the Target Input's parameters is left empty, the math_counter's value is used.Tip:Useful for entities such as:logic_case
,math_remap
,logic_compare
.
OnChangedFromMin
- Fired when the counter value changes from the minimum value.
OnChangedFromMax
- Fired when the counter value changes from the max value.
Base:
OnUser1
toOnUser4
- These outputs each fire in response to the firing of the like-numbered
FireUser1
toFireUser4
Input; see User Inputs and Outputs. OnKilled
- This output fires when the entity is killed and removed from the game. Parameter is the inflictor.