Advertisement
Guest User

Untitled

a guest
Mar 29th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.13 KB | None | 0 0
  1. /*
  2. Author: John_Spartan & Saul
  3.  
  4. Description:
  5. Dynamic loadout selection/rearming function for F/A-18 Black Wasp
  6. Adjusted to work for: USAF mod F22 [with permission's from original authors]
  7.  
  8. Exucution:
  9. USAF_F22_dynamic_loadoutscript = [_USAF_F22,_station_1,_station_2,_station_3,_station_4,_station_5,_station_6,_station_7,_station_8,_station_9,_station_10,_station_11,_station_12] execvm "\USAF_F22\scr\LOADOUTS\USAF_F22_dynamic_loadouts.sqf";
  10. via unit init line in editor or via instance of mission script [INIT.sqf for example]
  11.  
  12. Parameter(s):
  13. _this select 0: mode (Scalar)
  14.  
  15. 0: plane/object
  16. 1: magazine classname to be equipped on station 1 ["my_magazine_classname"]
  17. 2: magazine classname to be equipped on station 2 ["my_magazine_classname"]
  18. 3: magazine classname to be equipped on station 3 ["my_magazine_classname"]
  19. 4: magazine classname to be equipped on station 4 ["my_magazine_classname"]
  20. 5: magazine classname to be equipped on station 5 ["my_magazine_classname"]
  21. 6: magazine classname to be equipped on station 6 ["my_magazine_classname"]
  22. 7: magazine classname to be equipped on station 7 ["my_magazine_classname"]
  23. 8: magazine classname to be equipped on station 8 ["my_magazine_classname"]
  24. 9: magazine classname to be equipped on station 9 ["my_magazine_classname"]
  25. 10: magazine classname to be equipped on station 10 ["my_magazine_classname"]
  26. 11: magazine classname to be equipped on station 11 ["my_magazine_classname"]
  27. 12: magazine classname to be equipped on station 12 ["my_magazine_classname"]
  28.  
  29.  
  30.  
  31. Returns: nothing
  32. Result: aircrfat rearmed with desiered loadout
  33.  
  34. */
  35.  
  36.  
  37.  
  38. //BASIC DEFINITIONS
  39. _plane = _this select 0; //name of the unit we are playing with
  40. _plane_pilot = driver _plane; //pilot
  41. _default_sleep_time = 3; //actual time to wait/delay before loading every next magazine
  42. _sleep_time = 3; //time to wait/delay before loading every next magazine
  43. _plane_stop_speed = 1; //maximum speed of vehicle during the rearming
  44. _x = 1; //first magazine index in array passed to this function
  45. _w = 12; //total number of weapon proxies on model
  46.  
  47.  
  48.  
  49. //WEAPON CLASSNAME DEFINITIONS
  50. //LIST OF ALL POSSIBLE WEAPONS USED WITH THIS PLANE
  51. //IN CASE WE NEED TO ADAPT THIS TO SOME OTHER MOD
  52. _SAFE_weapon = "Fuller_master_arms_safe";
  53. _AIM9X_weapon = "USAF_AIM9X_Launcher";
  54. _AGM65_weapon = "USAF_AGM65_Launcher";
  55. _AGM84_weapon = "USAF_AGM84_Launcher";
  56. _AGM86_weapon = "USAF_AGM86C_Launcher";
  57. _AGM88_weapon = "USAF_AGM88_Launcher";
  58. _AIM120_weapon = "USAF_AIM120_Launcher";
  59. _AGM65E_weapon = "USAF_AGM65E_Launcher";
  60. _AGM154_weapon = "USAF_AGM154A1_Launcher";
  61. _FFARU_weapon = "USAF_FFARLauncher_unguided";
  62. _FFARL_weapon = "USAF_FFARLauncher_Laser";
  63. _MK82_weapon = "USAF_MK82_Launcher";
  64. _MK84_weapon = "USAF_MK84_Launcher";
  65. _GBU12_weapon = "USAF_GBU12_Launcher";
  66. _GBU24_weapon = "USAF_GBU24_Launcher";
  67. _GBU31_weapon = "USAF_GBU31_Launcher";
  68. _GBU38_weapon = "USAF_GBU38_Launcher";
  69. _GBU39_weapon = "USAF_GBU39_Launcher";
  70.  
  71.  
  72.  
  73.  
  74.  
  75. //MAGAZINE CLASSNAME DEFINITIONS
  76. //LIST OF ALL POSSIBLE MAGAZINES USED WITH THIS PLANE
  77. //IN CASE WE NEED TO ADAPT THIS TO SOME OTHER MOD
  78. _AIM9X_magazine = "USAF_1Rnd_AIM9X";
  79. _AIM120_magazine = "USAF_1Rnd_AIM120";
  80. _DUAL_RAIL_magazine = "USAF_1Rnd_DUALRAIL";
  81. _TRIPPLE_RAIL_magazine = "USAF_1Rnd_LAU88";
  82. _SINGLE_BOMB_magazine = "USAF_1Rnd_LAU117";
  83. _DOUBLE_MISSILE_magazine = "USAF_1Rnd_RACKS_X2";
  84. _TRIPPLE_MISSILE_magazine = "USAF_1Rnd_RACKS_X3";
  85. _GBU12_magazine = "USAF_1Rnd_GBU12";
  86. _GBU24_magazine = "USAF_1Rnd_GBU24";
  87. _GBU38_magazine = "USAF_1Rnd_GBU38";
  88. _GBU39_magazine = "USAF_1Rnd_GBU39";
  89. _GBU31_magazine = "USAF_1Rnd_GBU31";
  90. _MK82_magazine = "USAF_1Rnd_MK82";
  91. _MK84_magazine = "USAF_1Rnd_MK84";
  92. _MK82_RACK_magazine = "USAF_1Rnd_MK82RACK";
  93. _FFARU7_magazine = "USAF_7Rnd_HYDRA70_unguided";
  94. _FFARU19_magazine = "USAF_19Rnd_HYDRA70_unguided";
  95. _FFARL7_magazine = "USAF_7Rnd_HYDRA70_laser";
  96. _FFARL19_magazine = "USAF_19Rnd_HYDRA70_laser";
  97. _FFAR_POD_magazine = "USAF_1Rnd_FFARPOD7";
  98. _FFAR_POD2_magazine = "USAF_1Rnd_FFARPOD19";
  99. _AGM65_magazine = "USAF_1Rnd_AGM65";
  100. _AGM65E_magazine = "USAF_1Rnd_AGM65E";
  101. _AGM84_magazine = "USAF_1Rnd_AGM84";
  102. _AGM86_magazine = "USAF_1Rnd_AGM86";
  103. _AGM88_magazine = "USAF_1Rnd_AGM88";
  104. _AGM154_magazine = "USAF_1Rnd_AGM154A1";
  105. _FUEL_TANK_1 = "USAF_1Rnd_F22_FUEL";
  106. _FUEL_TANK_2 = "USAF_1Rnd_F22_DROPTANK";
  107. _FUEL_TANK_3 = "USAF_1Rnd_F35_TANK";
  108. _ANALQ131 = "USAF_1Rnd_ANALQ131";
  109. _ANAAQ28 = "USAF_1Rnd_ANAAQ28";
  110. _FlirPod = "USAF_1Rnd_Altflir_pod";
  111. _BRU61A = "USAF_1Rnd_BRU61A";
  112. _EMPTY_magazine = "USAF_empty";
  113. _EMPTY_Fake_magazine = "USAF_Fake_empty";
  114.  
  115.  
  116.  
  117.  
  118.  
  119. //REARMING SWITCH, CAN BE SUBSTITUDED BY VARIABLE, USED TO PREVENT
  120. //MULTIPLE INSTANCES OF SAME FUNCTION AT ONCE
  121. waitUntil {sleep 0.1;((_Plane getVariable ["Rearming_done_switch",-1]) == 0)};
  122.  
  123.  
  124.  
  125.  
  126. //SWITCH PILOTS WEAPON TO SAFE
  127. _plane selectWeapon _SAFE_weapon;
  128. _plane setVariable ["Rearming_done_switch", 0, false];
  129.  
  130.  
  131. //CHECK FOR PLANE SPEED, IF IN MOTION WE CANCEL REARMING WITH PENALTY
  132. if (speed _plane > _plane_stop_speed) exitWith {plane_cancel_rearm_penalty = _plane execVM "\js_s_plane\scripts\LOADOUTS\plane_empty_loadout.sqf";if (player == _plane_pilot) then {titleText ["Rearming canceled...", "PLAIN DOWN",0.3];};};
  133. if (player == _plane_pilot) then {titleText ["Rearming...", "PLAIN DOWN",0.3];};
  134.  
  135.  
  136.  
  137. //ROMEVE ALL POSSIBLE DEFAULT WEAPONS
  138. _Plane removeWeapon _AIM9X_weapon;
  139. _Plane removeWeapon _AIM120_weapon;
  140. _Plane removeWeapon _AGM65_weapon;
  141. _Plane removeWeapon _AGM84_weapon;
  142. _Plane removeWeapon _AGM86_weapon;
  143. _Plane removeWeapon _AGM88_weapon;
  144. _Plane removeWeapon _AGM65E_weapon;
  145. _Plane removeWeapon _FFARU_weapon;
  146. _Plane removeWeapon _FFARL_weapon;
  147. _Plane removeWeapon _MK82_weapon;
  148. _Plane removeWeapon _MK84_weapon;
  149. _Plane removeWeapon _GBU12_weapon;
  150. _Plane removeWeapon _GBU24_weapon;
  151. _Plane removeWeapon _GBU31_weapon;
  152. _Plane removeWeapon _GBU38_weapon;
  153. _Plane removeWeapon _GBU39_weapon;
  154. _Plane removeWeapon _AGM154_weapon;
  155.  
  156.  
  157.  
  158.  
  159. //ROMEVE ALL POSSIBLE DEFAULT MAGAZINES
  160. _Plane removeMagazines _AIM9X_magazine;
  161. _Plane removeMagazines _AIM120_magazine;
  162. _Plane removeMagazines _SINGLE_BOMB_magazine;
  163. _Plane removeMagazines _DUAL_RAIL_magazine;
  164. _Plane removeMagazines _TRIPPLE_RAIL_magazine;
  165. _Plane removeMagazines _DOUBLE_MISSILE_magazine;
  166. _Plane removeMagazines _TRIPPLE_MISSILE_magazine;
  167. _Plane removeMagazines _MK82_RACK_magazine;
  168. _Plane removeMagazines _GBU12_magazine;
  169. _Plane removeMagazines _GBU24_magazine;
  170. _Plane removeMagazines _GBU31_magazine;
  171. _Plane removeMagazines _GBU38_magazine;
  172. _Plane removeMagazines _GBU39_magazine;
  173. _Plane removeMagazines _MK82_magazine;
  174. _Plane removeMagazines _MK84_magazine;
  175. _Plane removeMagazines _GBU31_magazine;
  176. _Plane removeMagazines _GBU38_magazine;
  177. _Plane removeMagazines _AGM65_magazine;
  178. _Plane removeMagazines _AGM65E_magazine;
  179. _Plane removeMagazines _AGM84_magazine;
  180. _Plane removeMagazines _AGM86_magazine;
  181. _Plane removeMagazines _AGM88_magazine;
  182. _Plane removeMagazines _AGM154_magazine;
  183. _Plane removeMagazines _FFARU7_magazine;
  184. _Plane removeMagazines _FFARU19_magazine;
  185. _Plane removeMagazines _FFARL7_magazine;
  186. _Plane removeMagazines _FFARL19_magazine;
  187. _Plane removeMagazines _FFAR_POD_magazine;
  188. _Plane removeMagazines _FFAR_POD2_magazine;
  189. _Plane removeMagazines _FUEL_TANK_1;
  190. _Plane removeMagazines _FUEL_TANK_2;
  191. _Plane removeMagazines _FUEL_TANK_3;
  192. _Plane removeMagazines _ANALQ131;
  193. _Plane removeMagazines _ANAAQ28;
  194. _Plane removeMagazines _FlirPod;
  195. _Plane removeMagazines _BRU61A;
  196. _Plane removeMagazines _EMPTY_magazine;
  197. _Plane removeMagazines _EMPTY_Fake_magazine;
  198.  
  199.  
  200.  
  201. //ANIMATE ALL HIDDEN SELECTIONS TO SUPPORT NEW LOADOUT
  202. _Plane animate ["pylon_1_hide",0];
  203. _Plane animate ["pylon_2_hide",0];
  204. _Plane animate ["pylon_3_hide",0];
  205. _Plane animate ["pylon_4_hide",0];
  206. _Plane animate ["pylon_5_hide",0];
  207. _Plane animate ["pylon_6_hide",0];
  208.  
  209. //ADDING NEW MAGAZINES TO PLANE
  210. //STATIONS 1-12 ARE USED FOR CONVENTIONAL LOADOUTS
  211. for "_i" from 1 to 12 do
  212. {
  213.  
  214. _plane removeMagazines _EMPTY_FAKE_magazine;
  215. _new_magazine = _this select _x;
  216. _plane addMagazine _new_magazine;
  217. for "_y" from 1 to _w do {_plane addMagazine _EMPTY_FAKE_magazine;};
  218. if (_new_magazine == _EMPTY_magazine) then {_sleep_time = 0;} else {_sleep_time = _default_sleep_time;};
  219. if (speed _plane > _plane_stop_speed) exitWith {plane_cancel_rearm_penalty = _plane execVM "\USAF_F22\scr\LOADOUTS\USAF_F22_empty_loadout.sqf";if (player == _plane_pilot) then {titleText ["Rearming canceled...", "PLAIN DOWN",0.3];};};
  220. if (player == _plane_pilot) then {titleText ["Rearming...", "PLAIN DOWN",0.3];};
  221. _x= _x +1;
  222. _w= _w -1;
  223. sleep _sleep_time;
  224. //hintsilent format["Station Number: %1\nNew magazine: %2\nMax proxies: %3\nSleep time: %4\n",_station_number,_plane_new_magazine_station,_max_proxies,_sleep_time];
  225.  
  226. };
  227.  
  228. //ADD NEW WEAPONS FOR PRELOADED MAGAZINES
  229. _loadout = magazines _plane;
  230. sleep 0.5;
  231. if ((_AIM9X_magazine in _loadout)) then {_Plane addWeapon _AIM9X_weapon;};
  232. if ((_AIM120_magazine in _loadout)) then {_Plane addWeapon _AIM120_weapon;};
  233. if ((_FFARU7_magazine in _loadout)) then {_Plane addWeapon _FFARU_weapon;};
  234. if ((_FFARU19_magazine in _loadout)) then {_Plane addWeapon _FFARU_weapon;};
  235. if ((_FFAR
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement