Skip to main content

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.

RuleConditionCustom ParameterAction
Throw Parameter 0Donation ₩1,000 (exact match)0Throw one
Throw Parameter 1Donation ₩5,000 (exact match)1Throw 10 in a row
Throw Parameter 2Donation ₩10,000 (exact match)2Throw, 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 .mars sharing.
  • 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.