Blitzen88 18 Posted July 29, 2021 Greetings, Im trying to figure out how to gather a magazine from each unit of a group and add it to an ammobox. The idea is that necessary magazines will be added to the ammobox regardless of the loadout. Here is what I got: Quote _PlayerGroup = group _player; _AllMags = {primaryWeaponMagazine _x} foreach units _PlayerGroup; ammobox {addmagazinecargo _x, 5} foreach _Allmags; But it isnt working...? Share this post Link to post Share on other sites
sarogahtyp 1109 Posted July 29, 2021 addmagazinecargo is a command with local effects only. Read its biki entry. Share this post Link to post Share on other sites
Blitzen88 18 Posted July 29, 2021 2 minutes ago, sarogahtyp said: addmagazinecargo is a command with local effects only. Read its biki entry. Would only be used for single player. Dont know if that changes anything but I will checkout the wiki. Share this post Link to post Share on other sites
sarogahtyp 1109 Posted July 29, 2021 nevermind then. on SP it does not matter Share this post Link to post Share on other sites
pierremgi 4910 Posted July 29, 2021 _allMags = flatten (units _playerGroup apply {primaryWeaponMagazine _x}); {ammobox addMagazineCargo [_x, 5]} count _Allmags; In MP: see also: addMagazineCargoGlobal Running the code locally (where player is), the difference is that with global command, the crate contents all magazines of all groups, with non-global one, you make the crate specific for each player. Running the code on server only is probable non-sense (player is local if hosted, non-existent if dedicated). 1 Share this post Link to post Share on other sites
Blitzen88 18 Posted July 30, 2021 18 hours ago, pierremgi said: _allMags = flatten (units _playerGroup apply {primaryWeaponMagazine _x}); {ammobox addMagazineCargo [_x, 5]} count _Allmags; This seems to work perfectly. Thank you! Now I gotta read up on “flatten” and “apply” Share this post Link to post Share on other sites