Zombitch 10 Posted September 7, 2013 Hey guys, I am trying to delete all waypoints assigned to a group but when I do that some waypoint "still alive". Here is a picture of the situation : 3 waypoints have been assigned to the enemy group (red). When my player get in the trigger radius (at the bottom right) I would like to remove all enemy waypoint so in the trigger I call the following script when condition meet : _unit = _this select 0; _group = group _unit; _waypoints = waypoints _group; _i = 0; while{(count _waypoints) > 0} do { deleteWaypoint [_group, _i]; _i = _i + 1; }; hint format["Waypoint count %1", count (waypoints _group)]; The thing is when the hint show up it should be written : "Waypoint count 0" whereas it 's written "Waypoint count 2" meaning there are 2 waypoints "alive". Any idea why it's not completly working ? Thanks ;) Share this post Link to post Share on other sites
bhaz 0 Posted September 7, 2013 Comment copied from the wiki for deleteWaypoint by 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); }; I think that when you delete waypoint 0, 1 and 2 get shifted back to become 0 and 1 etc. Share this post Link to post Share on other sites
Zombitch 10 Posted September 7, 2013 Thanks it's working perfectly. (I read the wiki about deleteWaypoint function but I didn't read the notes...) Share this post Link to post Share on other sites
ziiip 1 Posted November 12, 2013 (edited) This is a major pita. Is it possible that the devs change the waypoint indexes to remain static? The current system is really bad, because, say, I want to delete a few particular waypoints in my mission if some conditions are met, but the time when those are met varies and I can't possibly know how many waypoints the unit has already passed. Another issue: deleting a waypoint does not affect the synchronisation of waypoints. Say, I have two tanks that are not in the same group. I give them a couple of waypoint, and I synchronise, say, waypoint "A" with waypoint "B". Even if I delete waypoint "A", the tank with waypoint "B" will NOT proceed and wait infinitely! Fix please! Edited November 12, 2013 by ziiip Share this post Link to post Share on other sites
mr_centipede 31 Posted November 12, 2013 Another problem with deleteWaypoint is, whenever I successfully delete all waypoints, the AI will still continue on with its current waypoint and then stop. I would expect they would stop in place when all waypoints have been deleted. This is the problem with "Cancel All Waypoints" in high command. I cannot make them stop Share this post Link to post Share on other sites
Noddan 11 Posted November 13, 2013 After you've deleted all waypoints, create a new one at their current location. Below is a script I've used for a helicopter named "heli": while {(count (waypoints group _heli)) > 0} do { deleteWaypoint ((waypoints group _heli) select 0); }; waypoint1 = (group _heli) addwaypoint [getpos _heli,0]; //Noddan Share this post Link to post Share on other sites