Branching Reactions with Custom Parameter
Each reaction entry in a rule has an integer Custom Parameter. Instead of duplicating blueprints, you can use this value to branch behavior inside the same reaction.
Example 2, Throw with Custom Parameter.mars, throws in three different ways from a single reaction depending on the donation amount. Rule names are in English in every language.
MARS 1.2.0 or later
This example uses the camera as a linked item, so it installs in MARS 1.2.0 or later. When the install window asks which camera to link, pick the camera you use.
| Rule | Condition | Custom Parameter | Action |
|---|---|---|---|
| Throw Parameter 0 | Donation ₩1,000 (exact match) | 0 | Throw one |
| Throw Parameter 1 | Donation ₩5,000 (exact match) | 1 | Throw 10 in a row |
| Throw Parameter 2 | Donation ₩10,000 (exact match) | 2 | Throw, ragdoll on hit |
In the blueprint, connect the Custom Parameter output of MARS Link to an If or Switch node and branch immediately after Invoked.
MARS LinkCustom Parameter output
Switch On IntegerBranch on parameter
Throw one0
Throw 10 in a row1 · For Loop
Throw, then ragdoll2 · on hit
MARS CompleteRun
- The default value is 0; negative values are allowed.
- Different values still use the same reaction, so a single execution policy applies.
- Test Run also passes this value, and it is included in
.marssharing. - The value is saved when the request enters the queue, so changing the Hub value later does not affect requests already queued.
- Do not call MARS Complete inside a loop (For Loop). Call it once when the loop ends. Calling it several times also ends the next queued request early.