Rejn 0 Posted May 14, 2007 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 Share this post Link to post Share on other sites
t_d 47 Posted May 14, 2007 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
Rejn 0 Posted May 14, 2007 Works like a charm.. thanks T_D Share this post Link to post Share on other sites
snkman 351 Posted May 14, 2007 Well i also have a question about this: 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
Rejn 0 Posted May 14, 2007 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
snkman 351 Posted May 14, 2007 Okay i will try it. Thank you Rejn Share this post Link to post Share on other sites
Big Dawg KS 6 Posted May 15, 2007 Well i also have a question about this: 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
snkman 351 Posted May 15, 2007 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
johnwilso007 0 Posted May 15, 2007 jsut a tip in armed assault theres also joinSilent command works the same but the units join without any radio communication Share this post Link to post Share on other sites
Big Dawg KS 6 Posted May 17, 2007 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