; exit script

; Saving player's status
; aa = aP saveStatus "03bPlayer";
; Player will not be saved - new mission is later


; Player's weapons to weapon pool

_i = 0;

#LPWeap

addWeaponPool [((weapons aP) select _i), 1];
_i = _i + 1;
? _i < (count weapons aP) : goto "LPWeap"

_i = 0;

#LPMag

addMagazinePool [((magazines aP) select _i), 1];
_i = _i + 1;
? _i < (count magazines aP) : goto "LPMag"


; Truck alive?

xx = deleteStatus "03bTruck";
GLB_03b_TRUCK = false;
? canmove Truck : GLB_03b_TRUCK = true; xx = Truck saveStatus "03bTruck";
SaveVar "GLB_03b_TRUCK";


; Saving soldiers - player's group

GLB_03b_HOWMANY = 0;
_grp = [p1, p2, p3, p4, p5]
? count _grp == 5 : GLB_03b_HOWMANY = 1;
? count _grp < 5 : GLB_03b_HOWMANY = 2;
saveVar "GLB_03b_HOWMANY";

; Special soldiers
? alive aMed : GLB_03b_MED = true; saveVar "GLB_03b_MED"; xx = aMed saveStatus "03bMedic";


; ------- Player's group ---------

_i = count _grp;
_j = 0;
_k = 0;
_Mis = "03b";
_Out = [aMed, aP]

#LOOP
? _j >= _i : goto "Next"

? (_grp select _j) in _Out : goto "SKIP"
? alive (_grp select _j) : xx = (_grp select _j) saveStatus _Mis + (format ["Sold%1", _k]); _k = _k+1;

#SKIP
_j = _j + 1;
goto "LOOP"

#Next
GLB_03b_NUMBER = _k; saveVar "GLB_03b_NUMBER";


; ================== WEAPON POOL ====================

AddWeaponPool ["AK47CZ", 4];
AddMagazinePool ["AK47", 40];
AddMagazinePool ["HandGrenade", 20];

pickWeaponPool Truck;
clearWeaponCargo Truck;
clearMagazineCargo Truck;


; ------------- END -------------

exit
; for now ! we will try to solve problem with weapon pool by other way


; Group

_whoW = 0;

#BACKWEAP

_whatW = 0;

? _whoW == (count units group aP) : goto "EndWeap"
_man = (units group aP) select _whoW;

#INTERWEAP

? _whatW == (count weapons _man) : goto "EndInterW"


_whatW = _whatW + 1;

#ENDINTERW

_whoW = _whoW + 1;




#ENDWEAP
