Table of Contents

Class NPCMovement

Namespace
S1API.Entities
Assembly
S1API.dll

Modder-facing movement wrapper for an S1API.Entities.NPCMovement.NPC. Provides navigation, warping, facing, and reachability helpers.

public class NPCMovement
Inheritance
NPCMovement
Inherited Members
Extension Methods

Properties

CurrentDestination

Current destination being navigated to, if any.

public Vector3 CurrentDestination { get; }

Property Value

Vector3

DefaultWalkSpeed

Gets the default walking speed of the NPC.

public float DefaultWalkSpeed { get; }

Property Value

float

FootPosition

Current foot position of the NPC in world space.

public Vector3 FootPosition { get; }

Property Value

Vector3

IsMoving

Whether the NPC is currently moving along a path.

public bool IsMoving { get; }

Property Value

bool

SpeedMultiplier

Gets or sets the overall speed multiplier that affects all movement.

public float SpeedMultiplier { get; set; }

Property Value

float

Methods

AddSpeedControl(string, int, float)

Adds or updates a speed control with the specified parameters. Higher priority values override lower ones.

public void AddSpeedControl(string id, int priority, float speed)

Parameters

id string

Unique identifier for this speed control.

priority int

Priority level (higher values take precedence).

speed float

Movement speed multiplier.

CanGetTo(Vector3)

Returns whether the NPC can path to a position.

public bool CanGetTo(Vector3 position)

Parameters

position Vector3

Target position.

Returns

bool

CanGetTo(Vector3, float)

Returns whether the NPC can path to a position within a threshold.

public bool CanGetTo(Vector3 position, float within)

Parameters

position Vector3

Target position.

within float

Acceptable distance to target.

Returns

bool

DoesSpeedControlExist(string)

Checks if a speed control with the given ID exists.

public bool DoesSpeedControlExist(string id)

Parameters

id string

The ID to check for.

Returns

bool

True if the speed control exists, false otherwise.

FaceDirection(Vector3)

Rotates to face a world-space direction.

public void FaceDirection(Vector3 forward)

Parameters

forward Vector3

Forward vector to face.

FacePoint(Vector3)

Rotates to face a world-space point.

public void FacePoint(Vector3 position)

Parameters

position Vector3

World position to face.

RemoveSpeedControl(string)

Removes a speed control by its ID.

public void RemoveSpeedControl(string id)

Parameters

id string

The ID of the speed control to remove.

SetDestination(Vector3)

Sets a new pathfinding destination in world space.

public void SetDestination(Vector3 position)

Parameters

position Vector3

Target destination.

Stop()

Stops any active movement/pathing immediately.

public void Stop()

Warp(Vector3)

Instantly moves the NPC to the given world position.

public void Warp(Vector3 position)

Parameters

position Vector3

Target position.