Jump to content
Sign in to follow this  
hoz

Groups

Recommended Posts

I searched before I posted. ALOT, just try searchin group smile.gif

Is there a way to create a group on the fly via script? I tried creating game logic and do the group1 = group this but i can't get units to join when its time to.

Hoz

Share this post


Link to post
Share on other sites

If you mean actualy create a group use the create unit function, if you mean you want some units to join another unit use:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">[unit1, unit2, unit3] join unit4<span id='postcolor'>

RED

Share this post


Link to post
Share on other sites

and then you can name group by :

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

Share this post


Link to post
Share on other sites

I'm talk about having units join a group that doesn't exisit yet. Nor do I want to care what the units names are.

Here is my problem, i have this script that has one group join another group. which works fine.

"[_x] join battlegp1" foreach units gengp

after these dudes join this new group (battlegp1)

my gengp group is then empty or non exisitant.

I then want to create more dudes in the gengp group, however when i goto create the units (on the fly) the group is empty and therefore doesn't exisit. So I would like to know how to recreate or create a new group and put the new dudes into this group.

Anyone get what I am saying?

Hoz

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 (hoz @ Nov. 14 2002,13:21)</td></tr><tr><td id="QUOTE">however when i goto create the units (on the fly) the group is empty and therefore doesn't exisit.<span id='postcolor'>

Nope, it does exist even when empty, keep using the group. (my findings)

Try this to make a new one:

make anyone join objNull

then grab his group ie: newGrp = group anyone

then you can make him join his old group and now you should be able to use the new group

Share this post


Link to post
Share on other sites

Thanks for the help, it sounds promising. smile.gif

Going to try it out here shortly.

I'll let you know.

Hoz

Share this post


Link to post
Share on other sites

When I try to create a group with objnull I get an error EXpect Number.

"KEGSSoldierEAK103" createUnit [(getpos chop2), objnull,"",intel,"SERGEANT"]

Edit:

I gave up on the objnull and created a second group and now i just keep moving the dude in and out of the group as a place holder. Kind of kludgy but it works.

I'd rather be able to create an empty group smile.gif

Hoz

Share this post


Link to post
Share on other sites

That's right, I never told you to create into objNull group.

wink.gif

So you can try what I told you to make a new group...

Share this post


Link to post
Share on other sites

With createUnit, you can't use grpNull

What I do is, if I want a new East group, put a russian soldier somewhere on the map, far from the action, and I name it dummyEast.

I then create units in the group of dummyEast, and then release dummyEast by making him join grpNull :

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

; Creating the first soldier in dummyEast group

; I give a name to the new unit, so I can get his group after

"SoldierEB" createUnit [_position, group dummyEast, "newEast=this"]

; separating them by making dummyEast joining grpNull

dummyEast join grpNull

; creating the remaining units in the new group

"soldierEB" createUnit [_position, group newEast]

"soldierEMG" createUnit [_position, group newEast]

; .....

<span id='postcolor'>

This works pretty well

Whis'

Share this post


Link to post
Share on other sites

I got what I wanted working with the grpnull.

Thanks for the help.

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 (Bart.Jan @ Nov. 14 2002,11:48)</td></tr><tr><td id="QUOTE">and then you can name group by :

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

Where do you put that to give the entire group a name?

Share this post


Link to post
Share on other sites

Group one guy in the init field or in a script.

then have the other join that group.

This way joins the group:

groupName = group unit4; [unit1, unit2, unit3] join groupName

Edit:

Actually there is several ways to give the entire group a name. This is probally easier and more what you want.

in each of the dudes you create you could put in the init field groupName = group this

Share this post


Link to post
Share on other sites

So if I put a trigger that, lets say, strips all the weapons off a unit. I just put the group name and it would take all the weapons off all of them without having to do each person individually?

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  

×