User Tools

Site Tools


dragengine:modules:dragonscript:behavior_behaviortree

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_behaviortree [2025/03/13 17:08] dragonlorddragengine:modules:dragonscript:behavior_behaviortree [2025/05/16 14:34] (current) dragonlord
Line 34: Line 34:
 You can assign actions and conditions without using other behaviors by using one or more factories. The factories are added to the behavior. Upon creating the behavior instances the factories are asked to create and assign BTAction and BTCondition. You can assign actions and conditions without using other behaviors by using one or more factories. The factories are added to the behavior. Upon creating the behavior instances the factories are asked to create and assign BTAction and BTCondition.
 See [[#element_class_example|Element Class Example]] for example code. See [[#element_class_example|Element Class Example]] for example code.
 +
 +See also:
 +  * [[dragengine:modules:dragonscript:behaviortrees|Behavior Trees]]
  
 ====== Instance Counts ====== ====== Instance Counts ======
Line 101: Line 104:
   func new()   func new()
     var ECBehaviorBehaviorTree btbehavior = ECBehaviorBehaviorTree.new(this)     var ECBehaviorBehaviorTree btbehavior = ECBehaviorBehaviorTree.new(this)
-    btbehavior.getPath().setValue("/content/myBehavior.debtree")+    btbehavior.getPath().setValue("/content/myBehavior.debt")
     btbehavior.getRun().setValue(true)     btbehavior.getRun().setValue(true)
          
Line 119: Line 122:
   func new()   func new()
     var ECBehaviorBehaviorTree btSpecific = ECBehaviorBehaviorTree.new(this, "specific")     var ECBehaviorBehaviorTree btSpecific = ECBehaviorBehaviorTree.new(this, "specific")
-    btSpecific.getPath().setValue("/content/mySpecificBehavior.debtree")+    btSpecific.getPath().setValue("/content/mySpecificBehavior.debt")
     btSpecific.getRun().setValue(true)     btSpecific.getRun().setValue(true)
          
     var ECBehaviorBehaviorTree btIdle = ECBehaviorBehaviorTree.new(this, "idle")     var ECBehaviorBehaviorTree btIdle = ECBehaviorBehaviorTree.new(this, "idle")
-    btIdle.getPath().setValue("/content/myIdleBehavior.debtree")+    btIdle.getPath().setValue("/content/myIdleBehavior.debt")
     btIdle.getRun().setValue(true)     btIdle.getRun().setValue(true)
          
Line 139: Line 142:
   func new()   func new()
     var ECBehaviorBehaviorTree btree = ECBehaviorBehaviorTree.new(this)     var ECBehaviorBehaviorTree btree = ECBehaviorBehaviorTree.new(this)
-    btSpecific.getPath().setValue("/content/basic.debtree")+    btSpecific.getPath().setValue("/content/basic.debt")
     //btSpecific.getRun().setValue(false) // the default is false     //btSpecific.getRun().setValue(false) // the default is false
          
Line 151: Line 154:
   func new()   func new()
     // load behavior tree to use. this is not required but allows to use different     // load behavior tree to use. this is not required but allows to use different
-    // behavior trees for different AI routines. if not used the "/content/basic.debtree"+    // behavior trees for different AI routines. if not used the "/content/basic.debt"
     // would be used as defined in MyElementClass.     // would be used as defined in MyElementClass.
     var BehaviorTree btree = BaseGameApp.getApp().getLoaders() \     var BehaviorTree btree = BaseGameApp.getApp().getLoaders() \
-      .getBehaviorTree().loadFromFile("/content/aiRoutine1.debtree")+      .getBehaviorTree().loadFromFile("/content/aiRoutine1.debt")
          
     // create context. BAAIBehaviorTree requires a BTContextAI subclass hence we can     // create context. BAAIBehaviorTree requires a BTContextAI subclass hence we can
Line 203: Line 206:
   <behavior type='ECBehaviorBehaviorTree'>   <behavior type='ECBehaviorBehaviorTree'>
     <!-- set element properties. omit property prefix if used inside behavior tag -->     <!-- set element properties. omit property prefix if used inside behavior tag -->
-    <string name='.path'>actor.debp</string>+    <string name='.path'>actor.debt</string>
   </behavior>   </behavior>
      
dragengine/modules/dragonscript/behavior_behaviortree.1741885738.txt.gz · Last modified: 2025/03/13 17:08 by dragonlord