Jump to content
Sign in to follow this  
Undeceived

How to identify the _x?

Recommended Posts

Hi guys!

I have the following in the condition line of a trigger (the trigger has size 0 and repeats itself):

{(Dude knowsAbout _x) > 0.0002} count (units group enmygrp) > 0

If I'm not mistaken, this should activate the trigger when "Dude" knows about any unit of the group called "enmygrp". At least I hope this happens! :D

Now my question is:

How can I identify WHO THAT UNIT IS that makes the trigger launch so I can use his name to launch a script from the activation line?

In other words: I want the name of the detected unit of the group so I can do this with it:

[nameofdetectedunit] exec "dude_kills_detected_unit.sqs";

Do you have an idea? Thanks a lot!

Edited by Undeceived

Share this post


Link to post
Share on other sites

{if (Dude knowsAbout _x>0.0002) then {_x exec "dude_kills_detected_unit.sqs"}} forEach units group enmygrp;

Share this post


Link to post
Share on other sites

didnt realize foreach works as trigger condition, never got it to work on my conditions :S

Share this post


Link to post
Share on other sites
{if (Dude knowsAbout _x>0.0002) then {_x exec "dude_kills_detected_unit.sqs"}} forEach units group enmygrp;

:yay: Wow, Celery, thanks a lot!

This seems to be the code for a script file and not for the condition line of a trigger, right?

I'll try it with a script then and will report back - thanks anyway.

One more thing now:

In the best case it would be that I don't need one script for every enemy group but instead one script with your code line that covers all possible units (with help of a large trigger area).

Now how would this code look like to work with all units in the trigger area? This way?

{if (Dude knowsAbout _x>0.0002) then {_x exec "dude_kills_detected_unit.sqs"}} forEach units list nameoftrigger;

Thanks again!

Edited by Undeceived

Share this post


Link to post
Share on other sites

Just put it in the On act field in the trigger with the count condition.

Share this post


Link to post
Share on other sites

Ok, I managed to get it working now. :) The _x unit is recognized and launches the script perfectly. :) Thanks so far!

I used the following:

Condition line: {(Dude knowsAbout _x) > 0.0002} count (units enemygrp) > 0

Activation line: {if (Dude knowsAbout _x > 0.0002) then {[_x] execVM "engage.sqf"}} forEach units enemygrp;

But the problem is now that even with the trigger being set to repeat, it won't activate itself again when "Dude" knows about the next unit of the group... I don't know why this happens. :(

Do you have an idea?

Edited by Undeceived

Share this post


Link to post
Share on other sites
But the problem is now that even with the trigger being set to repeat, it won't activate itself again when "Dude" knows about the next unit of the group... I don't know why this happens. :(

Do you have an idea?

Change trigger condition to true and on act to 0=[] spawn {while {alive Dude} do {{if (Dude knowsAbout _x>0.0002) then {_x exec "dude_kills_detected_unit.sqs"}} forEach units group enmygrp;sleep 1}}

Share this post


Link to post
Share on other sites

Really, thank you very much, Celery! :) It works like a charm! I only had to remove the word "group" before the "units". And now it works and the trigger activates repeatedly. :) Fantastic!!

Can I ask one last quesion (for now)? How would the code look if I want to involve not only one group but all units that are inside a trigger area?

I tried

0=[] spawn {while {alive Dude} do {{if (Dude knowsAbout _x>0.0002) then {_x exec "dude_kills_detected_unit.sqs"}} forEach units list triggername;sleep 1}}

and

0=[] spawn {while {alive Dude} do {{if (Dude knowsAbout _x>0.0002) then {_x exec "dude_kills_detected_unit.sqs"}} forEach list triggername;sleep 1}}

but without success...

Thanks, again!

Share this post


Link to post
Share on other sites

The latter should work if the trigger is activated repeatedly by anyone.

Share this post


Link to post
Share on other sites

Yes, I had to activate the area trigger by anyone!

Well, I think it will work now. As already said: Thanks a lot! :notworthy: :notworthy:

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  

×