Stag 0 Posted May 14, 2003 Setting up a trigger where any unit which enters the trigger area will perform a given action; eg, go to the bathroom, any unit flush the toilet? Thanks in advance. Share this post Link to post Share on other sites
toadeater 0 Posted May 15, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Wardog @ 14 May 2003,17:40)</td></tr><tr><td id="QUOTE">Setting up a trigger where any unit which enters the trigger area will perform a given action; eg, go to the bathroom, any unit flush the toilet? Thanks in advance.<span id='postcolor'> Set up the trigger to be activated by anybody and present, and set it to run repeatedly. Name your trigger something, like trg0001a, then write this in the on activation line: "_x switchmove poop" foreach units in list trg0001a Share this post Link to post Share on other sites
edc 0 Posted May 15, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">"_x switchmove poop" foreach units in list trg0001a<span id='postcolor'> Is that an actual switchmove? Share this post Link to post Share on other sites
Stag 0 Posted May 15, 2003 Thanks for the assist Toadeater. Tried that line, but getting the error: unknown operator list. Share this post Link to post Share on other sites
RED 0 Posted May 15, 2003 That line of code was wrong, if you use the following code it will save you from naming the trigger: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">"_x setBehaviour {SAFE}" foreach thislist<span id='postcolor'> RED Share this post Link to post Share on other sites
Stag 0 Posted May 15, 2003 Sorted! Many thanks Red. Share this post Link to post Share on other sites
Baron Hurlothrumbo IIX 0 Posted May 15, 2003 Great but how do you make it work with addaction? I want anyone in a small radius to be able to do the action 'steal radio' I have trigger set up as above, I tried putting </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">"beacon = _x addaction ["steal beacon","stolen.sqs"]" foreach thislist<span id='postcolor'> and </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">"_x addaction ["steal beacon","stolen.sqs"]" foreach thislist<span id='postcolor'> in its activation but it gives me an error 'unknown operator steal' EVEN THOUGH steal is in quote marks. stupid thing. Share this post Link to post Share on other sites
RED 0 Posted May 15, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">"_x addaction [{steal beacon},{stolen.sqs}]" foreach thislist<span id='postcolor'> That should work. RED Share this post Link to post Share on other sites
Baron Hurlothrumbo IIX 0 Posted May 15, 2003 sir! thou art my saviour! Share this post Link to post Share on other sites
toadeater 0 Posted May 16, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (RED @ 15 May 2003,08:34)</td></tr><tr><td id="QUOTE">That line of code was wrong, if you use the following code it will save you from naming the trigger: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">"_x setBehaviour {SAFE}" foreach thislist<span id='postcolor'> RED<span id='postcolor'> I don't get it, why didn't "in list" work? I've always used it that way in triggers. Besides not needing to name the trigger, what's the difference? </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> position[]={6350.088379,82.442749,4784.339844}; a=400.000000; b=400.000000; angle=245.304993; activationBy="WEST"; type="SWITCH"; age="UNKNOWN"; name="helipatrol"; expCond="aP in list helipatrol"; class Effects { }; synchronizations[]={7} <span id='postcolor'> Share this post Link to post Share on other sites
Stag 0 Posted May 16, 2003 Mr. T, all I can say is that when I cut and pasted the line you gave me I got the error message I posted about previously. Maybe I entered something wrong, but the jobs done now using Red's offering and I'm flushed with success. Share this post Link to post Share on other sites
RED 0 Posted May 16, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (toadeater @ 16 May 2003,05:53)</td></tr><tr><td id="QUOTE"></span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (RED @ 15 May 2003,08:34)</td></tr><tr><td id="QUOTE">That line of code was wrong, if you use the following code it will save you from naming the trigger: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">"_x setBehaviour {SAFE}" foreach thislist<span id='postcolor'> RED<span id='postcolor'> I don't get it, why didn't "in list" work? I've always used it that way in triggers. Besides not needing to name the trigger, what's the difference? </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> position[]={6350.088379,82.442749,4784.339844}; a=400.000000; b=400.000000; angle=245.304993; activationBy="WEST"; type="SWITCH"; age="UNKNOWN"; name="helipatrol"; expCond="aP in list helipatrol"; class Effects { }; synchronizations[]={7} <span id='postcolor'><span id='postcolor'> You only use the “in list†command when you want to check if a unit or units are in an array that trigger has given, in the case that wardog had the in command was not needed. And for using the thislist command, there is no real need of doing it other than saving a bit of time. RED Share this post Link to post Share on other sites
toadeater 0 Posted May 17, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (RED @ 16 May 2003,05:31)</td></tr><tr><td id="QUOTE">You only use the “in list†command when you want to check if a unit or units are in an array that trigger has given, in the case that wardog had the in command was not needed. And for using the thislist command, there is no real need of doing it other than saving a bit of time. RED<span id='postcolor'> OK, I get it now. Thanks. Share this post Link to post Share on other sites