I've seen some work done in assigning movement to units based on code, and not by using fixed waypoints. The general consenus has been to make missions more flexible by making waypoints dynamic.
I found a tutorial for assigning units to move to certain positions using markers, and there were some waypoints involved as well. It wasn't what I was hoping. I had already written a script for moving a unit along some path. The idea was that it would ultimately turn into a state machine, and the unit would change its mission as different conditions changed. For now, though, it was just cycling a sequence.
Here's a simplified version of what I had written:
_player_name = _this select 0
_player = call format["%1",_player_name]
_pos = "Logic" CreateVehicle [9632.477539,29.834999,3865.032227]
#Move1
_pos setPos [9632.477539,29.834999,3865.032227]
_player move (position _pos)
hint "Told target to move"
@((_player distance _pos) < 2.0)
#Move2
hint "Moving to second target"
_player doMove [9708.595703,29.834999,3865.032227]
_pos setPos [9708.595703,29.834999,3865.032227]
@((_player distance _pos) < 2.0)
#Move3
_player doMove [9709.749023,29.834999,3936.538574]
_pos setPos [9709.749023,29.834999,3936.538574]
@((_player distance _pos) < 2.0)
#Move4
_player doMove [9627.863281,29.834999,3933.078613]
_pos setPos [9627.863281,29.834999,3933.078613]
@((_player distance _pos) < 2.0)
goto "Move1"
I have a few different ways of moving shown above, with none of them working. I assign a solider as its own group to this script in init. The unit will just stand around, although I get the message "Told target to move." I've tried commandMove, doMove, and just plain move. I've been wrapping the position in an object because the move commands don't really like that array. If the script got any further than the first move, it should actually error. Still, you should be able to see what I am trying to do.
It doesn't seem like I fully understand how the move commands actually work. The OFP comref is lacking in that regard--the only distinction it seems to make above them is how they are relayed over the radio.
Can I use the code above in a certain way? Do I NEED markers and waypoints?