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.
The FlowScript OnEnable, OnUpdate, and OnDisable events will fire respectively when the sub FlowScript in the Behaviour Tree is enabled, updated, or disabled respectively.
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.
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 modelled with a FlowScript.
Remember that you can also use SubGraph Variables Mapping as normal between Behaviour Tree and FlowScript.
© Paradox Notion 2014-2024. All rights reserved.