ios 10 Posted April 8, 2011 i try to addMagazine to all units in player groups, _weaponMagazine = currentMagazine player; _playerGrp = Group player; _playerGrp addMagazine _weaponMagazine; and many other things that i think it's useless to post, but the problem is Addmagazine command expect Object, Is there a way to get there? Share this post Link to post Share on other sites
Romeo_Delta 10 Posted April 8, 2011 From what I have gathered thus far (I'm new to mission editing), the addMagazine and addWeapon commands are looking for, like you said, an object, not an array which is what _weaponMagazine is (I believe). I could be wrong. If I am, feel free to correct me. Share this post Link to post Share on other sites
ios 10 Posted April 8, 2011 you're right, but its not working either this way: _playerGrp = Group player; _playerGrp addMagazine currentMagazine player; or this way : Group player addMagazine currentMagazine player; Share this post Link to post Share on other sites
Romeo_Delta 10 Posted April 8, 2011 I believe there should be quotation marks around currentMagazine. I've never tried adding magazines or weapons like this. Share this post Link to post Share on other sites
ios 10 Posted April 8, 2011 that's not it either cause unitname addMagazine currentMagazine player; Works very well, the prob is addmagazine need : Object addmagazine _magazine and i want to add it for the whole group so when i do Groupname addmagazine _magazine it give me an error :mad: Share this post Link to post Share on other sites
riouken 15 Posted April 8, 2011 Here ya go. _weaponMagazine = currentMagazine player; {_x addmagazine _weaponMagazine } forEach units group player; Share this post Link to post Share on other sites
fatty86 10 Posted April 8, 2011 I don't think you can just addMagazine an entire group. I believe you need to specify a single object/character to receive the magazine. Try running a short loop like this instead: {_x addmagazine _magazine} foreach units group player; Edit: gah, beaten by mere seconds Share this post Link to post Share on other sites
ios 10 Posted April 8, 2011 Yay ! Thanks to both of you! Share this post Link to post Share on other sites
bloodxgusher 10 Posted April 10, 2011 Here ya go. _weaponMagazine = currentMagazine player; {_x addmagazine _weaponMagazine } forEach units group player; What does the _x pertain to? Whats its value? Share this post Link to post Share on other sites
galzohar 31 Posted April 10, 2011 (edited) If units group player is, say, [unit1, unit2, unit3] (as it is an array after all), then the code in {...} will run 3 times, first time _x will be unit1, 2nd time it'll be unit2, and 3rd time it'll be unit3. http://community.bistudio.com/wiki/forEach Edited April 10, 2011 by galzohar Share this post Link to post Share on other sites