Search the Community
Showing results for tags 'bis_fnc_addweapon'.
Found 1 result
-
How to create a loaded weapon (launch_RPG32_F)?
beako posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
HI ALL, I am simply trying to replace the current secondary weapon with a different type of launcher, but have it added already preloaded. Instead I have to wait until the unit reloads the weapon then I have to restock his backpack with the magazine he just used. Is there a simpler way to add a preloaded weapon? _man2 = objNull; {if (typeOf _x == "B_T_Soldier_LAT_F") then {_man2 = _x}} forEach units player; _lancherMagArray = []; _BP = ""; _BPItems = []; _backPackCamo = 'B_Kitbag_sgg'; // for units with secondaryWeapons _lancherMagArray = getArray (configfile >> "CfgWeapons" >> secondaryWeapon _man2 >> "magazines"); if !(_lancherMagArray isEqualTo []) then { // for B_T_Soldier_LAT_F replace NLAW with launch_RPG32_ghex_F if (typeOf _man2 == "B_T_Soldier_LAT_F") then { [_man2, "launch_RPG32_ghex_F", 2, "RPG32_F"] call BIS_fnc_addWeapon; _lancherMagArray = ["RPG32_F","RPG32_HE_F"]; }; // replaceBP with "B_Kitbag_cbr" removeBackpack _man2; _man2 addBackpack _backPackCamo; // B_Kitbag_sgg B_Kitbag_mcamo B_Kitbag_rgr B_Kitbag_cbr // fill backpack { if (_man2 canAddItemToBackpack _x) then { waitUntil { _man2 addItemToBackpack _x; !(_man2 canAddItemToBackpack _x) }; }; } forEach _lancherMagArray; _BP = backpack _man2; _BPItems = backpackItems _man2; }; // cheat to fill backpack after reloading launcher if (typeOf _man2 == "B_T_Soldier_LAT_F") then { waitUntil { ((_man2 ammo "launch_RPG32_ghex_F") == 1) }; _man2 addItemToBackpack "RPG32_F"; };