Files
agame/docs/limboai-stable/_i18n/batches/batch06.txt
T
2026-10-15 16:30:44 +08:00

156 lines
11 KiB
Plaintext

<623> BTState
<624> A state node for <l1>LimboHSM</l> that hosts a <l2>BehaviorTree</l>.
<625> BTState is a <l1>LimboState</l> node that manages a <l2>BehaviorTree</l> to provide behavior logic for the state. It instantiates and runs the <l3>BehaviorTree</l> resource, dispatching a state machine event upon <4/> or <5/>. Event names are customizable through <l6>success_event</l> and <l7>failure_event</l>. For further details on state machine events, see <l8>LimboState.dispatch</l>.
<626> <l1>behavior_tree</l>
<627> <l1>failure_event</l>
<628> <l1>monitor_performance</l>
<629> <l1>success_event</l>
<630> <l1>get_bt_instance</l>() <2/>
<631> <l1>set_scene_root_hint</l>(scene_root: <2/>)
<632> <l1>BehaviorTree</l> <b>behavior_tree</b> <l2>🔗</l>
<633> A <l1>BehaviorTree</l> resource that defines state behavior.
<634> <1/> <b>failure_event</b> = <2/> <l3>🔗</l>
<635> <1/> <b>set_failure_event</b>(value: <2/>)
<636> <1/> <b>get_failure_event</b>()
<637> HSM event that will be dispatched when the behavior tree results in <1/>. See <l2>LimboState.dispatch</l>.
<638> <1/> <b>monitor_performance</b> = <2/> <l3>🔗</l>
<639> If <1/>, adds a performance monitor to “Debugger->Monitors” for each instance of this <b>BTState</b> node.
<640> <1/> <b>success_event</b> = <2/> <l3>🔗</l>
<641> <1/> <b>set_success_event</b>(value: <2/>)
<642> <1/> <b>get_success_event</b>()
<643> HSM event that will be dispatched when the behavior tree results in <1/>. See <l2>LimboState.dispatch</l>.
<644> <l1>BTInstance</l> <b>get_bt_instance</b>() <2/> <l3>🔗</l>
<645> <1/> <b>set_scene_root_hint</b>(scene_root: <2/>) <l3>🔗</l>
<646> Sets the <1/> that will be used as the scene root for the newly instantiated behavior tree. Should be called before the state machine is initialized. This is typically useful when creating <b>BTState</b> nodes dynamically from code.
<647> Full class reference is available in the side bar.
<648> BBAabb
<649> <b>Inherits:</b> <l1>BBParam</l>
<650> AABB-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<651> BBArray
<652> Array-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<653> BBBasis
<654> Basis-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<655> BBBool
<656> Bool-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<657> BBByteArray
<658> ByteArray-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<659> BBColor
<660> Color-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<661> BBColorArray
<662> ColorArray-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<663> BBDictionary
<664> Dictionary-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<665> BBFloat
<666> Float-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<667> BBFloat32Array
<668> PackedFloat32Array-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<669> BBFloat64Array
<670> PackedFloat64Array-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<671> BBInt
<672> Integer-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<673> BBInt32Array
<674> PackedInt32Array-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<675> BBInt64Array
<676> PackedInt64Array-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<677> BBNode
<678> Node-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<679> Node-type parameter intended for use with <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<680> If the source is a blackboard variable, it allows any type extended from <1/>.
<681> BBPlane
<682> Plane-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<683> BBProjection
<684> Projection-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<685> BBQuaternion
<686> Quaternion-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<687> BBRect2
<688> Rect2-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<689> BBRect2i
<690> Rect2i-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<691> BBString
<692> String-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<693> BBStringArray
<694> StringArray-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<695> BBStringName
<696> StringName-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<697> BBTransform2D
<698> Transform2D-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<699> BBTransform3D
<700> Transform3D-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<701> BBVariant
<702> Variant-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<703> Variant-type parameter intended for use with <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<704> The data type is specified by <l1>type</l>.
<705> <l1>type</l>
<706> Variant.Type <b>type</b> = <1/> <l2>🔗</l>
<707> <1/> <b>set_type</b>(value: Variant.Type)
<708> Variant.Type <b>get_type</b>()
<709> Specified Variant.Type for the parameter value.
<710> BBVector2
<711> Vector2-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<712> BBVector2Array
<713> Vector2Array-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<714> BBVector2i
<715> Vector2i-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<716> BBVector3
<717> Vector3-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<718> BBVector3Array
<719> Vector3Array-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<720> BBVector3i
<721> Vector3i-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<722> BBVector4
<723> Vector4-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<724> BBVector4i
<725> Vector4i-type parameter for <l1>BehaviorTree</l> tasks. See <l2>BBParam</l>.
<726> BehaviorTree
<727> Contains Behavior Tree data.
<728> Behavior Trees are hierarchical structures used to model and control the behavior of agents in a game (e.g., characters, enemies, entities). They are designed to make it easier to create complex and highly modular behaviors for your games.
<729> Behavior Trees are composed of tasks that represent specific actions or decision-making rules. Tasks can be broadly categorized into two main types: control tasks and leaf tasks. Control tasks determine the execution flow within the tree. They include <l1>BTSequence</l>, <l2>BTSelector</l>, and <l3>BTInvert</l>. Leaf tasks represent specific actions to perform, like moving or attacking, or conditions that need to be checked. The <l4>BTTask</l> class provides the foundation for various building blocks of the Behavior Trees. BT tasks can share data with the help of <l5>Blackboard</l>. See <l6>BTTask.blackboard</l> and <l7>Blackboard</l>.
<730> <b>Note:</b> To create your own actions, extend the <l1>BTAction</l> class.
<731> The BehaviorTree is executed from the root task and follows the rules specified by the control tasks, all the way down to the leaf tasks, which represent the actual actions that the agent should perform or conditions that should be checked. Each task returns a status when it is executed. It can be <1/>, <2/>, or <3/>. These statuses determine how the tree progresses. They are defined in <l4>Status</l>.
<732> Behavior Trees handle conditional logic using condition tasks. These tasks check for specific conditions and return either <1/> or <2/> based on the state of the agent or its environment (e.g., “IsLowOnHealth”, “IsTargetInSight”). Conditions can be used together with <l3>BTSequence</l> and <l4>BTSelector</l> to craft your decision-making logic.
<733> <b>Note</b>: To create your own conditions, extend the <l1>BTCondition</l> class.
<734> Check out the <l1>BTTask</l> class, which provides the foundation for various building blocks of Behavior Trees.
<735> <l1>blackboard_plan</l>
<736> <l1>description</l>
<737> <l1>BehaviorTree</l>
<738> <l1>clone</l>() <2/>
<739> <l1>copy_other</l>(other: <l2>BehaviorTree</l>)
<740> <l1>BTTask</l>
<741> <l1>get_root_task</l>() <2/>
<742> <l1>instantiate</l>(agent: <2/>, blackboard: <l3>Blackboard</l>, instance_owner: <4/>, custom_scene_root: <5/> = null) <6/>
<743> <l1>set_root_task</l>(task: <l2>BTTask</l>)
<744> <b>plan_changed</b>() <l1>🔗</l>
<745> Emitted when the <l1>BlackboardPlan</l> changes.
<746> <l1>BlackboardPlan</l> <b>blackboard_plan</b> <l2>🔗</l>
<747> <1/> <b>description</b> = <2/> <l3>🔗</l>
<748> <1/> <b>set_description</b>(value: <2/>)
<749> <1/> <b>get_description</b>()
<750> User-provided description of the <b>BehaviorTree</b>.
<751> <l1>BehaviorTree</l> <b>clone</b>() <2/> <l3>🔗</l>
<752> Makes a copy of the BehaviorTree resource.
<753> <1/> <b>copy_other</b>(other: <l2>BehaviorTree</l>) <l3>🔗</l>
<754> Become a copy of another behavior tree.
<755> <l1>BTTask</l> <b>get_root_task</b>() <2/> <l3>🔗</l>
<756> Returns the root task of the BehaviorTree resource.
<757> <l1>BTInstance</l> <b>instantiate</b>(agent: <2/>, blackboard: <l3>Blackboard</l>, instance_owner: <4/>, custom_scene_root: <5/> = null) <6/> <l7>🔗</l>
<758> Instantiates the behavior tree and returns <l1>BTInstance</l>. <2/> should be the scene node that will own the behavior tree instance. This is typically a <l3>BTPlayer</l>, <l4>BTState</l>, or a custom player node that controls the behavior tree execution. Make sure to pass a <l5>Blackboard</l> with values populated from <l6>blackboard_plan</l>. See also <l7>BlackboardPlan.populate_blackboard</l> & <l8>BlackboardPlan.create_blackboard</l>.
<759> If <1/> is not <2/>, it will be used as the scene root for the newly instantiated behavior tree; otherwise, the scene root will be set to <3/>. Scene root is essential for <l4>BBNode</l> instances to work properly.
<760> <1/> <b>set_root_task</b>(task: <l2>BTTask</l>) <l3>🔗</l>
<761> Assigns a new root task to the <b>BehaviorTree</b> resource.
<762> BehaviorTreeData
<763> Represents current state of a <l1>BehaviorTree</l> instance.
<764> This class is used by the LimboAI debugger for the serialization and deserialization of <l1>BehaviorTree</l> instance data.
<765> Additionally, it can be used with <l1>BehaviorTreeView</l> to visualize the current state of a <l2>BehaviorTree</l> instance. It is meant to be utilized in custom in-game tools.
<766> <l1>BehaviorTreeData</l>
<767> <l1>create_from_bt_instance</l>(bt_instance: <l2>BTInstance</l>) <3/>
<768> <l1>BehaviorTreeData</l> <b>create_from_bt_instance</b>(bt_instance: <l2>BTInstance</l>) <3/> <l4>🔗</l>
<769> Returns current state of the <1/> encoded as a <b>BehaviorTreeData</b>, suitable for use with <l2>BehaviorTreeView</l>.
<770> Behavior tree instance can be acquired with <l1>BTPlayer.get_bt_instance</l>.
<771> BehaviorTreeView
<772> Visualizes the current state of a <l1>BehaviorTree</l> instance.
<773> Visualizes the current state of a <l1>BehaviorTree</l> instance. See also <l2>BehaviorTreeData</l>.
<774> <l1>update_interval_msec</l>
<775> <l1>clear</l>()
<776> <l1>update_tree</l>(behavior_tree_data: <l2>BehaviorTreeData</l>)
<777> <b>task_selected</b>(type_name: <1/>, script_path: <2/>) <l3>🔗</l>
<778> Emitted when a task item is selected in <b>BehaviorTreeView</b>.