Jump to content
Sign in to follow this  
falconx1

script wait for 2 conditions

Recommended Posts

How can i change this script to continue only after waves_east < AIWaveCount and time is greater than SetupTime var

i originaly made it to function different but now i want to give players a chance to have time to buy gear save it etc before the AI waves start coming

//SetupTime would be based on seconds only.

SetupTime = (paramsArray select 5);
while {waves_east < AIWaveCount} do {


not sure but is this right?


SetupTime = (paramsArray select 5);
while {waves_east < AIWaveCount || time > SetupTime} do {

Edited by falconx1

Share this post


Link to post
Share on other sites

yea but that would require more modding of other sqf pages in this case i believe its best to use time . is the bottom code i posted correct ?

Share this post


Link to post
Share on other sites

I'm sure I had a problem with (<condition1> || <condition2>) before and I ended up changing it to (<condition1> || {<condition2>}) and I'm sure it started working, something to do with lazy evaluation, could anyone explain this easily?

Share this post


Link to post
Share on other sites
How can i change this script to continue only after waves_east < AIWaveCount and time is greater than SetupTime var

|| is OR, you want &&.

Share this post


Link to post
Share on other sites

Okay if you want to use time how will you get the time then? SetupTime variable can be set to what 120 for 2 minutes. But you want to see if the time is greater than SetupTime. The time command (http://community.bistudio.com/wiki/time) only returns the number in seconds since the mission started so we can't use that. So maybe create a local variable that adds one to itself and then in your code check to see if that local variable is greater than SetupTime.

_time = 0
_time = _time + 1 ;

This will increase the variable by one every time but you will need a while or For loop to make _time increase itself.

The condition should look like this.

 while {waves_east < AIWaveCount && _time > SetupTime} do 
{
//Codes goes here
};

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  

×