User Tools

Site Tools


dragengine:modules:dragonscript:behavior_hearsounds

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_hearsounds [2025/03/13 17:16] dragonlorddragengine:modules:dragonscript:behavior_hearsounds [2025/05/04 13:49] (current) – [hearSound.check] dragonlord
Line 85: Line 85:
  
 ===== elementInaudible ===== ===== elementInaudible =====
 +
 +Element became inaudible.
 +
 +====== Behavior Tree Actions ======
 +
 +This behavior adds these behavior tree actions if behavior tree is present.
 +
 +===== hearSound.check =====
 +
 +Check one or more hear sound parameters. Action succeeds if all parameter value matches their respective hear sound parameter otherwise action fails. This action is typically used as first action in a sequence to run the sequence only if a hear sound parameter matches (or not).
 +
 +^Parameter^Value^Description^
 +|count|integer|Count of audible elements equals integer value|
 +|count.not|integer|Count of audible elements does not equal integer value|
 +|count.less|integer|Count of audible elements is less than integer value|
 +|count.greater|integer|Count of audible elements is greater than integer value|
 +|player|''true'', ''false''|Player is audible|
 +|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='hearSound.check'>
 +    <parameter name='player'>true</parameter>
 +  </action>
 +  <!-- actions here run only if player is audible by element -->
 +</sequence>
 +</code>
 +
 +====== Behavior Tree Conditions ======
 +
 +This behavior adds these behavior tree conditions if behavior tree is present.
 +
 +===== hearSound.check =====
 +
 +Check one or more hear sound parameters. Conditions returns true if all parameter value match their respective hear sound parameter. This condition is typically used to run an action or sequence of actions as long as hear sound conditions are true.
 +
 +^Parameter^Value^Description^
 +|hearSound.count|integer|Count of audible elements equals integer value|
 +|hearSound.count.not|integer|Count of audible elements does not equal integer value|
 +|hearSound.count.less|integer|Count of audible elements is less than integer value|
 +|hearSound.count.greater|integer|Count of audible elements is greater than integer value|
 +|hearSound.player|''true'', ''false''|Player is audible|
 +
 +This is an example of using this condition:
 +<code xml>
 +<action name='myAction' id='doing something'>
 +  <parameter name='hearSound.player'>true</parameter>
 +  <condition>hearSound.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.
 +
 +===== hearSound.audible =====
 +
 +Element become audible.
 +
 +===== hearSound.inaudible =====
  
 Element became inaudible. Element became inaudible.
Line 95: Line 164:
  
   * [[behavior_collider|ECBehaviorCollider]]: Attach to collider.   * [[behavior_collider|ECBehaviorCollider]]: Attach to collider.
 +  * [[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 208:
      
   <behavior type='ECBehaviorHearSounds'>   <behavior type='ECBehaviorHearSounds'>
 +    <!-- 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 -->
     <float name='.audibleDistance'>50</float>     <float name='.audibleDistance'>50</float>
dragengine/modules/dragonscript/behavior_hearsounds.1741886175.txt.gz · Last modified: 2025/03/13 17:16 by dragonlord