Conditions¶
Conditions are components attached to game objects that, when executed, start checking the conditions in each Branch, from top to bottom. If all the Conditions of a branch return success, then the Instructions associated to that branch are executed, and stops checking any further.
If any of the Conditions of a Branch returns false
, it skips to the next branch.
Example
In the image above, the Conditions component has just one Branch. This branch checks whether the player is moving or not. If it happens to move moving while this Conditions component is executed, it will print the "Player is moving" message on the console.
Creating Conditions¶
Right click on the Hierarchy panel and select Game Creator → Visual Scripting → Conditions. A game object named 'Conditions' will appear in the scene with a component of the same name.
Alternatively you can also add the Conditions component to any game object clicking on the Inspector's Add Component button and searching for Conditions.
Deleting Conditions
To delete a Conditions component, simply click on the component's little cog button and select "Remove Component" from the dropdown menu.
Adding Branches¶
To add a new Branch simply click on the Add Branch button. This will create a new branch at the bottom of the Conditions component. You can then click and drag the =
symbol on the right and reorder the branch list.
Branch Order
Remember that top branches have higher priority than lower ones when executed.
All Branches have a Description field, which can be used to more easily identify what that branch does. It has no gameplay effect.
Conditions and Instructions¶
A Branch is composed of a list of Conditions and a list of Instructions. Adding them is as easy as clicking on the Add Condition and Add Instruction respectively and choose the desired element.
Negate Condition
It is important to note that a specific Condition can be negated. For example, if the condition "Is Player Moving" returns success when the player is moving, but false when it's not, you can check for the opposite effect clicking on the small green toggle. It will now return true of the player is not moving, and true otherwise.
Empty Conditions List
An empty conditions list will always return success.