; exit script 08 Hostages


; Saving player's status
aa = aP saveStatus "08Player";
; Player will be saved


GLB_08_HOWMANY = 10 - (count units group aP);
? GLB_08_HOWMANY < 0 : GLB_06_HOWMANY = 0;
saveVar "GLB_08_HOWMANY";

; Special soldiers
? alive aMed : GLB_08_MED = true; saveVar "GLB_08_MED"; xx = aMed saveStatus "08Medic";
? alive aMed2 : GLB_08_MED2 = true; saveVar "GLB_08_MED2"; xx = aMed2 saveStatus "08Medic2";

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

_i = count units group aP;
_j = 0;
_k = 0;
_Mis = "08";
_Out = [aMed, aMed2, aP];

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

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

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

#Next
GLB_08_NUMBER = _k; saveVar "GLB_08_NUMBER";


; ================== BEGIN: WEAPON POOL ====================

#POOL

; Added by mission designer



; Alway adding basic weapons
? (queryWeaponPool "AK47CZ") < 10 : addWeaponPool ["AK47CZ", 10]
? (queryMagazinePool "AK47") < 100 : addMagazinePool ["AK47", 30]


; Weapon holders stolen?


_vehs = [Ur1, Ur2, Ur3, Ur4];
; These vehicles will add their weapons to pool if they are close enough

_a = 0;
_b = count units group aP;

; Add all group vehicles to _vehs
#LOOPGroupVeh

? _b >= _a : goto "ENDGroupVeh"

_who = (units group aP) select _a;
? (vehicle _who != _who) and not ((vehicle _who) in _vehs) : _vehs = _vehs + [vehicle _who];

_a = _a + 1;
goto "LOOPGroupVeh";

#ENDGroupVeh

_a = 0;
_b = count _vehs;

#LOOPHolders
? _a >= _b : goto "ENDHolders"

_work = false;
_u = _vehs select _a
? side (driver _u) == resistance : _work = true;
? alive _u and (driver _u != driver _u) and ((_u distance aP) < 300) : _work = true;

? _work : pickWeaponPool (vehicle _u); clearWeaponCargo (vehicle _u); clearMagazineCargo (vehicle _u);

_a = _a + 1;
goto "LOOPHolders"

#ENDHolders


; ================== END: WEAPON POOL ====================
