How would I find out, through a script, how many waypoints a unit has in total?
With some hacking, probably. I'll look into it. But
Alternatively, you could solve my problem by telling me if any command exists to automatically complete the waypoint, regardless of whether it's conditions have been met or if the unit is near.
I know of no one command, but you could modify the conditions of the waypoint so that it is now of the form:
(blahblahblah_conditions) OR finishWP
Then, when you need to have the waypoint finished, have a script execute:
finishWP = true
[groupOne, 1] setWPPos getpos (leader groupOne)
A waypoint is complete when its conditions are met and the unit is nearby, so the above sort of code will complete any waypoint.
Does that work?
EDIT:
Indeed, with some hacking it appears to be possible to find out how many waypoints a unit has. Notice that the
getWPPos returns [0,0,0] when it is asked to find the position of a non-existent waypoint. So, set up a script or function that will feed numbers to
getWPPos, starting with 0 and increasing, and continue to do so until the returned array is [0,0,0]. Use
("_x == 0" count getWPPos [groupOne, _loopindex]) == 3
to check when this happens. Subtract one from your loop index, and you have the number of waypoints that your group has. I'm just assuming that no waypoints will be at exactly [0,0,0].