Jump to content
Sign in to follow this  
vindaboner

Looping a simple script help

Recommended Posts

Hi guys,

I've searched around a tried a few ideas with no joy. I was wondering how do I simply make the following script loop every 3 minutes? Many thanks!

While {true} do {

Sleep 180;

{

_dropunits = _x;

if ((side _dropunits) == east) then {

if ( ({(_dropunits distance _x) > 2000} count playableUnits) == ({isplayer _x} count playableUnits) ) then {

deletevehicle _dropunits;

};

};

} forEach _dropunits;

Sleep 10;

Share this post


Link to post
Share on other sites

Are you seeking to remove AI that have strayed too far from the player group?

The script is really confusing because you reference _dropunits as the array as well as the single element of the array selected as _x.

As for the loop, the sleep 180 will work if you have a close }; for the while-do, and the script works. But I suspect it will error out.

This is what I'm seeing:

While {true} do 
{
Sleep 180;
{
	_dropunits = _x;
	if ((side _dropunits) == east) then 
	{
		if (({(_dropunits distance _x) > 2000} count playableUnits) == ({isplayer _x} count playableUnits)) then 
		{
			deletevehicle _dropunits;
		};
	};
} forEach _dropunits;
Sleep 10;

Edited by OpusFmSPol

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  

×