Advertisement
RipSaw

DZMSBox.sqf

Feb 19th, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 14.49 KB | None | 0 0
  1. /*
  2.     Usage: [_crate,"type"] execVM "dir\DZMSBox.sqf";
  3.         _crate is the crate to fill
  4.         "type" is the type of crate
  5.         "type" can be weapons or medical
  6. */
  7. _crate = _this select 0;
  8. _type = _this select 1;
  9.  
  10. // Clear the current cargo
  11. clearWeaponCargoGlobal _crate;
  12. clearMagazineCargoGlobal _crate;
  13.  
  14. // Define lists. Some lists are defined in DZMSWeaponCrateList.sqf in the ExtConfig.
  15. _bpackList = ["DZ_ALICE_Pack_EP1","DZ_TK_Assault_Pack_EP1","DZ_British_ACU","DZ_CivilBackpack_EP1","DZ_Backpack_EP1","DZ_GunBag_EP1","DZ_LargeGunBag_EP1"];
  16. _gshellList = ["HandGrenade_west","FlareGreen_M203","1Rnd_HE_M203"];
  17. _medical = ["ItemBandage","ItemMorphine","ItemPainkiller","ItemAntibiotic","ItemBloodbag"];
  18. _money = ["ItemGoldBar","ItemGoldBar10oz"];
  19. _food = ["FoodMRE","ItemWaterbottle","ItemSodaPepsi","ItemSodaCoke","FoodCanBakedBeans","FoodCanFrankBeans"]
  20. _rare = ["ItemBriefcase100oz","PipeBomb","ItemORP","ItemAVE","ItemLRK","ItemTNK"]
  21. _documents = ["ItemDocument"]
  22. _bulk = ["bulk_itemSodaCokeFull","bulk_itemSodaPepsiFull","bulk_FoodBaconCookedFull","bulk_17Rnd_9x19_glock17","bulk_15Rnd_9x19_M9SD","bulk_30Rnd_9x19_MP5SD","bulk_30Rnd_556x45_StanagSD","bulk_itemSandbag","bulk_itemTankTrap","bulk_itemWire","bulk_partGeneric"]
  23.  
  24. //////////////////////////////////////////////////////////////////
  25. // Medical Crates
  26. if (_type == "medical") then {
  27.     // load medical
  28.     _scount = count _medical;
  29.     for "_x" from 0 to 20 do {
  30.         _sSelect = floor(random _sCount);
  31.         _item = _medical select _sSelect;
  32.         _crate addMagazineCargoGlobal [_item,(round(random 4))];
  33.     };
  34. };
  35. ///////////////////////////////////////////////////////////////////
  36. // Food crate
  37. if (_type == "food") then {
  38.     //load food
  39.     _scount = count _food;
  40.     for "_x" from 0 to 20 do {
  41.         _sSelect = floor(random _sCount);
  42.         _item = _food select _sSelect;
  43.         _crate addMagazineCargoGlobal [_item,(round(random 4))];
  44.     };
  45. };
  46. ///////////////////////////////////////////////////////////////////
  47. // Weapon Crates
  48.  
  49. // Low weapons
  50. if (_type == "weaponsL") then {
  51.     // load grenades
  52.     _scount = count _gshellList;
  53.     for "_x" from 0 to 2 do {
  54.         _sSelect = floor(random _sCount);
  55.         _item = _gshellList select _sSelect;
  56.         _crate addMagazineCargoGlobal [_item,(round(random 2))];
  57.     };
  58.    
  59.     // load packs
  60.     _scount = count _bpackList;
  61.     for "_x" from 0 to 3 do {
  62.         _sSelect = floor(random _sCount);
  63.         _item = _bpackList select _sSelect;
  64.         _crate addBackpackCargoGlobal [_item,1];
  65.     };
  66.      
  67.     // load pistols
  68.     _scount = count DZMSpistolList;
  69.     for "_x" from 0 to 4 do {
  70.         _sSelect = floor(random _sCount);
  71.         _item = DZMSpistolList select _sSelect;
  72.         _crate addWeaponCargoGlobal [_item,1];
  73.         _ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
  74.         if (count _ammo > 0) then {
  75.             _crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
  76.         };
  77.     };
  78.  
  79.     //load sniper
  80.     _scount = count DZMSsniperList;
  81.     for "_x" from 0 to 3 do {
  82.         _sSelect = floor(random _sCount);
  83.         _item = DZMSsniperList select _sSelect;
  84.         _crate addWeaponCargoGlobal [_item,1];
  85.         _ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
  86.         if (count _ammo > 0) then {
  87.             _crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
  88.         };
  89.     };
  90.  
  91.     //load lmg
  92.     _scount = count DZMSlmgList;
  93.     for "_x" from 0 to 3 do {
  94.         _sSelect = floor(random _sCount);
  95.         _item = DZMSlmgList select _sSelect;
  96.         _crate addWeaponCargoGlobal [_item,1];
  97.         _ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
  98.         if (count _ammo > 0) then {
  99.             _crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
  100.         };
  101.     };
  102.    
  103.     //load smg
  104.     _scount = count DZMSsmgList;
  105.     for "_x" from 0 to 5 do {
  106.         _sSelect = floor(random _sCount);
  107.         _item = DZMSsmgList select _sSelect;
  108.         _crate addWeaponCargoGlobal [_item,1];
  109.         _ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
  110.         if (count _ammo > 0) then {
  111.             _crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
  112.         };
  113.     };
  114.    
  115.     //load shotguns
  116.     _scount = count DZMSShotgunList;
  117.     for "_x" from 0 to 5 do {
  118.         _sSelect = floor(random _sCount);
  119.         _item = DZMSShotgunList select _sSelect;
  120.         _crate addWeaponCargoGlobal [_item,1];
  121.         _ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
  122.         if (count _ammo > 0) then {
  123.             _crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
  124.         };
  125.     };
  126.  
  127.     //load primary
  128.     _scount = count DZMSprimaryList;
  129.     for "_x" from 0 to 10 do {
  130.         _sSelect = floor(random _sCount);
  131.         _item = DZMSprimaryList select _sSelect;
  132.         _crate addWeaponCargoGlobal [_item,1];
  133.         _ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
  134.         if (count _ammo > 0) then {
  135.             _crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
  136.         };
  137.     };
  138. };
  139.  
  140. // Medium weapons
  141. if (_type == "weaponsM") then {
  142.     // load grenades
  143.     _scount = count _gshellList;
  144.     for "_x" from 0 to 5 do {
  145.         _sSelect = floor(random _sCount);
  146.         _item = _gshellList select _sSelect;
  147.         _crate addMagazineCargoGlobal [_item,(round(random 2))];
  148.     };
  149.    
  150.     // load packs
  151.     _scount = count _bpackList;
  152.     for "_x" from 0 to 5 do {
  153.         _sSelect = floor(random _sCount);
  154.         _item = _bpackList select _sSelect;
  155.         _crate addBackpackCargoGlobal [_item,1];
  156.     };
  157.      
  158.     // load pistols
  159.     _scount = count DZMSpistolList;
  160.     for "_x" from 0 to 6 do {
  161.         _sSelect = floor(random _sCount);
  162.         _item = DZMSpistolList select _sSelect;
  163.         _crate addWeaponCargoGlobal [_item,1];
  164.         _ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
  165.         if (count _ammo > 0) then {
  166.             _crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
  167.         };
  168.     };
  169.  
  170.     //load sniper
  171.     _scount = count DZMSsniperList;
  172.     for "_x" from 0 to 5 do {
  173.         _sSelect = floor(random _sCount);
  174.         _item = DZMSsniperList select _sSelect;
  175.         _crate addWeaponCargoGlobal [_item,1];
  176.         _ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
  177.         if (count _ammo > 0) then {
  178.             _crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
  179.         };
  180.     };
  181.  
  182.     //load lmg
  183.     _scount = count DZMSlmgList;
  184.     for "_x" from 0 to 5 do {
  185.         _sSelect = floor(random _sCount);
  186.         _item = DZMSlmgList select _sSelect;
  187.         _crate addWeaponCargoGlobal [_item,1];
  188.         _ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
  189.         if (count _ammo > 0) then {
  190.             _crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
  191.         };
  192.     };
  193.    
  194.     //load sniper high cal
  195.     _scount = count DZMSHighCalSniperList;
  196.     for "_x" from 0 to 2 do {
  197.         _sSelect = floor(random _sCount);
  198.         _item = DZMSHighCalSniperList select _sSelect;
  199.         _crate addWeaponCargoGlobal [_item,1];
  200.         _ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
  201.         if (count _ammo > 0) then {
  202.             _crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
  203.         };
  204.     };
  205.    
  206.  
  207.     //load primary
  208.     _scount = count DZMSprimaryList;
  209.     for "_x" from 0 to 20 do {
  210.         _sSelect = floor(random _sCount);
  211.         _item = DZMSprimaryList select _sSelect;
  212.         _crate addWeaponCargoGlobal [_item,1];
  213.         _ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
  214.         if (count _ammo > 0) then {
  215.             _crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
  216.         };
  217.     };
  218. };
  219.  
  220.  
  221. // High weapons
  222. if (_type == "weaponsH") then {
  223.     // load grenades
  224.     _scount = count _gshellList;
  225.     for "_x" from 0 to 10 do {
  226.         _sSelect = floor(random _sCount);
  227.         _item = _gshellList select _sSelect;
  228.         _crate addMagazineCargoGlobal [_item,(round(random 2))];
  229.     };
  230.    
  231.     // load packs
  232.     _scount = count _bpackList;
  233.     for "_x" from 0 to 10 do {
  234.         _sSelect = floor(random _sCount);
  235.         _item = _bpackList select _sSelect;
  236.         _crate addBackpackCargoGlobal [_item,1];
  237.     };
  238.      
  239.     //load sniper
  240.     _scount = count DZMSsniperList;
  241.     for "_x" from 0 to 10 do {
  242.         _sSelect = floor(random _sCount);
  243.         _item = DZMSsniperList select _sSelect;
  244.         _crate addWeaponCargoGlobal [_item,1];
  245.         _ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
  246.         if (count _ammo > 0) then {
  247.             _crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
  248.         };
  249.     };
  250.  
  251.     //load lmg
  252.     _scount = count DZMSlmgList;
  253.     for "_x" from 0 to 10 do {
  254.         _sSelect = floor(random _sCount);
  255.         _item = DZMSlmgList select _sSelect;
  256.         _crate addWeaponCargoGlobal [_item,1];
  257.         _ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
  258.         if (count _ammo > 0) then {
  259.             _crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
  260.         };
  261.     };
  262.    
  263.     //load sniper high cal
  264.     _scount = count DZMSHighCalSniperList;
  265.     for "_x" from 0 to 5 do {
  266.         _sSelect = floor(random _sCount);
  267.         _item = DZMSHighCalSniperList select _sSelect;
  268.         _crate addWeaponCargoGlobal [_item,1];
  269.         _ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
  270.         if (count _ammo > 0) then {
  271.             _crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
  272.         };
  273.     };
  274.    
  275.     //load thermals
  276.     _scount = count DZMSThermalList;
  277.     for "_x" from 0 to 1 do {
  278.         _sSelect = floor(random _sCount);
  279.         _item = DZMSThermalList select _sSelect;
  280.         _crate addWeaponCargoGlobal [_item,1];
  281.         _ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
  282.         if (count _ammo > 0) then {
  283.             _crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
  284.         };
  285.     };
  286.    
  287.     //load explosive
  288.     _scount = count DZMSExpWeapList;
  289.     for "_x" from 0 to 2 do {
  290.         _sSelect = floor(random _sCount);
  291.         _item = DZMSExpWeapList select _sSelect;
  292.         _crate addWeaponCargoGlobal [_item,1];
  293.         _ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
  294.         if (count _ammo > 0) then {
  295.             _crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
  296.         };
  297.     };
  298.    
  299.  
  300.     //load primary
  301.     _scount = count DZMSprimaryList;
  302.     for "_x" from 0 to 30 do {
  303.         _sSelect = floor(random _sCount);
  304.         _item = DZMSprimaryList select _sSelect;
  305.         _crate addWeaponCargoGlobal [_item,1];
  306.         _ammo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
  307.         if (count _ammo > 0) then {
  308.             _crate addMagazineCargoGlobal [(_ammo select 0),(round(random 8))];
  309.         };
  310.     };
  311. };
  312. ///////////////////////////////////////////////////////////////////
  313. // Epoch Supply Crates
  314.  
  315. //low supplies
  316. if (_type == "supplyL") then {
  317.     // load tools
  318.     _scount = count DZMSConTools;
  319.     for "_x" from 0 to 2 do {
  320.         _sSelect = floor(random _sCount);
  321.         _item = DZMSConTools select _sSelect;
  322.         _crate addWeaponCargoGlobal [_item, 1];
  323.     };
  324.    
  325.     // load supplies
  326.     _scount = count DZMSConSupply;
  327.     for "_x" from 0 to 15 do {
  328.         _sSelect = floor(random _sCount);
  329.         _item = DZMSConSupply select _sSelect;
  330.         _crate addMagazineCargoGlobal [_item,(round(random 2))];
  331.     };
  332.    
  333.     // load structures
  334.     _scount = count DZMSConStructures;
  335.     for "_x" from 0 to 10 do {
  336.         _sSelect = floor(random _sCount);
  337.         _item = DZMSConStructures select _sSelect;
  338.         _crate addMagazineCargoGlobal [_item,(round(random 2))];
  339.     };
  340.    
  341.     // load bulk
  342.     _scount = count _bulk;
  343.     for "_x" from 0 to 5 do {
  344.         _sSelect = floor(random _sCount);
  345.         _item = _bulk select _sSelect;
  346.         _crate addMagazineCargoGlobal [_item,(round(random 2))];
  347.     };
  348.    
  349.     // load money
  350.     _scount = count _money;
  351.     for "_x" from 0 to 10 do {
  352.         _sSelect = floor(random _sCount);
  353.         _item = _money select _sSelect;
  354.         _crate addMagazineCargoGlobal [_item,(round(random 2))];
  355.     };
  356. };
  357.  
  358. //medium supplies
  359. if (_type == "supplyM") then {
  360.     // load tools
  361.     _scount = count DZMSConTools;
  362.     for "_x" from 0 to 5 do {
  363.         _sSelect = floor(random _sCount);
  364.         _item = DZMSConTools select _sSelect;
  365.         _crate addWeaponCargoGlobal [_item, 1];
  366.     };
  367.    
  368.     // load supplies
  369.     _scount = count DZMSConSupply;
  370.     for "_x" from 0 to 20 do {
  371.         _sSelect = floor(random _sCount);
  372.         _item = DZMSConSupply select _sSelect;
  373.         _crate addMagazineCargoGlobal [_item,(round(random 2))];
  374.     };
  375.    
  376.     // load structures
  377.     _scount = count DZMSConStructures;
  378.     for "_x" from 0 to 15 do {
  379.         _sSelect = floor(random _sCount);
  380.         _item = DZMSConStructures select _sSelect;
  381.         _crate addMagazineCargoGlobal [_item,(round(random 2))];
  382.     };
  383.    
  384.     // load bulk
  385.     _scount = count _bulk;
  386.     for "_x" from 0 to 10 do {
  387.         _sSelect = floor(random _sCount);
  388.         _item = _bulk select _sSelect;
  389.         _crate addMagazineCargoGlobal [_item,(round(random 2))];
  390.     };
  391.    
  392.     // load money
  393.     _scount = count _money;
  394.     for "_x" from 0 to 15 do {
  395.         _sSelect = floor(random _sCount);
  396.         _item = _money select _sSelect;
  397.         _crate addMagazineCargoGlobal [_item,(round(random 2))];
  398.     };
  399.    
  400.     // load rare
  401.     _scount = count _rare;
  402.     for "_x" from 0 to 2 do {
  403.         _sSelect = floor(random _sCount);
  404.         _item = _rare select _sSelect;
  405.         _crate addMagazineCargoGlobal [_item,1];
  406.     };
  407. };
  408.  
  409. //high supplies
  410. if (_type == "supplyH") then {
  411.     // load tools
  412.     _scount = count DZMSConTools;
  413.     for "_x" from 0 to 10 do {
  414.         _sSelect = floor(random _sCount);
  415.         _item = DZMSConTools select _sSelect;
  416.         _crate addWeaponCargoGlobal [_item, 1];
  417.     };
  418.    
  419.     // load supplies
  420.     _scount = count DZMSConSupply;
  421.     for "_x" from 0 to 40 do {
  422.         _sSelect = floor(random _sCount);
  423.         _item = DZMSConSupply select _sSelect;
  424.         _crate addMagazineCargoGlobal [_item,(round(random 2))];
  425.     };
  426.    
  427.     // load structures
  428.     _scount = count DZMSConStructures;
  429.     for "_x" from 0 to 30 do {
  430.         _sSelect = floor(random _sCount);
  431.         _item = DZMSConStructures select _sSelect;
  432.         _crate addMagazineCargoGlobal [_item,(round(random 2))];
  433.     };
  434.    
  435.     // load bulk
  436.     _scount = count _bulk;
  437.     for "_x" from 0 to 20 do {
  438.         _sSelect = floor(random _sCount);
  439.         _item = _bulk select _sSelect;
  440.         _crate addMagazineCargoGlobal [_item,(round(random 2))];
  441.     };
  442.    
  443.     // load money
  444.     _scount = count _money;
  445.     for "_x" from 0 to 20 do {
  446.         _sSelect = floor(random _sCount);
  447.         _item = _money select _sSelect;
  448.         _crate addMagazineCargoGlobal [_item,(round(random 2))];
  449.     };
  450.    
  451.     // load rare
  452.     _scount = count _rare;
  453.     for "_x" from 0 to 5 do {
  454.         _sSelect = floor(random _sCount);
  455.         _item = _rare select _sSelect;
  456.         _crate addMagazineCargoGlobal [_item,1];
  457.     };
  458. };
  459. ///////////////////////////////////////////////////////////////////
  460. // Epoch Money Crates
  461. if (_type == "money") then {
  462.     // load money
  463.     _scount = count _money;
  464.     for "_x" from 0 to 30 do {
  465.         _sSelect = floor(random _sCount);
  466.         _item = _money select _sSelect;
  467.         _crate addMagazineCargoGlobal [_item,(round(random 2))];
  468.     };
  469.    
  470.     // load rare
  471.     _scount = count _money;
  472.     for "_x" from 0 to 5 do {
  473.         _sSelect = floor(random _sCount);
  474.         _item = _money select _sSelect;
  475.         _crate addMagazineCargoGlobal [_item,1];
  476.     };
  477.    
  478.     // load documents
  479.     _scount = count _money;
  480.     for "_x" from 0 to 10 do {
  481.         _sSelect = floor(random _sCount);
  482.         _item = _money select _sSelect;
  483.         _crate addMagazineCargoGlobal [_item,4];
  484.     };
  485. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement