Pyrodox 0 Posted February 25, 2010 I was wondering if it's possible to call the deleteWaypoint function for every current waypoint in a groups "waypoints" array? I can't seem to get the syntax right. Any help is appreciated. Share this post Link to post Share on other sites
_unit 10 Posted March 1, 2010 not sure. I always just use forEach. { deleteWaypoint _x} forEach waypoints <group name>; Share this post Link to post Share on other sites
armatech 8 Posted March 1, 2010 Try this _currentgroup = group player; _newGroup = creategroup side player; { [_x] joinSilent _newGroup; }foreach (units _currentgroup); deleteGroup _currentgroup; Share this post Link to post Share on other sites
imutep 0 Posted March 1, 2010 Try... deleteWaypoint [_group, 0]; deleteWaypoint [_group, 1]; This will delete the waypoint 0 and 1 of the _group. Share this post Link to post Share on other sites
Monsada 10 Posted March 2, 2010 try this _grp = group player; _index = currentWaypoint _grp; { if ( _x select 1 < _index ) then { deleteWaypoint _x; }; }foreach waypoints _grp; Share this post Link to post Share on other sites
Toasted Duckie 0 Posted March 2, 2010 not sure. I always just use forEach.{ deleteWaypoint _x} forEach waypoints <group name>; that should do the trick Share this post Link to post Share on other sites
Monsada 10 Posted March 2, 2010 Is true. This delete all waypoints, not sure if not concluded waypoints will be deleted aswell, I think always mantain a waypoint. if Im ok, you can create a void waypoint or set move position leader unit, that creates a waypoint to currentpos, and then doing delete. { deleteWaypoint _x} forEach waypoints <group name>; Share this post Link to post Share on other sites
anemia 12 Posted August 9, 2010 (edited) try this I tested this , but my Waypoints a still there. _grp = group player; _index = currentWaypoint _grp; { if ( _x select 1 < _index ) then { deleteWaypoint _x; }; }foreach waypoints _grp; _playerGrp = group player; positions = [position r1, position r2, position r3, position r4, position r5, position r6, position r7, position r8]; // hier die Namen der Heli-H eintragen _i = ceil random (count positions); wposition = positions select _i; wp1 = _playerGrp addWaypoint [wposition, 0]; wp1 setWaypointType "MOVE"; _i = ceil random (count positions); wposition = positions select _i; wp2 = _playerGrp addWaypoint [wposition, 0]; wp2 setWaypointType "MOVE"; _i = ceil random (count positions); wposition = positions select _i; wp3 = _playerGrp addWaypoint [wposition, 0]; wp3 setWaypointType "MOVE"; wp4 = _playerGrp addwaypoint [position grendpos, 0]; wp4 setwaypointtype "MOVE"; wp4 setWaypointStatements ["true", "smp1 sidechat ""You a back in Base + 500 $""; cash = cash + 500"]; This is my code... everytime you will get a new route. And if you call the script again all old WP, should be deletedt. The Code itself works, but the Waypoints a still there after i recall the script. any ideas ?! Edited August 9, 2010 by Anemia Share this post Link to post Share on other sites
anemia 12 Posted August 11, 2010 sorry for doubble post ...but i need help at this :j: Share this post Link to post Share on other sites
moricky 211 Posted August 11, 2010 Waypoint is not data type, but array containing [group, ID]. When you delete waypoint, all following IDs are decreased by 1. Using foreach therefore won't work. This will do the trick: while {count waypoints groupName > 0} do {deletewaypoint (waypoints groupsName select 0)}; You can also use copyWaypoints for copying waypoints from group which have none. Share this post Link to post Share on other sites
katipo66 94 Posted July 2, 2011 while {count waypoints groupName > 0} do {deletewaypoint (waypoints groupsName select 0)}; How can i make this apply to any groups waypoint inside a trigger? Share this post Link to post Share on other sites
demonized 20 Posted July 2, 2011 How can i make this apply to any groups waypoint inside a trigger? well, wps dont show up in triggers list, but if you use round triggers you can use distance to determine if they are inside, note you need perfect circles, 50,50, not 60,40 or anything else for this to work. also trigger will only detect objects, so if group is outside of trigger, they will not be able to catch them, im asuming there can be both cases, so we use a connstant running script instead of the trigger. run this code whenever you want to remove waypoints of any group of a specific side wich have their wps "inside" the trigger. here we asume the trigger is 500,500 large, meaning a distance of 251 means outside, 249 and lower means inside, can also now use a marker instead if trigger have no other function. _triggername = myTrigger; _size = triggerArea _triggername; // get diameter, then calculatre radius below. _inside = (_size select 0)/2; { _grp = _x; // here we do for east side units only, change [b]== east[/b] to [b]in [east,west,resistance][/b] for multiple sides. if ((side _x) == east) then { { _wp = _x; if (((getWPPOs _wp) distance (getPos _triggername)) < _inside) then { deletewaypoint _x; }; } foreach waypoints _grp; }; } foreach allGroups; place the entire code inside a while loop to check it on intervalls.. while {true} do { here goes the code sleep 5; // add in a sleep to keep resource demand at minimum. }; Share this post Link to post Share on other sites
katipo66 94 Posted July 2, 2011 That all worked perfectly and seeing this in action i realize i do not need to try and deletelocation from my other thread. Thank you :) Share this post Link to post Share on other sites
demonized 20 Posted July 2, 2011 also Shuko, a member of these forums have a script/function to place and i belive also find objects or positions inside oddly shaped areas/markers, so you might want to take a look at that, but i have not used it myself and cannot say anymore on that. if you feel like you need the oddly shaped rectangles or whatnot for areas, instead of perfect circles i recomend you look into his post here: look a litlle further down in his thread for pictures on the use, you have full control on areas and can blacklist parts etc... http://forums.bistudio.com/showthread.php?t=89376 Share this post Link to post Share on other sites
katipo66 94 Posted July 2, 2011 Yes, I know of Shuko.. I'll investigate that script, cheers Share this post Link to post Share on other sites