Waypoint Library
Script Reference | Waypoint Library |
AddWaypoint
Creates a new waypoint at a specified location.
Parameters
<Vector3> The position to add waypoint.
<Vector3> The facing for the waypoint.
Returns
int Waypoint Id if successful OR null if there was an error adding waypoint.
Example
Wp.AddWaypoint(Vector3(1000,2000,1000),Vector3(0,0,0))
CheckBlockable
Verifies all red blockable connections and changes them to green immediately if they are not blocked anymore. This function should be used in triggers of destroyable walls or constructible bridges. It prevents a lot of path failed errors. Objects destroyed by a dynamite usually also require sleep(0.1) before CheckBlockable.
Parameters
None
Returns
Count of changed connections, but the number is unreliable and can be zero.
Connect
Connects two waypoints
Parameters
<int> Guid of a waypoint.
<int> Guid of another waypoint.
Returns
true if successful, false if not
DeleteWaypoint
Delete a waypoint from a specified location.
Parameters
<Vector3> The <Vector3> position to delete waypoint from.
Returns
true if successful, false if not
Example
Wp.DeleteWaypoint(Vector3(1000,2000,1000))
Disconnect
Disconnects two waypoints.
Parameters
<int> Guid of a waypoint.
<int> Guid of another waypoint.
Returns
true if successful, false if not
GetAllWaypoints
Gets all waypoints.
Parameters
<table> An empty table, the function will fill tables of position, facing, guid, radius, name, flags, property.
Returns
None
Example
wpTable = {};
Wp.GetAllWaypoints( wpTable );
foreach( waypoint in wpTable ) {
if( waypoint.name ) {
print(waypoint.name, "-", waypoint.position);
}
}
GetClosestWaypoint
Gets waypoint near position.
Parameters
<Vector3> position
<optional int> team
<optional options> 1=don't skip closed waypoints, 2=ignore waypoints without connections
Returns
<table>
Example
w = Wp.GetClosestWaypoint( Vec3(100,200,0) );
if(w) {
print("waypoint UID ", w.guid);
}
GetAllSelectedWaypoints
Gets selected waypoints.
Parameters
<table> An empty table, the function will fill tables of position, facing, guid, radius, name, flags, property.
Returns
None
GetWaypointByGUID
Gets a waypoint information by its guid.
Parameters
<int> Guid of a waypoint.
<table> An empty table, the function will fill in position, facing, guid, radius, name, flags, property.
Returns
true if successful, false if not
GetWaypointByName
Gets a waypoint's information by its name.
Parameters
<string> The name of the waypoint to get the info of.
<table> An empty table, the function will fill in position, facing, guid, radius, name, flags, property.
Returns
true if successful, false if not
IsWaypointViewOn
Checks if waypoint view is on.
Parameters
None
Returns
int true if waypoint_view is on, false if not
Example
Wp.IsWaypointViewOn()
Load
Loads waypoints from nav folder.
Parameters
<optional string> File name.
Returns
true if successful, false if not
Save
Saves waypoints to nav folder.
Parameters
<optional string> File name.
Returns
true if successful, false if not
SetRadius
Sets a wapoint radius.
Parameters
<int> Guid of a waypoint
<int> Radius.
Returns
true if successful, false if not
SetWaypointFlag
Sets the flag on a waypoint by name.
Parameters
<int> Guid of a waypoint OR <string> Name of the waypoint or a regular expression.
<string> The name of the flag to set OR <table> Multiple flags to set.
<int> True to set, false to clear.
Returns
None
Example
Wp.SetWaypointFlag("waypointname", "closed", false);
Wp.SetWaypointFlag("bridge_.*", "crouch", true);
Wp.SetWaypointFlag("main_entrance", { "axis", "door" }, true );
SetWaypointName
Assigns a name to a waypoint.
Parameters
<int> The id of the waypoint to set the name of.
<string> The name to assign to the waypoint.
Returns
true if successful, false if not
SetWaypointProperty
Sets the waypoint property.
Parameters
<int> Guid of a waypoint OR <string> Name of the waypoint.
<string> The name of the property to set.
<string> Property value to set.
Returns
None
WaypointColor
Customize the color of various types of waypoints, paths, etc... See waypoint_color command for help.
Parameters
<string> The name of the category to set a color for.
<int> The color to use for this type.
Returns
None
Properties
BlockablePathOffset
the offset for blockable paths for drawing purposes.
BottomPathOffset
the offset for path bottom for drawing purposes.
BottomWaypointOffset
the offset for waypoint bottom for drawing purposes.
FacingOffset
the offset for drawing the facing indicator.
PathLevelOffset
relative offset for path finding, default is 0.5
TextDuration
drawing duration for texts, default is 2 seconds
TextOffset
the offset for drawing waypoint name, UID, radius, flags.
TopPathOffset
the offset for path top for drawing purposes.
TopWaypointOffset
the offset for waypoint top for drawing purposes.