Advertisement
Guest User

Supplyitems.sqf

a guest
Apr 25th, 2014
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.03 KB | None | 0 0
  1. private ["_spawnChance", "_spawnMarker", "_spawnRadius", "_markerRadius", "_item", "_debug", "_start_time", "_loot", "_loot_amount", "_loot_box", "_wait_time", "_spawnRoll", "_position", "_event_marker", "_loot_pos", "_debug_marker","_loot_box", "_hint"];
  2.  
  3. _spawnChance = 0.75; // Percentage chance of event happening
  4. _markerRadius = 350; // Radius the loot can spawn and used for the marker
  5. _debug = false; // Puts a marker exactly were the loot spawns
  6.  
  7. _loot_box = "SpecialWeaponsBox";
  8. _loot_lists = [
  9. [
  10. ["M9SD"],
  11. ["15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","ItemSodaCoke","ItemSodaCoke","ItemSodaCoke","ItemSodaCoke","ItemSodaPepsi","ItemSodaPepsi","ItemSodaPepsi","ItemSodaPepsi","FoodCanBakedBeans","FoodCanBakedBeans","FoodCanBakedBeans","FoodCanBakedBeans","FoodCanPasta","FoodCanPasta","FoodCanPasta","FoodCanPasta","FoodCanSardines","FoodCanSardines","FoodCanSardines","FoodCanSardines","FoodMRE","FoodMRE","FoodMRE","FoodMRE","FoodMRE"]
  12. ],
  13. [
  14. ["M9SD"],
  15. ["15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","ItemSodaRbull","ItemSodaR4z0r","ItemSodaRbull","ItemSodaR4z0r","ItemSodaRbull","ItemSodaR4z0r","ItemSodaRbull","ItemSodaR4z0r","FoodbaconCooked","FoodchickenCooked","FoodbaconCooked","FoodchickenCooked","FoodbaconCooked","FoodchickenCooked","FoodbaconCooked","FoodchickenCooked","FoodbaconCooked","FoodchickenCooked","FoodbaconCooked","FoodchickenCooked","FoodbaconCooked","FoodchickenCooked"]
  16. ],
  17. [
  18. ["M9SD"],
  19. ["15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","ItemSodaRbull"]
  20. ],
  21. [
  22. ["M9SD"],
  23. ["15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","ItemSodaRbull"]
  24. ],
  25. [
  26. ["M9SD"],
  27. ["15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","ItemSodaRbull"]
  28. ],
  29. [
  30. ["M9SD"],
  31. ["15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","ItemSodaRbull"]
  32. ],
  33. [
  34. ["M9SD"],
  35. ["15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","ItemSodaRbull"]
  36. ],
  37. [
  38. ["M9SD"],
  39. ["15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","ItemSodaRbull"]
  40. ],
  41. [
  42. ["M9SD"],
  43. ["15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","Skin_Camo1_DZ","Skin_CZ_Soldier_Sniper_EP1_DZ","Skin_CZ_Special_Forces_GL_DES_EP1_DZ","Skin_Drake_Light_DZ","Skin_FR_OHara_DZ","Skin_FR_Rodriguez_DZ","Skin_Graves_Light_DZ","Skin_Sniper1_DZ","Skin_Soldier1_DZ","Skin_Soldier_Bodyguard_AA12_PMC_DZ"]
  44. ],
  45. [
  46. ["M9SD"],
  47. ["15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","Skin_Functionary1_EP1_DZ","Skin_Pilot_EP1_DZ","Skin_Priest_DZ","Skin_Rocker1_DZ","Skin_Rocker2_DZ","Skin_RU_Policeman_DZ","Skin_RU_Policeman_DZ","Skin_Pilot_EP1_DZ","Skin_Functionary1_EP1_DZ","Skin_Priest_DZ"]
  48. ],
  49. [
  50. ["M9SD"],
  51. ["15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","Skin_Bandit1_DZ","Skin_Bandit2_DZ","Skin_BanditW1_DZ","Skin_GUE_Commander_DZ","kin_GUE_Soldier_2_DZ","Skin_GUE_Soldier_Crew_DZ","Skin_GUE_Soldier_Sniper_DZ","Skin_Ins_Soldier_GL_DZ","Skin_TK_INS_Soldier_EP1_DZ","Skin_TK_INS_Warlord_EP1_DZ","Skin_GUE_Commander_DZ"]
  52. ],
  53. [
  54. ["M9SD"],
  55. ["15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","ItemAntibiotic","ItemBandage","ItemBloodbag","ItemEpinephrine","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemBandage","ItemBandage","ItemMorphine","ItemAntibiotic","ItemBandage","ItemBloodbag","ItemEpinephrine","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemSodaCoke","ItemSodaCoke","ItemSodaCoke","ItemSodaPepsi","ItemSodaPepsi","ItemSodaPepsi","ItemSodaPepsi","FoodCanBakedBeans","FoodCanBakedBeans","FoodCanBakedBeans","FoodCanBakedBeans","FoodCanPasta","FoodCanPasta","FoodCanPasta","FoodCanPasta","FoodCanSardines","FoodCanSardines","FoodCanSardines","FoodCanSardines","FoodMRE","FoodMRE","FoodMRE","FoodMRE","FoodMRE","ItemBandage","ItemBandage","ItemMorphine","ItemAntibiotic","ItemBandage","ItemBloodbag","ItemEpinephrine","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemBandage","ItemBandage","ItemMorphine","ItemTent","ItemJerrycan","ItemTent","ItemJerrycan","ItemTent","ItemJerrycan"]
  56. ],
  57. [
  58. ["M9SD"],
  59. ["15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","ItemAntibiotic","ItemBandage","ItemBloodbag","ItemEpinephrine","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemBandage","ItemBandage","ItemMorphine","ItemAntibiotic","ItemBandage","ItemBloodbag","ItemEpinephrine","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemBandage","ItemBandage","ItemMorphine","ItemAntibiotic","ItemBandage","ItemBloodbag","ItemEpinephrine","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemBandage","ItemBandage","ItemMorphine","ItemAntibiotic","ItemBandage","ItemBloodbag","ItemEpinephrine","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemBandage","ItemBandage","ItemMorphine","ItemAntibiotic","ItemBandage","ItemBloodbag","ItemEpinephrine","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemBandage","ItemBandage","ItemMorphine","ItemAntibiotic","ItemBandage","ItemBloodbag","ItemEpinephrine","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemBandage","ItemBandage","ItemMorphine","ItemAntibiotic","ItemBandage","ItemBloodbag","ItemEpinephrine","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemBandage","ItemBandage","ItemMorphine"]
  60. ]
  61. ];
  62. _loot = _loot_lists call BIS_fnc_selectRandom;
  63.  
  64. _loot_amount = 75;
  65. _wait_time = 900;
  66.  
  67. // Dont mess with theses unless u know what yours doing
  68. _start_time = time;
  69. _spawnRadius = 5000;
  70. _spawnMarker = 'center';
  71.  
  72. if (isNil "EPOCH_EVENT_RUNNING") then {
  73. EPOCH_EVENT_RUNNING = false;
  74. };
  75.  
  76. // Check for another event running
  77. if (EPOCH_EVENT_RUNNING) exitWith {
  78. diag_log("Event already running");
  79. };
  80.  
  81. // Random chance of event happening
  82. _spawnRoll = random 1;
  83. if (_spawnRoll > _spawnChance and !_debug) exitWith {};
  84.  
  85. // Random location
  86. _position = [getMarkerPos _spawnMarker,0,_spawnRadius,10,0,2000,0] call BIS_fnc_findSafePos;
  87.  
  88. diag_log(format["Spawning loot event at %1", _position]);
  89.  
  90. _event_marker = createMarker [ format ["loot_event_marker_%1", _start_time], _position];
  91. _event_marker setMarkerShape "ELLIPSE";
  92. _event_marker setMarkerColor "ColorBlue";
  93. _event_marker setMarkerAlpha 0.5;
  94. _event_marker setMarkerSize [(_markerRadius + 50), (_markerRadius + 50)];
  95.  
  96. _loot_pos = [_position,0,(_markerRadius - 100),10,0,2000,0] call BIS_fnc_findSafePos;
  97.  
  98. if (_debug) then {
  99. _debug_marker = createMarker [ format ["loot_event_debug_marker_%1", _start_time], _loot_pos];
  100. _debug_marker setMarkerShape "ICON";
  101. _debug_marker setMarkerType "mil_dot";
  102. _debug_marker setMarkerColor "ColorBlue";
  103. _debug_marker setMarkerAlpha 1;
  104. };
  105.  
  106. diag_log(format["Creating ammo box at %1", _loot_pos]);
  107.  
  108. // Create ammo box
  109. _loot_box = createVehicle [_loot_box,_loot_pos,[], 0, "NONE"];
  110. clearMagazineCargoGlobal _loot_box;
  111. clearWeaponCargoGlobal _loot_box;
  112.  
  113. // Cut the grass around the loot position
  114. _clutter = createVehicle ["ClutterCutter_small_2_EP1", _loot_pos, [], 0, "CAN_COLLIDE"];
  115. _clutter setPos _loot_pos;
  116. // cut the grass end
  117.  
  118. // Add loot
  119. {
  120. _loot_box addWeaponCargoGlobal [_x,1];
  121. } forEach (_loot select 0);
  122. {
  123. _loot_box addMagazineCargoGlobal [_x,1];
  124. } forEach (_loot select 1);
  125.  
  126. [nil,nil,rTitleText,"UN Agency drops life-saving supplies for Survivors, Check your Map for the Location!", "PLAIN",10] call RE;
  127.  
  128. diag_log(format["Loot event setup, waiting for %1 seconds", _wait_time]);
  129.  
  130. // Wait
  131. sleep _wait_time;
  132.  
  133. // Clean up
  134. EPOCH_EVENT_RUNNING = false;
  135. deleteVehicle _loot_box;
  136. deleteMarker _event_marker;
  137. if (_debug) then {
  138. deleteMarker _debug_marker;
  139. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement