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
dragengine:modules:dragonscript:behavior_attachable [2025/05/13 14:03] – dragonlorddragengine:modules:dragonscript:behavior_attachable [2026/10/12 18:21] (current) – dragonlord
Line 48: Line 48:
 |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|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''.| |interact.parameters|string|Optional parameters to use with ''interaction''.|
 +|runEvent|string|Run named event on all [[behavior_statemachine|ECBehaviorStateMachine]] instance of attach slot with the attachable element as event parameter.|
  
-This is an example of using this action:+This is an example of using this action to detach from attach slot:
 <code xml> <code xml>
 <action name='attachable.update'> <action name='attachable.update'>
   <parameter name='detach'>dispose</parameter>   <parameter name='detach'>dispose</parameter>
 +</action>
 +</code>
 +
 +This is an example of running a state machine event on the attach slot element:
 +<code xml>
 +<action name='attachable.update'>
 +  <parameter name='runEvent'>do something</parameter>
 </action> </action>
 </code> </code>
Line 62: Line 70:
 ^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|
 +|flags.set|string|Attach slot element has [[behavior_flags|ECBehaviorFlags]] with named flag set.|
 +|flags.clear|string|Attach slot element has [[behavior_flags|ECBehaviorFlags]] with named flag cleared.|
 |interact.name|string|Name of interaction| |interact.name|string|Name of interaction|
 |interact.has|''true'', ''false''|Has attach slot and interaction with name ''interaction.name'' is present| |interact.has|''true'', ''false''|Has attach slot and interaction with name ''interaction.name'' is present|
Line 68: Line 78:
 |wait| |If present action returns BTResult.running instead of BTResult.failed to wait until the checks are all fulfilled| |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 to run sequence only if attachable is attached to an attach slot:
 <code xml> <code xml>
 <sequence> <sequence>
Line 75: Line 85:
   </action>   </action>
   <!-- actions here run only if element is attached to a slot -->   <!-- actions here run only if element is attached to a slot -->
 +</sequence>
 +</code>
 +
 +This is an example of a sequence running only if attached element has flag set:
 +<code xml>
 +<sequence>
 +  <action name='attachable.check'>
 +    <parameter name='flags.set'>can pick up</parameter>
 +  </action>
 +  <!-- actions here run only if attached to an attach slot, attach slot element has ECBehaviorFlags and the flag ''can pick up'' is set. -->
 </sequence> </sequence>
 </code> </code>
Line 88: Line 108:
 ^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.flags.set|string|Attach slot element has [[behavior_flags|ECBehaviorFlags]] with named flag set.|
 +|attachable.flags.clear|string|Attach slot element has [[behavior_flags|ECBehaviorFlags]] with named flag cleared.|
 |attachable.interact.name|string|Name of interaction| |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.has|''true'', ''false''|Has attach slot and interaction with name ''interaction.name'' is present|
Line 93: Line 115:
 |attachable.interact.parameters|string|Optional parameters to use with ''interaction.query''.| |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 to run action only if attached to an attach slot:
 <code xml> <code xml>
 <action name='myAction' id='doing something'> <action name='myAction' id='doing something'>
   <parameter name='attachable.attached'>true</parameter>   <parameter name='attachable.attached'>true</parameter>
   <condition>attachable.check</condition>   <condition>attachable.check</condition>
 +</action>
 +</code>
 +
 +This is an example of an action running only if attached element has flag set:
 +<code xml>
 +<action name='myAction' id='doing something'>
 +  <condition>attachable.check</condition>
 +  <parameter name='attachable.flags.set'>can pick up</parameter>
 </action> </action>
 </code> </code>
dragengine/modules/dragonscript/behavior_attachable.txt · Last modified: by dragonlord