titleCut ["","BLACK IN", 3]
;setViewDistance 1200
"2" objStatus "Hidden"


; ==================================================================

; Global variables

_JN = [];

? GLB_03b_HOWMANY == GLB_03b_HOWMANY : goto "Defined"

; NOT DEFINED
; ===========

? CheatsEnabled : Hint "DEBUG:\nNot defined - initializing"
; DESIGNER VERSION ONLY

GLB_03b_HOWMANY = random 3;
GLB_03b_MED = true;
GLB_03b_NUMBER = 4;
GLB_03b_TRUCK = true;

#Defined

; Truck
add
Truck setPos getMarkerPos "TruckPos";
? not GLB_03b_TRUCK : deleteVehicle Truck

; WEAPON POOL

addWeaponPool ["RPGLauncher", 2];
addMagazinePool ["RPGLauncher", 6];

;clearMagazineCargo Bedna;
;clearWeaponCargo Bedna;

; Special soldiers with their own variables:

_hlp = [aMed, GLB_03b_MED, "03bMedic"];
_i = count _hlp;
_j = 0;

#LOOPSpec
? _j >= _i : goto "Rest";

_man = (_hlp select _j);
? (_hlp select (_j+1)) : _JN = _JN + [_man]; xx = _man loadStatus (_hlp select (_j+2)); _man setSkill ((skill _man)+0.2); _j = _j + 3; goto "LOOPSpec";

deleteVehicle (_hlp select _j);
_j = _j + 3;
goto "LOOPSpec";


; Normal soldiers

#Rest

_gr = [s_1, s_2, s_3, s_4, s_5, s_6, s_7, s_8, s_9, s_10];
_h = count _gr;
_u = GLB_03b_NUMBER;
_v = 0;

#LOOP2
? _v >= _u : goto "Out";
xx = (_gr select _v) loadStatus format ["03bSold%1", (_v)];
fillWeaponsFromPool (_gr select _v)
_JN = _JN + [(_gr select _v)];
(_gr select _v) setskill ((skill (_gr select _v)) + 0.2)
_v = _v+1;
goto "LOOP2"

#Out
? _v >= _h : goto "Reinf";
deleteVehicle (_gr select _v);
_v = _v + 1;
goto "Out";


#Reinf

; REINFORCEMENTS
? GLB_03b_HOWMANY >= 1 : _JN = _JN + [NSol1]; goto "Sol2";

deleteVehicle NSol1;
#Sol2


? GLB_03b_HOWMANY >= 2 : _JN = _JN + [NSol2]; goto "Final";
deleteVehicle NSol2;

#Final

_JN join group aP;
"_x setdammage 0" forEach units group aP;
