NPC
Inherits from: CharacterBase
Functions
Function Name | Return Type | Description | Tags |
---|---|---|---|
Roll() | None | Trigger a roll in the direction the NPC is moving. Will roll forwards when the NPC is stationary. | Server Only |
Jump(string propertyName) | None | Make the NPC jump. This may also trigger a mantle if the NPC is in a position to do so. NPC mantling works the same way as Player Character mantling. | Server Only |
SetCrouching(bool shouldCrouch) | None | Set the crouch state of the NPC. | None |
SetLookAtEntity(CharacterBase characterBase) | None | Set a CharacterBase as the look at focus for this NPC. The NPC will continuously rotate to face the target until the focus is changed or cleared. This will focus on the Head of the target CharacterBase. Only one focus may be set, this will override any previous entity or position focus. This will also override the facing of an NPC during movement, allowing for NPCs to look and move in different directions. | Server Only |
SetLookAtEntity(CharacterBase characterBase, string socket) | None | Set a CharacterBase as the look at focus for this NPC. The NPC will continuously rotate to face the target until the focus is changed or cleared. Use the Socket parameter to focus on a specific socket on the target. Only one focus may be set, this will override any previous entity or position focus. This will also override the facing of an NPC during movement, allowing for NPCs to look and move in different directions. | Server Only |
SetLookAtEntity(Entity entity) | None | Set an entity as the look at focus for this NPC. The NPC will continuously rotate to face the target until the focus is changed or cleared. Only one focus may be set, this will override any previous entity or position focus. This will also override the facing of an NPC during movement, allowing for NPCs to look and move in different directions. | Server Only |
GetLookAtEntity() | Entity | Get the entity this NPC is focused on; this will be the entity passed into SetLookAtEntity. | Server Only |
SetLookAtPosition(Vector position) | None | Set a world position as the look at focus for this NPC. The NPC will continuously rotate to face this position until the focus is changed or cleared. Only one focus may be set, this will override any previous entity or position focus. | Server Only |
GetLookAtPosition() | Vector | Returns the focus position of this NPC. If a focus has been manually set this will either be the value set using SetLookAtPosition, or the a position calculated from the position of the Entity set using SetLookAtEntity. Alternatively if the NPC is moving using the MoveToPosition command it will return the position the NPC is moving towards. | Server Only |
GetLookAt() | Vector | Returns two values, the position of the NPC and the position the NPC is looking at. | Server Only |
ClearLookAt() | None | Clear the current NPC look at focus. | Server Only |
MoveToPosition(Vector targetPosition) | None | Instruct the NPC to move to the specified world vector. This does not utilise any pathfinding or obstacle avoidance; the NPC will move in a straight line towards the target position. It will not automatically use any special movement actions like Jump, Crouch or Mantle. The NPC will stop moving once it has reached the target position. | Server Only |
MoveToPosition(Vector targetPosition, number movementMode) | None | Instruct the NPC to move to the specified world vector. This does not utilise any pathfinding or obstacle avoidance; the NPC will move in a straight line towards the target position. It will not automatically use any special movement actions like Jump, Crouch or Mantle. The NPC will stop moving once it has reached the target position. This overload includes a 'MovementMode' parameter to specify the MovementMode the NPC should use. See MovementMode enum for details. | Server Only |
MoveToPosition(Vector targetPosition, function callback) | None | Instruct the NPC to move to the specified world vector. This does not utilise any pathfinding or obstacle avoidance; the NPC will move in a straight line towards the target position. It will not automatically use any special movement actions like Jump, Crouch or Mantle. The NPC will stop moving once it has reached the target position. The completion callback function will be called when the movement completes or is cancelled for any reason. Callback contains 1 bool parameter which will be true if the NPC successfully reached it's target; False otherwise. | Server Only |
MoveToPosition(Vector targetPosition, function callback, number movementMode) | None | Instruct the NPC to move to the specified world vector. This does not utilise any pathfinding or obstacle avoidance; the NPC will move in a straight line towards the target position. It will not automatically use any special movement actions like Jump, Crouch or Mantle. The NPC will stop moving once it has reached the target position. This overload includes a 'MovementMode' parameter to specify the MovementMode the NPC should use. 1 = Walk, 2 = Run, 3 = Sprint The completion callback function will be called when the movement completes or is cancelled for any reason. Callback contains 1 bool parameter which will be true if the NPC successfully reached it's target; False otherwise. | Server Only |
CancelMovement() | None | Cancel the current NPC movement | Server Only |
PlayEmote(EmoteAsset emoteAsset) | None | Play the specified emote on the NPC. | Server Only |
IsPlayingEmote() | boolean | Returns true if an emote is currently playing on the NPC. | Server Only |
CancelEmote() | None | Cancel any emote that is currently playing. | Server Only |