Hey guys,
Below is Ravens TakeBuilding script that I've put into a mission of mine. I was hoping I could put something in the init line of each of the units spawned. I want to run Rommels AI Suppress Script alongside this one which is achieved by running the following in each of the group leaders (or units) init line:
nul = [group this] call compile preProcessFile "ROMM_IA.sqf"
; *******************************************************************************
; ** Script: TakeBuilding.sqs
; ** Description: Place enemies on buildings inside an area
; *******************************************************************************
; ** Author: RAVEN
; *******************************************************************************
; ** Usage: [this, 100, 50, 60, 0] exec "TakeBuilding.sqs"
; *******************************************************************************
; ** Consideraciones:
; *******************************************************************************
_unidades = ["ffaa_terrorista_agf_AK","ffaa_terrorista_agf_PK","ffaa_terrorista_agf_RPG","ffaa_terrorista_agf_Clerigo","ffaa_terrorista_ham_ak","ffaa_terrorista_ham_PK","ffaa_terrorista_ham_RPG"]
;this is to place a specific unit when the building's position is high (towers, high buildings, ..)
_francotirador = "ffaa_terrorista_agf_SVD"
#Init
_sitio = _this select 0
_Radio = _this select 1
_OcuCity = _this select 2
_OcuCasa = _this select 3
_OcuGen = _this select 4
_Ocuhome = 0
_pp = []; _ret = []; _ord = 0
;--- Reading buildings in the area
_edificios = nearestObjects [AREA1, ["HOUSE"], _Radio]
_max = count _edificios
_quedan = ((_OcuCity * _Max) / 100) + 0.5
_quedan = _quedan - (_quedan mod 1)
;--- Get the buildings as required (_OcuCity)
#Area
? _quedan <= 0 or _ord >= _max : goto "Fin_Area"
_cual = random(_max)
_cual = _cual - (_cual mod 1)
? _cual < 1 : _cual = 0
? _cual in _ret : goto "Area"
_ret = _ret + [_cual]
_ord = _ord + 1
_quedan = _quedan - 1
goto "Area"
#Fin_Area
{_pp = _pp + [_edificios select _x]} foreach _ret
_edificios = _pp
_max = (count _edificios)
;--- Processing the selected buildings
#loop
_max = _max - 1
? _max < 0 : goto "Salida"
_edi = _edificios select _max
_Posiciones = []
_ordPos = 0
_vacio = false
;--- Calculating the "fillable" positions on selected buildings
#loop2
_pos = (_edi buildingPos _ordPos)
? (_pos select 0) + (_pos select 1) + (_pos select 2) == 0: _vacio = true
? _vacio and _ordPos == 0 : goto "loop"
? _vacio and _ordPos != 0 : goto "Coloca"
_Posiciones = _Posiciones + [_pos]
_ordPos = _ordPos + 1
goto "loop2"
;--- Positions selection (_Ocuhome) on building
#Coloca
_Ocubuild = random(_OcuCasa)
if (_OcuGen != 0) then {_Ocuhome = _OcuGen} else {_Ocuhome = _Ocubuild}
_quedan = ((_Ocuhome * _ordPos) / 100) + 0.5
_quedan = _quedan - (_quedan mod 1)
? _quedan > _ordPos : _quedan = _ordPos
? _quedan < 1 : _quedan = 1
_pp = []; _ret = []; _ord = 0
_XX = (count _posiciones)
#Coloca2
? _ord >= _XX : goto "Coloca3"
_cual = random(_XX)
_cual = _cual - (_cual mod 1)
? _cual < 1 : _cual = 0
? _cual in _ret : goto "Coloca2"
_ret = _ret + [_cual]
_ord = _ord + 1
_quedan = _quedan - 1
? _quedan > 0 : goto "Coloca2"
;--- Placing units in the selected positions of each selected building
#Coloca3
{_pp = _pp + [_posiciones select _x]} foreach _ret
_posiciones = _pp
_MaxPos = count _posiciones
#Coloca4
_MaxPos = _MaxPos - 1
? _MaxPos < 0 : goto "loop"
_pos = _posiciones select _MaxPos
_cual = random(count _unidades)
_tipoMan = _unidades select _cual
_man = _tipoMan createunit [_pos, group general]
_sol = units (group general) select 1
[general] joinsilent grpnull
? random(100) > 50 : _sol setunitpos "middle"
? (position _sol) select 2 < 10 : goto "coloca5"
[_sol] joinsilent grpnull
deletevehicle _sol
_man = _francotirador createunit [_pos, group general]
_sol = units (group general) select 1
_sol setskill 1
#coloca5
_sol setPos _pos
_sol move _pos
_sol setdir (random 360)
~0.10
goto "Coloca4"
#salida
exit
Any help would be great guys!
Thanks,
Safety