Jump to content
Sign in to follow this  
Dragster

Help with a sript

Recommended Posts

Here is a script i could use a little help with.

_leader = _this select 0;

While { alive _leader} do

{

If ({alive _x} count units GRP1 <= 3) then

{

_leader addAction ["capture", "capture.sqs"];

}

};

When i try to run this it locks up my game. I think thats probably becouse im using the while command and the game locks running the script over and over again. It works fine if i use

_leader = _this select 0;

IF ( alive _leader) then

{

If ({alive _x} count units GRP1 <= 3) then

{

_leader addAction ["capture", "capture.sqs"];

}

};

My problem is that when i use the If command the script only checks the conditions one time. do anyone know how to fix this so script continualy checks if the conditions are fullfiled??

Share this post


Link to post
Share on other sites

You should always use the sleep command in loops.

This should do what you need:

waitUntil {{alive _x} count units GRP1<=3};

_leader addAction ["capture", "capture.sqs"];

Share this post


Link to post
Share on other sites

Thanks for the help that fixed it now the script looks like this

_leader = _this select 0;

IF ( alive _leader) then

{

waitUntil {{alive _x} count units GRP1<=3};

_leader addAction ["capture", "capture.sqs"];

};

Share this post


Link to post
Share on other sites

Could also skip the script and just put this in the leader's init field:

this addAction ["Capture","capture.sqs",[],1,false,true,"","alive _target && ({alive _x} count units GRP1<=3)"];

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  

×