The IfThenElse node works on the classic principle of "if-then-else". It helps decide what to do next based on whether a condition is met or not.
The left-most node is a Condition. If it returns Success
, the middle node (Then) is executed. If the condition fails (Failure
), the right-most node (Else) is executed, if it exists.
Alternatively, in more compact EyeAuras notation, this could look like this
In situations where you simply need to iterate through actions from left to right and stop at the first successful one, the Selector node is preferable. If performing several actions sequentially is essential, the Sequence node is suitable.
Suppose a character encounters an enemy and must behave differently depending on whether the enemy is a boss or a regular mob.
IfThenElse
├── Condition: "Is the target a boss?"
├── Then: "Use special boss skills"
└── Else: "Use regular skills"
This approach clearly specifies different behaviors for regular enemies and special cases.
The character must either avoid a dangerous zone if inside it or continue following the usual route.
IfThenElse
├── Condition: "Is the character in a dangerous zone?"
├── Then: "Leave the dangerous zone"
└── Else: "Follow the regular route"
This example clearly separates two entirely different behavioral strategies depending on the current situation.
Success
, the middle node (Then) executes.Failure
, the right-most node (Else) executes, if specified.Failure
.The IfThenElse node allows you to easily create various reactions for characters in game situations, making behavior flexible.
Don't confuse! IfThenElse separates conditions and two action variants distinctly, unlike the Selector node, which simply iterates actions from left to right until the first success.