Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private["_position","_veh","_num","_config","_itemType","_itemChance","_weights","_index","_iArray"];
- waitUntil{!isNil "BIS_fnc_selectRandom"};
- if (isDedicated) then {
- _position = [getMarkerPos "center",0,7000,10,0,2000,0] call BIS_fnc_findSafePos;
- _randomvehicle = ["MV22Wreck","LADAWreck","BMP2Wreck","MH60Wreck","C130JWreck","Mi24Wreck","UralWreck","HMMWVWreck","T72Wreck"] call BIS_fnc_selectRandom;
- _vehicleloottype = ["Residential","Industrial","Military","Farm","Supermarket","Hospital"] call BIS_fnc_selectRandom;
- _veh = createVehicle [_randomvehicle,_position, [], 0, "CAN_COLLIDE"];
- dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_veh];
- _veh setVariable ["ObjectID",1,true];
- _num = round(random 3) + 3;
- if (_randomvehicle == "UralWreck") then { _num = round(random 12) + 5; };
- if (_randomvehicle == "C130JWreck") then { _num = round(random 12) + 5; };
- switch (_vehicleloottype) do {
- case "Military1": {
- _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"]];
- _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];
- };
- case "Residential1": {
- _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"]];
- _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];
- };
- case "Industrial1": {
- _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"]];
- _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];
- };
- case "HeliCrash1": {
- _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"]];
- _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];
- };
- case "Farm1": {
- 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"]];
- 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];
- };
- case "Supermarket1": {
- _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"]];
- _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];
- };
- case "Hospital1": {
- _itemType = [["", "trash"], ["", "hospital"], ["MedBox0", "object"]];
- _itemChance = [0.2, 0.5, 0.5];
- };
- };
- diag_log("DEBUG: Spawning a " + str (_randomvehicle) + " at " + str(_position) + " with loot type " + str(_vehicleloottype) + " With total loot drops = " + str(_num));
- waituntil {!isnil "fnc_buildWeightedArray"};
- _weights = [];
- _weights = [_itemType,_itemChance] call fnc_buildWeightedArray;
- for "_x" from 1 to _num do {
- _index = _weights call BIS_fnc_selectRandom;
- sleep 1;
- if (count _itemType > _index) then {
- _iArray = _itemType select _index;
- _iArray set [2,_position];
- _iArray set [3,10];
- _iArray call spawn_loot;
- _nearby = _position nearObjects ["WeaponHolder",20];
- {
- _x setVariable ["permaLoot",true];
- } forEach _nearBy;
- };
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment