This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dragengine:modules:dragonscript:behavior_behaviortree [2025/03/13 17:08] – dragonlord | dragengine: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 [[# | See [[# | ||
+ | |||
+ | See also: | ||
+ | * [[dragengine: | ||
====== 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("/ | + | btbehavior.getPath().setValue("/ |
btbehavior.getRun().setValue(true) | btbehavior.getRun().setValue(true) | ||
| | ||
Line 119: | Line 122: | ||
func new() | func new() | ||
var ECBehaviorBehaviorTree btSpecific = ECBehaviorBehaviorTree.new(this, | var ECBehaviorBehaviorTree btSpecific = ECBehaviorBehaviorTree.new(this, | ||
- | btSpecific.getPath().setValue("/ | + | btSpecific.getPath().setValue("/ |
btSpecific.getRun().setValue(true) | btSpecific.getRun().setValue(true) | ||
| | ||
var ECBehaviorBehaviorTree btIdle = ECBehaviorBehaviorTree.new(this, | var ECBehaviorBehaviorTree btIdle = ECBehaviorBehaviorTree.new(this, | ||
- | btIdle.getPath().setValue("/ | + | btIdle.getPath().setValue("/ |
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("/ | + | btSpecific.getPath().setValue("/ |
// | // | ||
| | ||
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 "/ | + | // behavior trees for different AI routines. if not used the "/ |
// 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("/ | + | .getBehaviorTree().loadFromFile("/ |
| | ||
// create context. BAAIBehaviorTree requires a BTContextAI subclass hence we can | // create context. BAAIBehaviorTree requires a BTContextAI subclass hence we can | ||
Line 203: | Line 206: | ||
< | < | ||
<!-- set element properties. omit property prefix if used inside behavior tag --> | <!-- set element properties. omit property prefix if used inside behavior tag --> | ||
- | <string name=' | + | <string name=' |
</ | </ | ||
| |