Jump to content
Sign in to follow this  
ios

AddMagazine Group Player

Recommended Posts

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

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

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

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

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

Here ya go.

_weaponMagazine = currentMagazine player; 

{_x addmagazine _weaponMagazine } forEach units group player;

Share this post


Link to post
Share on other sites

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

Yay ! Thanks to both of you!

Share this post


Link to post
Share on other sites
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

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 by galzohar

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×