Advertisement
mmmyum

0.66 RELEASE

May 10th, 2013
1,746
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 23.32 KB | None | 0 0
  1. /////     /////     /////     /////     /////     /////     /////     /////     /////
  2. /////////////////////////////////////////////////////////////////////////////////////////////
  3. ///////////////mmmyum's animated air raid dayz///////////////////////////////////////
  4. ////////////////////////////////////////////////////////////////////////////////////////////
  5. //                                       v0.66 may 10 2013 6pmEST RANDOM AND STATIC ANIMAI
  6. //
  7. //      decided to get you guys some kind of update with some of the requested features.
  8. //      non-animated version will not be updated at this time, maybe later if there is demand.  
  9. //      to do following the code
  10. //       don't forget to read the readme! (below)
  11. //thanks to: opendayz.net! arma scripters Maxjoiner and DarkXess.  Sarge and Kind-Sir for all their help with this, and Grafzhal for his animated heli crashes code which helped me learn
  12. //
  13. //-------------------------------------------------------------------------------------------------------------
  14. // README
  15. //  README
  16. //    README
  17. // change SETUP sections
  18. // change SETUP section later in code if you want custom bomber spawn in and spawn out locations
  19. // change SET UP AI CODE section if you want AI spawns
  20. // read further comments if you'd like to customize further
  21. //  note: if you fuck up formatting, especially for _loc
  22. //                                                  !   it will not work
  23. //NEW! SARGE'S AI CALLS - setup for sarge's AI done, now choose either custom or sarge's AI
  24. //!!!!!!!!!!!!!!!!!!!!!!   IMPORTANT SETUP VALUES: MUST SET THESE FOR CODE TO WORK PROPERLY FOR YOU
  25. //_rmodyn ----- _useRandChoice ---------- _useRandBomb ------------ _spawnynAI -------------_spawnnumAI----_spawnMarker
  26. //locations list - change if you want less/different locations - if you change me, random(##) must represent number of cases.
  27. // start and end points
  28. //---------------------------------------------------------------------------------------------------------------
  29. //////////////////////////////BEGIN FILE
  30.  
  31. private ["_preWaypointPos","_spawnMarker","_spawnRadius","_wp","_espl","_sound","_duration","_aispawncoords","_aispawn","_rndSel","_loc","_city","_z","_xx","_y","_coords","_target","_posdebug","_heliModel","_heliStart","_safetyPoint","_bomberName","_positionLand","_bomber","_landingzone2","_aigroup2","_helipilot2","_wp2","_pos","_siren","_pos1","_wp3","_repeat","_break","_choice","_rmodyn","_preWaypoints","_sounddist","_ray","_pos2","_targetpos","_poswhistl","_sirenB","_citySwing","_wpT","_citySwing2","_wpT2","_wpLand","_rndSlp","_esp2","_useRandChoice","_useRandBomb","_aiSpawnX","_aiSpawnY","_spawnynAI","_spawnnumAI","_wpLandSpawn","_numbeofBombs","_esp3","_posEsp3","_debugPosEs1","_bomberDisT","_sirenPlayCnt","_randomLyn","_bomberPos","_debugYn","_yumEndCounter","_safetyEndPos","_safetyEnd","_sargeAI"];
  32.  
  33. sleep 5;
  34.  
  35. ////////////////////////////////////////////////////SETUP SETUP SETUP//SETUP SETUP SETUP//SETUP SETUP SETUP//SETUP SETUP SETUP//SETUP SETUP SETUP
  36. _repeat = 42;                                       //times to repeat//number of times to cycle complete code (pick new place to bomb)
  37. _break = 420;                                       //time to break between attacks, in seconds (time between cycles)
  38. _choice = 1;                                        //type of bombing 1 light, 2 medium, 3 heavy
  39. _randomLyn = true;                                  //true if you want random locations (be sure to set static location otherwise!)
  40. _loc = ["BalottaAirstrip",1.5,4829.9868,2450.1104]; //Set to static location format ["name",z,x,y]  //SKIP if using random locations
  41. _city = "BalottaAirstrip";                          //Set to string name of static location//allows for custom name in rpt no spaces
  42. _useRandChoice = true;                              //true if you want random choice of type of bomb per bomb
  43. _useRandBomb = true;                                //true if you want an extra random bomb
  44. _numbeofBombs = 60;                                 //how many bombs are dropped assuming 1 per cycle
  45. _rmodyn = false;                                    //true if you have rMod, false if you don't (choice of heli bomber) //mmmyum - it may work even without rmod as reported by users!
  46. _preWaypoints = 1;                                  //add waypoints before arriving at location. //mmmyum testing now
  47.     _spawnMarker = 'center';                            //change to 'name' if you want a custom waypoint, i made mine north (do it in mission.sqm!) only for prewaypoints
  48.     _spawnRadius = 4000;                            //radius to choose for prewaypoint (choose within x of _spawnMarker)
  49. _sounddist = 5000;                                  //distance sounds are audible at
  50. _ray = 120;                                         //ray of bombing//radius
  51. _spawnynAI = false;                                 //true if you want AIs to spawn (sometimes) //MUST SET UP AI CODE for your particular method of spawning AI
  52.     _spawnnumAI = 7;                                //number of times you want AIs to spawn MUST SET UP AI CODE
  53. _debugYn = false;                                   //additional debug messages
  54. ////////////////////////////////////////////////////END SETUP//END SETUP//END SETUP//END SETUP//END SETUP//END SETUP//END SETUP//END SETUP
  55.  
  56. //Initialize //dont change this
  57. _xx = 4829.9868;
  58. _y = 2450.1104;
  59. _z = 1.5;
  60. //Set
  61. _z = _loc select 1;
  62. _xx = _loc select 2;
  63. _y = _loc select 3;
  64. _coords = [_xx,_y,_z];
  65. diag_log format ["RANDOM WORLDSPACE: Initializing defaults... %1 | %2 %3 %4| RANDOM ON: %5",_city,_xx,_y,_z,_randomLyn];
  66.  
  67.  
  68. //BEGIN LOOP!          //change to While {true} do... for infinite loops                    
  69. While {_repeat > 0} do {
  70. _duration = _numbeofBombs;
  71.  
  72. //if option for random/static
  73. if (_randomLyn) then {
  74. _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]//change random number to number of last case
  75. _loc=
  76. switch (_rndSel) do {
  77. case 0: {["BalottaAirstrip",1.5,4829.9868,2450.1104]};
  78. case 1: {["Berenzino",1.5,12954.624,9783.1533]};
  79. case 2: {["Bereznio2",1.5,12043.963,9091.3477]};
  80. case 3: {["BlackMountain",1.5,10276.416,12049.6640]};
  81. case 4: {["Bor",1.5,3320.1643,3938.3496]};
  82. case 5: {["Cherno",1.5,6743.8853,2581.1865]};
  83. case 6: {["DevilsCastle",1.5,6891.9189,11438.73]};
  84. case 7: {["DonsCamp",1.5,7788.2856,12613.048]};
  85. case 8: {["Drozhino",1.5,3442.2849,4955.7129]};
  86. case 9: {["Dubrovka",1.5,10445.011,9868.9912]};
  87. case 10: {["Electro",1.5,10480.69,2217.8027]};
  88. case 11: {["Factory",1.5,13060.078,7094.0596]};
  89. case 12: {["Gorka",1.5,9659.084,8795.334]};
  90. case 13: {["Grishno",1.5,5979.6953,10343.341]};
  91. case 14: {["Guglovo",1.5,8517.8682,6676.3276]};
  92. case 15: {["Gvozdno",1.5,8614.4316,11868.967]};
  93. case 16: {["Kabanino",1.5,5318.8369,8602.6328]};
  94. case 17: {["Kamyshovo",1.5,12127.406,3496.2185]};
  95. case 18: {["Khelm",1.5,12290.833,10904.328]};
  96. case 19: {["Komarovo",1.5,3654.0908,2475.9468]};
  97. case 20: {["Kozlovka",1.5,4483.6777,4616.1675]};
  98. case 21: {["Krastonav",1.5,11212.624,12256.609]};
  99. case 22: {["Lopatino",1.5,2780.3135,10018.82]};
  100. case 23: {["Moglievka",1.5,7544.5845,5148.7822]};
  101. case 24: {["Msta",1.5,11275.323,5495.4053]};
  102. case 25: {["Myshkino",1.5,2019.2487,7327.7178]};
  103. case 26: {["Nadezhdino",1.5,5846.4434,4706.708]};
  104. case 27: {["NEAF",1.5,12073.906,12724.305]};
  105. case 28: {["Nizhnoye",1.5,13002.393,8285.8574]};
  106. case 29: {["NovySobor",1.5,7074.4854,7683.4883]};
  107. case 30: {["NWAF",1.5,4480.0781,10375.544]};
  108. case 31: {["Orlovets",1.5,12146.174,7266.5801]};
  109. case 32: {["Pavlovo",1.5,1693.9392,3845.0657]};
  110. case 33: {["Petrovka",1.5,5014.1143,12493.039]};
  111. case 34: {["Pogorevka",1.5,4473.5957,6411.3198]};
  112. case 35: {["Polana",1.5,10753.393,8132.6606]};
  113. case 36: {["Prigorodki",1.5,7976.5557,3299.5386]};
  114. case 37: {["Pulkovo",1.5,4915.0903,5605.6401]};
  115. case 38: {["Pusta",1.5,9156.2549,3897.7598]};
  116. case 39: {["Pustoshka",1.5,3072.9629,7945.4404]};
  117. case 40: {["Rogovo",1.5,4808.0024,6805.0518]};
  118. case 41: {["Shakhovka",1.5,9654.5244,6555.2583]};
  119. case 42: {["Solnichny",1.5,13454.279,6233.647]};
  120. case 43: {["Soosnovka",1.5,2528.7561,6354.9839]};
  121. case 44: {["Staroye",1.5,10140.659,5434.4302]};
  122. case 45: {["StarySobor",1.5,6143.6167,7721.5176]};
  123. case 46: {["Tulga",1.5,12803.296,4450.7466]};
  124. case 47: {["Vybor",1.5,3815.0635,8865.0938]};
  125. case 48: {["Vyshnoye",1.5,6590.3159,6029.1128]};
  126. case 49: {["Zelenogorsk",1.5,2758.7144,5304.3457]};
  127. };
  128. _city = _loc select 0;
  129. _z = _loc select 1;
  130. _xx = _loc select 2;
  131. _y = _loc select 3;
  132. _coords = [_xx,_y,_z];
  133. if (_debugYn) then {
  134. diag_log format ["RANDOM WORLDSPACE: %1 | %2",_city,_coords];
  135. };
  136. sleep 1;
  137. diag_log format ["RANDOM WORLDSPACE SELECTED: %1 | City: %2 | Coords: %3 , %4 | Try %5",_rndSel,_city,_xx,_y,_repeat];
  138. }; //end if random locations //otherwise static
  139.  
  140. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  141. //above  ---- the worldpace is selected, coordinates stored in _coords = [_xx,_y,_z]/////////////////////////////////////////////////////////
  142. //below  ---- chopper is created, flies to waypoint _coords while sirens play, hangs around till bombs are done flies off and is deleted/////////////
  143. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  144.  
  145. //CREATE TARGET///////////////
  146. _loc = createVehicle ["HeliHEmpty", _coords,[], 0, "NONE"];
  147. _target = createVehicle ["HeliHEmpty",position _loc,[], 0, "NONE"];  
  148. _posdebug = position _target;
  149. diag_log format ["AIRRAID: SEL: %1 | TARGET: %2 | CITY: %3",_posdebug,_coords,_city];
  150. sleep 2;
  151. //Random Heli-Type
  152. if (_rmodyn) then {
  153.     _heliModel = ["Mi24_D","MV22","UH1H_DZ","Mi17_DZ"] call BIS_fnc_selectRandom;
  154. } else {
  155.     _heliModel = ["UH1H_DZ","Mi17_DZ"] call BIS_fnc_selectRandom;
  156. };
  157.  
  158. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////SETUP//SETUP//SETUP
  159. //Random-Startposition - change to where you want the bomber to come from
  160. _heliStart = [[13987.627,10755.155,300],[13987.627,10755.155,300]] call BIS_fnc_selectRandom;
  161. //A Backup Waypoint, change to whatever you like - goes here after bombing
  162. _safetyPoint = [13987.627, 10755.155];
  163. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////SETUP//SETUP//SETUP
  164.  
  165. _bomberName = getText (configFile >> "CfgVehicles" >> _heliModel >> "displayName");
  166. diag_log(format["AIRRAID: BOMBER: %1 | TYPE: %4 Start at %2 | End at %3",_bomberName,str(_heliStart),str(_safetyPoint),_heliModel]);   
  167. _positionLand = [position _target,0,200,5,0,2000,0] call BIS_fnc_findSafePos; //set chopper destination
  168. diag_log(format["AIRRAID: BOMBER: %1 moving from %2 to %3 NOW!( TIME: %4 )", _bomberName,  str(_heliStart), str(_positionLand), round(time)]);
  169. //Build bomber
  170. _bomber = createVehicle [_heliModel,_heliStart, [], 0, "FLY"];
  171. _bomber setVariable["Sarge",1,true];
  172. _bomber engineOn true;
  173. _bomber flyInHeight 350;
  174. _bomber forceSpeed 180;
  175. //Create an Invisibile Landingpad near place to be bombed
  176. _landingzone2 = createVehicle ["HeliHEmpty", [_positionLand select 0, _positionLand select 1,0], [], 0, "CAN_COLLIDE"]; //_targets x,y
  177. if (_debugYn) then {
  178. diag_log(format["AIRRAID: BOMBER: DEBUG: %1 | BOMBER POS: %2 | POS LAND: %3 | TARGET: %4",str(getPosATL _landingzone2),str(getPosATL _bomber),str(_positionLand),str(getPosATL _target)]);
  179. };
  180. _sargeAI = false;
  181. //Bandit woman pilot
  182. _aigroup2 = creategroup civilian;
  183. _helipilot2 = _aigroup2 createUnit ["SurvivorW2_DZ",getPos _bomber,[],0,"FORM"];
  184. _helipilot2 moveindriver _bomber;
  185. _helipilot2 assignAsDriver _bomber;
  186. sleep 0.5;
  187. //prewaypoints
  188. if(_preWaypoints > 0) then {
  189.     for "_x" from 1 to _preWaypoints do {
  190.         _preWaypointPos = [getMarkerPos _spawnMarker,0,_spawnRadius,10,0,2000,0] call BIS_fnc_findSafePos;
  191.         diag_log(format["AIRRAID: BOMBER: Adding Pre-target Waypoint #%1 on %2", _x,str(_preWaypointPos)]);
  192.         _wp = _aigroup2 addWaypoint [_preWaypointPos, 0];
  193.         _wp setWaypointType "MOVE";
  194.         _bomber flyInHeight 400;
  195.         _bomber forceSpeed 400;
  196.         _bomber setspeedmode "NORMAL";
  197.         sleep 45;
  198.         waituntil {(_bomber distance _preWaypointPos) <= 2000 || not alive _bomber};
  199.         _bomberPos = getPosATL _bomber;
  200.         _wp setWPPos _bomberPos;
  201.         sleep 35;
  202.         deleteWaypoint _wp; //deletes waypoint
  203.         diag_log(format["AIRRAID: BOMBER: %1  POS: %2 end moving to Pre-target Waypoint at %3 ( TIME: %4 )", _bomberName, str(getPosATL _bomber), str(_preWaypointPos), round(time)]);
  204.     };
  205. };
  206. //Tell bomber to move to target
  207. _wp2 = _aigroup2 addWaypoint [position _target, 0];
  208. _wp2 setWaypointType "MOVE";
  209. _wp2 setWaypointBehaviour "CARELESS";
  210.        
  211. waituntil {(_bomber distance _positionLand) <= 10000 || not alive _bomber};
  212. _bomber flyInHeight 300;
  213. _bomber forceSpeed 260;
  214. _bomber setspeedmode "NORMAL";
  215.  
  216. ///////////////////////////////////////////////////////////////////START SIRENS/////////////////////////////////////////////////////
  217.  
  218. _pos = position _target;
  219. if (not alive _bomber) then {diag_log format ["AIRRAID: BOMBER DESTROYED: %1",_bomberName];};
  220. diag_log format ["AIRRAID: INCOMING ATTACK: Sounding Siren at: %1 %2",_pos,_wp2];
  221. //Create sirens
  222. _siren = createVehicle ["HeliHEmpty",position _target,[], 0, "NONE"];
  223. _sirenB = createVehicle ["HeliHEmpty",position _target,[], 0, "NONE"];
  224. _pos1 = position _siren;
  225. if (_debugYn) then {
  226. diag_log format ["AIRRAID: DEBUG: SIREN: %1 | TARGET: %2 | POS_TARGET %3",_pos1,_coords,_pos];
  227. };
  228. diag_log(format["AIRRAID: BOMBER: %1 is at %2!", _bomberName, str(getPosATL _bomber)]);
  229. [nil,_siren,rSAY,['eve', _sounddist]] call RE;
  230. sleep 2;
  231. [nil,_sirenB,rSAY,['puk', _sounddist]] call RE;
  232. _bomberDisT = _bomber distance _target;
  233. diag_log(format["AIRRAID: BOMBER: DISTANCE: %1 | POSITION: %2",_bomberDisT,str(getPosATL _bomber)]);
  234. _sirenPlayCnt = 0;
  235. //begin siren loop
  236. while {(_bomberDisT < 10000) and (_bomberDisT > 1000) and (_sirenPlayCnt < 20)} do {
  237.         if (not alive _bomber) exitWith{diag_log format ["AIRRAID: BOMBER DESTROYED: %1",_bomberName]};
  238.          if (_debugYn) then {
  239.         diag_log(format["AIRRAID: Playing Siren at %1 | Siren Nam %2 | Loop Num: %3",str(getPosATL _siren),_sounddist,_sirenPlayCnt]);
  240.          };
  241.         [nil,_siren,rSAY,['nam', _sounddist]] call RE;
  242.         sleep 8;
  243.         _rndSlp = floor(random 3);
  244.         sleep _rndSlp;
  245.         _bomberDisT = _bomber distance _pos;
  246.         sleep 1;
  247.         diag_log(format["AIRRAID: BOMBER: SIRENLOOP: DISTANCE: %1 | POSITION: %2",_bomberDisT,str(getPosATL _bomber)]);
  248.         _sirenPlayCnt = _sirenPlayCnt + 1;
  249.         sleep 1;
  250.     };
  251. if (_sirenPlayCnt < 3) then {
  252.     [nil,_siren,rSAY,['nam', _sounddist]] call RE;
  253.     sleep 7;
  254.     [nil,_sirenB,rSAY,['nam', _sounddist]] call RE;
  255.     sleep 8;
  256.     [nil,_siren,rSAY,['nam', _sounddist]] call RE;
  257.     sleep 7;
  258.     if (_debugYn) then {
  259.     diag_log(format["AIRRAID: BOMBER: SIRENIF: PLAYCOUNT: %1 + 3| POSITION: %2",_sirenPlayCnt,str(getPosATL _bomber)]);
  260.     };
  261. };
  262. [nil,_siren,rSAY,['eve', _sounddist]] call RE;
  263. sleep 10;
  264. [nil,_sirenB,rSAY,['puk', _sounddist]] call RE;
  265. sleep 10;
  266.  
  267. _bomber flyInHeight 350;
  268. _bomber forceSpeed 180;
  269. _bomber setspeedmode "NORMAL";
  270. _bomberDisT = _bomber distance _pos;
  271. diag_log(format["AIRRAID: BOMBER: DISTANCE: %1 | POSITION: %2",_bomberDisT,str(getPosATL _bomber)]);
  272. [nil,_siren,rSAY,['eve', _sounddist]] call RE;
  273. sleep 12;
  274. [nil,_sirenB,rSAY,['puk', _sounddist]] call RE;
  275.            
  276. waituntil {(_bomber distance _target) <= 1200 || not alive _bomber};
  277. sleep 8;
  278. _bomberPos = getPosATL _bomber;
  279. _wp2 setWPPos _bomberPos;
  280. sleep 8;
  281. deleteWaypoint _wp2; //deletes waypoint
  282. _bomber flyInHeight 360;
  283. _bomber forceSpeed 90;
  284. _bomber setspeedmode "NORMAL";
  285. [nil,_siren,rSAY,['nam', _sounddist]] call RE;
  286. _citySwing = [position _target,0,20,1,0,2000,0] call BIS_fnc_findSafePos; //set chopper cycle move back and forth over city
  287. _wpT = _aigroup2 addWaypoint [_citySwing, 0];
  288. _wpT setWaypointType "MOVE";
  289. sleep 15;
  290. _citySwing2 = [position _target,20,45,1,0,2000,0] call BIS_fnc_findSafePos; //set chopper cycle move back and forth over city
  291. _wpT2 = _aigroup2 addWaypoint [_citySwing2, 0];
  292. _wpT2 setWaypointType "MOVE";
  293. diag_log(format["AIRRAID: BOMBER: %1 Bombing Initialize: arrived at %2!, ", _bomberName, str(getPosATL _bomber)]);
  294. [nil,_siren,rSAY,['nam', _sounddist]] call RE;
  295.            
  296. ///////////////////////////////////////////////////START BOMBING////////////////////////////////////////////////////////////////////
  297.  
  298. _debugPosEs1 = getPosATL _bomber;
  299. _debugPosEs1 set [2, 0.1];
  300. sleep 1;
  301. _esp3 = createVehicle ["SH_105_HE",_debugPosEs1,[], 0, "NONE"];
  302. _posEsp3 = position _esp3;
  303. if (_debugYn) then {
  304. diag_log format ["AIRRAID: DEBUG ESP3: %1 | debugPosEs1: %2",_posEsp3,_debugPosEs1];
  305. };
  306. ///////////////////////////debug above
  307. sleep 3;
  308. //play long siren during bombing, one short siren
  309. [nil,_sirenB,rSAY,['puk', _sounddist]] call RE;
  310. sleep 1;
  311. [nil,_siren,rSAY,['nam', _sounddist]] call RE;
  312.  
  313. //start bombs loop
  314. While {_duration > 0} do {
  315. if (not alive _bomber) exitWith{diag_log format ["AIRRAID: BOMBER DESTROYED: %1",_bomberName]};
  316.     if (_useRandChoice) then {
  317.         _choice = floor(random 3);
  318.     };
  319.     _sound = createVehicle ["HeliHEmpty",position _target,[], _ray, "NONE"];
  320.     [nil,_sound,rSAY,['mortar1', _sounddist]] call RE;
  321.     sleep 2;
  322.     If (_choice == 0) then {
  323.         _espl = createVehicle ["SH_105_HE",position _sound,[], 0, "NONE"];
  324.     };
  325.     If (_choice == 1) then {
  326.         _espl = createVehicle ["SH_105_HE",position _sound,[], 0, "NONE"];
  327.     };
  328.     If (_choice == 2) then {
  329.         _espl = createVehicle ["SH_125_HE",position _sound,[], 0, "NONE"];
  330.     };
  331.     If (_choice == 3) then {
  332.         _espl = createVehicle ["BO_GBU12_LGB",position _sound,[], 0, "NONE"];
  333.     };
  334.     if (_duration > 59 || _duration < 2) then {
  335.         [nil,_siren,rSAY,['puk', _sounddist]] call RE;
  336.         _pos2 = getPosATL _espl;
  337.         _poswhistl = getPosATL _sound;
  338.         _targetpos = getPosATL _target;
  339.         diag_log format ["AIRRAID: BOMB: %1 | TARGET: %2 | NUMBER: %3 | SOUND %4 | CHOICE %5",str(_pos2),_targetpos,_duration,_poswhistl,_choice];
  340.     };
  341.     _duration = _duration - 1;
  342.     sleep (random 2);
  343.     if (_useRandBomb) then {
  344.         [nil,_sound,rSAY,['mortar1', _sounddist]] call RE;
  345.         sleep 1;
  346.         _esp2 = createVehicle ["SH_105_HE",position _sound,[], 0, "NONE"];
  347.     };
  348.     deletevehicle _sound;
  349.    
  350. }; // Close while loop. loop while _duration >1
  351. ///////////////////////////////////////////////////END SIRENS AND BOMBING, HELI LOWER TO GROUND, (SPAWN AIs), FLY AWAY//////////////////////////////////////////////////////////////
  352.            
  353. sleep 2;
  354. _bomberPos = getPosATL _bomber;
  355. _wpT setWPPos _bomberPos;
  356. sleep 30;
  357. deleteWaypoint _wpT; //deletes waypoint
  358. _bomberPos = getPosATL _bomber;
  359. _wpT2 setWPPos _bomberPos;
  360. sleep 30;
  361. deleteWaypoint _wpT2; //deletes waypoint
  362. _wpLandSpawn = [position _landingzone2,5,120,4,0,2000,0] call BIS_fnc_findSafePos;
  363. _wpLand = _aigroup2 addWaypoint [_wpLandSpawn, 0];
  364. _wpLand setWaypointType "MOVE";
  365. _bomber flyInHeight 100;
  366. _bomber forceSpeed 90;
  367. _bomber setspeedmode "NORMAL";
  368. sleep 15;
  369. if (_heliModel == "MV22") then { _bomber flyInHeight 35; } else {
  370. _bomber flyInHeight 15;
  371. };
  372. _bomber forceSpeed 0;
  373. _bomber setspeedmode "NORMAL";
  374. sleep 10;
  375. diag_log(format["AIRRAID: BOMBER: %1 has Completed Bombing at %2!", _bomberName, str(getPosATL _bomber)]);
  376. if (_spawnynAI) then {
  377.     if (_spawnnumAI > 0) then {
  378.         _aispawncoords = position _bomber;
  379.         diag_log(format["AIRRAID: BOMBER: AISPAWN: %1 | NUMBER %2",_aispawncoords,_spawnnumAI]);
  380.        
  381.         _aiSpawnX = _aispawncoords select 0;
  382.         _aiSpawnY = _aispawncoords select 1;
  383.         _spawnnumAI = _spawnnumAI - 1;
  384.            
  385. ///////////////////////////////////////////////////////////////////         //SET UP AI CODE//SET UP AI CODE//SETUP SETUP SETUP//SETUP SETUP SETUP
  386.                 //CUSTOM AI CALL
  387.         _aispawn = [[_aiSpawnX,_aiSpawnY,0],5000,20,5] execVM "units\add_unit_server_band.sqf"; //whole map waypoints//SETUP AI CODE HERE SETUP AI CODE HERE SETUP AI CODE HERE
  388.                 //THIS is how I call AI spawns on my server, you will need to set it up for your own code
  389.                 //use _aiSpawnX for x coords and _aiSpawnY for y coords - copy how you call AI spawn coords
  390.                
  391.                 //SARGE's AI CALL setup example //UNCOMMENT IF YOU WANT TO USE (remove /* and */ THIS! COMMENT out _aispawn = [[_aiSpawnX,.... if you do!
  392.         /*
  393.         SAR_marker_bomber = createMarker ["SAR_bomber", [_aiSpawnX,_aiSpawnY]];
  394.         SAR_marker_bomber setMarkerShape "RECTANGLE";
  395.         SAR_marker_bomber setMarkeralpha 0;
  396.         SAR_marker_bomber setMarkerType "Flag";
  397.         SAR_marker_bomber setMarkerBrush "Solid";
  398.         SAR_marker_bomber setMarkerSize [25, 25]; //make rectangle small
  399.         //then call the spawn
  400.         [SAR_marker_bomber,1,0,2,"patrol",false] call SAR_AI; //1,0,2 is 1 leader, 0 snipers, and 2 soldiers, change to your liking!
  401.         _sargeAI = true;        */
  402. ///////////////////////////////////////////////////////////////         //SET UP AI CODE//SET UP AI CODE//SETUP SETUP SETUP//SETUP SETUP SETUP END SETUP
  403.            
  404.         };
  405.     };
  406.  
  407. if (not alive _bomber) then {diag_log format ["AIRRAID: BOMBER DESTROYED: %1",_bomberName];};
  408. _bomberPos = getPosATL _bomber;
  409. _wpLand setWPPos _bomberPos;
  410. _bomber forceSpeed 25;
  411. _bomber flyInHeight 400;
  412. sleep 40;
  413. deleteWaypoint _wpLand; //deletes waypoint
  414. //create landing pad near end point
  415. _safetyEndPos = [[_safetyPoint select 0,_safetyPoint select 1,0],0,1000,4,1,2000,0] call BIS_fnc_findSafePos;
  416. _safetyEnd = createVehicle ["HeliHEmpty", _safetyEndPos,[], 0, "NONE"];
  417. //Adding a last Waypoint up in the North, to send bomber away after completion. Change this location (_safetyPoint) to where you want the AI to seem to originate from
  418. _wp3 = _aigroup2 addWaypoint [_safetyEndPos, 0];
  419. _wp3 setWaypointType "MOVE"; //maybe change to land?
  420. _wp3 setWaypointBehaviour "CARELESS";
  421.  
  422.  
  423. //Get position of the helis
  424. //_posBomb = [getpos _bomber select 0, getpos _bomber select 1,0];
  425. sleep 3;
  426. _bomber forceSpeed 400;
  427. _bomber flyInHeight 400;
  428. _bomber setspeedmode "NORMAL";
  429. diag_log(format["AIRRAID: BOMBER: %1 Leaving Area %2", _bomberName, str(getPosATL _bomber)]);
  430. //bomber position loop
  431.  
  432. _bomberDisT = _bomber distance _safetyEnd;
  433. _yumEndCounter = 0;
  434. while {(_bomberDisT < 20000) and (_bomberDisT > 2000) and (_yumEndCounter < 45)} do {
  435.         if (not alive _bomber) exitWith{diag_log format ["AIRRAID: BOMBER DESTROYED: %1",_bomberName]};
  436.         _bomberDisT = _bomber distance _safetyEnd;
  437.         diag_log(format["AIRRAID: BOMBER: DISTANCE SAFETYPOINT: %1 | POSITION: %2",_bomberDisT,str(getPosATL _bomber)]);
  438.         sleep 30;
  439.         _yumEndCounter = _yumEndCounter + 1;
  440.     };
  441.  
  442. //////////////////////////////////////////////////////////CLEAN UP//CLEAN UP//CLEAN UP//
  443. sleep 60;
  444. _bomberDisT = _bomber distance _safetyEnd;
  445. diag_log(format["AIRRAID: BOMBER: DISTANCE SAFETYPOINT: %1 | POSITION: %2",_bomberDisT,str(getPosATL _bomber)]);
  446. _bomber forceSpeed 200;
  447. _bomber flyInHeight 100;
  448. _bomber setspeedmode "NORMAL";
  449. sleep 60;
  450. deletevehicle _helipilot2;
  451. deletevehicle _bomber;
  452. if (_debugYn) then {
  453. diag_log format ["AIRRAID: DEBUG: Bomber deleted %1",_bomberName];
  454. };
  455. if (_sargeAI) then {
  456. deleteMarker "SAR_bomber";
  457. };
  458. sleep 0.1;
  459. deletevehicle _landingzone2;
  460. sleep 0.1;
  461. _repeat = _repeat - 1;
  462. sleep 0.1;
  463. deletevehicle _siren;
  464. sleep 0.1;
  465. deletevehicle _loc;
  466. sleep 0.1;
  467. deletevehicle _target;
  468. diag_log format ["AIRRAID: END CYCLE: Going down for sleep: Repeat:%1 | Sleep:%2",_repeat,_break];
  469. sleep _break;    
  470. }; //close while loop. loop -  while _repeat > 1
  471. exit
  472.  
  473. ///////////////////////////////////////////TO DO
  474. //
  475. //bombs start to drop from chopper pos as it hits city borders //working well for me - but bomber position is not always idea.  Working on this.
  476. ///////////////////-- UP NEXT! activate debug, see your rpt debug and report if it matches the bomber position message in the forum.  
  477. //crash site spawn if bomber destroyed //maybe - this seems to smash my fps a bit
  478. //AI parachutes? //hell yeah, this is in testing now
  479. //
  480. //nuke options (this is still a ways off)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement