addWaypoint

From Bohemia Interactive Community
Revision as of 15:04, 21 November 2023 by Lou Montana (talk | contribs) (Some wiki formatting)
Jump to navigation Jump to search
Hover & click on the images for description

Description

Description:
Adds (or inserts when index is given) a new waypoint to a group. The waypoint is placed randomly within a circle with the given center and radius. The function returns a waypoint with format [group, index].
For older titles and prior to Arma 3 v1.90, use setWaypointPosition if you need exact waypoint placement.
Groups:
Waypoints

Syntax

Syntax:
groupName addWaypoint [center, radius, index, name]
Parameters:
groupName: Group
center: Array format PositionAGL (PositionASL if radius is negative!) or Object
radius: Number - random waypoint placement within radius from center; Arma 3 logo black.png1.90 -1 can be used for exact waypoint placement
index: Number - (Optional) can be used to insert a waypoint in between existing waypoints
name: String - (Optional) waypointName
Return Value:
Array format Waypoint

Examples

Example 1:
_wp = _grp addWaypoint [position player, 0];
Example 2:
_wp = _grp addWaypoint [position player, 0]; // imprecise, placed like setVehiclePosition's "NONE" placement _wp setWaypointPosition [getPosASL player, -1]; // from Operation Flashpoint: Elite to Arma 3 v1.88 private _wp = _grp addWaypoint [getPosASL player, -1]; // Arma 3 v1.90+: precise placement

Additional Information

See also:
waypoints createGuardedPoint deleteWaypoint copyWaypoints move setCurrentWaypoint setWaypointBehaviour setWaypointCombatMode setWaypointCompletionRadius setWaypointDescription setWaypointHousePosition setWaypointPosition currentWaypoint waypointName waypointSpeed setWPPos

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
tijmenjoppe - c
Posted on Nov 26, 2009 - 18:07 (UTC)
In game versions prior to Arma 3 v1.22: If you add a waypoint to your group and then want them to start moving to that waypoint, make sure to call setWaypointType "MOVE" on your waypoint.
Giova - c
Posted on Jun 21, 2014 - 22:38 (UTC)
if you want to create a waypoint of type "MOVE" and set it as actual waypoint, you can use the move command that does everything for you with only one line of code !
Be aware that move command intercepts multiple waypoints and it will not line up in waypoints queue. In other word it is a quick solution if you want your group to get only one waypoint, but for several waypoints you'll have to use addwaypoint and all setwaypointXXXXXX commands around.
see move command.
odinviking - c
Posted on Aug 05, 2014 - 01:49 (UTC)
The waypoint may not be created exactly at the center position even if radius is zero. The position will be moved away if there are e.g. rocks at the center position or if it is placed at the edge of water on a shore.