deleteWaypoint

From Bohemia Interactive Community
Revision as of 01:30, 30 January 2021 by Lou Montana (talk | contribs) (Text replacement - "<dt class="note">([^<>]+) " to "<dt class="note">$1</dt> ")
Jump to navigation Jump to search
Hover & click on the images for description

Description

Description:
Description needed
Groups:
Waypoints

Syntax

Syntax:
Syntax needed
Parameters:
[group, index]: Array
group: Group
index: Number
Return Value:
Return value needed

Examples

Example 1:
deleteWaypoint [_grp, 2];
Example 2:
Because waypoints get immediately re-indexed when one gets deleted, delete them from last to first: private _group = group _unit; for "_i" from count waypoints _group - 1 to 0 step -1 do { deleteWaypoint [_group, _i]; };

Additional Information

See also:
See also needed

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
Posted on 1 Feb, 2008 - 07:48
Saintolaf
In order to change the behavior of a unit currently following some waypoints, it is not enough to use deleteWaypoint. To achieve the wanted effect, you should rather use setWPPos to the unit's current position (thereby stopping the unit), and (after a small delay) use deleteWaypoint to remove the next waypoints.
Posted on 15 Nov, 2008 - 13:37
VictorFarbau
Another (more foolproof) method to avoid the problem of non-deleteable waypoints is to introduce another group (createGroup) and join all units of the present group. A new group will start without any preset waypoints so you can start setting new WPs all over again. Old group is "_combatGroup", new group is "_combatGroup2" _combatGroup2 = createGroup east; { [_x] joinSilent _combatGroup2 } forEach (units _combatGroup); _combatGroup2 addWaypoint [getPos player, 25];
Posted on November 17, 2019 - 16:52 (UTC)
Mr H.
To have the unit stop on the spot you need to set its current waypoint where it is and add a little delay, as stated above by Saintolaf so: group _unit spawn { [_this, (currentWaypoint _this)] setWaypointPosition [getPosASL ((units _this) select 0), -1]; sleep 0.1; for "_i" from count waypoints _this - 1 to 0 step -1 do { deleteWaypoint [_this, _i]; }; }; Will stop the group where it is and delete its waypoints.