This page describes integration support for Behavior Designer. The Dialogue System's support package provides methods to control Behaviour Designer from within conversations and sequences. Behavior Designer itself has a corresponding support package that allows you to monitor and control the Dialogue System from within behavior trees. (Behavior Designer is required.)
Behavior Designer copyright © Opsive.
To enable Behavior Designer support in the Dialogue System:
Third Party Support/Behavior Designer Support
.The Behavior Tree Lua Bridge component synchronizes a behavior tree's shared variables with the Dialogue System's Lua environment. Attach it to the GameObject that contains the behavior tree. To do this, select the GameObject and then menu item Component > Dialogue System > Third Party > Behavior Designer > Behavior Tree Lua Bridge.
Synchronization occurs automatically at the beginning and end of conversations. You can also synchronize manually by calling SyncToLua() or SyncFromLua(). Only bools, floats, ints, and strings are synchronized.
The Lua variables will have the name gameObjectName_variableName. All blank spaces and hyphens will be converted to underscores.
For example, say an NPC named Private Hart has a behavior tree with a shared variable named Angry. The Lua variable will be Variable["Private_Hart_Angry"]
.
You can check the value of Variable["Private_Hart_Angry"]
in a dialogue entry's Conditions fields and set the value a User Script field.
The support package adds two sequencer commands. You can use these commands within conversations, barks, and other sequences to control behavior trees.
Note: Provided in Scripts/Third Party Support/Behavior Designer
. Requires Behavior Designer.
Syntax: Behavior(
subject, start|stop|pause|resume)
Description: Controls a Behavior Designer behavior tree.
Parameters:
speaker
or listener
. The behavior tree can be located on a child object.start|stop|pause|resume
: Control action for the behavior tree.start
: Starts or restarts the behavior tree.stop
: Stops the behavior tree.pause
: Pauses the behavior tree.resume
: Resumes the behavior tree if paused.Example:
Behavior(Sergeant Graves, start)
(Starts the behavior tree on Sergeant Graves)Behavior(Terminal, pause)
(Pauses the behavior tree on Terminal)Note: Provided in Scripts/Third Party Support/Behavior Designer
. Requires Behavior Designer.
Syntax: BehaviorVariable(
subject, variableName, value)
Description: Sets the value of a behavior tree's shared variable.
Parameters:
speaker
or listener
. The behavior tree can be located on a child object.Example:
BehaviorVariable(Sergeant Graves, target, speaker)
(On Sergeant Graves' behavior tree, sets the variable target to the speaker)Behavior(Terminal, overheating, true)
(On Terminal's behavior tree, sets the variable overheating to true
)