Epoch_Server/Server/@epochhive/addons/DZMS/Scripts/DZMSBox.sqf

224 lines
6.4 KiB
Plaintext

/*
Usage: [_crate,"type"] execVM "dir\DZMSBox.sqf";
_crate is the crate to fill
"type" is the type of crate
"type" can be weapons or medical
*/
//private ["_scount","_crate","_type","_sSelect","item","_ammo"];
_crate = _this select 0;
_type = _this select 1;
// Clear the current cargo
clearWeaponCargoGlobal _crate;
clearMagazineCargoGlobal _crate;
clearBackpackCargoGlobal _crate;
clearItemCargoGlobal _crate;
//////////////////////////////////////////////////////////////////
// Medical Crates
if (_type == "medical") then {
// load medical
_scount = count DZMSMedicalSupplies;
for "_x" from 0 to 40 do {
_sSelect = floor(random _sCount);
_item = DZMSMedicalSupplies select _sSelect;
_crate addMagazineCargoGlobal [_item,(round(random 2))];
};
};
///////////////////////////////////////////////////////////////////
// Weapon Crate Small Yield
if (_type == "weapons") then {
// load grenades
_scount = count DZMSGrenadeList;
for "_x" from 0 to 2 do {
_sSelect = floor(random _sCount);
_item = DZMSGrenadeList select _sSelect;
_crate addMagazineCargoGlobal [_item,(round(random 2))];
};
// load packs
_scount = count DZMSBackPackList;
for "_x" from 0 to 3 do {
_sSelect = floor(random _sCount);
_item = DZMSBackPackList select _sSelect;
_crate addBackpackCargoGlobal [_item,1];
};
// load pistols
_scount = count DZMSpistolList;
for "_x" from 0 to 2 do {
_sSelect = floor(random _sCount);
_item = DZMSpistolList select _sSelect;
_crate addWeaponCargoGlobal [_item,1];
_ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
if (count _ammo > 0) then {
_crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
};
};
//load sniper
_scount = count DZMSsniperList;
for "_x" from 0 to 1 do {
_sSelect = floor(random _sCount);
_item = DZMSsniperList select _sSelect;
_crate addWeaponCargoGlobal [_item,1];
_ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
if (count _ammo > 0) then {
_crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
};
};
//load mg
_scount = count DZMSmgList;
for "_x" from 0 to 1 do {
_sSelect = floor(random _sCount);
_item = DZMSmgList select _sSelect;
_crate addWeaponCargoGlobal [_item,1];
_ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
if (count _ammo > 0) then {
_crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
};
};
//load primary
_scount = count DZMSprimaryList;
for "_x" from 0 to 2 do {
_sSelect = floor(random _sCount);
_item = DZMSprimaryList select _sSelect;
_crate addWeaponCargoGlobal [_item,1];
_ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
if (count _ammo > 0) then {
_crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
};
};
};
///////////////////////////////////////////////////////////////////
// Weapon Crate Large Yield
if (_type == "weapons2") then {
// load grenades
_scount = count DZMSGrenadeList;
for "_x" from 0 to 5 do {
_sSelect = floor(random _sCount);
_item = DZMSGrenadeList select _sSelect;
_crate addMagazineCargoGlobal [_item,(round(random 2))];
};
// load packs
_scount = count DZMSBackPackList;
for "_x" from 0 to 3 do {
_sSelect = floor(random _sCount);
_item = DZMSBackPackList select _sSelect;
_crate addBackpackCargoGlobal [_item,1];
};
// load pistols
_scount = count DZMSpistolList;
for "_x" from 0 to 3 do {
_sSelect = floor(random _sCount);
_item = DZMSpistolList select _sSelect;
_crate addWeaponCargoGlobal [_item,1];
_ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
if (count _ammo > 0) then {
_crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
};
};
//load sniper
_scount = count DZMSsniperList;
for "_x" from 0 to 3 do {
_sSelect = floor(random _sCount);
_item = DZMSsniperList select _sSelect;
_crate addWeaponCargoGlobal [_item,1];
_ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
if (count _ammo > 0) then {
_crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
};
};
//load mg
_scount = count DZMSmgList;
for "_x" from 0 to 3 do {
_sSelect = floor(random _sCount);
_item = DZMSmgList select _sSelect;
_crate addWeaponCargoGlobal [_item,1];
_ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
if (count _ammo > 0) then {
_crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
};
};
//load primary
_scount = count DZMSprimaryList;
for "_x" from 0 to 5 do {
_sSelect = floor(random _sCount);
_item = DZMSprimaryList select _sSelect;
_crate addWeaponCargoGlobal [_item,1];
_ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
if (count _ammo > 0) then {
_crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
};
};
};
///////////////////////////////////////////////////////////////////
// Epoch Supply Small Yield
if (_type == "supply") then {
// load tools
_scount = count DZMSConTools;
for "_x" from 0 to 2 do {
_sSelect = floor(random _sCount);
_item = DZMSConTools select _sSelect;
_crate addWeaponCargoGlobal [_item, 1];
};
// load construction supplies
_scount = count DZMSConSupply;
for "_x" from 0 to 30 do {
_sSelect = floor(random _sCount);
_item = DZMSConSupply select _sSelect;
_crate addMagazineCargoGlobal [_item,1];
};
};
///////////////////////////////////////////////////////////////////
// Epoch Supply Large Yield
if (_type == "supply2") then {
// load tools
_scount = count DZMSConTools;
for "_x" from 0 to 5 do {
_sSelect = floor(random _sCount);
_item = DZMSConTools select _sSelect;
_crate addWeaponCargoGlobal [_item, 1];
};
// load construction supplies
_scount = count DZMSConSupply;
for "_x" from 0 to 40 do {
_sSelect = floor(random _sCount);
_item = DZMSConSupply select _sSelect;
_crate addMagazineCargoGlobal [_item,1];
};
// load prefab buildables
_scount = count DZMSBuildables;
for "_x" from 0 to 15 do {
_sSelect = floor(random _sCount);
_item = DZMSBuildables select _sSelect;
_crate addMagazineCargoGlobal [_item,1];
};
};
///////////////////////////////////////////////////////////////////
// Epoch Money Crates
if (_type == "highvalue") then {
// load money
_scount = count DZMSHighValue;
for "_x" from 0 to 3 do {
_sSelect = floor(random _sCount);
_item = DZMSHighValue select _sSelect;
_crate addMagazineCargoGlobal [_item,1];
};
};