Documentation

Learn how to use NodeCanvas

Download PDF Version

Behaviour Tree -> FlowScript

A FlowCanvas FlowScript can be used as a sub 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 sub FlowScript through the context menu; found under the “SubGraphs” category.

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

bt

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

flowscript1

As usual, a Sequencer (and most Behaviour Tree nodes), expects a return result of Success or Failure, based on which the Sequencer will continue executing its children 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 boolean port to determine returned Success or Failure.

flowscript2

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

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

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