Logic Entity Save Support

LogicArithmetic

Performs arithmetic on two float values and fires an output with the result as a pass variable.

Inputs

Name Parameter Description
SetA Float Sets the first operand.
SetB Float Sets the second operand.
Add Computes A + B and fires OnValueComputed.
Subtract Computes A - B and fires OnValueComputed.
Multiply Computes A * B and fires OnValueComputed.
Divide Computes A / B and fires OnValueComputed. Dividing by zero will produce infinity or NaN.

Outputs

Name Pass Variables Description
OnValueComputed !value_c !value_a !value_b Fires after any arithmetic operation with the result and both operands as pass variables.

Pass variable details:

!value_c The result of the operation.
!value_a The value of operand A at the time of the operation.
!value_b The value of operand B at the time of the operation.

Notes

Because it fires !value_c as a pass variable, the result can be fed directly into any downstream entity that accepts a float parameter, eg. LogicCompare’s SetValue or another LogicArithmetic’s SetA.

Both operand values are saved and restored across saves, so an arithmetic entity used as a running counter will remember its current state after a load.

A common use could be as a counter. Set B to 1 once at map start, then call Add every time an event happens. Each call increments the running total in A and fires !value_c with the new count. Route that into a LogicCompare to check if you’ve hit a target number.

Chains are possible by routing !value_c from one LogicArithmetic into SetA of another, then immediately calling an operation on the second. The result of the first feeds directly into the second with no intermediate storage needed. This lets you build multi-step calculations entirely in the editor.

Avoid dividing by zero. There is no guard against it and the result will be infinity or NaN, which will likely break any downstream LogicCompare silently.