blackpixxel 53 Posted August 29, 2014 Hi, I have the following problem: I made a list of all the magazines of a unit using this command: _magazinesList = magazinesAmmo _unit; Now I want to add all the magazines from the list back to the unit, after I removed each of them. I tried it like this: {player addmagazine [(_magazinesList select _x) select 0,(_magazinesList select _x) select 1]}foreach _magazinesList; But it doesn't work. I am not a scripting expert, so I hope that someone could answer this hopefully simple question. Thank you for your help! BlackPixxel Share this post Link to post Share on other sites
maddogx 13 Posted August 29, 2014 The forEach command will iterate over each item in the array - _x represents the item itself and not its index, so using "_magazinesList select _x" is wrong. The code should be: {player addmagazine [_x select 0, _x select 1]}foreach _magazinesList; Share this post Link to post Share on other sites
blackpixxel 53 Posted August 29, 2014 Wow, thank you for your fast response! It works great now, and I learned something new. Thanks alot! Share this post Link to post Share on other sites