User Tools

Site Tools


dragengine:modules:dragonscript:behavior_daytimesky

Differences

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

Link to this comparison view

Next revision
Previous revision
dragengine:modules:dragonscript:behavior_daytimesky [2025/03/13 13:59] – created dragonlorddragengine:modules:dragonscript:behavior_daytimesky [2025/05/04 13:48] (current) – [dayTimeSky.check] 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]] >> **ECBehaviorDayTimeSky**+[[: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]] >> **ECBehaviorDayTimeSky**
 </WRAP> </WRAP>
  
Line 43: Line 43:
  
 This behavior has no events. This behavior has no events.
 +
 +====== Behavior Tree Actions ======
 +
 +This behavior adds these behavior tree actions if behavior tree is present. If behavior has non-empty identifier replace ''dayTimeSky'' with ''dayTimeSky(id)''.
 +
 +===== dayTimeSky.set =====
 +
 +Set one or more day time sky parameters.
 +
 +^Parameter^Value^Description^
 +|time|float|Set day time as hour of day|
 +
 +This is an example of using this action:
 +<code xml>
 +<action name='dayTimeSky.set'>
 +  <parameter name='time'>8.5</parameter>
 +</action>
 +</code>
 +
 +===== dayTimeSky.check =====
 +
 +Check one or more day time sky parameters. Action succeeds if all parameter value matches their respective day time sky parameter otherwise action fails. This action is typically used as first action in a sequence to run the sequence only if a day time sky parameter matches (or not).
 +
 +^Parameter^Value^Description^
 +|time.less|float|Day time is less than hour of day|
 +|time.greater|float|Day time is greater than hour of day|
 +|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='dayTimeSky.check'>
 +    <parameter name='time.less'>6.5</parameter>
 +  </action>
 +  <!-- actions here run only if day time is before 6h30 in the morning -->
 +</sequence>
 +</code>
 +
 +====== Behavior Tree Conditions ======
 +
 +This behavior adds these behavior tree conditions if behavior tree is present. If behavior has non-empty identifier replace ''dayTimeSky'' with ''dayTimeSky(id)''.
 +
 +===== dayTimeSky.check =====
 +
 +Check one or more day time sky parameters. Conditions returns true if all parameter value match their respective day time sky parameter. This condition is typically used to run an action or sequence of actions as long as day time sky conditions are true.
 +
 +^Parameter^Value^Description^
 +|dayTimeSky.time.less|float|Day time is less than hour of day|
 +|dayTimeSky.time.greater|float|Day time is greater than hour of day|
 +
 +This is an example of using this condition:
 +<code xml>
 +<action name='myAction' id='doing something'>
 +  <parameter name='dayTimeSky.time.less'>6.5</parameter>
 +  <condition>dayTimeSky.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 no state machine events.
  
 ====== Required Behaviors ====== ====== Required Behaviors ======
Line 50: Line 119:
 ====== 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 90: Line 159:
      
   <behavior type='ECBehaviorDayTimeSky'>   <behavior type='ECBehaviorDayTimeSky'>
 +    <!-- 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='.controllerDayTime'>daytime</string>     <string name='.controllerDayTime'>daytime</string>
dragengine/modules/dragonscript/behavior_daytimesky.1741874352.txt.gz · Last modified: 2025/03/13 13:59 by dragonlord