JCataclisma 80 Posted June 11, 2024 These are a couple of simple codes I am using, which are working both in editor and MP missions. I call them to add two permanent, different actions on the scroll menu, and they are shown only when player is on pilot seat, and to such pilot alone. Please note that "_currentVehicle" is a variable name, so you need to change it according to your situation - most likely replace it for "this" if you wanna use it on editor ("init" field on vehicle's properties), or for "cursorObject" (in case you wanna paste the whole code for immediately testing purposes - but remember to delete all comments after "//" in this case). For Kajman and Blackfoot: // This code is meant for use on Kajman (East) and Blackfoot (West) only; _currentVehicle addAction // replace "_currentVehicle" accordingly; [ "<t color='#f0cc0f'>Recruit AI Gunner</t>", { _aiGunner = (group player) createUnit ["B_Deck_Crew_F", [0,0,0], [], 0, "NONE"]; sleep 0.25; _aiGunner moveInGunner (vehicle player); _aiGunner setCombatBehaviour "COMBAT"; // check wiki for other options; _aiGunner setCombatMode "RED"; // check wiki for other options; }, nil, -8, false, true, "", "_this == _target turretUnit [-1]", //shown only for the pilot; 10, false ]; _currentVehicle addAction [ "<t color='#00000f'>Dismiss AI Gunner</t>", { _aiGunner = (vehicle player) turretUnit [0]; _aiGunner spawn { sleep 0.25; deleteVehicle _this; }; }, nil, -9, false, true, "", "_this == _target turretUnit [-1]", 10, false ]; And here is for Czapla (will probably work for Hellcat as well): // This code should work for helicopters Czapla and Hellcat; _currentVehicle addAction [ "<t color='#f0cc0f'>Recruit AI Gunner</t>", { _aiLeftGunner = (group player) createUnit ["B_Deck_Crew_F", [0,0,0], [], 0, "NONE"]; sleep 0.25; _aiLeftGunner moveInCargo [(vehicle player), 1]; removeAllWeapons _aiLeftGunner; _aiLeftGunner addWeapon "srifle_LRR_camo_LRPS_F"; _aiLeftGunner addMagazine "7Rnd_408_Mag"; _aiLeftGunner addMagazine "7Rnd_408_Mag"; _aiLeftGunner addMagazine "7Rnd_408_Mag"; _aiLeftGunner setCombatBehaviour "COMBAT"; _aiLeftGunner setCombatMode "RED"; sleep 0.25; _aiRightGunner = (group player) createUnit ["C_Man_formal_4_F", [0,0,0], [], 0, "NONE"]; sleep 0.25; _aiRightGunner moveInCargo [(vehicle player), 0]; _aiRightGunner addWeapon "srifle_LRR_camo_LRPS_F"; _aiRightGunner addMagazine "7Rnd_408_Mag"; _aiRightGunner addMagazine "7Rnd_408_Mag"; _aiRightGunner addMagazine "7Rnd_408_Mag"; _aiRightGunner setCombatBehaviour "COMBAT"; _aiRightGunner setCombatMode "RED"; sleep 0.25; }, nil, -8, false, true, "", "_this == _target turretUnit [-1]", 10, false ]; _currentVehicle addAction [ "<t color='#00000f'>Dismiss AI Gunner</t>", { // The vehicle the player is in _vehicle = vehicle player; // Get the units in cargo index 0 and cargo index 1 // cargo 0 is the 'shoot from vehicle' on the right side (pilot side, in this case), while cargo 1 is seated at the left side (co-pilot); _cargo0 = _vehicle call { _cargoUnits = crew _vehicle select {_x in (crew _vehicle select {assignedVehicleRole _x select 0 == "cargo"})}; if (count _cargoUnits > 0) then {_cargoUnits select 0} else {objNull}; }; _cargo1 = _vehicle call { _cargoUnits = crew _vehicle select {_x in (crew _vehicle select {assignedVehicleRole _x select 0 == "cargo"})}; if (count _cargoUnits > 1) then {_cargoUnits select 1} else {objNull}; }; _cargo0 spawn { sleep 0.25; deleteVehicle _this; }; _cargo1 spawn { sleep 0.25; deleteVehicle _this; }; }, nil, -9, false, true, "", "_this == _target turretUnit [-1]", 10, false ]; 2 Share this post Link to post Share on other sites
JCataclisma 80 Posted June 13, 2024 The code below was changed to fit MH9 - Hummingbird, but it will probably NOT fit Pawnee. Note that there are three extra lines of code inside each addActions, which will REMOVE that action once executed. Those were added to prevent "infinite spawning" of gunners/shooters, which could be ejected by the player and then re-spawned. Such lines have the attached comment "// related to remove action once executed (line 1 of 3);" I did NOT add such "removeAction" on the previous code, but they can be easily pasted from here to there, at the same positions. _currentVehicle addAction [ "<t color='#f0cc0f'>Recruit AI Gunner</t>", { _recruitGunner = _this select 2; // related to remove action once executed (line 1 of 3); _currentHeli = (vehicle player); // related to remove action once executed (line 2 of 3); _aiLeftGunner = (group player) createUnit ["B_Deck_Crew_F", [0,0,0], [], 0, "NONE"]; sleep 0.25; _aiLeftGunner moveInCargo [(vehicle player), 3]; removeAllWeapons _aiLeftGunner; _aiLeftGunner addWeapon "srifle_DMR_02_camo_AMS_LP_F"; _aiLeftGunner addMagazine "10Rnd_338_Mag"; _aiLeftGunner addMagazine "10Rnd_338_Mag"; _aiLeftGunner addMagazine "10Rnd_338_Mag"; _aiLeftGunner setCombatBehaviour "COMBAT"; _aiLeftGunner setCombatMode "RED"; sleep 0.25; _aiRightGunner = (group player) createUnit ["B_Competitor_F", [0,0,0], [], 0, "NONE"]; sleep 0.25; _aiRightGunner moveInCargo [(vehicle player), 5]; _aiRightGunner addWeapon "srifle_LRR_camo_LRPS_F"; _aiRightGunner addMagazine "7Rnd_408_Mag"; _aiRightGunner addMagazine "7Rnd_408_Mag"; _aiRightGunner addMagazine "7Rnd_408_Mag"; _aiRightGunner setCombatBehaviour "COMBAT"; _aiRightGunner setCombatMode "RED"; sleep 0.25; _currentHeli removeAction _recruitGunner; // related to remove action once executed (line 3 of 3); }, nil, -8, false, true, "", "_this == _target turretUnit [-1]", 10, false ]; _currentVehicle addAction [ "<t color='#00000f'>Dismiss AI Gunner</t>", { _dismissGunner = _this select 2; // related to remove action once executed (line 1 of 3); _currentHeli = (vehicle player); // related to remove action once executed (line 2 of 3); // Get the vehicle the player is in _vehicle = vehicle player; // Get the units in cargo index 0 and cargo index 1 _cargo0 = _vehicle call { _cargoUnits = crew _vehicle select {_x in (crew _vehicle select {assignedVehicleRole _x select 0 == "cargo"})}; if (count _cargoUnits > 0) then {_cargoUnits select 0} else {objNull}; }; _cargo1 = _vehicle call { _cargoUnits = crew _vehicle select {_x in (crew _vehicle select {assignedVehicleRole _x select 0 == "cargo"})}; if (count _cargoUnits > 1) then {_cargoUnits select 1} else {objNull}; }; _cargo0 spawn { sleep 0.25; deleteVehicle _this; }; _cargo1 spawn { sleep 0.25; deleteVehicle _this; }; sleep 0.25; _currentHeli removeAction _dismissGunner; // related to remove action once executed (line 3 of 3); }, nil, -9, false, true, "", "_this == _target turretUnit [-1]", 10, false ]; Share this post Link to post Share on other sites