Jump to content
LSValmont

Help getting two WaitUntil conditions Merged.

Recommended Posts

So my script starts like this:

 

_Join_East = creategroup EAST; 
call {
_changing = allUnits select {(side _x isEqualTo civilian) && (!isPlayer _x) && (_x distance player < 100)};
_changing apply { 
units _x joinSilent _Join_East;	
[_Join_East, _Pos_1] call BIS_fnc_taskAttack;

// Now all nearby Ai civilians turn hostile to the player!

And that works like a charm!

 

What I need is to put this two waitUntil conditions into a single waitUntil with an OR.

 

waitUntil {sleep 1; ({alive _x} count units _Join_East) < 3;};
waitUntil {sleep 1; player distance units _Join_East > 500};

 

I can't seem to get both to work in an OR format.

 

The final result should be:

 

waitUntil { (The _Join_East group has less than 3 units) OR (The player got 500 meters away from the units in the _Join_East group).

 

Thanks in advanced!

Share this post


Link to post
Share on other sites

:eh:

waitUntil {sleep 1; ({alive _x} count units _Join_East) < 3 || player distance units _Join_East > 500};

distance units makes no sense though. distance doesn't take an array of units.

 

9 minutes ago, LSValmont said:

I can't seem to get both to work in an OR format.

I can't even get the second one to work seperately.

 

Chose one unit of that group. And check the distance to that one.

  • Thanks 2

Share this post


Link to post
Share on other sites
15 minutes ago, Dedmen said:

:eh:


waitUntil {sleep 1; ({alive _x} count units _Join_East) < 3 || player distance units _Join_East > 500};

distance units makes no sense though. distance doesn't take an array of units.

 

I can't even get the second one to work seperately.

 

Chose one unit of that group. And check the distance to that one.

 

Thanks Dedmen! Would this work:

waitUntil {sleep 1; ({alive _x} count units _Join_East) < 3 || player distance leader _Join_East > 500};

?

 

PS: I never knew that || meant OR :dummy:

  • Like 2

Share this post


Link to post
Share on other sites
1 minute ago, LSValmont said:

PS: I never knew that || meant OR

https://community.bistudio.com/wiki/or

 

1 minute ago, LSValmont said:

Would this work:

yeah. Can't see anything wrong. Might need to add some more parenthesis. I prefer less parenthesis though.

  • Thanks 1

Share this post


Link to post
Share on other sites
2 hours ago, Dedmen said:

yeah. Can't see anything wrong. Might need to add some more parenthesis. I prefer less parenthesis though.

 

Just tested it and works like a charm! Thank you!

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

×