titleCut ["","BLACK IN", 3]
;setviewdistance 1200



; ====================== SOLDIERS FROM LAST MISSION ===============================

; Global variables

_JN = [];

? GLB_15_HOWMANY == GLB_15_HOWMANY : goto "Defined"

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

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

GLB_15_HOWMANY = 3;
GLB_15_MED = true;
GLB_15_MED2 = false;

GLB_15_NUMBER = 3;

GLB_15_T1 = false;
GLB_15_T2 = true;

#Defined

_howmany = GLB_15_HOWMANY;
_number = GLB_15_NUMBER;
_strSold = "15Sold%1";

aa = aP loadStatus "15Player";
fillWeaponsFromPool player;

; Special soldiers with their own variables:

_hlp = [aMed, GLB_15_MED, "15Medic", aMed2, GLB_15_MED2, "15Medic2"];
_i = count _hlp;
_j = 0;

; No medics? Create!

? not (_hlp select 1) and not (_hlp select 4) : _JN = _JN + [aMed]; deleteVehicle aMed2; goto "Rest";

#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); fillWeaponsFromPool _man; _j = _j + 3; goto "LOOPSpec";

deleteVehicle _man;
_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, s_11, s_12];
_v = 0;

#LOOPNormal
? _v >= _number : goto "ENDNormal";

xx = (_gr select _v) loadStatus format [_strSold, (_v)];
fillWeaponsFromPool (_gr select _v)

_JN = _JN + [(_gr select _v)];
(_gr select _v) setskill ((skill (_gr select _v)) + 0.2)

_v = _v+1;
goto "LOOPNormal"

#ENDNormal

? _v >= count _gr : goto "Reinf";
deleteVehicle (_gr select _v);
_v = _v + 1;
goto "ENDNormal";

#Reinf


; REINFORCEMENTS

_reinf = [NSol1, NSol2, NSol3, NSol4, NSol5, NSol6, NSol7, NSol8, NSol9, NSol10]
_a = 0;

#LOOPReinf

? _a >= (count _reinf) : goto "Final";
? _a >= _howmany : goto "Final"

_JN = _JN + [_reinf select _a]
_a = _a + 1; goto "LOOPReinf"

#Final

_JN join group aP;

"_x setdammage 0" forEach units group aP;
JN = _JN;

#ENDReinf

? _a >= (count _reinf) : goto "REINFDeleted"
deleteVehicle (_reinf select _a);
_a = _a + 1;
goto "ENDReinf";

#REINFDeleted

; ------------- Vehicles ---------------

_who = [GLB_15_T1, T1, GLB_15_T2, T2]
_a = 0;
_b = count _who;
_tanks = 0;

#LOOPVehlImport
? _a >= _b : goto "ENDVehlImport"

? _who select _a : _tanks = _tanks + 1; goto "JMPVehlImport"

deleteVehicle (_who select (_a+1));

#JMPVehlImport
_a = _a + 2;
goto "LOOPVehlImport"

#ENDVehlImport
