Advertisement
Guest User

Treasure.sqf

a guest
Apr 25th, 2014
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.14 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.45; // 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 = "GuerillaCacheBox";
  8. _loot_lists = [
  9. [
  10. ["revolver_gold_EP1"],
  11. ["6Rnd_45ACP","6Rnd_45ACP","6Rnd_45ACP","ItemSilverBar10oz","ItemSilverBar10oz","ItemSilverBar10oz","ItemSilverBar10oz","ItemSilverBar10oz","ItemSilverBar10oz","ItemSilverBar10oz","ItemSilverBar10oz","ItemSilverBar10oz","ItemSilverBar10oz","ItemSilverBar10oz"]
  12. ],
  13. [
  14. ["revolver_gold_EP1"],
  15. ["6Rnd_45ACP","6Rnd_45ACP","6Rnd_45ACP","ItemGoldBar10oz","ItemGoldBar10oz","ItemGoldBar10oz","ItemGoldBar10oz","ItemGoldBar10oz","ItemGoldBar10oz","ItemGoldBar10oz"]
  16. ],
  17. [
  18. ["revolver_gold_EP1"],
  19. ["6Rnd_45ACP","6Rnd_45ACP","6Rnd_45ACP","ItemGoldBar","ItemGoldBar","ItemGoldBar","ItemGoldBar","ItemGoldBar","ItemGoldBar","ItemGoldBar","ItemGoldBar","ItemGoldBar","ItemGoldBar","ItemGoldBar","ItemGoldBar","ItemGoldBar","ItemGoldBar","ItemGoldBar","ItemGoldBar","ItemGoldBar"]
  20. ],
  21. [
  22. ["revolver_gold_EP1"],
  23. ["6Rnd_45ACP","6Rnd_45ACP","6Rnd_45ACP","ItemBriefcase100oz"]
  24. ],
  25. [
  26. ["revolver_gold_EP1"],
  27. ["6Rnd_45ACP","6Rnd_45ACP","6Rnd_45ACP","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar"]
  28. ],
  29. [
  30. ["revolver_gold_EP1"],
  31. ["6Rnd_45ACP","6Rnd_45ACP","6Rnd_45ACP","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar","ItemCopperBar"]
  32. ],
  33. [
  34. ["revolver_gold_EP1"],
  35. ["6Rnd_45ACP","6Rnd_45ACP","6Rnd_45ACP","ItemCopperBar","ItemCopperBar"]
  36. ],
  37. [
  38. ["revolver_gold_EP1"],
  39. ["6Rnd_45ACP","6Rnd_45ACP","6Rnd_45ACP","ItemCopperBar","ItemCopperBar"]
  40. ],
  41. [
  42. ["revolver_gold_EP1"],
  43. ["6Rnd_45ACP","6Rnd_45ACP","6Rnd_45ACP","ItemCopperBar","ItemCopperBar"]
  44. ],
  45. [
  46. ["revolver_gold_EP1"],
  47. ["6Rnd_45ACP","6Rnd_45ACP","6Rnd_45ACP","ItemCopperBar","ItemCopperBar"]
  48. ],
  49. [
  50. ["revolver_gold_EP1"],
  51. ["6Rnd_45ACP","6Rnd_45ACP","6Rnd_45ACP","ItemCopperBar","ItemCopperBar"]
  52. ],
  53. [
  54. ["revolver_gold_EP1"],
  55. ["6Rnd_45ACP","6Rnd_45ACP","6Rnd_45ACP","ItemGoldBar","ItemCopperBar","ItemGoldBar10oz","ItemSilverBar10oz","ItemTinBar","ItemSilverBar","ItemGoldBar","ItemCopperBar","ItemGoldBar10oz","ItemSilverBar10oz","ItemTinBar","ItemSilverBar"]
  56. ]
  57. ];
  58. _loot = _loot_lists call BIS_fnc_selectRandom;
  59.  
  60. _loot_amount = 75;
  61. _wait_time = 900;
  62.  
  63. // Dont mess with theses unless u know what yours doing
  64. _start_time = time;
  65. _spawnRadius = 5000;
  66. _spawnMarker = 'center';
  67.  
  68. if (isNil "EPOCH_EVENT_RUNNING") then {
  69. EPOCH_EVENT_RUNNING = false;
  70. };
  71.  
  72. // Check for another event running
  73. if (EPOCH_EVENT_RUNNING) exitWith {
  74. diag_log("Event already running");
  75. };
  76.  
  77. // Random chance of event happening
  78. _spawnRoll = random 1;
  79. if (_spawnRoll > _spawnChance and !_debug) exitWith {};
  80.  
  81. // Random location
  82. _position = [getMarkerPos _spawnMarker,0,_spawnRadius,10,0,2000,0] call BIS_fnc_findSafePos;
  83.  
  84. diag_log(format["Spawning loot event at %1", _position]);
  85.  
  86. _event_marker = createMarker [ format ["loot_event_marker_%1", _start_time], _position];
  87. _event_marker setMarkerShape "ELLIPSE";
  88. _event_marker setMarkerColor "ColorYellow";
  89. _event_marker setMarkerAlpha 0.5;
  90. _event_marker setMarkerSize [(_markerRadius + 50), (_markerRadius + 50)];
  91.  
  92. _loot_pos = [_position,0,(_markerRadius - 100),10,0,2000,0] call BIS_fnc_findSafePos;
  93.  
  94. if (_debug) then {
  95. _debug_marker = createMarker [ format ["loot_event_debug_marker_%1", _start_time], _loot_pos];
  96. _debug_marker setMarkerShape "ICON";
  97. _debug_marker setMarkerType "mil_dot";
  98. _debug_marker setMarkerColor "ColorYellow";
  99. _debug_marker setMarkerAlpha 1;
  100. };
  101.  
  102. diag_log(format["Creating ammo box at %1", _loot_pos]);
  103.  
  104. // Create ammo box
  105. _loot_box = createVehicle [_loot_box,_loot_pos,[], 0, "NONE"];
  106. clearMagazineCargoGlobal _loot_box;
  107. clearWeaponCargoGlobal _loot_box;
  108.  
  109. // Cut the grass around the loot position
  110. _clutter = createVehicle ["ClutterCutter_small_2_EP1", _loot_pos, [], 0, "CAN_COLLIDE"];
  111. _clutter setPos _loot_pos;
  112. // cut the grass end
  113.  
  114. // Add loot
  115. {
  116. _loot_box addWeaponCargoGlobal [_x,1];
  117. } forEach (_loot select 0);
  118. {
  119. _loot_box addMagazineCargoGlobal [_x,1];
  120. } forEach (_loot select 1);
  121.  
  122. 1
  123. diag_log(format["Loot event setup, waiting for %1 seconds", _wait_time]);
  124.  
  125. // Wait
  126. sleep _wait_time;
  127.  
  128. // Clean up
  129. EPOCH_EVENT_RUNNING = false;
  130. deleteVehicle _loot_box;
  131. deleteMarker _event_marker;
  132. if (_debug) then {
  133. deleteMarker _debug_marker;
  134. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement