Rejn 0 Posted October 1, 2008 Im trying to find a way to check if a group has no waypoint so that i can add a waypoint as sometimes merging squads and selecting the leader of another squad to lead removes the waypoints (sometimes). Im looking at the following: Quote[/b] ]WaypointList = waypoints Unit Does anyone know if this works? Quote[/b] ]waypointlist = waypoints player ?(waypointslist==isnil): do whatever Share this post Link to post Share on other sites
[frl]myke 15 Posted October 1, 2008 As the command "waypoints _unit" will return an array with all (or no) waypoints of the selected unit, a isnil check won't work. But as it is an array, a "count" might do the trick. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> if (count (waypoints _unit) == 0) then { .....code Although i don't know if waypoints already passed are deleted or if they remain inside this array. If they remain, it could be tricky to check if a unit already has passed all WP's or not. But at first i guess this is worth a try. Share this post Link to post Share on other sites
Rejn 0 Posted October 1, 2008 Thanks mate I will give your suggestion a try and see if it works. Will let you know Share this post Link to post Share on other sites
Rejn 0 Posted October 1, 2008 Didn't seem to work even for a unit/group that had no waypoints I may have to work around this another way. Share this post Link to post Share on other sites
Namikaze 0 Posted October 1, 2008 Now that you've got the array of waypoints, use the in command to search the array for your token. You might have to play around a little bit to get exactly what you want, but the in command works great whenever I've needed to use it. Also, parseNumber and parseText are really handy for searching through arrays of multiple data types, but I don't think that's your issue here. I would suggest you save a waypoint position as a variable named _token or something like that, then use _token as the search variable. Share this post Link to post Share on other sites
Rejn 0 Posted October 1, 2008 I might even be able to use the find command as that can quickly and easily search for anything in the array as far as I know. So if the result comes up as 0 I can go from there. Share this post Link to post Share on other sites
Namikaze 0 Posted October 1, 2008 That's another good command I forgot to mention. Yeah, find is great if you want to know which waypoint it is, for example. Just remember that arrays start at 0, and waypoint 0 is the initial starting position for the group. Share this post Link to post Share on other sites