Advertisement
Guest User

Treasure.sqf

a guest
Mar 23rd, 2014
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.79 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 = 500; // 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 = 1195;
  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. EPOCH_EVENT_RUNNING = true;
  82.  
  83. // Random location
  84. _position = [getMarkerPos _spawnMarker,0,_spawnRadius,10,0,2000,0] call BIS_fnc_findSafePos;
  85.  
  86. diag_log(format["Spawning loot event at %1", _position]);
  87.  
  88. // Configurate Marker - Refresh Marker Script by *hs-s.com | waTTe - www.banditparty.de
  89. _markerRadius = 250;
  90. _markershape = "ELLIPSE";
  91. _markercolor = "ColorYellow";
  92. _missiontype = 0; //0=EPOCH_EVENT_RUNNING 1=SPECIAL_EVENT_RUNNING
  93. _refreshmarker = [_position,_markerRadius,_markershape,_markercolor,_missiontype] execVM "\z\addons\dayz_server\modules\refreshmarker.sqf";
  94.  
  95. _loot_pos = [_position,0,(_markerRadius - 100),10,0,2000,0] call BIS_fnc_findSafePos;
  96.  
  97. if (_debug) then {
  98. _debug_marker = createMarker [ format ["loot_event_debug_marker_%1", _start_time], _loot_pos];
  99. _debug_marker setMarkerShape "ICON";
  100. _debug_marker setMarkerType "mil_dot";
  101. _debug_marker setMarkerColor "ColorYellow";
  102. _debug_marker setMarkerAlpha 1;
  103. };
  104.  
  105. diag_log(format["Creating ammo box at %1", _loot_pos]);
  106.  
  107. // Create ammo box
  108. _loot_box = createVehicle [_loot_box,_loot_pos,[], 0, "NONE"];
  109. clearMagazineCargoGlobal _loot_box;
  110. clearWeaponCargoGlobal _loot_box;
  111.  
  112. // Cut the grass around the loot position
  113. _clutter = createVehicle ["ClutterCutter_small_2_EP1", _loot_pos, [], 0, "CAN_COLLIDE"];
  114. _clutter setPos _loot_pos;
  115. // cut the grass end
  116.  
  117. // Add loot
  118. {
  119. _loot_box addWeaponCargoGlobal [_x,1];
  120. } forEach (_loot select 0);
  121. {
  122. _loot_box addMagazineCargoGlobal [_x,1];
  123. } forEach (_loot select 1);
  124.  
  125. // Send Top Right message to users , requires Remote message script
  126. _hint = parseText format["<t align='center' color='#FFFF66' shadow='2' size='1.75'>Treasure Crate</t><br/><t align='center' color='#ffffff'>Bandits or Pirates? We found their treasure, Check your Map for the Location!</t>"];
  127. customRemoteMessage = ['hint', _hint];
  128. publicVariable "customRemoteMessage";
  129.  
  130. // Send center message to users
  131. //[nil,nil,rTitleText,"Bandits or Pirates? We found their treasure, Check your Map for the Location!", "PLAIN",10] call RE;
  132.  
  133. diag_log(format["Loot event setup, waiting for %1 seconds", _wait_time]);
  134.  
  135. // Wait
  136. sleep _wait_time;
  137.  
  138. // Clean up
  139. EPOCH_EVENT_RUNNING = false;
  140. deleteVehicle _loot_box;
  141. deleteMarker _event_marker;
  142. if (_debug) then {
  143. deleteMarker _debug_marker;
  144. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement