Jump to content
Sign in to follow this  
Rejn

_x join command

Recommended Posts

Just wondering Im trying to make a _x join group plat3 command... unfortuantley i get errors..

tried:

{[_x] join platr1} foreach units plat1

{_x join platr1} foreach units plat1

Anyone know?

Thanks sad_o.gif

Share this post


Link to post
Share on other sites

Try this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(units plat1) join platr1

Share this post


Link to post
Share on other sites

Works like a charm.. thanks T_D biggrin_o.gif

Share this post


Link to post
Share on other sites

Well i also have a question about this: smile_o.gif

I try to add a EventHandler to a Group called "_tg"

So far i used:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (KEY_AIinjured) then {(units _tg select 1) addEventHandler ["hit",{_this exec "ai\ai_voice\ai_voice4.sqs"}]}

But with this only one soldier of the Group is selected.

So what do i have to do to add the EventHandler to the complete "_tg"?

Share this post


Link to post
Share on other sites

Im not sure if this will help you but check out this thread.. I asked something about eventhandlers and did get a command at the bottom on how to assign eventhandlers to an entire team with one command.

http://www.flashpoint1985.com/cgi-bin....t=62430

{_x addEventHandler ["killed",{_this exec "hide.sqs"}]}foreach units def1

were def1 was the group i wanted and hide.sqs the script to execute...

If you get any errors try adding select 0 example:

{_x addEventHandler ["killed",{_this select 0 exec "hide.sqs"}]}foreach units def1

Not sure if this is what your after D:

Share this post


Link to post
Share on other sites

Okay i will try it.

Thank you Rejn wink_o.gif

Share this post


Link to post
Share on other sites
Well i also have a question about this: smile_o.gif

I try to add a EventHandler to a Group called "_tg"

So far i used:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (KEY_AIinjured) then {(units _tg select 1) addEventHandler ["hit",{_this exec "ai\ai_voice\ai_voice4.sqs"}]}

But with this only one soldier of the Group is selected.

So what do i have to do to add the EventHandler to the complete "_tg"?

You can't add a single eventhandler to a group, eventhandlers only work on objects, not groups. You need to give each individual group member their own eventhandler.

Share this post


Link to post
Share on other sites

Hey Kyle,

well i just did some play around with the EventHandler and it look's like this way is working well.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (KEY_AIinjured) then {{_x addEventHandler ["hit",{_this exec "ai\ai_voice\ai_voice2.sqs"}]} foreach units _tg}

Share this post


Link to post
Share on other sites

jsut a tip in armed assault theres also joinSilent command works the same but the units join without any radio communication biggrin_o.gif

Share this post


Link to post
Share on other sites
Hey Kyle,

well i just did some play around with the EventHandler and it look's like this way is working well.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (KEY_AIinjured) then {{_x addEventHandler ["hit",{_this exec "ai\ai_voice\ai_voice2.sqs"}]} foreach units _tg}

Yes, because forEach adds an eventhandler to each unit in the group. I know this, what I was trying to do is make him better understand the difference between groups and objects. A group (as a single entity) cannot be given an eventhandler, only objects.

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  

×