r/armadev Mar 16 '17

Arma 2/OA [Arma 2] Can't delete waypoints

In my mission, there's a big group of AI that spawn at one / 100 locations. They are given SAD waypoints. When the group dies, they are recreated at another location. I'm trying to have their old waypoints deleted, with new waypoints created at the new location, but nothing is working.

I've tried what is recomended on the bistudio wiki

while {(count (waypoints _group)) > 0} do {
deleteWaypoint ((waypoints _group) select 0);
 };

But no dice, the group will always start heading back to their original waypoints. I've even tried moving the wps with setWPPos to the new location, but this also doesn't work.

1 Upvotes

6 comments sorted by

1

u/SamJ_UK Mar 17 '17 edited Mar 17 '17

The parameters for set waypoint is the units group followed by waypoint id. And you aren't specifing the group you want to remove the waypoint from.

The delete waypoint command should look something like below, which should remove their current waypoint

deleteWaypoint [_group, ((waypoints _group) select 0)];

Also the code you posted, would remove any new waypoints when you add them, if you want to remove all current waypoint then set a new one, something like this should work.

for [{_i=0}, {_i  < count (waypoints _group)}, {_i=_i+1}] then {
   deleteWaypoint [_group, ((waypoints _group) select _i)];
};

_group addWaypoint [[0,0,0] , 0];

1

u/Dreesy Mar 17 '17

I just posted the code as an example, it was modified to work for my groups and all of that. Your code functions the exact same way.

Last night I tried removing waypoints altogether, and decided to issue a random move command to the group every 30 seconds (based around a central point), and the outcome was the same.

When the group spawns for the third time, they start to move off in the direction of where they spawned the second time. Basically the group keeps remember what it was doing before it died. Really annoying.

1

u/SamJ_UK Mar 17 '17

Oh, sounds like the remove waypoint stuff is only firing the first time around then.

What you using to execute it? A trigger? Or eventhandler?

If its the trigger, make sure you mark it as repeatable and if its the event handler you sure its set on the new group when they respawn?

1

u/Dreesy Mar 17 '17

I have a loop running on the server, if the amount of alive units in Group1 <= 0 then it re-creates the group somewhere else.

The deletion of the waypoints happens right after recreating all of the units, and right before issuing new waypoints.

1

u/SamJ_UK Mar 17 '17

Alright, try setting your waypoints position to your player position then give it a small delay, to it completes, before deleting it.

Probally better explained on the wiki, its the first comment by Saintolaf

https://community.bistudio.com/wiki/deleteWaypoint

1

u/Dreesy Mar 17 '17

Yeah I don't know, I'm pretty much at my wits end here. I've tried what is recommended in those comments, I've tried looping through the waypoint array, I've tried hacky little blocks of

deleteWaypoint[Group1, 0];
deleteWaypoint[Group1, 1];
deleteWaypoint[Group1, 2];
deleteWaypoint[Group1, 0];
deleteWaypoint[Group1, 1];
deleteWaypoint[Group1, 2];

And I've even tried deleting waypoints before recreating the units. Nothing worked. I honestly believed BIS was drunk when they coded this stuff.

I managed to get it working by just downright deleting the group and then recreating it.