Class: patrol
Patrol path parameters used by movement actions.
Source
src/xrAICore/Navigation/PatrolPath/patrol_path_params_script.cpp, CPatrolPathParams binding.
Custom Constructor
patrol
Remarks
The Lua-visible patrol class stores a patrol path name, start mode, route mode, randomization flag, and optional custom point index. Movement action constructors copy those values into the native movement action.
Extends
Constructors
Constructor
new patrol(
name?: string,
startType?: TXR_patrol_start_type,
routeType?: TXR_patrol_route_type,
random?: boolean,
customPointIndex?: number): patrol;Create patrol path parameters.
Parameters
| Parameter | Type | Description |
|---|---|---|
name? | string | Patrol path name. |
startType? | TXR_patrol_start_type | Patrol start mode. |
routeType? | TXR_patrol_route_type | Patrol route mode. |
random? | boolean | Whether random point selection is enabled. |
customPointIndex? | number | Custom start point index. |
Returns
patrol
Remarks
The native constructor resolves name through patrol path storage. Missing patrol paths can assert in debug builds. Use patrol.custom with customPointIndex to start from an explicit patrol point.
Overrides
Methods
count()
count(): number;Returns
number
Number of points in the patrol path.
flag()
Call Signature
flag(value1: number, value2: number): boolean;Check a patrol point flag by numeric index.
Parameters
| Parameter | Type | Description |
|---|---|---|
value1 | number | Patrol point index. |
value2 | number | Flag index. |
Returns
boolean
Whether the flag is set.
Call Signature
flag(value1: number, value2: string): boolean;Check a patrol point flag by name.
Parameters
| Parameter | Type | Description |
|---|---|---|
value1 | number | Patrol point index. |
value2 | string | Flag name. |
Returns
boolean
Whether the flag is set.
flags()
flags(point_index: number): flags32;Get all flags for a patrol point.
Parameters
| Parameter | Type | Description |
|---|---|---|
point_index | number | Patrol point index. |
Returns
Point flags.
game_vertex_id()
game_vertex_id(value: number): number;Get game graph vertex id for a patrol point.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | number | Patrol point index. |
Returns
number
Game graph vertex id.
get_nearest()
get_nearest(vector: vector): number;Find nearest patrol point to a position.
Parameters
| Parameter | Type | Description |
|---|---|---|
vector | vector | Position to test. |
Returns
number
Patrol point index.
index()
index(value: string): number;Find patrol point index by name.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | string | Patrol point name. |
Returns
number
Patrol point index.
level_vertex_id()
level_vertex_id(value: number): number;Get level vertex id for a patrol point.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | number | Patrol point index. |
Returns
number
Level vertex id.
name()
name(point_index: number): string;Get patrol point name.
Parameters
| Parameter | Type | Description |
|---|---|---|
point_index | number | Patrol point index. |
Returns
string
Point name.
point()
point(index: number): vector;Get patrol point position.
Parameters
| Parameter | Type | Description |
|---|---|---|
index | number | Patrol point index. |
Returns
Point position.
terminal()
terminal(point_index: number): boolean;Check whether a patrol point is terminal.
Parameters
| Parameter | Type | Description |
|---|---|---|
point_index | number | Patrol point index. |
Returns
boolean
Whether the point ends the route.
Properties
__name
readonly __name: string;LuaBind instance constructor name.
Inherited from
__name
readonly static __name: string;LuaBind class constructor name.
Inherited from
continue
readonly static continue: 1;Engine enum value for patrol.continue.
custom
readonly static custom: 3;Engine enum value for patrol.custom.
dummy
readonly static dummy: -1;Engine enum value for patrol.dummy.
nearest
readonly static nearest: 2;Engine enum value for patrol.nearest.
next
readonly static next: 4;Engine enum value for patrol.next.
start
readonly static start: 0;Engine enum value for patrol.start.
stop
readonly static stop: 0;Engine enum value for patrol.stop.
Source
src/xrAICore/Navigation/PatrolPath/patrol_path_params_script.cpp, route stop enum.