Advertisement
mmmyum

ver0.3

Apr 25th, 2013
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.96 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 defaults... %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 = false; //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;/////////////////////////////////////////not sure why this was here
  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. _posdebug = position _target;
  105. diag_log format ["AIRRAID: SEL: %1 | TARGET: %2 | SHOULD MATCH APPROX",_posdebug,_coords];
  106. /////above is the target to bomb
  107. sleep 2;
  108. //Random Heli-Type
  109. //if (_rmodyn) then {
  110. // _heliModel = ["Mi24_D","MV22"] call BIS_fnc_selectRandom;
  111. //} else {
  112. // _heliModel = ["UH1H_DZ","Mi17_DZ"] call BIS_fnc_selectRandom;
  113. //};
  114. _heliModel = "UH1H_DZ";
  115. //Random-Startpositions, Adjust this for other Maps then Chernarus //////////////////////////////mmmyum - change me to where you want heli to start, ie over carrier?
  116. _heliStart = [[6993.7007,173.05298,300],[1623.715,218.18848,300]] call BIS_fnc_selectRandom;
  117.  
  118. //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
  119. _safetyPoint = [7492.6675, 15263.042];
  120.  
  121. _bomberName = getText (configFile >> "CfgVehicles" >> _heliModel >> "displayName");
  122.  
  123. diag_log(format["AIRRAID: BOMBER: %1 | Lift Off at %2 | with Backup WP %3",_bomberName,str(_heliStart),str(_safetyPoint)]);
  124. diag_log(format["AIRRAID: BOMBER: %1 | TYPE: %2 |",_bomberName,_heliModel]);
  125.  
  126. _positionLand = [position _target,0,200,5,0,2000,0] call BIS_fnc_findSafePos; //set chopper destination
  127.  
  128. diag_log(format["AIRRAID: BOMBER: %1 started flying from %2 to %3 NOW!(TIME:%4|)", _bomberName, str(_heliStart), str(_positionLand), round(time)]);
  129.  
  130. //Spawn the AI-Heli flying in the air
  131. _startTime = time;
  132. _bomber = createVehicle [_heliModel,_heliStart, [], 0, "FLY"];
  133.  
  134. //Make sure its not destroyed by the Hacker-Killing-Cleanup (Thanks to Sarge for the hint)
  135. _bomber setVariable["Sarge",1]; //I'm unsure what do to here, so I'm leaving it
  136.  
  137. _bomber engineOn true;
  138. _bomber flyInHeight 350;
  139. _bomber forceSpeed 250;
  140. //_bomber setspeedmode "LIMITED";
  141.  
  142. //Create an Invisibile Landingpad at the Crashside-Coordinates
  143. _landingzone2 = createVehicle ["HeliHEmpty", [_positionLand select 0, _positionLand select 1,0], [], 0, "CAN_COLLIDE"]; //_targets x,y
  144. _landingzone2 setVariable["Sarge",1];
  145. diag_log(format["AIRRAID: BOMBER: LANDINGZONE: %1 | BOMBER POS: %2 | POS LAND: %3",str(getPosATL _landingzone2),str(getPosATL _bomber),str(_positionLand)]);
  146.  
  147. //Only a Woman could crash a Heli this way...
  148. _aigroup2 = creategroup civilian;
  149. _helipilot2 = _aigroup2 createUnit ["SurvivorW2_DZ",getPos _bomber,[],0,"FORM"];
  150. _helipilot2 moveindriver _bomber;
  151. _helipilot2 assignAsDriver _bomber;
  152.  
  153.  
  154. sleep 0.5;
  155.  
  156. if(_preWaypoints > 0) then {
  157. for "_num" from 1 to _preWaypoints do {
  158. _preWaypointPos = [getMarkerPos _spawnMarker,0,_spawnRadius,10,0,2000,0] call BIS_fnc_findSafePos;
  159. };
  160. diag_log(format["AIRRAID: BOMBER: Adding Pre-POC-Waypoint #%1 on %2", _num,str(_preWaypointPos)]);
  161. _wp = _aigroup2 addWaypoint [_preWaypointPos, 0];
  162. _wp setWaypointType "MOVE";
  163. //_wp setWaypointBehaviour "CARELESS";
  164. };
  165.  
  166. _wp2 = _aigroup2 addWaypoint [position _target, 0];
  167. _wp2 setWaypointType "MOVE";
  168. //_wp2 setWaypointBehaviour "CARELESS";
  169.  
  170. //Get some more Speed when close to the Crashpoint and go on even if Heli died or hit the ground
  171. waituntil {(_bomber distance _positionLand) <= 2000};
  172. _bomber flyInHeight 300;
  173. _bomber forceSpeed 260;
  174. _bomber setspeedmode "NORMAL";
  175. ///////////////////////////////////////////////////////////////////START SIRENS/////////////////////////////////////////////////////
  176. diag_log format ["AIRRAID: INCOMING ATTACK: Sounding Siren at: %1 %2 | Repeat: %3| Type: %4 | Duration: %5",_xpos,_ypos,_repeat,_choice,_duration];
  177. //sounds
  178. _pos = position _target;
  179. diag_log format ["AIRRAID: POS: %1 | TARGET: %2 | SHOULD MATCH",_pos,_coords];
  180. _siren = createVehicle ["HeliHEmpty",position _target,[], 0, "NONE"];
  181. _siren say ["eve",_sounddist]; // siren sound
  182. sleep 60;
  183. _siren say ["puk",_sounddist]; // siren sound
  184. sleep 60;
  185. _pos1 = position _espl;
  186. diag_log format ["AIRRAID: SIREN: %1 | TARGET: %2 | SHOULD MATCH APPROX",_pos1,_coords];
  187. _siren say ["eve",_sounddist]; // siren sound
  188. sleep 60;
  189. _siren say ["nam",_sounddist]; // siren sound
  190. sleep 30;
  191. _siren say ["puk",_sounddist];
  192. sleep 60; // wait a while
  193. _siren say ["nam",_sounddist];
  194. sleep 30; //thats enough warning
  195. ////////////////////////////////////////DEBUG //worries that that this will stop the script calling the says with the sleep sections.
  196. ////////////////////////////////////////////////maybe it will just make it play sirens for my set amount of time, then it will move on down the list
  197.  
  198. waituntil {(_bomber distance _positionLand) <= 150};
  199. _bomber flyInHeight 300;
  200. _bomber forceSpeed 100;
  201. _bomber setspeedmode "NORMAL";
  202. diag_log(format["AIRRAID: BOMBER: %1 has arrived at %2!, ", _bomberName, str(getPosATL _bomber)]);
  203. _siren say ["nam",_sounddist];
  204. sleep 10;
  205.  
  206. waituntil {(_bomber distance _positionLand) <= 30};
  207. _bomber flyInHeight 300;
  208. _bomber forceSpeed 25;
  209. _bomber setspeedmode "NORMAL";
  210. _siren say ["nam",_sounddist];
  211. sleep 10;
  212.  
  213. waituntil {(_bomber distance _positionLand) <= 25};
  214. _bomber flyInHeight 300;
  215. _bomber forceSpeed 2;
  216. _bomber setspeedmode "NORMAL";
  217. _bombardStart = true; //set var so we know to start bombing (heli is in position)
  218. _siren say ["puk",_sounddist];
  219.  
  220. ///////////////////////////////////////////////////START BOMBING////////////////////////////////////////////////////////////////////
  221. diag_log format ["AIRRAID: Bombing Area: %1 %2",_xpos,_ypos];
  222.  
  223. //bomb while _duration > 1
  224. While {_duration > 1} do {
  225. _sound = createVehicle ["HeliHEmpty",position _target,[], _ray, "NONE"];
  226. _sound say ["mortar1",_sounddist];
  227. sleep 2;
  228. If (_choice == 1) then {
  229. _espl = createVehicle ["SH_105_HE",position _sound,[], 0, "NONE"];
  230. };
  231. If (_choice == 2) then {
  232. _espl = createVehicle ["SH_125_HE",position _sound,[], 0, "NONE"];
  233. };
  234. If (_choice == 3) then {
  235. _espl = createVehicle ["BO_GBU12_LGB",position _sound,[], 0, "NONE"];
  236. };
  237. _duration = _duration - 1;
  238. deletevehicle _sound;
  239. }; // Close while loop. loop while _duration >1
  240. _bombardDone = true; //set done bombing
  241. ///////////////////////////////////////////////////END SIRENS AND BOMBING, HELI LOWER TO GROUND, (SPAWN AIs), FLY AWAY//////////////////////////////////////////////////////////////
  242.  
  243. waituntil {_bombardDone}; ///////////////////hover over town until town is bombed to shit
  244. _bomber flyInHeight 15;
  245. _bomber forceSpeed 140;
  246. _bomber setspeedmode "NORMAL";
  247. diag_log(format["AIRRAID: BOMBER: %1 has Completed Bombing at %2!, ", _bomberName, str(getPosATL _bomber)]);
  248. if (_repeat < 5) then {
  249. _aispawncoords = position _bomber;
  250. _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)////
  251. };
  252. //Giving the crashed Heli some time to leave
  253. sleep 15;
  254.  
  255. //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
  256. _wp3 = _aigroup2 addWaypoint [_safetyPoint, 0];
  257. _wp3 setWaypointType "DESTROY";
  258. _wp3 setWaypointBehaviour "CARELESS";
  259.  
  260. //Get position of the helis
  261. _posBomb = [getpos _bomber select 0, getpos _bomber select 1,0];
  262. sleep 2;
  263. _bomber forceSpeed 200;
  264. _bomber flyInHeight 300;
  265. _bomber setspeedmode "NORMAL";
  266. diag_log(format["AIRRAID: BOMBER: %1 Leaving Area %2!, ", _bomberName, str(getPosATL _bomber)]);
  267.  
  268. //////////////////////////////////////////////////////////CLEAN UP//CLEAN UP//CLEAN UP//
  269. sleep 15;
  270. waituntil {(_bomber distance _safetyPoint) <= 1000};
  271. _bomber set damage 1;
  272. _bomber set fuel 0;
  273. _bomber setspeedmode "NORMAL";
  274. sleep 3;
  275. deletevehicle _bomber;
  276. deletevehicle _landingzone2;
  277. deletevehicle _helipilot2;
  278. _repeat = _repeat - 1;
  279. deletevehicle _siren;
  280. deletevehicle _loc;
  281. deletevehicle _target;
  282. diag_log format ["AIRRAID: Going down for sleep: Repeat:%1 | Sleep:%2",_repeat,_break];
  283. sleep _break;
  284. }; //close while loop. loop - while _repeat > 1
  285. exit
  286.  
  287. ///////////////////////////////////////////TO DO
  288. //stress testing - what happens if a player destroys the heli before it gets to bomb? do we hang on the waituntil or does the loop know enough to close itself
  289. //code in this type of error handling
  290. //does the ai spawning work? how well?
  291. //haha does this code work at all? who knows.
  292. //
  293. //get rid of waituntils
  294. //separate into functions
  295. //learn about locality in arma 2
  296. //private variables so as not to fuck the publics - test other scripts
  297. // simplify - plane goes straight to bomb sites and bombs? 2, plane hovers, lowers, and spawns, flies away to die, gets random waypoint.
  298. //integreate - into heli crashs - every time a heli crash gets called, shit gets hectic bombed, then chopper spawns ais, zeds smackdown, flies away
  299. // eventually crashes cause of zombie bites.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement