Advertisement
Guest User

building_supplies.sqf

a guest
Dec 13th, 2013
482
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.29 KB | None | 0 0
  1. // NN Custom supply side mission event mass description
  2. // Example taken from: http://dayzepoch.com/forum/index.php?/topic/1027-spawn-ammo-box-with-loot-sample/
  3. // https://dl.dropboxusercontent.com/u/135243/dayz_epoch/sample_loot_event.sqf
  4. // Edited with "side mission script" as example
  5. // Edited by Randomness
  6.  
  7.  
  8. private ["_spawnChance", "_spawnMarker", "_spawnRadius", "_markerRadius", "_item", "_debug", "_start_time", "_loot", "_loot_lists", "_loot_amount", "_loot_box", "_wait_time", "_spawnRoll", "_position", "_event_marker", "_loot_pos", "_debug_marker","_loot_box", "_hint", "_loot_weapon", "_loot_mags", "_loot_backpack", "_loot_b", "_loot_w"];
  9.  
  10. _spawnChance = 0.35; // chance of event happening
  11. _markerRadius = 250; // Radius the loot can spawn and used for the marker
  12. _debug = false; // Puts a marker exactly were the loot spawns
  13.  
  14. _loot_box = "USBasicWeaponsBox";
  15.  
  16. _loot_weapon = ["ItemEtool","ItemCrowbar","itemToolbox","ItemSledge"];
  17. _loot_mags = [
  18. ["ItemTentOld", "ItemWire", "CinderBlocks", "MortarBucket", "ItemPole", "ItemTankTrap"],
  19. ["ItemSandbag", "CinderBlocks", "MortarBucket", "ItemPole", "ItemTankTrap"],
  20. ["PartFueltank", "PartGlass", "PartEngine", "PartWheel", "PartGeneric", "ItemJerrycan","PartVRotor"],
  21. ["PartPlankPack", "PartPlywoodPack", "CinderBlocks", "MortarBucket", "CinderBlocks", "ItemPole", "ItemTankTrap"],
  22. ["CinderBlocks", "MortarBucket", "ItemPole", "ItemTankTrap"]
  23. ];
  24. _loot_backpack = ["DZ_Backpack_EP1","DZ_ALICE_Pack_EP1","DZ_CivilBackpack_EP1","CZ_VestPouch_EP1","DZ_GunBag_EP1","DZ_LargeGunBag_EP1"];
  25. _loot = _loot_mags call BIS_fnc_selectRandom;
  26. _loot_b = _loot_backpack call BIS_fnc_selectRandom;
  27. _loot_w = _loot_weapon call BIS_fnc_selectRandom;
  28.  
  29. _loot_amount = 25;
  30. _wait_time = 450;
  31.  
  32. // Dont mess with theses unless u know what yours doing
  33. _start_time = time;
  34. _spawnRadius = 4000;
  35. _spawnMarker = [6152.5718,7716.6011,0]; //using stary sobor as center of the map
  36.  
  37. if (isNil "EPOCH_EVENT_RUNNING") then {
  38. EPOCH_EVENT_RUNNING = false;
  39. };
  40.  
  41. // Check for another event running
  42. if (EPOCH_EVENT_RUNNING) exitWith {
  43. diag_log("Event already running");
  44. };
  45. EPOCH_EVENT_RUNNING = true;
  46.  
  47. // Random chance of event happening
  48. _spawnRoll = random 1;
  49. if (_spawnRoll > _spawnChance and !_debug) exitWith {
  50. diag_log("Event stopped by random chance");
  51. EPOCH_EVENT_RUNNING = false;
  52. };
  53.  
  54. // Random location
  55. _position = [_spawnMarker,0,_spawnRadius,10,0,2000,0] call BIS_fnc_findSafePos;
  56. diag_log(format["Spawning loot event at %1", _position]);
  57.  
  58. _event_marker = createMarker [ format ["loot_event_marker_%1", _start_time], _position];
  59. _event_marker setMarkerShape "ELLIPSE";
  60. _event_marker setMarkerColor "ColorGreen";
  61. _event_marker setMarkerAlpha 0.75;
  62. _event_marker setMarkerSize [(_markerRadius + 50), (_markerRadius + 50)];
  63.  
  64. _loot_pos = [_position,0,(_markerRadius - 100),10,0,2000,0] call BIS_fnc_findSafePos;
  65.  
  66. if (_debug) then {
  67. _debug_marker = createMarker [ format ["loot_event_debug_marker_%1", _start_time], _loot_pos];
  68. _debug_marker setMarkerShape "ICON";
  69. _debug_marker setMarkerType "mil_dot";
  70. _debug_marker setMarkerColor "ColorBlue";
  71. _debug_marker setMarkerAlpha 1;
  72. };
  73.  
  74. diag_log(format["Creating building supply drop at %1", _loot_pos]);
  75. // Information text
  76. [nil,nil,rTitleText,"A cargo plane dropped a box full of building supplies! Check your map to see its location!", "PLAIN",10] call RE;
  77. //Sending the message before we actually make the crate so we know at what time to check
  78.  
  79. // Create ammo box
  80. _loot_box = createVehicle [_loot_box,_loot_pos,[], 0, "NONE"];
  81. clearMagazineCargoGlobal _loot_box;
  82. clearWeaponCargoGlobal _loot_box;
  83. clearBackpackCargoGlobal _loot_box;
  84.  
  85. // Add loot
  86. for "_x" from 1 to _loot_amount do {
  87. _item = _loot call BIS_fnc_selectRandom;
  88. _loot_box addMagazineCargoGlobal [_item, 1];
  89. };
  90. _loot_box addBackpackCargoGlobal [_loot_b, 1];
  91. _loot_box addWeaponCargoGlobal [_loot_w, 1];
  92.  
  93. diag_log("Succesfully added loot to the box, going to bed for some time now");
  94. // Wait
  95. sleep _wait_time;
  96.  
  97. diag_log("Time to wake up, lets delete some markers and the box");
  98. deleteMarker _event_marker;
  99. if (_debug) then {
  100. deleteMarker _debug_marker;
  101. };
  102. deleteVehicle _loot_box;
  103. EPOCH_EVENT_RUNNING = false;
  104. diag_log("Everything should be deleted now, or at least this event came to an end");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement