{{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]] >> **ECBehaviorStepAside** * [[behaviors_use_cases|Behaviors Explained: By Use-Case]] * [[behaviors_a_to_z|Behaviors Explained: From A to Z]] ====== ECBehaviorStepAside ====== {{youtube>BbP-lMrr0tQ?medium}} 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 [[behavior_clearpath|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. ====== Instance Counts ====== This behavior can be used only once on an element. The behavior always has identifier empty string. ====== Element Class Properties ====== Element class properties have the prefix ''stepAside.'' . ===== enabled ===== Determines if the behavior is initially enabled. * Full name: ''stepAside.enabled'' * Type: boolean * Default Value: ''true'' * Example (*.deeclass) false ===== radius ===== Avoid radius. Actor tries to move to a position with this distance away from the moving lane of the actor requesting to step aside. * Full name: ''stepAside.radius'' * Type: floating point * Minimum Value: 0 * Default value: 0.4 * Example (*.deeclass) 0.5 ====== Behavior Tree Actions ====== This behavior adds these behavior tree actions if behavior tree is present. ===== stepAside.set ===== Set one or more step aside parameters. ^Parameter^Value^Description^ |enabled|''true'', ''false''|Enable step aside| This is an example of using this action: true ===== stepAside.check ===== 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: true ====== Behavior Tree Conditions ====== This behavior adds these behavior tree conditions if behavior tree is present. ===== stepAside.check ===== 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: true stepAside.check ====== State Machine Actions ====== Same as [[#behavior_tree_actions|Behavior Tree Actions]]. ====== State Machine Conditions ====== Same as [[#behavior_tree_conditions|Behavior Tree Conditions]]. ====== State Machine Events ====== This behavior sends these state machine events. ===== stepAside.stepAside ===== Step aside. ====== Required Behaviors ====== * [[behavior_actormover|ECBehaviorActorMover]] ====== Optional Behaviors ====== * [[behavior_behaviortree|ECBehaviorBehaviorTree]]: Add actions and conditions for behavior trees to use. * [[behavior_statemachine|ECBehaviorStateMachine]]: Add actions and conditions for state machine to use and events to send to the state machine. ====== Persistency ====== This behavior does support element class to be persistable (setPersistable). Saves enabled state. ====== API Documentation ====== #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorStepAside.html,ECBehaviorStepAside~@#. Since DragonScript Module Version ''1.4'' ====== Use Cases ====== * Avoid actors blocking the path of other actors. The moving actors can make blocking actors move away. * Avoid player blocking actors or actors blocking the player. * Create situations where player or other actors are running and other actors move out of the way ahead of time. ====== Element Class Example ====== 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 ====== Behavior Factory ====== Using element class supporting adding behaviors the behavior can be added like this: second second 0.5 ====== Live Examples ====== * [[https://github.com/LordOfDragons/deexamples|DEExamples Repository]]