Jump to content

Sign in to follow this  
carlostex

How to "addmagazine loops in groups?

Recommended Posts

How can i use an addmagazine loop for filling up the gear of every single unit of a group?

like this:

{this addMagazine "ACE_75Rnd_545x39_T_RPK"} forEach [1,2,3,...,10];

and combine with :

{_x addmagazine "ACE_75Rnd_545x39_T_RPK"} foreach units _grpone;

Share this post


Link to post
Share on other sites

edit..

See my post below for the answer.

Edited by Riouken
nvm I was wrong on that

Share this post


Link to post
Share on other sites

{_x {this addMagazine "ACE_75Rnd_545x39_T_RPK"} forEach [1,2,3,4,5,6,7,8,9,10]} foreach units _grpone

:confused:

Share this post


Link to post
Share on other sites

Instead of me doing:

{_x addmagazine "ACE_75Rnd_545x39_T_RPK"} foreach units _grpone;
{_x addmagazine "ACE_75Rnd_545x39_T_RPK"} foreach units _grpone;
{_x addmagazine "ACE_75Rnd_545x39_T_RPK"} foreach units _grpone;
{_x addmagazine "ACE_75Rnd_545x39_T_RPK"} foreach units _grpone;
{_x addmagazine "ACE_75Rnd_545x39_T_RPK"} foreach units _grpone;
{_x addmagazine "ACE_75Rnd_545x39_T_RPK"} foreach units _grpone;
{_x addmagazine "ACE_75Rnd_545x39_T_RPK"} foreach units _grpone;
{_x addmagazine "ACE_75Rnd_545x39_T_RPK"} foreach units _grpone;
{_x addmagazine "ACE_75Rnd_545x39_T_RPK"} foreach units _grpone;
{_x addmagazine "ACE_75Rnd_545x39_T_RPK"} foreach units _grpone;

Can 't i do this with a single line?

If i use this in the init line of a unit:

{this addMagazine "ACE_75Rnd_545x39_T_RPK"} forEach [1,2,3,...,10];

it will give that unit 10 mags which much better coding addmagazine 10 times.

How can i combine this code so i can give every unit in a group 10 mags at a time? I need to do this in script.

Share this post


Link to post
Share on other sites

This works just tested it.

{
     _sol = _x;
     {_sol addMagazine "ACE_75Rnd_545x39_T_RPK"} forEach [1,2,3];
} foreach units _grpone;

Share this post


Link to post
Share on other sites

Thank you just a question:

Why do you need to put the magic variable _x into another variable first?

Share this post


Link to post
Share on other sites
  CarlosTex said:
Thank you just a question:

Why do you need to put the magic variable _x into another variable first?

Because the first forEach will try to replace the unit with 1,2,3etc. This way the inner forEach runs but replaces the _sol with _x which turns to theunitname.

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  

×