titleCut ["","BLACK IN", 3]
;setviewdistance 1200;
"A1" objStatus "Hidden";
"0" objStatus "Hidden";
BegCamp = false;

; The beginning is chosen here

? GLB_04_Tanks == GLB_04_Tanks : goto "Eval"

; ------------ Default values (not defined) -------------

GLB_04_Tanks = 1;
; Not defined - set to 1 ... tanks were defeated


#Eval

? GLB_04_Tanks == 0 : goto "Bad"

; Otherwise tanks WERE defeated...

"deletevehicle _x" forEach [oT1, oT2, oT1G, oT1D, oT1C, oT2G, oT2D, oT2C]
goto "End";

#Bad
; Tanks were not defeated !!!

BegCamp = true;
"Start" setmarkerpos getmarkerpos "Camp"
"d" setMarkerType "Empty"
"d_1" setMarkerType "Empty"
"d_2" setMarkerType "Empty"
"d_3" setMarkerType "Empty"
"d_4" setMarkerType "Empty"
"oth" setMarkerType "Empty"
"A1" objStatus "Active"
"0" objStatus "Active"

"1" objStatus "Hidden"
"A" objStatus "Hidden"
"B" objStatus "Hidden"

[group aP, 1] setWPPos getMarkerPos "Meet"

_i = 0;
_gr1 = [aP, s_1, s_2, s_3, s_4, s_5, s_6, s_7, s_8, S_9, NSol1, NSol2, NSol3, aMed];
_j = count _gr1;

#Loop

(_gr1 select _i) setpos [(getmarkerpos "Camp" select 0) + 3, (getmarkerpos "Camp" select 1) + _i]

_i = _i+1;
? _i < _j : goto "Loop"

mapAnimAdd [0, 0.1, getMarkerPos "Camp"]

#End

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

; Global variables

_JN = [];

? GLB_04_HOWMANY == GLB_04_HOWMANY : goto "Defined"

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

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

GLB_04_HOWMANY = random 3;
GLB_04_MED = true;

GLB_04_NUMBER = 3;

#Defined

aa = aP loadStatus "04Player";
aP setDammage 0;
fillWeaponsFromPool player;

; Special soldiers with their own variables:

_hlp = [aMed, GLB_04_MED, "04Medic"];
_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";

; Not medic? Create in second group




; Normal soldiers

#Rest

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

#LOOP3
? _v >= _u : goto "Out";
xx = (_gr select _v) loadStatus format ["04Sold%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 "LOOP3"

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


#Reinf

; REINFORCEMENTS
? GLB_04_HOWMANY >= 1 : _JN = _JN + [NSol1, NSol2]; goto "Sol2";

deleteVehicle NSol1;
#Sol2


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

#Final

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