Interface INpcService
Provides access to global NPC infrastructure: path containers, movement recordings, and node navigation.
public interface INpcService
Methods
AddPointToPath(int, Vector3, float)
Appends a waypoint to an existing path container.
bool AddPointToPath(int pathId, Vector3 position, float stopRange)
Parameters
pathIdintThe path ID.
positionVector3The waypoint position.
stopRangefloatThe radius within which the NPC is considered to have reached this waypoint.
Returns
ClearPath(int)
Removes all waypoints from a path container.
bool ClearPath(int pathId)
Parameters
pathIdintThe path ID.
Returns
CloseNode(int)
Closes a previously opened node file.
void CloseNode(int nodeId)
Parameters
nodeIdintThe node ID.
CreatePath()
Creates a new (empty) NPC path container.
int CreatePath()
Returns
- int
The newly allocated path ID.
DestroyAllPaths()
Destroys all path containers.
void DestroyAllPaths()
DestroyPath(int)
Destroys a previously created path container.
bool DestroyPath(int pathId)
Parameters
pathIdintThe path ID.
Returns
GetNodeInfo(int, out uint, out uint, out uint)
Gets information about vehicle nodes, pedestrian nodes, and navigation nodes in a node file.
bool GetNodeInfo(int nodeId, out uint vehicleNodes, out uint pedNodes, out uint naviNodes)
Parameters
nodeIdintThe node ID.
vehicleNodesuintThe number of vehicle nodes.
pedNodesuintThe number of pedestrian nodes.
naviNodesuintThe number of navigation nodes.
Returns
GetNodePointCount(int)
Gets the total number of points in a node.
int GetNodePointCount(int nodeId)
Parameters
nodeIdintThe node ID.
Returns
GetNodePointPosition(int, out Vector3)
Gets the position of the current point in a node.
bool GetNodePointPosition(int nodeId, out Vector3 position)
Parameters
Returns
GetNodeType(int)
Gets the type of a node.
byte GetNodeType(int nodeId)
Parameters
nodeIdintThe node ID.
Returns
GetPathCount()
Gets the total number of active path containers.
Size GetPathCount()
Returns
GetPathPoint(int, Size, out Vector3, out float)
Gets the position and stop range of a specific waypoint in a path.
bool GetPathPoint(int pathId, Size pointIndex, out Vector3 position, out float stopRange)
Parameters
pathIdintThe path ID.
pointIndexSizeThe zero-based index of the waypoint.
positionVector3The position of the waypoint.
stopRangefloatThe stop range of the waypoint.
Returns
GetPathPointCount(int)
Gets the number of waypoints in a path container.
Size GetPathPointCount(int pathId)
Parameters
pathIdintThe path ID.
Returns
GetRecordCount()
Gets the total number of loaded recordings.
Size GetRecordCount()
Returns
HasPathPointInRange(int, Vector3, float)
Checks whether any waypoint in the path is within the given radius of the position.
bool HasPathPointInRange(int pathId, Vector3 position, float radius)
Parameters
Returns
IsNodeOpen(int)
Checks whether the specified node file is currently open.
bool IsNodeOpen(int nodeId)
Parameters
nodeIdintThe node ID.
Returns
IsValidPath(int)
Checks whether the given path ID refers to a live path container.
bool IsValidPath(int pathId)
Parameters
pathIdintThe path ID.
Returns
IsValidRecord(int)
Checks whether the given record ID is valid.
bool IsValidRecord(int recordId)
Parameters
recordIdintThe record ID.
Returns
LoadRecord(string)
Loads a recorded movement file (.rec) for playback by NPCs.
int LoadRecord(string filePath)
Parameters
filePathstringThe path to the recording file (relative to scriptfiles).
Returns
- int
The record ID, or
-1on failure.
OpenNode(int)
Opens a node file for NPC path navigation.
bool OpenNode(int nodeId)
Parameters
nodeIdintThe node ID.
Returns
RemovePointFromPath(int, Size)
Removes the waypoint at the specified index from a path container.
bool RemovePointFromPath(int pathId, Size pointIndex)
Parameters
Returns
SetNodePoint(int, ushort)
Sets the current point within a node.
bool SetNodePoint(int nodeId, ushort pointId)
Parameters
Returns
UnloadAllRecords()
Unloads all loaded recordings.
void UnloadAllRecords()
UnloadRecord(int)
Unloads a previously loaded recording.
bool UnloadRecord(int recordId)
Parameters
recordIdintThe record ID returned by LoadRecord(string).