mmmyum

mmmyumhelibombairraid0.31

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