Documentation

Learn how to use NodeCanvas

Download PDF Version

Behaviour Tree -> FlowScript

A FlowCanvas FlowScript can be used as a nested Behaviour Tree node to model the node’s behaviour completely with visual scripting. After you have downloaded the FlowCanvas bridge extension, it will be possible to add such a nested FlowScript through the context menu and found under the “Nested” category.

In the example here, we use a FlowScript as a child of a Behaviour Tree’s Sequencer. 

bt

 

The FlowScript’s OnEnable, OnUpdate, OnDisable events will fire respectively when the nested FlowScript in the Behaviour Tree is enabled, updated or disabled.

flowscript1

 

Per usual, a Sequencer (and most Behaviour Tree nodes), expects a return result of Success or Failure, based on which the Sequencer will continue executing it’s child nodes or not, for Success/Failure respectively. Within the FlowScript, the ‘Finish’ node has to be used to return control back to the Behaviour Tree, using the Finish node’s boolean port to determine returned Success or Failure.

flowscript2

Without a Finish node called, the FlowScript will continue run indefinitely, thus returning Status.Running back to the Behaviour Tree forever, unless the Behaviour Tree Nested FlowScript Node is interrupted by any means.

Generally speaking, for all purposes you can treat a Nested FlowScript Node as a normal Action Node, which though instead of having a Task assigned, it’s functionality is modeled with a FlowScript.

Last but not least, all Variables used in the Behaviour Tree, are propagated down the nested FlowScript like all other nested Graphs work.

 

Yes No Suggest edit
1 of 3 users found this section helpful
Suggest Edit