Waypoint Library: Difference between revisions
(SetWaypointFlag parameters) |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 24: | Line 24: | ||
<syntaxhighlight lang="java"> | <syntaxhighlight lang="java"> | ||
Wp.AddWaypoint(Vector3(1000,2000,1000),Vector3(0,0,0))</syntaxhighlight> | Wp.AddWaypoint(Vector3(1000,2000,1000),Vector3(0,0,0))</syntaxhighlight> | ||
== 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 == | == Connect == | ||
Line 52: | Line 63: | ||
<syntaxhighlight lang="java"> | <syntaxhighlight lang="java"> | ||
Wp.DeleteWaypoint(Vector3(1000,2000,1000))</syntaxhighlight> | Wp.DeleteWaypoint(Vector3(1000,2000,1000))</syntaxhighlight> | ||
== Disconnect == | |||
Disconnects two waypoints. | |||
'''Parameters''' | |||
<nowiki><int></nowiki> Guid of a waypoint. | |||
<nowiki><int></nowiki> Guid of another waypoint. | |||
'''Returns''' | |||
true if successful, false if not | |||
== GetAllWaypoints == | == GetAllWaypoints == | ||
Line 193: | Line 217: | ||
<nowiki><int></nowiki> Guid of a waypoint '''OR'''<nowiki> <string></nowiki> Name of the waypoint or a regular expression. | <nowiki><int></nowiki> Guid of a waypoint '''OR'''<nowiki> <string></nowiki> Name of the waypoint or a regular expression. | ||
<nowiki><string></nowiki> | <nowiki><string></nowiki> The name of the flag to set '''OR''' <nowiki><table></nowiki> Multiple flags to set. | ||
<nowiki><int></nowiki> True to set, false to clear. | <nowiki><int></nowiki> True to set, false to clear. | ||
Line 203: | Line 227: | ||
'''Example''' | '''Example''' | ||
<syntaxhighlight lang="java"> | <syntaxhighlight lang="java"> | ||
Wp.SetWaypointFlag("waypointname", "closed", | Wp.SetWaypointFlag("waypointname", "closed", false); | ||
Wp.SetWaypointFlag("bridge_.*", "crouch", true);</syntaxhighlight> | Wp.SetWaypointFlag("bridge_.*", "crouch", true); | ||
Wp.SetWaypointFlag("main_entrance", { "axis", "door" }, true );</syntaxhighlight> | |||
== SetWaypointName == | == SetWaypointName == |
Latest revision as of 09:21, 12 June 2023
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.