Function Effect errors
Most Function Effect problems are small: a task name differs by one character, the effect runs at the wrong moment, or the two branches of an if() return incompatible results.
Work from a minimal rule first, then add one condition at a time.
Quick checklist
- Test the task or trigger that owns the Function Effect.
- Use Test Action before testing a large flow.
- Copy task and variable names exactly.
- Use $TN{Task} numeric states: 0.0 Not Active, 1.0 Active, 2.0 Completed.
- Use decimal values in Function Effect expressions: 0.0, 1.0, and 10.0.
- Confirm whether the task or variable should be single-player or multiplayer.
Nothing happens
Check the owning task first
A Function Effect is not a global script. Its owning task or trigger must run, unless Activate On Start is intentionally enabled.
Start with an unmistakable change:
SetVariable('FunctionTest', 1.0, 0.0)
If this does not change FunctionTest, inspect the task or trigger configuration before changing the expression.
Use the settings only when intended
| Setting | What it does |
|---|---|
| Activate On Start | Runs once while the task is prepared. |
| Trigger On Tasks Change | Re-runs when a task or value named in the expression changes. |
Do not assume either setting is required for every Function Effect. Turn on Trigger On Tasks Change only when the rule should react to referenced state changes.
A task condition is always false
Use the numeric state reference and check the exact name:
$TN{FindKey} == 2.0
| Expected state | Correct condition |
|---|---|
| Not Active | $TN{FindKey} == 0.0 |
| Active | $TN{FindKey} == 1.0 |
| Completed | $TN{FindKey} == 2.0 |
If a task was renamed, update every expression that references it.
A value does not update
Check the setter signature:
SetVariable('Coins', 10.0, 0.0)
The third argument is a delay in seconds. It is not an operation value.
For a shared numeric variable, use the dedicated update helper instead:
UpdateMultiplayerNumericVariable('TeamScore', 1.0, 1.0, 0.0)
This example adds one to a multiplayer numeric TeamScore. It does not work as intended if TeamScore was not configured as a multiplayer numeric variable.
An if() expression fails or takes the wrong branch
First, test the condition alone:
($N{Coins} >= 10.0) && ($TN{FindKey} == 2.0)
Then add the action:
if(
($N{Coins} >= 10.0) && ($TN{FindKey} == 2.0),
SetTask('OpenDoor', 'Active', 0.0),
''
)
The false branch is an empty string because SetTask() returns text. Do not mix that result with a number such as 0.0 in the other branch.
A rule repeatedly fires
A Function Effect can re-run when Trigger On Tasks Change is enabled. Do not make it both watch and unconditionally change the same value:
SetVariable('Score', $N{Score} + 1.0, 0.0)
Instead, trigger the increment from the player action that earns the point, or use a separate guard task.
Avoid legacy inline change subscriptions in new expressions. Use explicit $TN{...} and $N{...} references together with the settings toggle.
A shared score loses points
Do not do a local read-modify-write for a shared number:
SetVariable('TeamScore', $N{TeamScore} + 1.0, 0.0)
When multiple players score together, one update can overwrite another. For a configured multiplayer numeric variable, use operation 1 (Add):
UpdateMultiplayerNumericVariable('TeamScore', 1.0, 1.0, 0.0)
Final isolation test
- Create a fresh test task and test variable.
- Write one setter with no condition.
- Test it.
- Add one $TN or $N read.
- Add the condition.
- Move the tested expression back into the real task.
If the small version succeeds but the real task does not, compare the task scope, trigger, and exact names.
