Alternative

The CrowdBeOpAlternative is used to select one connection among several connections and conditions.
 
An alternative operator item in  the behavior editor with two conditions and a default connection
 
Indeed, each connection is allocated a Trigger (shown by a bubble on the link) and an evaluation order. When the Alternative Operator is evaluated, the first Trigger is evaluated: if true, the related connection is selected, othewise the next Trigger is evaluated and so on …
 
If all Triggers are false (e.g. no connection has been selected), the default connection (the link without bubble) is then selected. If no default connection is set, the Alternative Operator is blocking.
 
Creating an Alternative Operator can be performed through the following options:
  • Behavior Editor / Behavior Library: 
  • Crowd Menu: Crowd Behaviors / Operators / CrowdBeOpAlternative Node
  • MEL command: glmCrowdBeOpAlternativeCmd;

Configuration

This part describes the specific manipulations to perform in order to configure an Alternative Operator.
 

In the Behavior Editor

In the Behavior Editor, if the Alternative Operator is not followed by a default connection, the next link drawn will define the default connection.
 
Alternative operator with a single default connection
 
When a default connection is already in place, every future link drawn will define another connection, with a true CrowdTrigger by default, keeping the previous order. This trigger will be used to make a if (trigger) then… else if… statement
 
Alternative operator with a previous default connection and a condition connection
 
Tip: If a Trigger is set as a condition, select it by clicking on the bubble of the related connection.
 

In the Attribute Editor

An Alternative Operator defines the following specific attributes. To get more information about shared parameters, see part 9.3.2.
 
Conditions of an Alternative Operator
 
Add

Add the next condition (e.g. the next Behavior/Operator connected to a new link with a condition), this behavior must be a child of the parent Behavior Container. When several connections are establish, the labels "if" and "else if" defined the evaluation order

Conditions of an alternative operator with connections
 
Else Select a default Behavior/Operator.