Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Author: John_Spartan & Saul
- Description:
- Dynamic loadout selection/rearming function for F/A-18 Black Wasp
- Adjusted to work for: USAF mod F22 [with permission's from original authors]
- Exucution:
- 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";
- via unit init line in editor or via instance of mission script [INIT.sqf for example]
- Parameter(s):
- _this select 0: mode (Scalar)
- 0: plane/object
- 1: magazine classname to be equipped on station 1 ["my_magazine_classname"]
- 2: magazine classname to be equipped on station 2 ["my_magazine_classname"]
- 3: magazine classname to be equipped on station 3 ["my_magazine_classname"]
- 4: magazine classname to be equipped on station 4 ["my_magazine_classname"]
- 5: magazine classname to be equipped on station 5 ["my_magazine_classname"]
- 6: magazine classname to be equipped on station 6 ["my_magazine_classname"]
- 7: magazine classname to be equipped on station 7 ["my_magazine_classname"]
- 8: magazine classname to be equipped on station 8 ["my_magazine_classname"]
- 9: magazine classname to be equipped on station 9 ["my_magazine_classname"]
- 10: magazine classname to be equipped on station 10 ["my_magazine_classname"]
- 11: magazine classname to be equipped on station 11 ["my_magazine_classname"]
- 12: magazine classname to be equipped on station 12 ["my_magazine_classname"]
- Returns: nothing
- Result: aircrfat rearmed with desiered loadout
- */
- //BASIC DEFINITIONS
- _plane = _this select 0; //name of the unit we are playing with
- _plane_pilot = driver _plane; //pilot
- _default_sleep_time = 3; //actual time to wait/delay before loading every next magazine
- _sleep_time = 3; //time to wait/delay before loading every next magazine
- _plane_stop_speed = 1; //maximum speed of vehicle during the rearming
- _x = 1; //first magazine index in array passed to this function
- _w = 12; //total number of weapon proxies on model
- //WEAPON CLASSNAME DEFINITIONS
- //LIST OF ALL POSSIBLE WEAPONS USED WITH THIS PLANE
- //IN CASE WE NEED TO ADAPT THIS TO SOME OTHER MOD
- _SAFE_weapon = "Fuller_master_arms_safe";
- _AIM9X_weapon = "USAF_AIM9X_Launcher";
- _AGM65_weapon = "USAF_AGM65_Launcher";
- _AGM84_weapon = "USAF_AGM84_Launcher";
- _AGM86_weapon = "USAF_AGM86C_Launcher";
- _AGM88_weapon = "USAF_AGM88_Launcher";
- _AIM120_weapon = "USAF_AIM120_Launcher";
- _AGM65E_weapon = "USAF_AGM65E_Launcher";
- _AGM154_weapon = "USAF_AGM154A1_Launcher";
- _FFARU_weapon = "USAF_FFARLauncher_unguided";
- _FFARL_weapon = "USAF_FFARLauncher_Laser";
- _MK82_weapon = "USAF_MK82_Launcher";
- _MK84_weapon = "USAF_MK84_Launcher";
- _GBU12_weapon = "USAF_GBU12_Launcher";
- _GBU24_weapon = "USAF_GBU24_Launcher";
- _GBU31_weapon = "USAF_GBU31_Launcher";
- _GBU38_weapon = "USAF_GBU38_Launcher";
- _GBU39_weapon = "USAF_GBU39_Launcher";
- //MAGAZINE CLASSNAME DEFINITIONS
- //LIST OF ALL POSSIBLE MAGAZINES USED WITH THIS PLANE
- //IN CASE WE NEED TO ADAPT THIS TO SOME OTHER MOD
- _AIM9X_magazine = "USAF_1Rnd_AIM9X";
- _AIM120_magazine = "USAF_1Rnd_AIM120";
- _DUAL_RAIL_magazine = "USAF_1Rnd_DUALRAIL";
- _TRIPPLE_RAIL_magazine = "USAF_1Rnd_LAU88";
- _SINGLE_BOMB_magazine = "USAF_1Rnd_LAU117";
- _DOUBLE_MISSILE_magazine = "USAF_1Rnd_RACKS_X2";
- _TRIPPLE_MISSILE_magazine = "USAF_1Rnd_RACKS_X3";
- _GBU12_magazine = "USAF_1Rnd_GBU12";
- _GBU24_magazine = "USAF_1Rnd_GBU24";
- _GBU38_magazine = "USAF_1Rnd_GBU38";
- _GBU39_magazine = "USAF_1Rnd_GBU39";
- _GBU31_magazine = "USAF_1Rnd_GBU31";
- _MK82_magazine = "USAF_1Rnd_MK82";
- _MK84_magazine = "USAF_1Rnd_MK84";
- _MK82_RACK_magazine = "USAF_1Rnd_MK82RACK";
- _FFARU7_magazine = "USAF_7Rnd_HYDRA70_unguided";
- _FFARU19_magazine = "USAF_19Rnd_HYDRA70_unguided";
- _FFARL7_magazine = "USAF_7Rnd_HYDRA70_laser";
- _FFARL19_magazine = "USAF_19Rnd_HYDRA70_laser";
- _FFAR_POD_magazine = "USAF_1Rnd_FFARPOD7";
- _FFAR_POD2_magazine = "USAF_1Rnd_FFARPOD19";
- _AGM65_magazine = "USAF_1Rnd_AGM65";
- _AGM65E_magazine = "USAF_1Rnd_AGM65E";
- _AGM84_magazine = "USAF_1Rnd_AGM84";
- _AGM86_magazine = "USAF_1Rnd_AGM86";
- _AGM88_magazine = "USAF_1Rnd_AGM88";
- _AGM154_magazine = "USAF_1Rnd_AGM154A1";
- _FUEL_TANK_1 = "USAF_1Rnd_F22_FUEL";
- _FUEL_TANK_2 = "USAF_1Rnd_F22_DROPTANK";
- _FUEL_TANK_3 = "USAF_1Rnd_F35_TANK";
- _ANALQ131 = "USAF_1Rnd_ANALQ131";
- _ANAAQ28 = "USAF_1Rnd_ANAAQ28";
- _FlirPod = "USAF_1Rnd_Altflir_pod";
- _BRU61A = "USAF_1Rnd_BRU61A";
- _EMPTY_magazine = "USAF_empty";
- _EMPTY_Fake_magazine = "USAF_Fake_empty";
- //REARMING SWITCH, CAN BE SUBSTITUDED BY VARIABLE, USED TO PREVENT
- //MULTIPLE INSTANCES OF SAME FUNCTION AT ONCE
- waitUntil {sleep 0.1;((_Plane getVariable ["Rearming_done_switch",-1]) == 0)};
- //SWITCH PILOTS WEAPON TO SAFE
- _plane selectWeapon _SAFE_weapon;
- _plane setVariable ["Rearming_done_switch", 0, false];
- //CHECK FOR PLANE SPEED, IF IN MOTION WE CANCEL REARMING WITH PENALTY
- 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];};};
- if (player == _plane_pilot) then {titleText ["Rearming...", "PLAIN DOWN",0.3];};
- //ROMEVE ALL POSSIBLE DEFAULT WEAPONS
- _Plane removeWeapon _AIM9X_weapon;
- _Plane removeWeapon _AIM120_weapon;
- _Plane removeWeapon _AGM65_weapon;
- _Plane removeWeapon _AGM84_weapon;
- _Plane removeWeapon _AGM86_weapon;
- _Plane removeWeapon _AGM88_weapon;
- _Plane removeWeapon _AGM65E_weapon;
- _Plane removeWeapon _FFARU_weapon;
- _Plane removeWeapon _FFARL_weapon;
- _Plane removeWeapon _MK82_weapon;
- _Plane removeWeapon _MK84_weapon;
- _Plane removeWeapon _GBU12_weapon;
- _Plane removeWeapon _GBU24_weapon;
- _Plane removeWeapon _GBU31_weapon;
- _Plane removeWeapon _GBU38_weapon;
- _Plane removeWeapon _GBU39_weapon;
- _Plane removeWeapon _AGM154_weapon;
- //ROMEVE ALL POSSIBLE DEFAULT MAGAZINES
- _Plane removeMagazines _AIM9X_magazine;
- _Plane removeMagazines _AIM120_magazine;
- _Plane removeMagazines _SINGLE_BOMB_magazine;
- _Plane removeMagazines _DUAL_RAIL_magazine;
- _Plane removeMagazines _TRIPPLE_RAIL_magazine;
- _Plane removeMagazines _DOUBLE_MISSILE_magazine;
- _Plane removeMagazines _TRIPPLE_MISSILE_magazine;
- _Plane removeMagazines _MK82_RACK_magazine;
- _Plane removeMagazines _GBU12_magazine;
- _Plane removeMagazines _GBU24_magazine;
- _Plane removeMagazines _GBU31_magazine;
- _Plane removeMagazines _GBU38_magazine;
- _Plane removeMagazines _GBU39_magazine;
- _Plane removeMagazines _MK82_magazine;
- _Plane removeMagazines _MK84_magazine;
- _Plane removeMagazines _GBU31_magazine;
- _Plane removeMagazines _GBU38_magazine;
- _Plane removeMagazines _AGM65_magazine;
- _Plane removeMagazines _AGM65E_magazine;
- _Plane removeMagazines _AGM84_magazine;
- _Plane removeMagazines _AGM86_magazine;
- _Plane removeMagazines _AGM88_magazine;
- _Plane removeMagazines _AGM154_magazine;
- _Plane removeMagazines _FFARU7_magazine;
- _Plane removeMagazines _FFARU19_magazine;
- _Plane removeMagazines _FFARL7_magazine;
- _Plane removeMagazines _FFARL19_magazine;
- _Plane removeMagazines _FFAR_POD_magazine;
- _Plane removeMagazines _FFAR_POD2_magazine;
- _Plane removeMagazines _FUEL_TANK_1;
- _Plane removeMagazines _FUEL_TANK_2;
- _Plane removeMagazines _FUEL_TANK_3;
- _Plane removeMagazines _ANALQ131;
- _Plane removeMagazines _ANAAQ28;
- _Plane removeMagazines _FlirPod;
- _Plane removeMagazines _BRU61A;
- _Plane removeMagazines _EMPTY_magazine;
- _Plane removeMagazines _EMPTY_Fake_magazine;
- //ANIMATE ALL HIDDEN SELECTIONS TO SUPPORT NEW LOADOUT
- _Plane animate ["pylon_1_hide",0];
- _Plane animate ["pylon_2_hide",0];
- _Plane animate ["pylon_3_hide",0];
- _Plane animate ["pylon_4_hide",0];
- _Plane animate ["pylon_5_hide",0];
- _Plane animate ["pylon_6_hide",0];
- //ADDING NEW MAGAZINES TO PLANE
- //STATIONS 1-12 ARE USED FOR CONVENTIONAL LOADOUTS
- for "_i" from 1 to 12 do
- {
- _plane removeMagazines _EMPTY_FAKE_magazine;
- _new_magazine = _this select _x;
- _plane addMagazine _new_magazine;
- for "_y" from 1 to _w do {_plane addMagazine _EMPTY_FAKE_magazine;};
- if (_new_magazine == _EMPTY_magazine) then {_sleep_time = 0;} else {_sleep_time = _default_sleep_time;};
- 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];};};
- if (player == _plane_pilot) then {titleText ["Rearming...", "PLAIN DOWN",0.3];};
- _x= _x +1;
- _w= _w -1;
- sleep _sleep_time;
- //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];
- };
- //ADD NEW WEAPONS FOR PRELOADED MAGAZINES
- _loadout = magazines _plane;
- sleep 0.5;
- if ((_AIM9X_magazine in _loadout)) then {_Plane addWeapon _AIM9X_weapon;};
- if ((_AIM120_magazine in _loadout)) then {_Plane addWeapon _AIM120_weapon;};
- if ((_FFARU7_magazine in _loadout)) then {_Plane addWeapon _FFARU_weapon;};
- if ((_FFARU19_magazine in _loadout)) then {_Plane addWeapon _FFARU_weapon;};
- if ((_FFAR
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement