Casio91Fin 31 Posted February 16, 2022 Hello all. I have a problem that should get two items added to the script, but I haven’t succeeded. That is why I am asking for help. DLC = S. O. G. Prairie Fire These two items should be added to the player 1. (vn_m67_grenade_mag) max 4. 2. (vn_b_item_firstaidkit) max 5. Spoiler this addAction [ "Rearm", { If (Player CanAdd ((GetArray (ConfigFile >> "CfgWeapons" >> currentWeapon player >> "Magazines")) Select 0)) Then { While {Player CanAdd ((GetArray (ConfigFile >> "CfgWeapons" >> currentWeapon player >> "Magazines")) Select 0)} Do {Player AddMagazine ((GetArray (ConfigFile >> "CfgWeapons" >> currentWeapon player >> "Magazines")) Select 0);}; Player playMove "AinvPknlMstpSrasWrflDnon_Putdown_AmovPknlMstpSrasWrflDnon"; if (count magazines player > 10) then {{player removeMagazineGlobal _x} forEach (magazines player select [10, 20]);};}; }, nil, 1.5, true, true, "", "true", 5, false, "", "" ]; Share this post Link to post Share on other sites
_foley 192 Posted February 16, 2022 Hey Try this to add no more than 4 grenades to inventory player addMagazines [ "vn_m67_grenade_mag", 4 - ({_x isEqualTo "vn_m67_grenade_mag"} count itemsWithMagazines player) ]; For first aid kits you will need to do it differently while { player canAdd "vn_b_item_firstaidkit" && ({_x isEqualTo "vn_b_item_firstaidkit"} count itemsWithMagazines player) < 5 } do { player addItem "vn_b_item_firstaidkit"; }; Share this post Link to post Share on other sites
Casio91Fin 31 Posted February 16, 2022 @_foley thank you it works like a dream 🤗 Spoiler this addAction [ "Rearm", { If (Player CanAdd ((GetArray (ConfigFile >> "CfgWeapons" >> currentWeapon player >> "Magazines")) Select 0)) Then { While {Player CanAdd ((GetArray (ConfigFile >> "CfgWeapons" >> currentWeapon player >> "Magazines")) Select 0)} Do {Player AddMagazine ((GetArray (ConfigFile >> "CfgWeapons" >> currentWeapon player >> "Magazines")) Select 0);}; Player playMove "AinvPknlMstpSrasWrflDnon_Putdown_AmovPknlMstpSrasWrflDnon"; if (count magazines player > 15) then {{player removeMagazineGlobal _x} forEach (magazines player select [15, 20]);}; player addMagazines ["vn_m67_grenade_mag", 4 - ({_x isEqualTo "vn_m67_grenade_mag"} count itemsWithMagazines player)]; while {player canAdd "vn_b_item_firstaidkit" && ({_x isEqualTo "vn_b_item_firstaidkit"} count itemsWithMagazines player) < 5} do {player additem "vn_b_item_firstaidkit";}; }; }, nil, 1, true, true, "", "true", 5, false, "", "" ]; Share this post Link to post Share on other sites