User Tools

Site Tools


dragengine:modules:dragonscript:behavior_interactionspot

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_interactionspot [2025/03/12 20:27] dragonlorddragengine:modules:dragonscript:behavior_interactionspot [2025/05/13 14:08] (current) dragonlord
Line 1: Line 1:
 {{tag>dragonscript behavior}} {{tag>dragonscript behavior}}
 <WRAP youarehere> <WRAP youarehere>
-[[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[abstractions#behavior_elementsquick_and_easy_development|Behavior Elements: Quick and Easy Development]] >> **ECBehaviorInteractionSpot**+[[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[dragengine:modules:dragonscript:abstractions|Abstraction Layers: How you want to build your Game]] >> [[dragengine:modules:dragonscript:behavior_elements|Behavior Elements]] >> **ECBehaviorInteractionSpot**
 </WRAP> </WRAP>
  
Line 60: Line 60:
  
 ===== spotReleased ===== ===== spotReleased =====
 +
 +Occupier has release spot.
 +
 +====== Behavior Tree Actions ======
 +
 +This behavior adds these behavior tree actions if behavior tree is present. If behavior has non-empty identifier replace ''interactionSpot'' with ''interactionSpot(id)''.
 +
 +===== interactionSpot.update =====
 +
 +Update interact spot.
 +
 +^Parameter^Value^Description^
 +|release| |Release occupied if one interaction spot is not empty.|
 +|interactElement.assign|string|Assign occupying element to [[behavior_interactelement|ECBehaviorInteractElement]] with identifier matching value string. Action fails if no element is occupying or interact element behavior is absent|
 +|interact|string|Interact with occupier. 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:
 +<code xml>
 +<action name='interactionSpot.update'>
 +  <parameter name='release'/>
 +</action>
 +</code>
 +
 +===== interactionSpot.check =====
 +
 +Check one or more interaction spot parameters. Action succeeds if all parameter value matches their respective interaction spot parameter otherwise action fails. This action is typically used as first action in a sequence to run the sequence only if a interaction spot parameter matches (or not).
 +
 +^Parameter^Value^Description^
 +|empty|''true'', ''false''|Interaction spot is empty, hence not occupied by an occupier|
 +|interact.name|string|Name of interaction|
 +|interact.has|''true'', ''false''|Has occupier and interaction with name ''interaction.name'' is present|
 +|interact.query|''true'', ''false''|Interact with occupier and test result. Condition is true if occupier 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:
 +<code xml>
 +<sequence>
 +  <action name='interactionSpot.check'>
 +    <parameter name='empty'>true</parameter>
 +  </action>
 +  <!-- actions here run only if interaction spot is empty, hence not occupied by an occupier -->
 +</sequence>
 +</code>
 +
 +====== Behavior Tree Conditions ======
 +
 +This behavior adds these behavior tree conditions if behavior tree is present. If behavior has non-empty identifier replace ''interactionSpot'' with ''interactionSpot(id)''.
 +
 +===== interactionSpot.check =====
 +
 +Check one or more interaction spot parameters. Conditions returns true if all parameter value match their respective interaction spot parameter. This condition is typically used to run an action or sequence of actions as long as interaction spot conditions are true.
 +
 +^Parameter^Value^Description^
 +|interactionSpot.empty|''true'', ''false''|Interaction spot is empty, hence not occupied by an occupier|
 +|interactionSpot.interact.name|string|Name of interaction|
 +|interactionSpot.interact.has|''true'', ''false''|Has occupier and interaction with name ''interaction.name'' is present|
 +|interactionSpot.interact.query|''true'', ''false''|Interact with occupier and test result. Condition is true if occupier 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).|
 +|interactionSpot.interact.parameters|string|Optional parameters to use with ''interaction.query''.|
 +
 +This is an example of using this condition:
 +<code xml>
 +<action name='myAction' id='doing something'>
 +  <parameter name='interactionSpot.empty'>true</parameter>
 +  <condition>interactionSpot.check</condition>
 +</action>
 +</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. If behavior has non-empty identifier replace ''interactionSpot'' with ''interactionSpot(id)''.
 +
 +===== interactionSpot.claimed =====
 +
 +Occupier has claimed spot.
 +
 +===== interactionSpot.released =====
  
 Occupier has release spot. Occupier has release spot.
Line 69: Line 155:
 ====== Optional Behaviors ====== ====== Optional Behaviors ======
  
-This behavior does not support optional behaviors.+  * [[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 76: Line 163:
  
 ====== API Documentation ====== ====== API Documentation ======
 +
 #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorInteractionSpot.html,ECBehaviorInteractionSpot~@#. #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorInteractionSpot.html,ECBehaviorInteractionSpot~@#.
  
Line 126: Line 214:
      
   <behavior type='ECBehaviorInteractionSpot'>   <behavior type='ECBehaviorInteractionSpot'>
 +    <!-- 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 -->
     <vector name='.lookAt' x='0' y='0.2' z='0.5'/>     <vector name='.lookAt' x='0' y='0.2' z='0.5'/>
dragengine/modules/dragonscript/behavior_interactionspot.1741811221.txt.gz · Last modified: 2025/03/12 20:27 by dragonlord