---
name: "deleteWaypoint"
type: command
status: ok
groups: ["Waypoints"]
arma3_since: "0.50"
locality: {"argument": "global", "effect": "global", "server_exec": false}
source: https://community.bistudio.com/wiki/deleteWaypoint
revid: 339202
updated: 2023-04-27T17:09:15Z
---

# deleteWaypoint

*Command · Waypoints · Arma 3 v0.50 · introduced in Operation Flashpoint: Elite v1.00*

Locality: arguments **global** · effect **global**

## Description

Removes the specified waypoint.

> [!NOTE]
> - When a waypoint is deleted, all other [group](../commands/group.md) [waypoints](../commands/waypoints.md) are immediately re-indexed. See [#Example 2](../commands/deleteWaypoint.md#example-2) for a deletion of all group's waypoints.
> - Deleting a group's [current waypoint](../commands/currentWaypoint.md) will *not* stop the group on its tracks.

## Syntax

```sqf
deleteWaypoint [group, index]
```

**Parameters:**

- `group`: [Group](../topics/Group.md)
- `index`: [Number](../topics/Number.md)

**Returns:** [Nothing](../topics/Nothing.md)

## Examples

### Example 1

```sqf
deleteWaypoint [_grp, 2];
```

### Example 2

Because waypoints get immediately re-indexed when one gets deleted, delete them from last to first:

```sqf
private _group = group _unit;
for "_i" from (count waypoints _group - 1) to 0 step -1 do
{
    deleteWaypoint [_group, _i];
};
```

or always delete the first one (if you want to delete them all)

```sqf
private _group = group _unit;
for "_i" from 0 to (count waypoints _group - 1) do
{
    deleteWaypoint [_group, 0];
};
```

or use [forEachReversed](../commands/forEachReversed.md):

```sqf
{ deleteWaypoint _x } forEachReversed waypoints _group; // Arma 3 v2.14+ only
```

## See also

[waypoints](../commands/waypoints.md) · [setCurrentWaypoint](../commands/setCurrentWaypoint.md) · [setWaypointPosition](../commands/setWaypointPosition.md) · [setWaypointScript](../commands/setWaypointScript.md) · [setWaypointStatements](../commands/setWaypointStatements.md) · [setWaypointType](../commands/setWaypointType.md) · [addWaypoint](../commands/addWaypoint.md)

## Community notes

**Saintolaf** — 2008-01-01

In order to change the behavior of a unit currently following some waypoints, it is not enough to use [deleteWaypoint](../commands/deleteWaypoint.md).
To achieve the wanted effect, you should rather use [setWPPos](../commands/setWPPos.md) to the unit's current position (thereby stopping the unit), and (after a small delay) use [deleteWaypoint](../commands/deleteWaypoint.md) to remove the next [waypoints](../commands/waypoints.md).

---

**VictorFarbau** — 2008-11-15

Another (more foolproof) method to avoid the problem of non-deleteable waypoints is to introduce another group ([createGroup](../commands/createGroup.md)) and [join](../commands/join.md) 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"

```sqf
_combatGroup2 = createGroup east;
{ [_x] joinSilent _combatGroup2 } forEach (units _combatGroup);
_combatGroup2 addWaypoint [getPos player, 25];
```

---

**Mr H.** — 2019-11-17

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:

```sqf
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.

<sub>Source: [BI Community Wiki — deleteWaypoint](https://community.bistudio.com/wiki/deleteWaypoint) (revision 339202).</sub>
