Advertisement
Guest User

Treasure.sqf

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