Counter Device
The counter_device is a creative device that manages a counter value which can be updated via various triggers. It supports both global and per-player tracking of counter values and fires an event whenever the counter changes.
Properties
Triggers
Type: []session_counter_trigger
An array of counter triggers that modify the counter value. Each trigger specifies an operation (such as Add, Subtract, etc.) and an amount to update the counter when its associated trigger device is activated.
OnCompareTriggers
Type: []session_counter_comparison_trigger
An array of comparison triggers that evaluate the current counter value. If a comparison condition is met (for example, the counter equals a specified value), the associated trigger is fired.
OnChangeTrigger
Type: trigger_device
A trigger device that is activated whenever the counter value changes.
InitialCount
Type: int
The starting value of the counter.
PerPlayer
Type: logic
A flag that determines whether the counter is tracked individually for each player (true) or globally (false).
ChangedEvent
Type: counter_change_event
A public event that is invoked whenever the counter value changes.
Below are details on the supporting trigger devices used with the counter device.
session_counter_trigger
A session_counter_trigger updates the counter when its associated trigger is activated.
Properties
Trigger
Type: trigger_device
The trigger device that, when activated, initiates a counter update.
Operation
Type: counter_operation
Specifies the operation to perform on the counter. Options include:
- Set: Assigns a specific value to the counter.
- Add: Increases the counter by a specified amount.
- Subtract: Decreases the counter by a specified amount.
- Multiply: Multiplies the counter by a specified amount.
- Divide: Divides the counter by a specified amount (using ceiling to round up).
Amount
Type: int
The numeric value used in the counter operation.
Target
Type: counter_trigger_target
Determines which target player(s) are affected by this trigger. Typically, this is set to target the Instigator, but it can also be configured to affect all players.
session_counter_comparison_trigger
A session_counter_comparison_trigger evaluates the current counter value against a specified amount and fires its associated trigger if the comparison condition is met.
Properties
Comparison
Type: comparison_operation
The comparison operator used to evaluate the counter value. Options include:
- NotEqual
- LessThan
- LessThanOrEqual
- Equal
- GreaterThan
- GreaterThanOrEqual
Amount
Type: int
The value against which the current counter is compared.
OnPassTrigger
Type: trigger_device
The trigger device that is activated if the counter value satisfies the comparison condition.