Jump to content
Sign in to follow this  
bangabob

forEach in trigger condition

Recommended Posts

I may be coming at the complete wrong angle here.

But what i want is a trigger to detect players only.

I have an array for all my players. So

EOS_Players = [e1,e2,e3,e4,e5,e6];

Then i have my created trigger

	
_spotFriendlies = createTrigger ["EmptyDetector",_currentPOS]; 
_spotFriendlies setTriggerArea [(_SafeZone+ _eosMarkerSizeA),(_SafeZone+ _eosMarkerSizeB),0,true]; 
_spotFriendlies setTriggerActivation ["ANY","PRESENT",true];  

So in my trigger statement this should work? But doesnt

_spotFriendlies setTriggerStatements ["{_x in thisList}foreach EOS_Players","",""];

Any help would be appreciated. Thanks

BTW.

 vehicle player in thisList

Does NOT work on dedicated servers

Edited by BangaBob

Share this post


Link to post
Share on other sites

If it's actually UNITS entering the statement you had should work:

_spotFriendlies setTriggerStatements ["{_x in thisList}foreach EOS_Players","",""];

If the units are actually inside a vehicle it won't because thisList will contain a (or more) vehicles. Also the var player is only set localy if a isDedicated = false.

So if you also want the trigger to check for units inside vehicles you would also have to check the cargo of each thisList item.

I can fix the script, i'm not sure tho wheter it should fire if every unit is inside the trigger area or if one of them (or more) is inside it.

Share this post


Link to post
Share on other sites
If it's actually UNITS entering the statement you had should work:

_spotFriendlies setTriggerStatements ["{_x in thisList}foreach EOS_Players","",""];

If the units are actually inside a vehicle it won't because thisList will contain a (or more) vehicles. Also the var player is only set localy if a isDedicated = false.

So if you also want the trigger to check for units inside vehicles you would also have to check the cargo of each thisList item.

I can fix the script, i'm not sure tho wheter it should fire if every unit is inside the trigger area or if one of them (or more) is inside it.

Thanks for the explanation. Will it fire for just one of the EOS_Players or would all of them need to be in the trigger?

Share this post


Link to post
Share on other sites

To check if all of them are inside the trigger area (in a vehicle or not)

_spotFriendlies setTriggerStatements ["{vehicle _x in thisList}foreach EOS_Players","",""]; 

And to check if one of them is in it:

_spotFriendlies setTriggerStatements ["{vehicle _x in thisList} count EOS_Players > 0","",""]; 

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  

×