Advertisement
Guest User

military_supplies.sqf

a guest
Dec 13th, 2013
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.75 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_amount", "_loot_box", "_wait_time", "_spawnRoll", "_spawnRoll0", "_spawnRoll1", "_position", "_event_marker", "_loot_pos", "_debug_marker","_loot_box", "_hint", "_loot_mags", "_loot_backpack", "_loot_brief", "_loot_b", "_loot_wt0", "_loot_wt1", "_loot_wt2", "_loot_bcs", "_gun_t0", "_gun_t1", "_gun_t2"];
  8.  
  9. _spawnChance = 0.35; // chance of event happening
  10. _markerRadius = 400; // 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_wt0 = ["M110_NVG_ep1",
  16. "FN_FAL_ANPVS4",
  17. "BAF_LRR_scoped",
  18. "SCAR_H_LNG_Sniper_SD",
  19. "SCAR_H_CQC_CCO",
  20. "SCAR_H_CQC_CCO_SD",
  21. "SCAR_L_STD_HOLO",
  22. "SCAR_L_CQC_CCO_SD",
  23. "SCAR_L_CQC_EGLM_Holo",
  24. "SCAR_L_STD_EGLM_RCO",
  25. "SCAR_L_STD_Mk4CQT"];
  26.  
  27. _loot_wt1 = ["SVD_NSPU_EP1",
  28. "M4A1_AIM_SD_camo",
  29. "G36_C_SD_camo",
  30. "SVD_des_EP1",
  31. "M40A3",
  32. "SVD_CAMO",
  33. "Pecheneg_DZ",
  34. "M24_des_EP1",
  35. "M24",
  36. "VSS_vintorez",
  37. "M14_EP1"];
  38.  
  39. _loot_wt2 = ["LeeEnfield",
  40. "Remington870_lamp",
  41. "M1014",
  42. "M249_DZ",
  43. "M240_DZ",
  44. "Mk_48_DZ",
  45. "M4SPR",
  46. "MP5SD",
  47. "AK_74",
  48. "M16A2",
  49. "G36A_camo",
  50. "G36C_camo",
  51. "G36C",
  52. "M16A2GL",
  53. "M16A4_ACG",
  54. "M4A1",
  55. "AK_47_M",
  56. "AKS_74_U",
  57. "AKS_74_kobra",
  58. "Sa58V_EP1",
  59. "Sa58V_CCO_EP1",
  60. "M4A1_Aim",
  61. "M4A3_CCO_EP1",
  62. "M4A1_HWS_GL_camo"];
  63.  
  64. _loot_mags = ["30Rnd_556x45_Stanag",
  65. "30Rnd_556x45_StanagSD",
  66. "20Rnd_762x51_FNFAL",
  67. "100Rnd_762x51_M240",
  68. "200Rnd_556x45_M249",
  69. "100Rnd_762x54_PK",
  70. "20Rnd_762x51_DMR",
  71. "10Rnd_762x54_SVD",
  72. "30Rnd_9x19_MP5SD",
  73. "20Rnd_9x39_SP5_VSS",
  74. "20Rnd_762x51_SB_SCAR",
  75. "8Rnd_B_Beneli_74Slug",
  76. "5Rnd_762x51_M24",
  77. "HandGrenade_west",
  78. "30Rnd_545x39_AK",
  79. "30Rnd_762x39_AK47",
  80. "5Rnd_762x51_M24",
  81. "20Rnd_762x51_B_SCAR",
  82. "5Rnd_86x70_L115A1",
  83. "30Rnd_762x39_SA58",
  84. "5x_22_LR_17_HMR"];
  85.  
  86. _loot_bcs = ["ItemBriefcaseEmpty",
  87. "ItemBriefcase10oz",
  88. "ItemBriefcase20oz",
  89. "ItemBriefcase30oz",
  90. "ItemBriefcase40oz",
  91. "ItemBriefcase50oz",
  92. "ItemBriefcase60oz",
  93. "ItemBriefcase70oz",
  94. "ItemBriefcase80oz",
  95. "ItemBriefcase90oz",
  96. "ItemBriefcase100oz"];
  97. _loot_backpack = ["DZ_Backpack_EP1","DZ_ALICE_Pack_EP1","DZ_CivilBackpack_EP1","CZ_VestPouch_EP1","DZ_GunBag_EP1","DZ_LargeGunBag_EP1"];
  98.  
  99. _loot_b = _loot_backpack call BIS_fnc_selectRandom;
  100. _loot_brief = _loot_bcs call BIS_fnc_selectRandom;
  101.  
  102. _loot_amount = 25;
  103. _wait_time = 450;
  104.  
  105. // Dont mess with theses unless u know what yours doing
  106. _start_time = time;
  107. _spawnRadius = 4000;
  108. _spawnMarker = [6152.5718,7716.6011,0]; //using stary sobor as center of the map
  109.  
  110. if (isNil "EPOCH_EVENT_RUNNING") then {
  111. EPOCH_EVENT_RUNNING = false;
  112. };
  113.  
  114. // Check for another event running
  115. if (EPOCH_EVENT_RUNNING and !_debug) exitWith {
  116. diag_log("Event already running");
  117. };
  118. EPOCH_EVENT_RUNNING = true;
  119.  
  120. // Random chance of event happening
  121. _spawnRoll = random 1;
  122. if (_spawnRoll > _spawnChance and !_debug) exitWith {
  123. diag_log("Event stopped by random chance");
  124. EPOCH_EVENT_RUNNING = false;
  125. };
  126.  
  127. // Random location
  128. _position = [_spawnMarker,0,_spawnRadius,10,0,2000,0] call BIS_fnc_findSafePos;
  129. diag_log(format["Spawning loot event at %1", _position]);
  130.  
  131. _event_marker = createMarker [ format ["loot_event_marker_%1", _start_time], _position];
  132. _event_marker setMarkerShape "ELLIPSE";
  133. _event_marker setMarkerColor "ColorRed";
  134. _event_marker setMarkerAlpha 0.5;
  135. _event_marker setMarkerSize [(_markerRadius + 50), (_markerRadius + 50)];
  136.  
  137. _loot_pos = [_position,0,(_markerRadius - 100),20,0,2000,0] call BIS_fnc_findSafePos;
  138.  
  139. if (_debug) then {
  140. _debug_marker = createMarker [ format ["loot_event_debug_marker_%1", _start_time], _loot_pos];
  141. _debug_marker setMarkerShape "ICON";
  142. _debug_marker setMarkerType "mil_dot";
  143. _debug_marker setMarkerColor "ColorRed";
  144. _debug_marker setMarkerAlpha 1;
  145. };
  146.  
  147. diag_log(format["Creating military supply drop at %1", _loot_pos]);
  148. // Information text
  149. [nil,nil,rTitleText,"Armed forces were forced to flee and had to leave heir gear behind! Check your to see where it happened.", "PLAIN",10] call RE;
  150. //Sending the message before we actually make the crate so we know at what time to check
  151.  
  152. // Create ammo box
  153. _loot_box = createVehicle [_loot_box,_loot_pos,[], 0, "NONE"];
  154. clearMagazineCargoGlobal _loot_box;
  155. clearWeaponCargoGlobal _loot_box;
  156. clearBackpackCargoGlobal _loot_box;
  157.  
  158. //Randomly add or not add a tier 0 and tier 1 gun
  159. _spawnRoll0 = random 1;
  160. if (_spawnRoll0 > 0.50) then {
  161. _gun_t0 = _loot_wt0 call BIS_fnc_selectRandom;
  162. _loot_box addWeaponCargoGlobal [_gun_t0, 1];
  163. };
  164. _spawnRoll1 = random 1;
  165. if (_spawnRoll1 > 0.50) then {
  166. _gun_t1 = _loot_wt1 call BIS_fnc_selectRandom;
  167. _loot_box addWeaponCargoGlobal [_gun_t1, 1];
  168. };
  169. //Adding 3 random guns from t2 list:
  170. for "_z" from 1 to 3 do {
  171. _gun_t2 = _loot_wt2 call BIS_fnc_selectRandom;
  172. _loot_box addWeaponCargoGlobal [_gun_t2, 1];
  173. };
  174.  
  175. // Adding ammo
  176. for "_x" from 1 to _loot_amount do {
  177. _item = _loot_mags call BIS_fnc_selectRandom;
  178. _loot_box addMagazineCargoGlobal [_item, 1];
  179. };
  180.  
  181. // Adding a random briefcase and backpack
  182. _loot_box addMagazineCargoGlobal [_loot_brief, 1];
  183. _loot_box addBackpackCargoGlobal [_loot_b, 1];
  184.  
  185. diag_log("Succesfully added loot to the box, going to bed for some time now");
  186. // Wait
  187. sleep _wait_time;
  188.  
  189. diag_log("Time to wake up, lets delete some markers and the box");
  190. deleteMarker _event_marker;
  191. if (_debug) then {
  192. deleteMarker _debug_marker;
  193. };
  194. deleteVehicle _loot_box;
  195. EPOCH_EVENT_RUNNING = false;
  196. 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