Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
Stag

How would you go about

Recommended Posts

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

</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

</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? biggrin.gif

Share this post


Link to post
Share on other sites

Thanks for the assist Toadeater. Tried that line, but getting the error:

unknown operator list. confused.gif

Share this post


Link to post
Share on other sites

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

Sorted!

Many thanks Red.

smile.gif

Share this post


Link to post
Share on other sites

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

</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

</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

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. biggrin.gif

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 (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

</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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×