Start Page » DragonScript Scripting Language » Abstraction Layers: How you want to build your Game » Behavior Elements » ECBehaviorStepAside
Behavior in action
Behavior adding support to actors to step aside if told.
This behavior is useful for situations where actors can get in the way of the player or other actors. The behavior is a reactive behavior not acting by itself. It is triggered by ECBehaviorClearPath or other behaviors supporting it if the find a future collision.
This behavior has no effect if actor mover has a goal set.
This behavior can be disabled temporarily to prevent actors from stepping aside.
This behavior can be used only once on an element. The behavior always has identifier empty string.
Element class properties have the prefix stepAside. .
Determines if the behavior is initially enabled.
stepAside.enabledtrue<boolean name='stepAside.enabled'>false</boolean>
Avoid radius. Actor tries to move to a position with this distance away from the moving lane of the actor requesting to step aside.
stepAside.radius<float name='stepAside.radius'>0.5</float>
This behavior adds these behavior tree actions if behavior tree is present.
Set one or more step aside parameters.
| Parameter | Value | Description | 
|---|---|---|
| enabled | true, false | Enable step aside | 
This is an example of using this action:
<action name='stepAside.set'> <parameter name='enabled'>true</parameter> </action>
Check one or more step aside parameters. Action succeeds if all parameter value matches their respective step aside parameter otherwise action fails. This action is typically used as first action in a sequence to run the sequence only if a step aside parameter matches (or not).
| Parameter | Value | Description | 
|---|---|---|
| enabled | true, false | Step aside is enabled or not | 
| 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:
<sequence> <action name='stepAside.check'> <parameter name='enabled'>true</parameter> </action> <!-- actions here run only if step aside is enabled --> </sequence>
This behavior adds these behavior tree conditions if behavior tree is present.
Check one or more step aside parameters. Conditions returns true if all parameter value match their respective step aside parameter. This condition is typically used to run an action or sequence of actions as long as step aside conditions are true.
| Parameter | Value | Description | 
|---|---|---|
| stepAside.enabled | true, false | Step aside is enabled or not | 
This is an example of using this condition:
<action name='myAction' id='doing something'> <parameter name='stepAside.enabled'>true</parameter> <condition>stepAside.check</condition> </action>
Same as Behavior Tree Actions.
Same as Behavior Tree Conditions.
This behavior sends these state machine events.
Step aside.
This behavior does support element class to be persistable (setPersistable). Saves enabled state.
Since DragonScript Module Version 1.4
class ExampleElementClass extends BehaviorElementClass
   public var ECBehaviorComponent component
   public var ECBehaviorCollider collider
   public var ECBehaviorColliderAI colliderAI
   public var ECBehaviorLocomotion locomotion
   public var ECBehaviorNavigator navigator
   public var ECBehaviorActorMover actorMover
   public var ECBehaviorStepAside stepAside
   
   public func new() super("ExampleElement")
     // create required behaviors
     component = ECBehaviorComponent.new(this)
     collider = ECBehaviorCollider.new(this, component)
     colliderAI = ECBehaviorColliderAI.new(this, collider)
     locomotion = ECBehaviorLocomotion.new(this, colliderAI)
     navigator = ECBehaviorNavigator.new(this)
     actorMover = ECBehaviorActorMover.new(this, locomotion, navigator, null)
     
     // create step aside behavior
     stepAside = ECBehaviorStepAside.new(this, actorMover)
   end
end
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='ECBehaviorComponent'/> <behavior type='ECBehaviorCollider'/> <behavior type='ECBehaviorColliderAI'/> <behavior type='ECBehaviorLocomotion'/> <behavior type='ECBehaviorNavigator'/> <behavior type='ECBehaviorActorMover'/> <behavior type='ECBehaviorStepAside'> <!-- 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 --> <float name='.radius'>0.5</float> </behavior> </elementClass>