OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Rommel92 on 06 Jun 2008, 01:01:28

Title: Get Next Waypoint
Post by: Rommel92 on 06 Jun 2008, 01:01:28
Anyone know how a way to get a command/function similiar to that of what could be:
"GetNextWaypoint".

 :dunno:

Say I commandStop a group, after a period of time, how do I let them continue on their original path.  :blink:
Title: Re: Get Next Waypoint
Post by: Wolfrug on 06 Jun 2008, 01:11:54
Not sure I understand what you mean? A getnextwaypoint function would, I think, be a little like a "getcurrentwaypoint" function, that is to say, return whatever waypoint the unit is on at the moment (which would allow for easy extrapolation of "next" and "previous" for instance). I would love that as well, plus other WP-related stuff, like "getwaypointtype" and such :D

Anyway, as to your question: they should automatically continue their waypoints after being stopped. To "snap out" of commandstop, simply use doFollow or commandFollow (the equivalent of ordering "return to formation!"):

{_x dofollow leader _x} foreach units yourgroup.

Should do it?

Wolfrug out.
Title: Re: Get Next Waypoint
Post by: Mandoble on 06 Jun 2008, 01:41:26
try a move (getPos leader yourgroup)
Title: Re: Get Next Waypoint
Post by: Rommel92 on 06 Jun 2008, 02:09:19
Say the leaders been commandStop'd aswell, and yes WolfRug thats exactly what I wish aswell!

 ;)

Ta, BIKI and other sources plus Wolfrugs post sounds like this isn't going to be good.
Only way I could think of it would be a monitor script that monitors their waypoints (possible) which at each one ticks it off from an array and moves onto the next.... do-able... but gah globalVariables.  :P
Title: Re: Get Next Waypoint
Post by: Wolfrug on 06 Jun 2008, 02:37:20
Hm hm. You can do it with a vehiclevariable attached to a game logic or somesuch too, if you're so afraid of globals ;) Since waypoints can be cycled, you should watch out for that and use something like:

gamelogic1 setvehiclevariable ["CurrentWp", 1];

and such, changing the number for each waypoint. :P That way you can know how far the group has gotten. Note that there is always an invisible waypoint 0 on the starting location of each group.

However, it won't let them continue on their way after having been commandstopped,and would force you to constantly tell them to move on at each WP. I really do suggest the dofollow command, did you try it? Ordering a group leader to follow himself SHOULD also happily lead to him snapping out of a commandstop. Can't try it, but that's my theory.

Need it for something more complicated? Remember you can always use lockWP to make them not go past their next WP...

Wolfrug out.
Title: Re: Get Next Waypoint
Post by: Rommel92 on 06 Jun 2008, 02:52:16
Works a beauty mate. DoFollow after a commandStop returned him to normal.

Thanks a tonne!!!  :yes: