From 0810060ee60c7f5b9d84312cbbbc592253985475 Mon Sep 17 00:00:00 2001 From: Vdauphin Date: Fri, 3 Jan 2020 16:05:02 +0100 Subject: [PATCH] Don't halt planned movement for empty group CBA_fnc_clearWaypoints can be call for empty group. This avoid the creation of a waypoint at [0,0,0] because getPosATL (leader _group) --- addons/ai/fnc_clearWaypoints.sqf | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/ai/fnc_clearWaypoints.sqf b/addons/ai/fnc_clearWaypoints.sqf index 72bd57c34..165124364 100644 --- a/addons/ai/fnc_clearWaypoints.sqf +++ b/addons/ai/fnc_clearWaypoints.sqf @@ -29,6 +29,8 @@ private _waypoints = waypoints _group; deleteWaypoint [_group, 0]; } forEach _waypoints; -// Create a self-deleting waypoint at the leader position to halt all planned movement (based on old waypoints) -private _wp = _group addWaypoint [getPosATL (leader _group), 0]; -_wp setWaypointStatements ["true", "deleteWaypoint [group this,currentWaypoint (group this)]"]; +if !(units _group isEqualTo []) then { + // Create a self-deleting waypoint at the leader position to halt all planned movement (based on old waypoints) + private _wp = _group addWaypoint [getPosATL (leader _group), 0]; + _wp setWaypointStatements ["true", "deleteWaypoint [group this,currentWaypoint (group this)]"]; +};