Jump to content
thy_

Trigger condition: any unit of a specific group can do it

Recommended Posts

Hey, folks

 

I have a trigger that its goal is:

 

Condition: If any unit of a specific GROUP get close < 5 meters to the target; 

On Activation: hint "Some of of the group is around the target";

 

The question arounds only regarding the condition. I am not sure what is my mistake: 

 

I've tried:

  • (group01 distance bluTarget) < 5;
  • (group group01 distance bluTarget) < 5;
  • (units group01 distance bluTarget) < 5;
  • {(units group group01) distance bluTarget} < 5;

 

Can you put light here?

 

Thanks in advance.

Share this post


Link to post
Share on other sites

distance works between objects and/or positions.

 

units group01 findIf {_x distance bluTarget < 5} > -1

 

you can use also distanceSqr (so <25) for faster check.

 

For side...

 

allUnits findIf {side _x == EAST && _x distanceSqr bluTarget < 25} > 1

 

(just a little bit resource consuming with many units). Depending on your scenario and the way you check it.

See https://community.bistudio.com/wiki/setTriggerInterval

 

 

 

  • Thanks 1

Share this post


Link to post
Share on other sites


@pierremgi, everything working fine here! 😄

Btw, making some tests, I noticed these codes below doesn't work correctly when only the leader gets close to the target: 

  • leader group01 findIf {_x distance bluTarget < 5} > -1;
  • leader units group01 findIf {_x distance bluTarget < 5} > -1;

Share this post


Link to post
Share on other sites

leader (of a group/units) is an object, not an array. FindIf  applies to an array.

If you have to check this unit only, it's easy :  leader group01 distance bluTarget < 5

  • Thanks 1

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

×