Advertisement
Guest User

rubble_town.sqf

a guest
Jan 7th, 2018
550
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.49 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", "_baserunover", "_baserunover1", "_baserunover2", "_baserunover3","_baserunover4","_baserunover5","_baserunover6","_baserunover7","_baserunover8","_baserunover9","_baserunover10","_baserunover11","_baserunover12","_baserunover13","_baserunover14","_baserunover15","_baserunover16","_baserunover17","_baserunover18"];
  2.  
  3. _spawnChance = 0.35; // Percentage chance of event happening 0.35
  4. _markerRadius = 200; // Radius the loot can spawn and used for the marker
  5. _debug = true; // Puts a marker exactly were the loot spawns
  6.  
  7.  
  8. _loot_box = "GuerillaCacheBox";
  9. _loot_lists = [
  10. [
  11. ["AKS74U_DZ","Sa58V_CCO_EP1","ItemEtool","ItemCrowbar","ItemKnife","ItemSledge","ItemCompass","Binocular"],
  12. ["150Rnd_127x107_DSHKM","30Rnd_545x39_AK","30Rnd_556x45_G36"]
  13. ],
  14. [
  15. ["vil_SKS"],
  16. ["30Rnd_545x39_AK","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit"]
  17. ],
  18. [
  19. ["ItemToolbox","RPK74_DZ"],
  20. ["75Rnd_762x39_RPK","ItemWoodFloor","ItemSodaCoke","FoodCanSardines"]
  21. ],
  22. [
  23. ["ChainSaw"],
  24. ["ItemCorrugated","ItemCorrugated","ItemPole","ItemPole","ItemPole","ItemComboLock","ItemGenerator"]
  25. ],
  26.  
  27. [
  28. ["vil_Abakan"],
  29. ["30Rnd_545x39_AK","30Rnd_545x39_AK","30Rnd_545x39_AK","FoodCanFrankBeans","CinderBlocks"]
  30. ],
  31. [
  32. ["SVD_DZ"],
  33. ["10Rnd_762x54_SVD","HandGrenade_east","HandGrenade_east","FoodCanSardines","FoodMRE","CinderBlocks"]
  34. ]
  35. ];
  36. _loot = _loot_lists call BIS_fnc_selectRandom;
  37.  
  38.  
  39. _loot_amount = 75;
  40. _wait_time = 900;
  41.  
  42.  
  43. // Dont mess with theses unless u know what yours doing
  44. _start_time = time;
  45. _spawnRadius = 5200;
  46. _spawnMarker = 'center';
  47.  
  48.  
  49. // Random chance of event happening
  50. _spawnRoll = random 1;
  51. if (_spawnRoll > _spawnChance and !_debug) exitWith {};
  52.  
  53.  
  54. // Random location
  55. _position = [getMarkerPos "center",0,5500,10,0,2000,0] call BIS_fnc_findSafePos;
  56.  
  57.  
  58. diag_log(format["MISSION EVENT ------- RUBBLE TOWN ---------- Spawning loot event at %1", _position]);
  59.  
  60. _event_marker = createMarker [ format ["loot_event_marker_%1", _start_time], _position];
  61. _event_marker setMarkerShape "RECTANGLE";
  62. _event_marker setMarkerColor "ColorOrange";
  63. _event_marker setMarkerAlpha 0.5;
  64. _event_marker setMarkerBrush "FDiagonal";
  65. _event_marker setMarkerSize [_markerRadius, _markerRadius];
  66. //
  67. _event_markerLabel = createMarker [ format ["loot_event_marker_%1", _start_time], _position];
  68. _event_markerLabel setMarkerColor "ColorBlack";
  69. _event_markerLabel setMarkerText "Rubble Town";
  70.  
  71.  
  72.  
  73. _positionarray = [
  74. [(_position select 0) - 14.5, (_position select 1) - 21,-0.012],
  75. [(_position select 0) - 20, (_position select 1) - 20,-0.012],
  76. [(_position select 0) + 25, (_position select 1) + 5,-0.012],
  77. [(_position select 0) + 16, (_position select 1) - 14,-0.012],
  78. [(_position select 0) + 49, (_position select 1) + 17.5,-0.012],
  79. [(_position select 0) + 38.5, (_position select 1) - 16,-0.012]
  80. ];
  81. _loot_pos = _positionarray call BIS_fnc_selectRandom;
  82.  
  83.  
  84. _vehclass = cargo_trucks call BIS_fnc_selectRandom;
  85.  
  86.  
  87. if (_debug) then {
  88. _debug_marker = createMarker [ format ["loot_event_debug_marker_%1", _start_time], _loot_pos];
  89. _debug_marker setMarkerShape "ICON";
  90. _debug_marker setMarkerText "Rebellious Base inoperative";
  91. _debug_marker setMarkerType "mil_dot";
  92. _debug_marker setMarkerColor "ColorOrange";
  93. _debug_marker setMarkerAlpha 1;
  94. };
  95.  
  96.  
  97. diag_log(format["MISSION EVENT ------- RUBBLE TOWN ---------- Creating ammo box at %1", _loot_pos]);
  98.  
  99.  
  100. // Create ammo box
  101. _loot_box = createVehicle [_loot_box,_loot_pos,[], 0, "NONE"];
  102. clearMagazineCargoGlobal _loot_box;
  103. clearWeaponCargoGlobal _loot_box;
  104.  
  105.  
  106. // Cut the grass around the loot position
  107. _clutter = createVehicle ["ClutterCutter_small_2_EP1", _loot_pos, [], 0, "CAN_COLLIDE"];
  108. _clutter setPos _loot_pos;
  109. // cut the grass end
  110.  
  111.  
  112. // Buildings and Objects
  113. _baserunover = createVehicle ["Land_a_stationhouse_ruins",[(_position select 0) - 5, (_position select 1) + 16,-0.12],[], 0, "CAN_COLLIDE"];
  114. _baserunover setDir 0;
  115. _baserunover setVectorUp surfaceNormal position _baserunover;
  116. _baserunover1 = createVehicle ["Land_kostel_trosky_ruins", [(_position select 0) + 1, (_position select 1) - 13,-0.12],[], 0, "CAN_COLLIDE"];
  117. _baserunover1 setDir 0;
  118. _baserunover1 setVectorUp surfaceNormal position _baserunover1;
  119. _baserunover2 = createVehicle ["Land_ruin_01", [(_position select 0) - 13, (_position select 1) - 3,-0.12],[], 0, "CAN_COLLIDE"];
  120. _baserunover2 setDir 0;
  121. _baserunover2 setVectorUp surfaceNormal position _baserunover2;
  122. _baserunover3 = createVehicle ["Land_ruin_chimney", [(_position select 0) + 14, (_position select 1) - 8,-0.12],[], 0, "CAN_COLLIDE"];
  123. _baserunover3 setDir 0;
  124. _baserunover3 setVectorUp surfaceNormal position _baserunover3;
  125. _baserunover4 = createVehicle ["Land_ruin_corner_2",[(_position select 0) + 17, (_position select 1) - 14,-0.12],[], 0, "CAN_COLLIDE"];
  126. _baserunover4 setDir 0;
  127. _baserunover4 setVectorUp surfaceNormal position _baserunover4;
  128. _baserunover5 = createVehicle ["Land_ruin_walldoor", [(_position select 0) - 12, (_position select 1) - 11,-0.12],[], 0, "CAN_COLLIDE"];
  129. _baserunover5 setDir 0;
  130. _baserunover5 setVectorUp surfaceNormal position _baserunover5;
  131. _baserunover6 = createVehicle ["MAP_rubble_bricks_02", [(_position select 0) + 7, (_position select 1) + 3,-0.12],[], 0, "CAN_COLLIDE"];
  132. _baserunover6 setDir 0;
  133. _baserunover6 setVectorUp surfaceNormal position _baserunover6;
  134. _baserunover7 = createVehicle ["MAP_rubble_wood_03", [(_position select 0) - 19, (_position select 1) - 9,-0.12],[], 0, "CAN_COLLIDE"];
  135. _baserunover7 setDir 0;
  136. _baserunover7 setVectorUp surfaceNormal position _baserunover7;
  137. _baserunover9 = createVehicle ["MAP_Misc_trunk_water", [(_position select 0) - 9, (_position select 1) - 14,-0.12],[], 0, "CAN_COLLIDE"];
  138. _baserunover9 setDir 0;
  139. _baserunover9 setVectorUp surfaceNormal position _baserunover9;
  140. _baserunover10 = createVehicle ["MAP_HouseBlock_C1_ruins", [(_position select 0) + 30, (_position select 1) + 18,-0.12],[], 0, "CAN_COLLIDE"];
  141. _baserunover10 setDir 0;
  142. _baserunover10 setVectorUp surfaceNormal position _baserunover10;
  143. _baserunover11 = createVehicle ["MAP_HouseBlock_A3_ruins", [(_position select 0) + 41, (_position select 1) - 17,-0.12],[], 0, "CAN_COLLIDE"];
  144. _baserunover11 setDir -183.96;
  145. _baserunover11 setVectorUp surfaceNormal position _baserunover11;
  146. _baserunover12 = createVehicle ["MAP_Ind_Stack_Big_ruins", [(_position select 0) - 30, (_position select 1) - 28,-0.12],[], 0, "CAN_COLLIDE"];
  147. _baserunover12 setDir 0;
  148. _baserunover12 setVectorUp surfaceNormal position _baserunover12;
  149. _baserunover13 = createVehicle ["MAP_dulni_bs",[(_position select 0) + 48, (_position select 1) + 20,-0.12],[], 0, "CAN_COLLIDE"];
  150. _baserunover13 setDir 0;
  151. _baserunover13 setVectorUp surfaceNormal position _baserunover13;
  152. _baserunover14 = createVehicle ["MAP_rubble_rocks_01", [(_position select 0) + 49, (_position select 1) + 5,-0.12],[], 0, "CAN_COLLIDE"];
  153. _baserunover14 setDir -123.02;
  154. _baserunover14 setVectorUp surfaceNormal position _baserunover14;
  155. _baserunover15 = createVehicle ["HMMWVWreck", [(_position select 0) + 22, (_position select 1) + 8,-0.12],[], 0, "CAN_COLLIDE"];
  156. _baserunover15 setDir 0;
  157. _baserunover15 setVectorUp surfaceNormal position _baserunover15;
  158. _baserunover16 = createVehicle ["UralWreck", [(_position select 0) + 27, (_position select 1) + 3,-0.12],[], 0, "CAN_COLLIDE"];
  159. _baserunover16 setDir 33.81;
  160. _baserunover16 setVectorUp surfaceNormal position _baserunover16;
  161. _baserunover17 = createVehicle ["UralWreck", [(_position select 0) - 44, (_position select 1) + 11,-0.12],[], 0, "CAN_COLLIDE"];
  162. _baserunover17 setDir 45.3;
  163. _baserunover17 setVectorUp surfaceNormal position _baserunover17;
  164. _baserunover18 = createVehicle ["UralWreck", [(_position select 0) - 10, (_position select 1) - 23,-0.12],[], 0, "CAN_COLLIDE"];
  165. _baserunover18 setDir 200.2;
  166. _baserunover18 setVectorUp surfaceNormal position _baserunover18;
  167.  
  168.  
  169. // Add loot
  170. {
  171. _loot_box addWeaponCargoGlobal [_x,1];
  172. } forEach (_loot select 0);
  173. {
  174. _loot_box addMagazineCargoGlobal [_x,1];
  175. } forEach (_loot select 1);
  176.  
  177.  
  178. // Send Top Right message to users , requires Remote message script
  179. _hint = parseText format["<t align='center' color='#31db3c' shadow='2' size='1.75'>NEW INCIDENT</t><br/><t align='center' color='#ffffff'>!Militars destroyed a small rebel base! Check your Map for the Location.</t>"];
  180. RemoteMessage = ['hint', _hint];
  181. publicVariable "RemoteMessage";
  182.  
  183.  
  184. // Send center message to users
  185. // [nil,nil,rTitleText,"Mercenaries stashed a loot crate in rubble town]", "PLAIN",10] call RE;
  186.  
  187.  
  188. diag_log(format["Loot event setup, waiting for %1 seconds", _wait_time]);
  189.  
  190.  
  191. // Wait
  192. sleep _wait_time;
  193.  
  194. // Clean up
  195. // EPOCH_EVENT_RUNNING = false;
  196. deleteVehicle _loot_box;
  197. // delete town
  198. deleteVehicle _baserunover;
  199. deleteVehicle _baserunover1;
  200. deleteVehicle _baserunover2;
  201. deleteVehicle _baserunover3;
  202. deleteVehicle _baserunover4;
  203. deleteVehicle _baserunover5;
  204. deleteVehicle _baserunover6;
  205. deleteVehicle _baserunover7;
  206. deleteVehicle _baserunover9;
  207. deleteVehicle _baserunover10;
  208. deleteVehicle _baserunover11;
  209. deleteVehicle _baserunover12;
  210. deleteVehicle _baserunover13;
  211. deleteVehicle _baserunover14;
  212. deleteVehicle _baserunover15;
  213. deleteVehicle _baserunover16;
  214. deleteVehicle _baserunover17;
  215. deleteVehicle _baserunover18;
  216.  
  217. deleteMarker _event_marker;
  218. deleteMarker _event_markerLabel;
  219.  
  220. if (_debug) then {
  221. deleteMarker _debug_marker;
  222. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement