Guest User

wrecks 1340 15jan13

a guest
Jan 15th, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.06 KB | None | 0 0
  1. private["_position","_veh","_num","_config","_itemType","_itemChance","_weights","_index","_iArray"];
  2.  
  3. waitUntil{!isNil "BIS_fnc_selectRandom"};
  4. if (isDedicated) then {
  5. _position = [getMarkerPos "center",0,7000,10,0,2000,0] call BIS_fnc_findSafePos;
  6.  
  7. _randomvehicle = ["MV22Wreck","LADAWreck","BMP2Wreck","MH60Wreck","C130JWreck","Mi24Wreck","UralWreck","HMMWVWreck","T72Wreck"] call BIS_fnc_selectRandom;
  8. _vehicleloottype = ["Residential","Industrial","Military","Farm","Supermarket","Hospital"] call BIS_fnc_selectRandom;
  9.  
  10. _veh = createVehicle [_randomvehicle,_position, [], 0, "CAN_COLLIDE"];
  11. dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_veh];
  12. _veh setVariable ["ObjectID",1,true];
  13.  
  14. _num = round(random 3) + 3;
  15.  
  16. if (_randomvehicle == "UralWreck") then { _num = round(random 12) + 5; };
  17. if (_randomvehicle == "C130JWreck") then { _num = round(random 12) + 5; };
  18.  
  19. switch (_vehicleloottype) do {
  20. case "Military1": {
  21. _itemType = [[AK_107_kobra", "weapon"], [AK_107_pso", "weapon"], [bizon_silenced", "weapon"], [SVD_CAMO", "weapon"], [SVD_des_EP1", "weapon"], ["SVD_NSPU_EP1", "weapon"], ["KSVK", "weapon"], ["30Rnd_545x39_AK", "magazine"], ["10Rnd_762x54_SVD", "magazine"], ["5Rnd_127x108_KSVK", "magazine"], ["DZ_Patrol_Pack_EP1", "object"], ["DZ_Assault_Pack_EP1", "object"], ["Skin_Camo1_DZ", "magazine"], ["Skin_Soldier1_DZ", "magazine"], ["ItemEtool", "weapon"], ["ItemGPS", "weapon"], ["ItemFlashlightRed", "military"], ["ItemKnife", "military"], ["Binocular", "weapon"], ["binocular_vector", "weapon"], ["Laserdesignator", "object"], ["NVGoggles", "weapon"], ["Pipebomb", "weapon"], ["", "generic"], ["", "military"]];
  22. _itemChance = [0.15, 0.1, 0.04, 0.02, 0.02, 0.01, 0.01, 0.1, 0.04, 0.02, 0.03, 0.03, 0.04, 0.02, 0.04, 0.01, 0.03, 0.04, 0.06, 0.03, 0.01, 0.01, 0.15, 0.25, 0.24];
  23. };
  24. case "Residential1": {
  25. _itemType = [[AK_74, "weapon"], [AKS_74_pso, "weapon"], [AKS_74_Kobra, "weapon"], ["AKS_74_UN_kobra", "weapon"], ["RPK_74", "weapon"], ["SVD", "weapon"], ["Bizon", "weapon"], ["30Rnd_545x39_AK", "magazine"], ["10Rnd_762x54_SVD", "magazine"], ["64Rnd_9x19_Bizon", "magazine"], ["DZ_Patrol_Pack_EP1", "object"], ["DZ_Assault_Pack_EP1", "object"], ["Skin_Camo1_DZ", "magazine"], ["Skin_Soldier1_DZ", "magazine"], ["ItemEtool", "weapon"], ["ItemGPS", "weapon"], ["ItemFlashlightRed", "military"], ["ItemKnife", "military"], ["Binocular", "weapon"], ["binocular_vector", "weapon"], ["Laserdesignator", "object"], ["NVGoggles", "weapon"], ["Pipebomb", "weapon"], ["", "generic"], ["", "military"]];
  26. _itemChance = [0.15, 0.1, 0.04, 0.02, 0.02, 0.01, 0.01, 0.1, 0.04, 0.02, 0.03, 0.03, 0.04, 0.02, 0.04, 0.01, 0.03, 0.04, 0.06, 0.03, 0.01, 0.01, 0.15, 0.25, 0.24];
  27. };
  28. case "Industrial1": {
  29. _itemType = [["M4A1_Aim_camo", "weapon"], ["M4A1_HWS_GL_camo", "weapon"], ["M4A1_HWS_GL_SD_camo", "weapon"], ["M4A1_AIM_SD_camo", "weapon"], ["Mk_48", "weapon"], ["M40A3", "weapon"], ["BAF_LRR_scoped_W", "weapon"], ["30Rnd_556x45_Stanag", "magazine"], ["5Rnd_86x70_L115A1", "magazine"], ["100Rnd_762x51_M240", "magazine"], ["DZ_Patrol_Pack_EP1", "object"], ["DZ_Assault_Pack_EP1", "object"], ["Skin_Camo1_DZ", "magazine"], ["Skin_Soldier1_DZ", "magazine"], ["ItemEtool", "weapon"], ["ItemGPS", "weapon"], ["ItemFlashlightRed", "military"], ["ItemKnife", "military"], ["Binocular", "weapon"], ["binocular_vector", "weapon"], ["Laserdesignator", "object"], ["NVGoggles", "weapon"], ["Pipebomb", "object"], ["", "generic"], ["", "military"]];
  30. _itemChance = [0.15, 0.1, 0.02, 0.04, 0.02, 0.01, 0.01, 0.1, 0.04, 0.02, 0.03, 0.03, 0.04, 0.02, 0.04, 0.01, 0.03, 0.04, 0.06, 0.03, 0.01, 0.01, 0.15, 0.25, 0.24];
  31. };
  32. case "HeliCrash1": {
  33. _itemType = [["M16A4", "weapon"], ["M16A4_ACG_GL", "weapon"], ["M16A4_ACOG", "weapon"], ["M240", "weapon"], ["MP5SD", "weapon"], ["DMR", "weapon"], ["M24", "weapon"], ["30Rnd_556x45_Stanag", "magazine"], ["20Rnd_762x51_DMR", "magazine"], ["100Rnd_762x51_M240", "magazine"], ["DZ_Patrol_Pack_EP1", "object"], ["DZ_Assault_Pack_EP1", "object"], ["Skin_Camo1_DZ", "magazine"], ["Skin_Soldier1_DZ", "magazine"], ["ItemEtool", "weapon"], ["ItemGPS", "weapon"], ["ItemFlashlightRed", "military"], ["ItemKnife", "military"], ["Binocular", "weapon"], ["binocular_vector", "weapon"], ["Laserdesignator", "object"], ["NVGoggles", "weapon"], ["Pipebomb", "weapon"], ["", "generic"], ["", "military"]];
  34. _itemChance = [0.15, 0.1, 0.04, 0.02, 0.02, 0.01, 0.01, 0.1, 0.04, 0.02, 0.03, 0.03, 0.04, 0.02, 0.04, 0.01, 0.03, 0.04, 0.06, 0.03, 0.01, 0.01, 0.15, 0.25, 0.24];
  35. };
  36. case "Farm1": {
  37. itemType = [["BAF_L85A2_RIS_ACOG", "weapon"], ["BAF_L85A2_RIS_SUSAT", "weapon"], ["BAF_L86A2_ACOG", "weapon"], ["BAF_L110A1_Aim", "weapon"], ["M240", "weapon"], ["BAF_LRR_scoped_W", "weapon"], ["BAF_LRR_scoped", "weapon"], ["30Rnd_556x45_Stanag", "magazine"], ["100Rnd_762x51_M240", "magazine"], ["5Rnd_86x70_L115A1", "magazine"], ["DZ_Patrol_Pack_EP1", "object"], ["DZ_Assault_Pack_EP1", "object"], ["Skin_Camo1_DZ", "magazine"], ["Skin_Soldier1_DZ", "magazine"], ["ItemEtool", "weapon"], ["ItemGPS", "weapon"], ["ItemFlashlightRed", "military"], ["ItemKnife", "military"], ["Binocular", "weapon"], ["binocular_vector", "weapon"], ["Laserdesignator", "object"], ["NVGoggles", "weapon"], ["Pipebomb", "weapon"], ["", "generic"], ["", "military"]];
  38. itemChance = [0.15, 0.1, 0.04, 0.02, 0.02, 0.01, 0.01, 0.1, 0.04, 0.02, 0.03, 0.03, 0.04, 0.02, 0.04, 0.01, 0.03, 0.04, 0.06, 0.03, 0.01, 0.01, 0.15, 0.25, 0.24];
  39. };
  40. case "Supermarket1": {
  41. _itemType = [["M4A3_CCO_EP1", "weapon"], ["G36_camo", "weapon"], ["G36K", "weapon"], ["G36C", "weapon"], ["G36_c_SD_eotech", "weapon"], ["G36a", "weapon"], ["M107", "weapon"], ["30Rnd_556x45_Stanag", "magazine"], ["30Rnd_556x45_G36", "magazine"], ["30Rnd_556x45_G36SD", "magazine"], ["DZ_Patrol_Pack_EP1", "object"], ["DZ_Assault_Pack_EP1", "object"], ["Skin_Camo1_DZ", "magazine"], ["Skin_Soldier1_DZ", "magazine"], ["ItemEtool", "weapon"], ["ItemGPS", "weapon"], ["ItemFlashlightRed", "military"], ["ItemKnife", "military"], ["Binocular", "weapon"], ["binocular_vector", "weapon"], ["Laserdesignator", "object"], ["NVGoggles", "weapon"], ["Pipebomb", "weapon"], ["", "generic"], ["", "military"]];
  42. _itemChance = [0.15, 0.1, 0.04, 0.02, 0.02, 0.01, 0.01, 0.05, 0.09, 0.02, 0.03, 0.03, 0.04, 0.02, 0.04, 0.01, 0.03, 0.04, 0.06, 0.03, 0.01, 0.01, 0.15, 0.25, 0.24];
  43. };
  44. case "Hospital1": {
  45. _itemType = [["", "trash"], ["", "hospital"], ["MedBox0", "object"]];
  46. _itemChance = [0.2, 0.5, 0.5];
  47. };
  48. };
  49.  
  50. diag_log("DEBUG: Spawning a " + str (_randomvehicle) + " at " + str(_position) + " with loot type " + str(_vehicleloottype) + " With total loot drops = " + str(_num));
  51.  
  52. waituntil {!isnil "fnc_buildWeightedArray"};
  53.  
  54. _weights = [];
  55. _weights = [_itemType,_itemChance] call fnc_buildWeightedArray;
  56. for "_x" from 1 to _num do {
  57. _index = _weights call BIS_fnc_selectRandom;
  58. sleep 1;
  59. if (count _itemType > _index) then {
  60. _iArray = _itemType select _index;
  61. _iArray set [2,_position];
  62. _iArray set [3,10];
  63. _iArray call spawn_loot;
  64. _nearby = _position nearObjects ["WeaponHolder",20];
  65. {
  66. _x setVariable ["permaLoot",true];
  67. } forEach _nearBy;
  68. };
  69. };
  70. };
Advertisement
Add Comment
Please, Sign In to add comment