mmmyum

mmmyum animated air raid!

Apr 17th, 2013
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.41 KB | None | 0 0
  1. ///// ///// ///// ///// ///// ///// ///// ///// /////
  2. /////////////////////////////////////////////////////////////////////////////////////
  3. ///////////////mmmyum's random animated air raid dayz////////////////////////////////
  4. /////////////////////////////////////////////////////////////////////////////////////
  5. //
  6. //
  7. //
  8. //special thanks to arma scripters maxjoiner and darkxess from armaholic, and the opendayz community!//
  9. //
  10. //
  11. //
  12. ///////////////////////////////////////////////////INITIALIZE
  13. _loc = ["BalottaAirstrip",1.5,4829.9868,2450.1104];
  14. _city = "BalottaAirstrip";
  15. _x = 4829.9868;
  16. _y = 2450.1104;
  17. _z = 1.5;
  18. _coords = [_x,_y,_z];
  19. diag_log format ["RANDOM WORLDSPACE: Initializing... %1 | %2 %3 %4|",_city,_x,_y,_z];
  20. sleep 1;
  21. ////////////////////////////////////////////////////SETUP SETUP SETUP
  22. _repeat = 30; //times to repeat
  23. _break = 300; //time to break between attacks
  24. _choice = 1; //type of bombing 1 light, 2 medium, 3 heavy
  25. _duration = 60; //how long the bombing should last - really how many bombs are dropped assuming 1 per cycle
  26. _rmodyn = 1; //1 if you have rmod, 0 if you don't (mv22 mi24 vs uh1h and mi17)
  27. _preWaypoints = 0; //untested, add waypoints before arriving at location.
  28. _sounddist = 1500; //distance sounds are audible at
  29. _ray = 120; //ray of bombing
  30. ////////////////////////////////////////////////////END SETUP
  31. //selector
  32. While {_repeat > 1} do {
  33. _rndSel=floor(random 49); //select random number 0-49, then set loc based on the case number
  34. _loc=
  35. switch (_rndSel) do {
  36. case 0: {["BalottaAirstrip",1.5,4829.9868,2450.1104]};
  37. case 1: {["Berenzino",1.5,12954.624,9783.1533]};
  38. case 2: {["Bereznio2",1.5,12043.963,9091.3477]};
  39. case 3: {["BlackMountain",1.5,10276.416,12049.6640]};
  40. case 4: {["Bor",1.5,3320.1643,3938.3496]};
  41. case 5: {["Cherno",1.5,6743.8853,2581.1865]};
  42. case 6: {["DevilsCastle",1.5,6891.9189,11438.73]};
  43. case 7: {["DonsCamp",1.5,7788.2856,12613.048]};
  44. case 8: {["Drozhino",1.5,3442.2849,4955.7129]};
  45. case 9: {["Dubrovka",1.5,10445.011,9868.9912]};
  46. case 10: {["Electro",1.5,10480.69,2217.8027]};
  47. case 11: {["Factory",1.5,13060.078,7094.0596]};
  48. case 12: {["Gorka",1.5,9659.084,8795.334]};
  49. case 13: {["Grishno",1.5,5979.6953,10343.341]};
  50. case 14: {["Guglovo",1.5,8517.8682,6676.3276]};
  51. case 15: {["Gvozdno",1.5,8614.4316,11868.967]};
  52. case 16: {["Kabanino",1.5,5318.8369,8602.6328]};
  53. case 17: {["Kamyshovo",1.5,12127.406,3496.2185]};
  54. case 18: {["Khelm",1.5,12290.833,10904.328]};
  55. case 19: {["Komarovo",1.5,3654.0908,2475.9468]};
  56. case 20: {["Kozlovka",1.5,4483.6777,4616.1675]};
  57. case 21: {["Krastonav",1.5,11212.624,12256.609]};
  58. case 22: {["Lopatino",1.5,2780.3135,10018.82]};
  59. case 23: {["Moglievka",1.5,7544.5845,5148.7822]};
  60. case 24: {["Msta",1.5,11275.323,5495.4053]};
  61. case 25: {["Myshkino",1.5,2019.2487,7327.7178]};
  62. case 26: {["Nadezhdino",1.5,5846.4434,4706.708]};
  63. case 27: {["NEAF",1.5,12073.906,12724.305]};
  64. case 28: {["Nizhnoye",1.5,13002.393,8285.8574]};
  65. case 29: {["NovySobor",1.5,7074.4854,7683.4883]};
  66. case 30: {["NWAF",1.5,4480.0781,10375.544]};
  67. case 31: {["Orlovets",1.5,12146.174,7266.5801]};
  68. case 32: {["Pavlovo",1.5,1693.9392,3845.0657]};
  69. case 33: {["Petrovka",1.5,5014.1143,12493.039]};
  70. case 34: {["Pogorevka",1.5,4473.5957,6411.3198]};
  71. case 35: {["Polana",1.5,10753.393,8132.6606]};
  72. case 36: {["Prigorodki",1.5,7976.5557,3299.5386]};
  73. case 37: {["Pulkovo",1.5,4915.0903,5605.6401]};
  74. case 38: {["Pusta",1.5,9156.2549,3897.7598]};
  75. case 39: {["Pustoshka",1.5,3072.9629,7945.4404]};
  76. case 40: {["Rogovo",1.5,4808.0024,6805.0518]};
  77. case 41: {["Shakhovka",1.5,9654.5244,6555.2583]};
  78. case 42: {["Solnichny",1.5,13454.279,6233.647]};
  79. case 43: {["Soosnovka",1.5,2528.7561,6354.9839]};
  80. case 44: {["Staroye",1.5,10140.659,5434.4302]};
  81. case 45: {["StarySobor",1.5,6143.6167,7721.5176]};
  82. case 46: {["Tulga",1.5,12803.296,4450.7466]};
  83. case 47: {["Vybor",1.5,3815.0635,8865.0938]};
  84. case 48: {["Vyshnoye",1.5,6590.3159,6029.1128]};
  85. case 49: {["Zelenogorsk",1.5,2758.7144,5304.3457]};
  86. };
  87. _city = _loc select 0;
  88. _z = _loc select 1;
  89. _x = _loc select 2;
  90. _y = _loc select 3;
  91. _coords = [_x,_y,_z]; ////////////////////////////////////////////////does this need spaces?
  92. diag_log format ["RANDOM WORLDSPACE: %1 | %2",_city,_coords];
  93. sleep 1;
  94. diag_log format ["RANDOM WORLDSPACE SELECTED: %1 | City: %2 | Coords: %3 %4 |||Try %5",_rndSel,_city,_x,_y,_repeat];
  95. _repeat = _repeat - 1;
  96. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  97. //above ---- the worldpace is selected, coordinates stored in _coords = [_x,_y,_z]/////////////////////////////////////////////////////////
  98. //below ---- chopper is created, flies to waypoint _coords while sirens play, hangs around till bombs are done flies off and is deleted/////////////
  99. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  100. //CREATE TARGET///////////////
  101. _loc = createVehicle ["HeliHEmpty", _coords,[], 0, "NONE"];
  102. _target = createVehicle ["HeliHEmpty",position _loc,[], 0, "NONE"];
  103. /////above is the target to bomb
  104. sleep 2;
  105. //Random Heli-Type
  106. if (_rmodyn = 1) then {
  107. _heliModel = ["UH1H_DZ","Mi17_DZ"] call BIS_fnc_selectRandom;
  108. } else {
  109. _heliModel = ["Mi24_D","MV22"] call BIS_fnc_selectRandom;
  110. };
  111.  
  112. //Random-Startpositions, Adjust this for other Maps then Chernarus //////////////////////////////mmmyum - change me to where you want heli to start, ie over carrier?
  113. _heliStart = [[6993.7007,173.05298,300],[1623.715,218.18848,300]] call BIS_fnc_selectRandom;
  114.  
  115. //A Backup Waypoint, if not Chernarus, set some Coordinates far up in the north (behind all possible Crashsites)
  116. _safetyPoint = [7492.6675, 15263.042];
  117.  
  118. _bomberName = getText (configFile >> "CfgVehicles" >> _heliModel >> "displayName");
  119.  
  120. diag_log(format["AIRRAID: BOMBER: %1 | Lift Off at %2 | with Backup WP %3",_bomberName,str(_heliStart),str(_safetyPoint)]);
  121.  
  122. _positionLand = [position _target,0,20,10,0,2000,0] call BIS_fnc_findSafePos; //ADD MY POSITION stuff - from bombing script
  123.  
  124. diag_log(format["AIRRAID: BOMBER: %1 started flying from %2 to %3 NOW!(TIME:%4||LT:%5)", _bomberName, str(_heliStart), str(_positionLand), round(time)]);
  125.  
  126. //Spawn the AI-Heli flying in the air
  127. _startTime = time;
  128. _bomber = createVehicle [_heliModel,_heliStart, [], 0, "FLY"];
  129.  
  130. //Make sure its not destroyed by the Hacker-Killing-Cleanup (Thanks to Sarge for the hint)
  131. _bomber setVariable["Sarge",1]; //I'm unsure what do to here, so I'm leaving it
  132.  
  133. _bomber engineOn true;
  134. _bomber flyInHeight 250;
  135. _bomber forceSpeed 140;
  136. _bomber setspeedmode "LIMITED";
  137.  
  138. //Create an Invisibile Landingpad at the Crashside-Coordinates
  139. _landingzone = createVehicle ["HeliHEmpty", [_positionLand select 0, _positionLand select 1,0], [], 0, "CAN_COLLIDE"]; //_targets x,y
  140. _landingzone setVariable["Sarge",1];
  141.  
  142. //Only a Woman could crash a Heli this way...
  143. _aigroup = creategroup civilian;
  144. _helipilot = _aigroup createUnit ["SurvivorW2_DZ",getPos _bomber,[],0,"FORM"];
  145. _helipilot moveindriver _bomber;
  146. _helipilot assignAsDriver _bomber;
  147.  
  148. sleep 0.5;
  149.  
  150. if(_preWaypoints > 0) then {
  151. for "_x" from 1 to _preWaypoints do {
  152. _preWaypointPos = [getMarkerPos _spawnMarker,0,_spawnRadius,10,0,2000,0] call BIS_fnc_findSafePos;
  153. };
  154. diag_log(format["AIRRAID: BOMBER: Adding Pre-POC-Waypoint #%1 on %2", _x,str(_preWaypointPos)]);
  155. _wp = _aigroup addWaypoint [_preWaypointPos, 0];
  156. _wp setWaypointType "MOVE";
  157. _wp setWaypointBehaviour "CARELESS";
  158. };
  159. };
  160.  
  161. _wp2 = _aigroup addWaypoint [position _landingzone, 0];
  162. _wp2 setWaypointType "MOVE";
  163. _wp2 setWaypointBehaviour "CARELESS";
  164.  
  165. //Get some more Speed when close to the Crashpoint and go on even if Heli died or hit the ground
  166. waituntil {(_bomber distance _positionLand) <= 2000};
  167. _bomber flyInHeight 200;
  168. _bomber forceSpeed 90;
  169. _bomber setspeedmode "NORMAL";
  170. ///////////////////////////////////////////////////////////////////START SIRENS/////////////////////////////////////////////////////
  171. diag_log format ["AIRRAID: INCOMING ATTACK: Sounding Siren at: %1 %2 | Repeat: %3| Type: %4 | Duration: %5",_xpos,_ypos,_repeat,_choice,_duration];
  172. //sounds
  173. _pos = position _target;
  174. diag_log format ["AIRRAID: POS: %1 | TARGET: %2 | SHOULD MATCH",_pos,_coords];
  175. _siren = createVehicle ["HeliHEmpty",position _target,[], 0, "NONE"];
  176. _siren say ["eve",_sounddist]; // siren sound
  177. sleep 60;
  178. _siren say ["puk",_sounddist]; // siren sound
  179. sleep 60;
  180. _siren say ["eve",_sounddist]; // siren sound
  181. sleep 60;
  182. _siren say ["nam",_sounddist]; // siren sound
  183. sleep 60;
  184. _siren say ["puk",_sounddist];
  185. sleep 60; // wait a while
  186. _siren say ["nam",_sounddist];
  187. sleep 5; //thats enough warning
  188.  
  189. waituntil {(_bomber distance _positionLand) <= 150};
  190. _bomber flyInHeight 300;
  191. _bomber forceSpeed 45;
  192. _bomber setspeedmode "NORMAL";
  193. diag_log(format["AIRRAID: BOMBER: %1 has arrived at %2!, ", _bomberName, str(getPosATL _bomber)]);
  194. _siren say ["nam",_sounddist];
  195.  
  196. waituntil {(_bomber distance _positionLand) <= 30};
  197. _bomber flyInHeight 300;
  198. _bomber forceSpeed 2;
  199. _bomber setspeedmode "NORMAL";
  200. _siren say ["nam",_sounddist];
  201.  
  202. waituntil {(_bomber distance _positionLand) <= 25};
  203. _bomber flyInHeight 300;
  204. _bomber forceSpeed 0;
  205. _bomber setspeedmode "NORMAL";
  206. _bombardStart = true; //set var so we know to start bombing (heli is in position)
  207. _siren say ["nam",_sounddist];
  208.  
  209. ///////////////////////////////////////////////////START BOMBING////////////////////////////////////////////////////////////////////
  210. diag_log format ["AIRRAID: Bombing Area: %1 %2",_xpos,_ypos];
  211.  
  212. //bomb while _duration > 1
  213. While {_duration > 1} do {
  214. _sound = createVehicle ["HeliHEmpty",position _target,[], _ray, "NONE"];
  215. _sound say ["mortar1",_sounddist];
  216. sleep 2;
  217. If (_choice == 1) then {
  218. _espl = createVehicle ["SH_105_HE",position _sound,[], 0, "NONE"];
  219. };
  220. If (_choice == 2) then {
  221. _espl = createVehicle ["SH_125_HE",position _sound,[], 0, "NONE"];
  222. };
  223. If (_choice == 3) then {
  224. _espl = createVehicle ["BO_GBU12_LGB",position _sound,[], 0, "NONE"];
  225. };
  226. _duration = _duration - 1;
  227. deletevehicle _sound;
  228. }; // Close while loop. loop while _duration >1
  229. _bombardDone = true; //set done bombing
  230. ///////////////////////////////////////////////////END SIRENS AND BOMBING//////////////////////////////////////////////////////////////
  231.  
  232. waituntil {_bombardDone == true}; ///////////////////hover over town until town is bombed to shit
  233. _bomber flyInHeight 15;
  234. _bomber forceSpeed 140;
  235. _bomber setspeedmode "NORMAL";
  236. diag_log(format["AIRRAID: BOMBER: %1 has Completed Bombing at %2!, ", _bomberName, str(getPosATL _bomber)]);
  237.  
  238. //Giving the crashed Heli some time to leave
  239. sleep 1;
  240.  
  241. //Adding a last Waypoint up in the North, to send bomber away after complettion.
  242. _wp3 = _aigroup addWaypoint [_safetyPoint, 0];
  243. _wp3 setWaypointType "DESTROY";
  244. _wp3 setWaypointBehaviour "CARELESS";
  245.  
  246. //Get position of the helis
  247. _posBomb = [getpos _bomber select 0, getpos _bomber select 1,0];
  248. sleep 2;
  249. _bomber forceSpeed 200;
  250. _bomber flyInHeight 300;
  251. _bomber setspeedmode "NORMAL";
  252. diag_log(format["AIRRAID: BOMBER: %1 Leaving Area %2!, ", _bomberName, str(getPosATL _bomber)]);
  253.  
  254. //Clean Up
  255. sleep 15;
  256. waituntil {(_bomber distance _positionLand) > 500};
  257. _bomber set damage 1;
  258. _bomber set fuel;
  259. _bomber setspeedmode "NORMAL";
  260. sleep 3;
  261. deletevehicle _bomber;
  262. deletevehicle _landingzone;
  263. deletevehicle _helipilot;
  264. _repeat = _repeat - 1;
  265. deletevehicle _siren;
  266. deletevehicle _loc;
  267. deletevehicle _target;
  268. diag_log format ["AIRRAID: Going down for sleep: Repeat:%1 | Sleep:%2",_repeat,_break];
  269. sleep _break;
  270. }; //close while loop. loop - while _repeat > 1
  271. exit
Advertisement
Add Comment
Please, Sign In to add comment