Advertisement
Guest User

medical_supplies.sqf

a guest
Dec 13th, 2013
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.38 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. 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"];
  8.  
  9. _spawnChance = 0.35; // chance of event happening
  10. _markerRadius = 250; // Radius the loot can spawn and used for the marker
  11. _debug = false; // Puts a marker exactly were the loot spawns
  12.  
  13. _loot_box = "USBasicWeaponsBox";
  14.  
  15. _loot_weapon = ["ItemKnife","ItemFlashlightRed","ItemMachete","ItemGPS"];
  16. _loot_mags = [
  17. ["ItemBloodbag", "ItemAntibiotic", "ItemPainkiller", "ItemMorphine", "ItemBandage", "ItemEpinephrine", "FoodCanPasta", "ItemSodaPepsi", "FoodCanSardines", "ItemSodaCoke"],
  18. ["ItemBloodbag", "ItemAntibiotic", "ItemPainkiller", "ItemMorphine", "ItemBandage", "ItemEpinephrine", "FoodBioMeat", "FoodrabbitCooked", "ItemSodaMtngreen", "ItemSodaDrwaste"],
  19. ["ItemBloodbag", "ItemAntibiotic", "ItemPainkiller", "ItemMorphine", "ItemBandage", "ItemEpinephrine", "ItemTunaCooked", "ItemSodaRbull", "ItemSeaBassCooked", "ItemSodaClays"]
  20. ];
  21. _loot_backpack = ["DZ_Backpack_EP1","DZ_ALICE_Pack_EP1","DZ_CivilBackpack_EP1","CZ_VestPouch_EP1","DZ_GunBag_EP1","DZ_LargeGunBag_EP1"];
  22. _loot = _loot_mags call BIS_fnc_selectRandom;
  23. _loot_b = _loot_backpack call BIS_fnc_selectRandom;
  24. _loot_w = _loot_weapon call BIS_fnc_selectRandom;
  25.  
  26. _loot_amount = 25;
  27. _wait_time = 450;
  28.  
  29. // Dont mess with theses unless u know what yours doing
  30. _start_time = time;
  31. _spawnRadius = 4000;
  32. _spawnMarker = [6152.5718,7716.6011,0]; //using stary sobor as center of the map
  33.  
  34. if (isNil "EPOCH_EVENT_RUNNING") then {
  35. EPOCH_EVENT_RUNNING = false;
  36. };
  37.  
  38. // Check for another event running
  39. if (EPOCH_EVENT_RUNNING) exitWith {
  40. diag_log("Event already running");
  41. };
  42. EPOCH_EVENT_RUNNING = true;
  43.  
  44. // Random chance of event happening
  45. _spawnRoll = random 1;
  46. if (_spawnRoll > _spawnChance and !_debug) exitWith {
  47. diag_log("Event stopped by random chance");
  48. EPOCH_EVENT_RUNNING = false;
  49. };
  50.  
  51. // Random location
  52. _position = [_spawnMarker,0,_spawnRadius,10,0,2000,0] call BIS_fnc_findSafePos;
  53. diag_log(format["Spawning loot event at %1", _position]);
  54.  
  55. _event_marker = createMarker [ format ["loot_event_marker_%1", _start_time], _position];
  56. _event_marker setMarkerShape "ELLIPSE";
  57. _event_marker setMarkerColor "ColorBlue";
  58. _event_marker setMarkerAlpha 0.5;
  59. _event_marker setMarkerSize [(_markerRadius + 50), (_markerRadius + 50)];
  60.  
  61. _loot_pos = [_position,0,(_markerRadius - 100),10,0,2000,0] call BIS_fnc_findSafePos;
  62.  
  63. if (_debug) then {
  64. _debug_marker = createMarker [ format ["loot_event_debug_marker_%1", _start_time], _loot_pos];
  65. _debug_marker setMarkerShape "ICON";
  66. _debug_marker setMarkerType "mil_dot";
  67. _debug_marker setMarkerColor "ColorBlue";
  68. _debug_marker setMarkerAlpha 1;
  69. };
  70.  
  71. diag_log(format["Creating medical supply drop at %1", _loot_pos]);
  72. // Information text
  73. [nil,nil,rTitleText,"A group of survivors left behind their medical supplies! Check your map to see its location", "PLAIN",10] call RE;
  74. //Sending the message before we actually make the crate so we know at what time to check
  75.  
  76. // Create ammo box
  77. _loot_box = createVehicle [_loot_box,_loot_pos,[], 0, "NONE"];
  78. clearMagazineCargoGlobal _loot_box;
  79. clearWeaponCargoGlobal _loot_box;
  80. clearBackpackCargoGlobal _loot_box;
  81.  
  82. // Add loot
  83. for "_x" from 1 to _loot_amount do {
  84. _item = _loot call BIS_fnc_selectRandom;
  85. _loot_box addMagazineCargoGlobal [_item, 1];
  86. };
  87. _loot_box addBackpackCargoGlobal [_loot_b, 1];
  88. _loot_box addWeaponCargoGlobal [_loot_w, 1];
  89.  
  90. diag_log("Succesfully added loot to the box, going to bed for some time now");
  91. // Wait
  92. sleep _wait_time;
  93.  
  94. diag_log("Time to wake up, lets delete some markers and the box");
  95. deleteMarker _event_marker;
  96. if (_debug) then {
  97. deleteMarker _debug_marker;
  98. };
  99. deleteVehicle _loot_box;
  100. EPOCH_EVENT_RUNNING = false;
  101. 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