ljcampos 3 Posted June 13, 2016 this is my current code, and I need to add magazines to the current weapon in all units in editor. Can you please help me on how to do this? waitUntil {!isNil "bis_fnc_init"}; _civ_hats = ["H_Bandanna_camo", "H_Booniehat_oli", "H_Watchcap_blk", "H_Shemag_olive"]; _vests = ["V_Rangemaster_belt", "V_TacVest_oli", "V_BandollierB_cbr"]; _weapons = ["V_Rangemaster_belt", "V_TacVest_oli", "V_BandollierB_cbr"]; _unit = _this select 0; removeHeadgear _this; // Add vest and clothing removeVest _this; _vest_item = _vests call BIS_fnc_selectRandom; _this addVest _vest_item; removeUniform _this; _uniforms = ["U_IG_Guerilla3_2","U_IG_Guerilla3_1","U_IG_Guerilla2_3","U_IG_Guerilla2_2","U_IG_Guerilla2_1"]; _count = count _uniforms; _this addUniform (_uniforms select floor random _count); // Random integer, if 1 instead of 0, add a random item from the array if(round (random 1) == 1) then { _hat_item = _civ_hats call BIS_fnc_selectRandom; _this addHeadgear _hat_item; }; Share this post Link to post Share on other sites
kylania 568 Posted June 13, 2016 You can use the command addMagazines or if you wanna get fancy adapt this code to add only what they need. _unit addMagazines ["30Rnd_65x39_caseless_mag", 3]; Share this post Link to post Share on other sites
serena 151 Posted June 13, 2016 This code add magazines to all unit weapons for each muzzle: Fn_Gear_CompatibleMagazines = { private _cls = configFile >> "CfgWeapons" >> _this; private _res = []; {_res pushBack (if (_x == "this") then {getArray(_cls >> "magazines")} else {getArray(_cls >> _x >> "magazines")}); } forEach getArray(_cls >> "muzzles"); _res }; private _unt = player; { if (count _x > 0) then { { if (count _x > 0) then { _unt addMagazine (_x select 0)} } foreach (_x call Fn_Gear_CompatibleMagazines) } } forEach [primaryWeapon _unt, secondaryWeapon _unt, handgunWeapon _unt]; 1 Share this post Link to post Share on other sites
aimgame 5 Posted November 19, 2021 How about BIS_fnc_compatibleMagazines ?😉 Share this post Link to post Share on other sites