Guest User

Untitled

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