deleteWaypoint

From Bohemia Interactive Community
Revision as of 17:52, 17 November 2019 by Mr H. (talk | contribs)
Jump to navigation Jump to search
-wrong parameter ("Arma") defined!-1.00
Hover & click on the images for description

Description

Description:
Removes the specified waypoint.

When a waypoint is deleted, all other group waypoints are immediately re-indexed. So in order to delete all waypoints for a group, delete them from back to front:
group _unit call 
{
	for "_i" from count waypoints _this - 1 to 0 step -1 do 
	{
		deleteWaypoint [_this, _i];
	};
};
Groups:
Uncategorised

Syntax

Syntax:
deleteWaypoint [group, index]
Parameters:
[group, index]: Array
group: Group
index: Number
Return Value:
Nothing

Examples

Example 1:
deleteWaypoint [_grp, 2]

Additional Information

See also:
waypointscopyWaypointssetCurrentWaypointsetWaypointBehavioursetWaypointCombatModesetWaypointCompletionRadiussetWaypointDescriptionsetWaypointFormationsetWaypointHousePositionsetWaypointPositionsetWaypointScriptsetWaypointSpeedsetWaypointStatementssetWaypointTimeoutsetWaypointTypesetWaypointVisiblewaypointAttachVehiclewaypointAttachedVehiclesetWaypointLoiterRadiuswaypointLoiterRadiusaddWaypointsetWaypointLoiterTypewaypointSpeed

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

Notes

Posted on 1 Feb, 2008 - 07:48
Saintolaf
In order to change the behavior of a unit currently following a string of waypoints, it is not enough to use deleteWaypoint. The path of the unit is calculated by the waypoints present at start, and the unit will continue according to the original waypoints even if you delete them by using this command. To achieve the wanted effect, you should rather use setWPPos to the units current position (thereby stopping the unit), and (after a small delay) use deleteWaypoint to remove the 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 January 04, 2011
kju
When you want to remove all waypoints, do NOT iterate over waypoints _group while trying to delete them (an array is by reference!). Instead use an approach like this: while {(count (waypoints _group)) > 0} do { deleteWaypoint ((waypoints _group) select 0); };

Bottom Section

Posted on November 17, 2019 - 16:52 (UTC)
Mr H.
The first waypoint with index 0 is not the same as waypoint 0 in the editor. Index 0 is the position the group was spawned at, and is set by the engine when spawning and should (probably ?) not be deleted. Waypoint 0 is in fact index 1. so the example provided to delete all waypoints should be group _unit call { for "_i" from count waypoints _this - 1 to 1 step -1 do { deleteWaypoint [_this, _i]; }; }; In addition 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 below by Saintolag so: group _unit spawn { for "_i" from count waypoints _this - 1 to 0 step -1 do { deleteWaypoint [_this, _i]; }; sleep 0.1; for "_i" from count waypoints _this - 1 to 1 step -1 do { deleteWaypoint [_this, _i]; }; }; Will stop the group where it is and delete its waypoints. 0.1 seems to be the correct sleep value in this case