Jump to content
Sign in to follow this  
TYsiEK

Group selecting

Recommended Posts

(units groupxxx select [0, 1]) is not working. How can i use this command to select a many units ?

Share this post


Link to post
Share on other sites
Guest

Can you explain a little better what you mean?

units( aGroup)  returns an array with the units.

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">(units groupxxx select [0, 1]) is not working. <span id='postcolor'> What does work for you?

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">How can i use this command to select a many units ?<span id='postcolor'> Which command do you mean by this? (units or select)

Reason I ask is I know you can figure it out if you take it step by step. smile.gif

EDIT: see we both have questions

Share this post


Link to post
Share on other sites

Yes but i get no explain about it what i have to do.

I writeing this command: (units huey1crews select 1) assignascargo huey2 .

It must working with assignascargo command.

Share this post


Link to post
Share on other sites
Guest

Aha, ok, I think I see what you want:

selectMultipleUnits.sqf:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

comment

{

Select multiple units

unitarray = selectMultipleUnits(indexArray, group)

};

private ["_indeces", "_grp", "_return", "_units",_i"];

_indices = _this select 0;

_grp = _this select 1;

_return = [];

_return resize ( count ( _indeces ) );

_units = units(_grp);

_i = 0;

while "_i<count ( _indeces ) )" do

{

_return set [_i, _units select (_indeces select _i ) ];

_i = _i + 1;

}

_return

<span id='postcolor'>

.. or something like that

Share this post


Link to post
Share on other sites

Yep excellent stuff Denoir...

To make it bare bones do:

_units = [(units huey1crews) select 1] + [(units huey1crews) select 2];

_units assignAsCargo huey2;

Share this post


Link to post
Share on other sites

I am not sure of what you try to do, because i dont really understand your question

But if you want to use the assignascargo command to a group of soldiers to UH60 , do it like this

by example, name an infantry group TEAM1 , in the officer init line use

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">TEAM1=group this<span id='postcolor'>

and name your UH60 by example BLACKHAWK

The use this

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">"_x assignascargo BLACKHWAK" foreach units TEAM1<span id='postcolor'>

But if you want them to go in , you will have to use a GET IN waypoint

Or if you dont want to use waypoint, after using the assigncargo command, you will have to give a name to every member of the squad and use (by example i have 6 guy in the TEAM1 group , i name them no1 no2 no3 no4 no5 no6)

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">[no1,no2,no3,no4,no5,no6] ordergetin true<span id='postcolor'>

And they will all get in the chopper

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">_units = [(units huey1crews) select 1] + [(units huey1crews) select 2];

_units assignAsCargo huey2; <span id='postcolor'>

Now that Chronicles posted I realized I was thinking of orderGetin Command... wow.gif

use this:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_units = [(units huey1crews) select 1] + [(units huey1crews) select 2];

"_x assignascargo huey2" foreach _units;<span id='postcolor'>

Share this post


Link to post
Share on other sites

Of course we talking about mission editor ? How yes, i should know what can i do with _units ? It is name of the units or somethink like this ?

Share this post


Link to post
Share on other sites

well if you want to do everything in mission editor I have not tested, if this will be used in the editor not a script use an array name like selectedUnits not _units

in the above examples _units was an array holding 2 group members like [member1,member2]

_ defines a local variable and can not be used in editor, it will let you know.

Share this post


Link to post
Share on other sites

OK THX, but i have a last question smile.gif. What does it mean the _x in a command line ---> "_x assignascargo huey2" foreach _units;

Is it a name from officer of the units group ?

Share this post


Link to post
Share on other sites

_x will become each unit from the array of units (_units)

what you have in ""s will become like a command and _x will be replaced by each element of array provided. smile.gif

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  

×