Advertisement
Black_Sheep

mmmyum's animated air raid dayz Black_Sheep version

Oct 20th, 2013
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.48 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 = 48; //times to repeat//number of times to cycle complete code (pick new place to bomb)
  37. _break = 2760; //time to break between attacks, in seconds (time between cycles)
  38. _choice = 3; //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 = false; //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 = 40; //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 = 2; //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 = 7000; //radius to choose for prewaypoint (choose within x of _spawnMarker)
  49. _sounddist = 1000; //distance sounds are audible at
  50. _ray = 180; //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 48); //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: {["Tulga",1.5,12803.296,4450.7466]};
  123. case 46: {["Vybor",1.5,3815.0635,8865.0938]};
  124. case 44: {["Vyshnoye",1.5,6590.3159,6029.1128]};
  125. case 48: {["Zelenogorsk",1.5,2758.7144,5304.3457]};
  126.  
  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"] call BIS_fnc_selectRandom;
  154. //_heliModel = ["Mi24_D","MV22","UH1H_DZ","Mi17_DZ"] call BIS_fnc_selectRandom;
  155. } else {
  156. //_heliModel = ["UH1H_DZ","Mi17_DZ"] call BIS_fnc_selectRandom;
  157. //_heliModel = ["Mi24_D","MV22"] call BIS_fnc_selectRandom;
  158. _heliModel = ["Su25_TK_EP1","A10","MQ9PredatorB"] call BIS_fnc_selectRandom;
  159. };
  160.  
  161.  
  162.  
  163. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////SETUP//SETUP//SETUP
  164. //Random-Startposition - change to where you want the bomber to come from
  165. _heliStart = [[13987.627,10755.155,300],[13987.627,10755.155,300]] call BIS_fnc_selectRandom;
  166. //A Backup Waypoint, change to whatever you like - goes here after bombing
  167. _safetyPoint = [13987.627, 10755.155];
  168. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////SETUP//SETUP//SETUP
  169.  
  170. _bomberName = getText (configFile >> "CfgVehicles" >> _heliModel >> "displayName");
  171. diag_log(format["AIRRAID: BOMBER: %1 | TYPE: %4 Start at %2 | End at %3",_bomberName,str(_heliStart),str(_safetyPoint),_heliModel]);
  172. _positionLand = [position _target,0,200,5,0,2000,0] call BIS_fnc_findSafePos; //set chopper destination
  173. diag_log(format["AIRRAID: BOMBER: %1 moving from %2 to %3 NOW!( TIME: %4 )", _bomberName, str(_heliStart), str(_positionLand), round(time)]);
  174. //Build bomber
  175. _bomber = createVehicle [_heliModel,_heliStart, [], 0, "FLY"];
  176. _bomber setVariable["Sarge",1,true];
  177. _bomber engineOn true;
  178. _bomber flyInHeight 100;
  179. _bomber forceSpeed 300;
  180. //Create an Invisibile Landingpad near place to be bombed
  181. _landingzone2 = createVehicle ["HeliHEmpty", [_positionLand select 0, _positionLand select 1,0], [], 0, "CAN_COLLIDE"]; //_targets x,y
  182. if (_debugYn) then {
  183. 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)]);
  184. };
  185. _sargeAI = false;
  186. //Bandit woman pilot
  187. _aigroup2 = creategroup civilian;
  188. _helipilot2 = _aigroup2 createUnit ["SurvivorW2_DZ",getPos _bomber,[],0,"FORM"];
  189. _helipilot2 moveindriver _bomber;
  190. _helipilot2 assignAsDriver _bomber;
  191. sleep 0.5;
  192. //prewaypoints
  193. if(_preWaypoints > 0) then {
  194. for "_x" from 1 to _preWaypoints do {
  195. _preWaypointPos = [getMarkerPos _spawnMarker,0,_spawnRadius,10,0,2000,0] call BIS_fnc_findSafePos;
  196. diag_log(format["AIRRAID: BOMBER: Adding Pre-target Waypoint #%1 on %2", _x,str(_preWaypointPos)]);
  197. _wp = _aigroup2 addWaypoint [_preWaypointPos, 0];
  198. _wp setWaypointType "MOVE";
  199. _bomber flyInHeight 100;
  200. _bomber forceSpeed 300;
  201. _bomber setspeedmode "NORMAL";
  202. sleep 45;
  203. waituntil {(_bomber distance _preWaypointPos) <= 2000 || not alive _bomber};
  204. _bomberPos = getPosATL _bomber;
  205. _wp setWPPos _bomberPos;
  206. sleep 35;
  207. deleteWaypoint _wp; //deletes waypoint
  208. 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)]);
  209. };
  210. };
  211. //Tell bomber to move to target
  212. _wp2 = _aigroup2 addWaypoint [position _target, 0];
  213. _wp2 setWaypointType "MOVE";
  214. _wp2 setWaypointBehaviour "CARELESS";
  215.  
  216. waituntil {(_bomber distance _positionLand) <= 10000 || not alive _bomber};
  217. _bomber flyInHeight 100;
  218. _bomber forceSpeed 300;
  219. _bomber setspeedmode "NORMAL";
  220.  
  221. ///////////////////////////////////////////////////////////////////START SIRENS/////////////////////////////////////////////////////
  222.  
  223. _pos = position _target;
  224. if (not alive _bomber) then {diag_log format ["AIRRAID: BOMBER DESTROYED: %1",_bomberName];};
  225. diag_log format ["AIRRAID: INCOMING ATTACK: Sounding Siren at: %1 %2",_pos,_wp2];
  226. //Create sirens
  227. _siren = createVehicle ["HeliHEmpty",position _target,[], 0, "NONE"];
  228. _sirenB = createVehicle ["HeliHEmpty",position _target,[], 0, "NONE"];
  229. _pos1 = position _siren;
  230. if (_debugYn) then {
  231. diag_log format ["AIRRAID: DEBUG: SIREN: %1 | TARGET: %2 | POS_TARGET %3",_pos1,_coords,_pos];
  232. };
  233. diag_log(format["AIRRAID: BOMBER: %1 is at %2!", _bomberName, str(getPosATL _bomber)]);
  234. [nil,_siren,rSAY,['nam', _sounddist]] call RE;
  235. sleep 2;
  236. [nil,_sirenB,rSAY,['nam', _sounddist]] call RE;
  237. _bomberDisT = _bomber distance _target;
  238. diag_log(format["AIRRAID: BOMBER: DISTANCE: %1 | POSITION: %2",_bomberDisT,str(getPosATL _bomber)]);
  239. _sirenPlayCnt = 0;
  240. //begin siren loop
  241. while {(_bomberDisT < 10000) and (_bomberDisT > 1000) and (_sirenPlayCnt < 20)} do {
  242. if (not alive _bomber) exitWith{diag_log format ["AIRRAID: BOMBER DESTROYED: %1",_bomberName]};
  243. if (_debugYn) then {
  244. diag_log(format["AIRRAID: Playing Siren at %1 | Siren Nam %2 | Loop Num: %3",str(getPosATL _siren),_sounddist,_sirenPlayCnt]);
  245. };
  246. [nil,_siren,rSAY,['nam', _sounddist]] call RE;
  247. sleep 8;
  248. _rndSlp = floor(random 3);
  249. sleep _rndSlp;
  250. _bomberDisT = _bomber distance _pos;
  251. sleep 1;
  252. diag_log(format["AIRRAID: BOMBER: SIRENLOOP: DISTANCE: %1 | POSITION: %2",_bomberDisT,str(getPosATL _bomber)]);
  253. _sirenPlayCnt = _sirenPlayCnt + 1;
  254. sleep 1;
  255. };
  256. if (_sirenPlayCnt < 3) then {
  257. [nil,_siren,rSAY,['nam', _sounddist]] call RE;
  258. sleep 7;
  259. [nil,_sirenB,rSAY,['nam', _sounddist]] call RE;
  260. sleep 8;
  261. [nil,_siren,rSAY,['nam', _sounddist]] call RE;
  262. sleep 7;
  263. if (_debugYn) then {
  264. diag_log(format["AIRRAID: BOMBER: SIRENIF: PLAYCOUNT: %1 + 3| POSITION: %2",_sirenPlayCnt,str(getPosATL _bomber)]);
  265. };
  266. };
  267. [nil,_siren,rSAY,['nam', _sounddist]] call RE;
  268. sleep 10;
  269. [nil,_sirenB,rSAY,['nam', _sounddist]] call RE;
  270. sleep 10;
  271.  
  272. _bomber flyInHeight 100;
  273. _bomber forceSpeed 200;
  274. _bomber setspeedmode "NORMAL";
  275. _bomberDisT = _bomber distance _pos;
  276. diag_log(format["AIRRAID: BOMBER: DISTANCE: %1 | POSITION: %2",_bomberDisT,str(getPosATL _bomber)]);
  277. [nil,_siren,rSAY,['nam', _sounddist]] call RE;
  278. sleep 12;
  279. [nil,_sirenB,rSAY,['nam', _sounddist]] call RE;
  280.  
  281. waituntil {(_bomber distance _target) <= 1200 || not alive _bomber};
  282. sleep 8;
  283. _bomberPos = getPosATL _bomber;
  284. _wp2 setWPPos _bomberPos;
  285. sleep 8;
  286. deleteWaypoint _wp2; //deletes waypoint
  287. _bomber flyInHeight 150;
  288. _bomber forceSpeed 200;
  289. _bomber setspeedmode "NORMAL";
  290. [nil,_siren,rSAY,['nam', _sounddist]] call RE;
  291. _citySwing = [position _target,0,20,1,0,2000,0] call BIS_fnc_findSafePos; //set chopper cycle move back and forth over city
  292. _wpT = _aigroup2 addWaypoint [_citySwing, 0];
  293. _wpT setWaypointType "MOVE";
  294. sleep 15;
  295. _citySwing2 = [position _target,20,45,1,0,2000,0] call BIS_fnc_findSafePos; //set chopper cycle move back and forth over city
  296. _wpT2 = _aigroup2 addWaypoint [_citySwing2, 0];
  297. _wpT2 setWaypointType "MOVE";
  298. diag_log(format["AIRRAID: BOMBER: %1 Bombing Initialize: arrived at %2!, ", _bomberName, str(getPosATL _bomber)]);
  299. [nil,_siren,rSAY,['nam', _sounddist]] call RE;
  300.  
  301. ///////////////////////////////////////////////////START BOMBING////////////////////////////////////////////////////////////////////
  302.  
  303. _debugPosEs1 = getPosATL _bomber;
  304. _debugPosEs1 set [2, 0.1];
  305. sleep 1;
  306. _esp3 = createVehicle ["SH_105_HE",_debugPosEs1,[], 0, "NONE"];
  307. _posEsp3 = position _esp3;
  308. if (_debugYn) then {
  309. diag_log format ["AIRRAID: DEBUG ESP3: %1 | debugPosEs1: %2",_posEsp3,_debugPosEs1];
  310. };
  311. ///////////////////////////debug above
  312. sleep 3;
  313. //play long siren during bombing, one short siren
  314. [nil,_sirenB,rSAY,['nam', _sounddist]] call RE;
  315. sleep 1;
  316. [nil,_siren,rSAY,['nam', _sounddist]] call RE;
  317.  
  318. //start bombs loop
  319. While {_duration > 0} do {
  320. if (not alive _bomber) exitWith{diag_log format ["AIRRAID: BOMBER DESTROYED: %1",_bomberName]};
  321. if (_useRandChoice) then {
  322. _choice = floor(random 3);
  323. };
  324. _sound = createVehicle ["HeliHEmpty",position _target,[], _ray, "NONE"];
  325. [nil,_sound,rSAY,['mortar1', _sounddist]] call RE;
  326. sleep 2;
  327. If (_choice == 0) then {
  328. _espl = createVehicle ["SH_105_HE",position _sound,[], 0, "NONE"];
  329. };
  330. If (_choice == 1) then {
  331. _espl = createVehicle ["SH_105_HE",position _sound,[], 0, "NONE"];
  332. };
  333. If (_choice == 2) then {
  334. _espl = createVehicle ["SH_125_HE",position _sound,[], 0, "NONE"];
  335. };
  336. If (_choice == 3) then {
  337. _espl = createVehicle ["BO_GBU12_LGB",position _sound,[], 0, "NONE"];
  338. };
  339. if (_duration > 59 || _duration < 2) then {
  340. [nil,_siren,rSAY,['nam', _sounddist]] call RE;
  341. _pos2 = getPosATL _espl;
  342. _poswhistl = getPosATL _sound;
  343. _targetpos = getPosATL _target;
  344. diag_log format ["AIRRAID: BOMB: %1 | TARGET: %2 | NUMBER: %3 | SOUND %4 | CHOICE %5",str(_pos2),_targetpos,_duration,_poswhistl,_choice];
  345. };
  346. _duration = _duration - 1;
  347. sleep (random 2);
  348. if (_useRandBomb) then {
  349. [nil,_sound,rSAY,['mortar1', _sounddist]] call RE;
  350. sleep 1;
  351. _esp2 = createVehicle ["SH_105_HE",position _sound,[], 0, "NONE"];
  352. };
  353. deletevehicle _sound;
  354.  
  355. }; // Close while loop. loop while _duration >1
  356. ///////////////////////////////////////////////////END SIRENS AND BOMBING, HELI LOWER TO GROUND, (SPAWN AIs), FLY AWAY//////////////////////////////////////////////////////////////
  357.  
  358. sleep 2;
  359. _bomberPos = getPosATL _bomber;
  360. _wpT setWPPos _bomberPos;
  361. sleep 5;
  362. deleteWaypoint _wpT; //deletes waypoint
  363. _bomberPos = getPosATL _bomber;
  364. _wpT2 setWPPos _bomberPos;
  365. sleep 5;
  366. deleteWaypoint _wpT2; //deletes waypoint
  367. /*_wpLandSpawn = [position _landingzone2,5,120,4,0,2000,0] call BIS_fnc_findSafePos;
  368. _wpLand = _aigroup2 addWaypoint [_wpLandSpawn, 0];
  369. _wpLand setWaypointType "MOVE";
  370. _bomber flyInHeight 100;
  371. _bomber forceSpeed 90;
  372. _bomber setspeedmode "NORMAL";
  373. sleep 15;
  374. if (_heliModel == "MV22") then { _bomber flyInHeight 35; } else {
  375. _bomber flyInHeight 15;
  376. };
  377. _bomber forceSpeed 0;
  378. _bomber setspeedmode "NORMAL";
  379. sleep 10;
  380. */
  381. diag_log(format["AIRRAID: BOMBER: %1 has Completed Bombing at %2!", _bomberName, str(getPosATL _bomber)]);
  382. if (_spawnynAI) then {
  383. if (_spawnnumAI > 0) then {
  384. _aispawncoords = position _bomber;
  385. diag_log(format["AIRRAID: BOMBER: AISPAWN: %1 | NUMBER %2",_aispawncoords,_spawnnumAI]);
  386.  
  387. _aiSpawnX = _aispawncoords select 0;
  388. _aiSpawnY = _aispawncoords select 1;
  389. _spawnnumAI = _spawnnumAI - 1;
  390.  
  391. /////////////////////////////////////////////////////////////////// //SET UP AI CODE//SET UP AI CODE//SETUP SETUP SETUP//SETUP SETUP SETUP
  392. //CUSTOM AI CALL
  393. _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
  394. //THIS is how I call AI spawns on my server, you will need to set it up for your own code
  395. //use _aiSpawnX for x coords and _aiSpawnY for y coords - copy how you call AI spawn coords
  396.  
  397. //SARGE's AI CALL setup example //UNCOMMENT IF YOU WANT TO USE (remove /* and */ THIS! COMMENT out _aispawn = [[_aiSpawnX,.... if you do!
  398. /*
  399. SAR_marker_bomber = createMarker ["SAR_bomber", [_aiSpawnX,_aiSpawnY]];
  400. SAR_marker_bomber setMarkerShape "RECTANGLE";
  401. SAR_marker_bomber setMarkeralpha 0;
  402. SAR_marker_bomber setMarkerType "Flag";
  403. SAR_marker_bomber setMarkerBrush "Solid";
  404. SAR_marker_bomber setMarkerSize [25, 25]; //make rectangle small
  405. //then call the spawn
  406. [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!
  407. _sargeAI = true; */
  408. /////////////////////////////////////////////////////////////// //SET UP AI CODE//SET UP AI CODE//SETUP SETUP SETUP//SETUP SETUP SETUP END SETUP
  409.  
  410. };
  411. };
  412.  
  413. if (not alive _bomber) then {diag_log format ["AIRRAID: BOMBER DESTROYED: %1",_bomberName];};
  414. _bomberPos = getPosATL _bomber;
  415. _wpLand setWPPos _bomberPos;
  416. _bomber forceSpeed 25;
  417. _bomber flyInHeight 400;
  418. sleep 5;
  419. //deleteWaypoint _wpLand; //deletes waypoint
  420. //create landing pad near end point
  421. _safetyEndPos = [[_safetyPoint select 0,_safetyPoint select 1,0],0,1000,4,1,2000,0] call BIS_fnc_findSafePos;
  422. _safetyEnd = createVehicle ["HeliHEmpty", _safetyEndPos,[], 0, "NONE"];
  423. //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
  424. _wp3 = _aigroup2 addWaypoint [_safetyEndPos, 0];
  425. _wp3 setWaypointType "MOVE"; //maybe change to land?
  426. _wp3 setWaypointBehaviour "CARELESS";
  427.  
  428.  
  429. //Get position of the helis
  430. //_posBomb = [getpos _bomber select 0, getpos _bomber select 1,0];
  431. sleep 3;
  432. _bomber forceSpeed 400;
  433. _bomber flyInHeight 400;
  434. _bomber setspeedmode "NORMAL";
  435. diag_log(format["AIRRAID: BOMBER: %1 Leaving Area %2", _bomberName, str(getPosATL _bomber)]);
  436. //bomber position loop
  437.  
  438. _bomberDisT = _bomber distance _safetyEnd;
  439. _yumEndCounter = 0;
  440. while {(_bomberDisT < 20000) and (_bomberDisT > 2000) and (_yumEndCounter < 45)} do {
  441. if (not alive _bomber) exitWith{diag_log format ["AIRRAID: BOMBER DESTROYED: %1",_bomberName]};
  442. _bomberDisT = _bomber distance _safetyEnd;
  443. diag_log(format["AIRRAID: BOMBER: DISTANCE SAFETYPOINT: %1 | POSITION: %2",_bomberDisT,str(getPosATL _bomber)]);
  444. sleep 30;
  445. _yumEndCounter = _yumEndCounter + 1;
  446. };
  447.  
  448. //////////////////////////////////////////////////////////CLEAN UP//CLEAN UP//CLEAN UP//
  449. sleep 60;
  450. _bomberDisT = _bomber distance _safetyEnd;
  451. diag_log(format["AIRRAID: BOMBER: DISTANCE SAFETYPOINT: %1 | POSITION: %2",_bomberDisT,str(getPosATL _bomber)]);
  452. _bomber forceSpeed 200;
  453. _bomber flyInHeight 100;
  454. _bomber setspeedmode "NORMAL";
  455. sleep 60;
  456. deletevehicle _helipilot2;
  457. deletevehicle _bomber;
  458. if (_debugYn) then {
  459. diag_log format ["AIRRAID: DEBUG: Bomber deleted %1",_bomberName];
  460. };
  461. if (_sargeAI) then {
  462. deleteMarker "SAR_bomber";
  463. };
  464. sleep 0.1;
  465. deletevehicle _landingzone2;
  466. sleep 0.1;
  467. _repeat = _repeat - 1;
  468. sleep 0.1;
  469. deletevehicle _siren;
  470. sleep 0.1;
  471. deletevehicle _loc;
  472. sleep 0.1;
  473. deletevehicle _target;
  474. diag_log format ["AIRRAID: END CYCLE: Going down for sleep: Repeat:%1 | Sleep:%2",_repeat,_break];
  475. sleep _break;
  476. }; //close while loop. loop - while _repeat > 1
  477. exit
  478.  
  479. ///////////////////////////////////////////TO DO
  480. //
  481. //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.
  482. ///////////////////-- UP NEXT! activate debug, see your rpt debug and report if it matches the bomber position message in the forum.
  483. //crash site spawn if bomber destroyed //maybe - this seems to smash my fps a bit
  484. //AI parachutes? //hell yeah, this is in testing now
  485. //
  486. //nuke options (this is still a ways off)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement