Home   Help Search Login Register  

Author Topic: How would i turn this sqs into a sqf,AI grp board multiable un-named vehicles  (Read 1475 times)

0 Members and 2 Guests are viewing this topic.

Offline Michael

  • Members
  • *
  • www.zonekiller.ath.cx
    • ZoneKillers
How would i turn this sqs into a sqf ??

THE TRIGGER

[thislist] exec "getin.sqs                     trigger array --- set a delay so the group have time to get in the trigger
or
[alpha] exec "getin.sqs                     Â group
or
[man1] exec "getin.sqs                       leader unit

i wrote this on the weekend and it works realy well
but now i would like to convert it to a sqf any ideas.

;Script By Michael --- www.zonekiller.ath.cx --- zonekiller@iinet.net.au

_grp = _this select 0
_aunits = units _grp

;makes an array of all empty vehicles on the island of these types
~0.1
_objects = nearestObjects [leader _grp, ["jeep","car","air","Tank","Truck","ship"], 6000]

_b = 0
_t = 0
_s = count _aunits

; if no empty vehicles exit
?count _objects == 0 : goto "exit"

;if unit is in a vehicle goto next unit
#loop
? vehicle (_aunits select _t) != (_aunits select _t) : _t =_t + 1; goto "loop"
~0.1

;selects first vehicle in the array
_truck = _objects select _b

;if no vehicles within 200 mtrs exit
? _truck distance (_aunits select _t) > 200 : exit
~0.1

; check for empty positions
_freecommander = _truck emptyPositions "commander"
_freedriver = _truck emptyPositions "driver"
_freegunner = _truck emptyPositions "gunner"


_com = 0
_driver = 0
_gunner = 0

;if you set this number to 2 it will leave 2 empty spaces in the vehicle. 1 for 1 , 3 for 3
_cargo = 0

;if vehicle is not empty get next vehicle
; take this line out --?(_h > 0) : _b = _b + 1 ; goto "loop"-- if you want ai to get into a vehicle that has some units in it
_c = units _truck
~0.1
_h = count _c
~0.1
?(_h > 0) : _b = _b + 1 ; goto "loop"


; puts unit into these position if available
~0.2
?(alive (_aunits select _t)) && (_freedriver > _driver) : _driver = 1; (_aunits select _t) AssignAsdriver _truck; _t = _t + 1
~0.2
?(alive (_aunits select _t)) && (_freegunner > _gunner) : _gunner = 1; (_aunits select _t) AssignAsgunner _truck; _t = _t + 1
~0.2
?(alive (_aunits select _t)) && (_freecommander > _com) : _com = 1;(_aunits select _t) AssignAscommander _truck; _t = _t + 1�  � 
~0.2
_b = _b + 1
~1

;check how many cargo positions are available
_freecargo = _truck emptyPositions "cargo"
#getin

;if unit is in a vehicle goto next unit
? vehicle (_aunits select _t) != (_aunits select _t) : _t =_t + 1; goto "getin"
~0.5
?(alive (_aunits select _t)) && (_freecargo > _cargo) : (_aunits select _t) AssignAscargo _truck
~0.1

;when full it will look for next vehicle
?(alive (_aunits select _t)) && (_freecargo <= _cargo) : goto "loop"
_t = _t + 1
_cargo = _cargo + 1

;selects next unit to get in the vehicle
~0.1
?(_t < _s) : goto "getin"

_aunits orderGetIn true

exit

Many Thanks in Advance Michael

« Last Edit: 28 Mar 2007, 10:56:05 by Michael »

Offline Cheetah

  • Former Staff
  • ****
I suggest that you read this. It's a tutorial I wrote as a basic introduction to SQF, might help you.
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!