{{tag>dragonscript behavior}}
[[: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]] >> **ECBehaviorInteraction**
* [[behaviors_use_cases|Behaviors Explained: By Use-Case]]
* [[behaviors_a_to_z|Behaviors Explained: From A to Z]]
====== ECBehaviorInteraction ======
Behavior element behavior adding storing supported interactions.
====== Instance Counts ======
This behavior can be used only once on an element.
====== Element Class Properties ======
This behavior adds no element class properties.
====== Events ======
This behavior has no event
====== Behavior Tree Actions ======
This behavior adds no behavior tree actions.
====== Behavior Tree Conditions ======
This behavior adds no behavior tree conditions.
====== State Machine Actions ======
This behavior adds no state machine actions.
====== State Machine Conditions ======
This behavior adds no state machine conditions.
====== State Machine Events ======
This behavior does not send state machine events.
====== Required Behaviors ======
This behavior requires no other behaviors.
====== Optional Behaviors ======
This behavior supports no optional behaviors.
====== Persistency ======
This behavior does not required element class to be persistable (setPersistable)
====== API Documentation ======
#@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorInteraction.html,ECBehaviorInteraction~@#.
Since DragonScript Module Version ''1.26''
====== Use Cases ======
* Allow behaviors to add interactions usable by player/actor conversation scripts, behaviors trees and state machines
====== Element Class Example ======
This example defines an element which contains a interaction. The "MyBehaviorWithInteraction" class has to add an instance of a class implementing ECBehaviorInteraction.Interaction to "interaction". This can be for example an interaction named "frob" which triggers for a ECBehaviorTwoStateAnimated behavior.
class MyElement extends BehaviorElementClass
public var ECBehaviorInteraction interaction
public var MyBehaviorWithInteraction myBehavior
func new()
interaction = ECBehaviorInteraction.new(this)
myBehavior = MyBehaviorWithInteraction.new(this, interaction)
end
end
====== Behavior Factory ======
Using element class supporting adding behaviors the behavior can be added like this:
====== Live Examples ======
* [[https://github.com/LordOfDragons/deexamples|DEExamples Repository]]