User Tools

Site Tools


dragengine:modules:dragonscript:behavior_interaction

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

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:

<?xml version='1.0' encoding='UTF-8'?>
<elementClass name='MyClass' class='GenericBehaviorElement'>
  <behavior type='ECBehaviorInteraction'/>
</elementClass>

Live Examples

You could leave a comment if you were logged in.
dragengine/modules/dragonscript/behavior_interaction.txt · Last modified: 2025/05/11 14:47 by dragonlord