Skip to content

<s:btNpcWalk> Node

This node is an adapter for another script named npcMovement.

npcMovement supports animation of walking while also moving npc to the target location defined by entity position.

btNpcWalk would adapt the walking part of the movement to the behavior tree, keeping running status until the npc reaches the target and then returning success. Status failure would be returned when npcMovement script is missing or the target entity could not be resolved.

Prerequisites

Control entity must have npcMovement and btNpcWalk scripts attached.

Attributes

<s:btNpcWalk> node can receive the following attributes:

  • entity (required) - target entity to move to, value is expected to be a blackboard key that holds entity reference

Example

<seq> // walking to referred entity
  <set WalkTo=_ref>
  <s:btNpcWalk entity=WalkTo>

Downstream API

btNpcWalk script expects the following API to be available on the control entity from script npcMovement:

interface NpcMovementScript {
    getMovementTarget(): Entity; // returns the target entity to move to
    setMovementTarget(target: Entity): void; // sets the target entity to move to
    isMoving(): boolean; // returns true if npc is moving
}