Advertisement
Guest User

ammobox.sqf

a guest
Sep 2nd, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 4.89 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.50; // Percentage chance of event happening
  4. _markerRadius = 400; // Radius the loot can spawn and used for the marker
  5. _debug = true; // Puts a marker exactly were the loot spawns
  6.  
  7. _loot_box = "RUBasicWeaponsBox";
  8. _loot_lists = [
  9. [
  10. ["G36_C_SD_camo","FN_FAL_ANPVS4","SCAR_H_LNG_Sniper_SD","G36K_camo"],
  11. ["ItemPainkiller","ItemMorphine","ItemBandage","ItemBloodbag", "ItemAntibiotic","ItemEpinephrine","ItemBriefcase100oz","PipeBomb","PipeBomb","PipeBomb","PipeBomb","SmokeShellYellow","SmokeShellRed","SmokeShellGreen","SmokeShellPurple","SmokeShellBlue","SmokeShellOrange","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","20Rnd_762x51_FNFAL","20Rnd_762x51_FNFAL","20Rnd_762x51_FNFAL","20Rnd_762x51_FNFAL","20Rnd_762x51_SB_SCAR","20Rnd_762x51_SB_SCAR","20Rnd_762x51_SB_SCAR","20Rnd_762x51_SB_SCAR"]
  12. ],
  13. [
  14. ["M4A1","M4A3_CCO_EP1","M8_sharpshooter","M40A3"],
  15. ["ItemPainkiller","ItemMorphine","ItemBandage","ItemBloodbag", "ItemAntibiotic","ItemEpinephrine","ItemBriefcase100oz","PipeBomb","PipeBomb","PipeBomb","PipeBomb","SmokeShellYellow","SmokeShellRed","SmokeShellGreen","SmokeShellPurple","SmokeShellBlue","SmokeShellOrange","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","5Rnd_762x51_M24","5Rnd_762x51_M24","5Rnd_762x51_M24","5Rnd_762x51_M24"]
  16. ],
  17. [
  18. ["BAF_LRR_scoped","VSS_vintorez","DMR"],
  19. ["ItemPainkiller","ItemMorphine","ItemBandage","ItemBloodbag", "ItemAntibiotic","ItemEpinephrine","ItemBriefcase100oz","PipeBomb","PipeBomb","PipeBomb","PipeBomb","SmokeShellYellow","SmokeShellRed","SmokeShellGreen","SmokeShellPurple","SmokeShellBlue","SmokeShellOrange","5Rnd_86x70_L115A1","5Rnd_86x70_L115A1","5Rnd_86x70_L115A1","5Rnd_86x70_L115A1""20Rnd_9x39_SP5_VSS","20Rnd_9x39_SP5_VSS","20Rnd_9x39_SP5_VSS","20Rnd_9x39_SP5_VSS","20Rnd_762x51_DMR","20Rnd_762x51_DMR","20Rnd_762x51_DMR","20Rnd_762x51_DMR"]
  20. ]
  21. ];
  22. _loot = _loot_lists call BIS_fnc_selectRandom;
  23.  
  24. _loot_amount = 75;
  25. _wait_time = 900;
  26.  
  27. // Dont mess with theses unless u know what yours doing
  28. _start_time = time;
  29. _spawnRadius = 5000;
  30. _spawnMarker = 'center';
  31.  
  32. if (isNil "EPOCH_EVENT_RUNNING") then {
  33.     EPOCH_EVENT_RUNNING = false;
  34. };
  35.  
  36. // Check for another event running
  37. if (EPOCH_EVENT_RUNNING) exitWith {
  38.     diag_log("Event already running");
  39. };
  40.  
  41. // Random chance of event happening
  42. _spawnRoll = random 1;
  43. if (_spawnRoll > _spawnChance and !_debug) exitWith {};
  44.  
  45. // Random location
  46. _position = [getMarkerPos _spawnMarker,0,_spawnRadius,10,0,2000,0] call BIS_fnc_findSafePos;
  47.  
  48. diag_log(format["Spawning loot event at %1", _position]);
  49.  
  50. _event_marker = createMarker [ format ["loot_event_marker_%1", _start_time], _position];
  51. _event_marker setMarkerShape "ELLIPSE";
  52. _event_marker setMarkerColor "ColorRed";
  53. _event_marker setMarkerAlpha 0.5;
  54. _event_marker setMarkerSize [(_markerRadius + 50), (_markerRadius + 50)];
  55.  
  56. _loot_pos = [_position,0,(_markerRadius - 100),10,0,2000,0] call BIS_fnc_findSafePos;
  57.  
  58. if (_debug) then {
  59.     _debug_marker = createMarker [ format ["loot_event_debug_marker_%1", _start_time], _loot_pos];
  60.     _debug_marker setMarkerShape "ICON";
  61.     _debug_marker setMarkerType "mil_dot";
  62.     _debug_marker setMarkerColor "ColorBlue";
  63.     _debug_marker setMarkerAlpha 1;
  64. };
  65.  
  66. diag_log(format["Creating ammo box at %1", _loot_pos]);
  67.  
  68. // Create ammo box
  69. _loot_box = createVehicle [_loot_box,_loot_pos,[], 0, "NONE"];
  70. clearMagazineCargoGlobal _loot_box;
  71. clearWeaponCargoGlobal _loot_box;
  72.  
  73. // Cut the grass around the loot position
  74. _clutter = createVehicle ["ClutterCutter_small_2_EP1", _loot_pos, [], 0, "CAN_COLLIDE"];
  75. _clutter setPos _loot_pos;
  76. // cut the grass    end
  77.  
  78. // Add loot
  79. {
  80. _loot_box addWeaponCargoGlobal [_x,1];
  81. } forEach (_loot select 0);
  82. {
  83. _loot_box addMagazineCargoGlobal [_x,1];
  84. } forEach (_loot select 1);
  85.  
  86. // Send message to users (http://dayzepoch.com/forum/index.php?/topic/1026-server-side-hintglobalchat-fix-deathmsg-fix/)
  87. _hint = parseText format["<t align='center' color='#52bf90' shadow='2' size='1.75'>Weapon Box Mission</t><br/><t align='center' color='#ffffff'>A weaponbox has been located within the shaded area on the map, you have 15 minutes to grab the loot</t>"];
  88. customRemoteMessage = ['hint', _hint];
  89. publicVariable "customRemoteMessage";
  90.  
  91. diag_log(format["Loot event setup, waiting for %1 seconds", _wait_time]);
  92.  
  93. // Wait
  94. sleep _wait_time;
  95.  
  96. // Clean up
  97. EPOCH_EVENT_RUNNING = false;
  98. deleteVehicle _loot_box;
  99. deleteMarker _event_marker;
  100. if (_debug) then {
  101.     deleteMarker _debug_marker;
  102. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement