User Tools

Site Tools


dragengine:modules:dragonscript:behavior_attachable

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dragengine:modules:dragonscript:behavior_attachable [2025/05/02 10:42] dragonlorddragengine:modules:dragonscript:behavior_attachable [2025/05/13 14:03] (current) dragonlord
Line 34: Line 34:
  
 Attachable has been removed from slot. Attachable has been removed from slot.
 +
 ====== Behavior Tree Actions ====== ====== Behavior Tree Actions ======
  
 This behavior adds these behavior tree actions if behavior tree is present. This behavior adds these behavior tree actions if behavior tree is present.
  
-===== attachable.detach =====+===== attachable.update =====
  
-Detach element from attach slot if attached to an attach slot.+Update attachable.
  
 ^Parameter^Value^Description^ ^Parameter^Value^Description^
-|dispose| |If present element is disposed after detachingeven if not attached before. Action returns BTResult.running to stop the behavior tree.|+|detach|empty string, ''dispose''|Detach element from attach slot if attached to an attach slot. If value is ''dispose'' disposed after detaching (even if not attached before) and returns BTResult.running to stop the behavior tree.| 
 +|interactElement.assign|string|Assign attach slot element to [[behavior_interactelement|ECBehaviorInteractElement]] with identifier matching value string. Action fails if not attached to an attach slot or interact element behavior is absent| 
 +|interact|string|Interact with attach slot. If element is absent action fails. Runs interaction with name value. If interaction with name value is absent fails action. If interaction returns false fails action. Otherwise action succeeds.| 
 +|interact.parameters|string|Optional parameters to use with ''interaction''.|
  
 This is an example of using this action: This is an example of using this action:
 <code xml> <code xml>
-<action name='attachable.detach'> +<action name='attachable.update'> 
-  <parameter name='dispose'/>+  <parameter name='detach'>dispose</parameter>
 </action> </action>
 </code> </code>
Line 58: Line 62:
 ^Parameter^Value^Description^ ^Parameter^Value^Description^
 |attached|''true'', ''false''|Element is attached to an attach slot or not| |attached|''true'', ''false''|Element is attached to an attach slot or not|
 +|interact.name|string|Name of interaction|
 +|interact.has|''true'', ''false''|Has attach slot and interaction with name ''interaction.name'' is present|
 +|interact.query|''true'', ''false''|Interact with attach slot and test result. Condition is true if attach slot is present, interaction with name ''interaction.name'' is present and interaction returns true. It is recommended to use here only interactions without side effects (hence query interactions).|
 +|interact.parameters|string|Optional parameters to use with ''interaction.query''.|
 +|wait| |If present action returns BTResult.running instead of BTResult.failed to wait until the checks are all fulfilled|
  
 This is an example of using this action: This is an example of using this action:
Line 79: Line 88:
 ^Parameter^Value^Description^ ^Parameter^Value^Description^
 |attachable.attached|''true'', ''false''|Element is attached to an attach slot or not| |attachable.attached|''true'', ''false''|Element is attached to an attach slot or not|
 +|attachable.interact.name|string|Name of interaction|
 +|attachable.interact.has|''true'', ''false''|Has attach slot and interaction with name ''interaction.name'' is present|
 +|attachable.interact.query|''true'', ''false''|Interact with attach slot and test result. Condition is true if attach slot is present, interaction with name ''interaction.name'' is present and interaction returns true. It is recommended to use here only interactions without side effects (hence query interactions).|
 +|attachable.interact.parameters|string|Optional parameters to use with ''interaction.query''.|
  
 This is an example of using this condition: This is an example of using this condition:
Line 87: Line 100:
 </action> </action>
 </code> </code>
 +
 +====== State Machine Actions ======
 +
 +Same as [[#behavior_tree_actions|Behavior Tree Actions]].
 +
 +====== State Machine Conditions ======
 +
 +Same as [[#behavior_tree_conditions|Behavior Tree Conditions]].
 +
 +====== State Machine Events ======
 +
 +This behavior sends these state machine events.
 +
 +===== attachable.attached =====
 +
 +Attachable has been attached to slot.
 +
 +===== attachable.detached =====
 +
 +Attachable has been removed from slot.
  
 ====== Required Behaviors ====== ====== Required Behaviors ======
Line 95: Line 128:
  
   * [[behavior_behaviortree|ECBehaviorBehaviorTree]]: Add actions and conditions for behavior trees to use.   * [[behavior_behaviortree|ECBehaviorBehaviorTree]]: Add actions and conditions for behavior trees to use.
 +  * [[behavior_statemachine|ECBehaviorStateMachine]]: Add actions and conditions for state machine to use and events to send to the state machine.
  
 ====== Persistency ====== ====== Persistency ======
Line 137: Line 171:
      
   <behavior type='ECBehaviorAttachable'>   <behavior type='ECBehaviorAttachable'>
 +    <!-- optional: use behavior tree with id instead of empty string -->
 +    <string name='behaviorTree'>second</string>
 +    
 +    <!-- optional: use state machine with id instead of empty string -->
 +    <string name='stateMachine'>second</string>
 +    
     <!-- set element properties. omit property prefix if used inside behavior tag -->     <!-- set element properties. omit property prefix if used inside behavior tag -->
     <string name='.name'>value</string>     <string name='.name'>value</string>
dragengine/modules/dragonscript/behavior_attachable.1746182565.txt.gz · Last modified: 2025/05/02 10:42 by dragonlord