Jump to content
lawman_actual

wait until in vehicle fires too early

Recommended Posts

It's pretty simple; i need the script to pause until all units from the group have mounted the vehicle.

But for whatever reason the wait until command is firing too early; a good 5 seconds or more before units have boarded.

 

Any able to tell me why or how to improve upon it?

I should be able to work around it by just sleeping a certain amount of time, but it's frustrating.

 


waitUntil 
		{
			{((vehicle _x) == iran_mrap1)} forEach (units group_varza1);
		};
sleep 10;												
hint "MARK";

 

Share this post


Link to post
Share on other sites

The better condidtion would be

waitUntil 
		{
			{_x in iran_mrap1} count (units group_varza1) == count (units group_varza1)
		};
sleep 10;												
hint "MARK";

 

  • Like 1

Share this post


Link to post
Share on other sites
4 minutes ago, 7erra said:

The better condidtion would be


waitUntil 
		{
			{_x in iran_mrap1} count (units group_varza1) == count (units group_varza1)
		};
sleep 10;												
hint "MARK";

 

 

Worked a charm :)

Just needed a different way of thinking about it.

 

Much obliged.

Share this post


Link to post
Share on other sites

This will work provided your vehicle has enough seats to accommodate the group.

Share this post


Link to post
Share on other sites

Just to clear this up lawman, forEach returns only the value of the last statement.

Hence your waitUntil triggeres as soon as the last unit in the list is in the vehicle, even when the others are not.

 

 

Also, if its not critical that your waitUntil reacts immediately and you want to save some performance, include a sleep in the waitUntil condition.

 

waitUntil 
		{
          	sleep 1;
			{_x in iran_mrap1} count (units group_varza1) == count (units group_varza1)
		};
sleep 10;												
hint "MARK";

This way it checks the vehicle only every second instead of all the time which is easily enough in this case.

  • Like 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

×