Meteor 2 Scripting Functions
Waypoint
bool bindToWaypoint(int objectID, int waypointID)
Make an object follow a waypoint.

Example
// Make object ID 0 follow waypoint ID 3
bindToWaypoint(0, 3);

Comments
The object will continue to follow the waypoint, even if stuck. To make the object stop following the waypoint if it gets stuck, use bindToWaypointSoft.

See also
bindToWaypointSoft

bool bindToWaypointSoft(int objectID, int waypointID)
Make an object follow a waypoint. The object will stop following the waypoint if it gets stuck.

Example
// Make object ID 0 follow waypoint ID 3, stopping if it gets stuck
bindToWaypointSoft(0, 3);

See also
bindToWaypoint

int createWaypoint(vector2 pos, int prevWaypointID)
Create a waypoint.

Example
// Example 1: create a single waypoint
int newWaypointID = createWaypoint(vector2(100,100), -1);

// Example 2: create 3 waypoints in a line
int prevID = -1;
prevID = createWaypoint(vector2(100,100), -1);
prevID = createWaypoint(vector2(200,100), prevID);
prevID = createWaypoint(vector2(300,100), prevID);

Comments
The prevWaypointID parameter is the previous connected waypoint ID, set this -1 to no connect to a previous waypoint.
Return value (newWaypointID) will be -1 if the waypoint could not be created.
Enable netIDs display (netids console command) or general debug (gbug console command) to view waypoints in game.

See also
deleteWaypoint

bool deleteWaypoint(int waypointID)
Delete a waypoint.

Example
deleteWaypoint(1);

Comments
Objects currently on the waypoint will be either sent to the next waypoint or unbound depending on whether a next waypoint existed.

See also
createWaypoint

int getNextWaypointID(int waypointID)
Get a waypoint's next waypoint ID.

Example
print(getNextWaypointID(1));

See also
setNextWaypointID

void setNextWaypointID(int waypointID, int nextWaypointID)
Set a waypoint's next waypoint ID.

Example
setNextWaypointID(1, 2);

See also
getNextWaypointID

vector2 getWaypointPos(int waypointID)
Get a waypoint's position.

Example
print(getWaypointPos(1));

Comments
Do not use this function to check if a waypoint exists (use waypointExists).

See also
setWaypointPos waypointExists

void setWaypointPos(int waypointID, vector2 pos)
Set a waypoint's position.

Example
int waypointID = 1;

// print old pos
print(getWaypointPos(waypointID));

// set new pos
setWaypointPos(waypointID, vector2(200,200));

// print new pos
print(getWaypointPos(waypointID));

Comments
Do not use this function to check if a waypoint exists (use waypointExists).

See also
getWaypointPos waypointExists

bool waypointExists(int waypointID)
Determine if a waypoint exists.

Example
int waypointID = 1;

if(waypointExists(waypointID))
    print("Waypoint " + waypointID + " exists");
else
    print("Waypoint " + waypointID + " does not exist");


Index

Generated on the 24 June 2024 at 06:55:38 (UK Time)