OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: trinec on 19 Aug 2005, 04:14:42

Title: Unit move thru marker positions
Post by: trinec on 19 Aug 2005, 04:14:42
Im trying to figure out how to script when a unit reaches a certain area then another unit in a vehicle moves thru multiple marker positions.

I know you can use

unit doMove getmarkerpos "marker1" in the editor  but im not sure if thats the right way to place it in a script..


Thanks
Title: Re:Unit move thru marker positions
Post by: Blanco on 19 Aug 2005, 04:31:24
Ok, Let's say you got 3 markers, "M1","M2","M3"

Copy & paste this and save it as markermove.sqs
Code: [Select]
;markermove.sqs
_veh = _this select 0
_markers = ["M1","M2","M3"]

_c = count _markers
_i = 0

#START
_veh domove getmarkerpos (_markers select _i)

#1
?!alive _veh : exit
?unitready _veh : goto "2"
~2
goto "1"

#2
_i = _i + 1
?_i < _c : goto "START"
exit

Run it with

Code: [Select]
[name_of_vehicle] exec "markermove.sqs"

If you got more markers, simply add them in the _markers array.
Not tested.

Title: Re:Unit move thru marker positions
Post by: trinec on 19 Aug 2005, 05:29:33
Any Idea on having the unit driving to not stop then start when changing to the next marker or backup to change direction instead of just driving to the next marker.  But other then that it works great..

Thanks
Title: Re:Unit move thru marker positions
Post by: bedges on 19 Aug 2005, 08:25:30
as far as i know, this pausing at a marker/waypoint is a 'feature' of the way AI drives in flashpoint, and other than complex setvelocity calculations, there's nothing to be done about it.  :-\
Title: Re:Unit move thru marker positions
Post by: macguba on 19 Aug 2005, 10:58:22
You can cover each marker with a trigger.   When the unit enters the trigger area (experiment to find the right area) it is given the order to move to the next marker.    Thus it never reaches the first marker, so it doens't pause.

It works with choppers, don't know how it will go with ground vehicles.