Jump to content
SOVIET_IDIOT

I can't execute a sqf on a specific daytime

Recommended Posts

I'm trying to use the Dynamic AI Spawn System script to execute every time the mission is on a specific daytime.

 

I tried using this:

 

if (daytime >= 12) then
{
execVM "DynamicAISpawn.sqf";
};

 

It doesn't work. Can anybody help?

Share this post


Link to post
Share on other sites

Well you certainly need a loop:
 

while { true } do
{


if (daytime >= 12) exitWith // Exit loop
{
execVM "DynamicAISpawn.sqf";
};


sleep 2;
};

 

  • Haha 1

Share this post


Link to post
Share on other sites
9 minutes ago, SOVIET_IDIOT said:

It gives me "Error missing )" line 5

 

there was invisible character, try  now

Share this post


Link to post
Share on other sites

For a single event, you don't need a loop:

0 = [] spawn {

  waitUntil {sleep 5; dayTime > 12};

  your code

};

 

If your mission lasts for several days (acceleration time or else), you need a loop and certainly not exit it:

0 = [] spawn {

  while {true} do {

    waitUntil {sleep 2; dayTime > 12};

    your code

    waitUntil {sleep 2; dayTime <= 12};

  };

};

 

 

  • Like 1

Share this post


Link to post
Share on other sites
16 minutes ago, pierremgi said:

For a single event, you don't need a loop:

0 = [] spawn {

  waitUntil {sleep 5; dayTime > 12};

  your code

};

 

If your mission lasts for several days (acceleration time or else), you need a loop and certainly not exit it:

0 = [] spawn {

  while {true} do {

    waitUntil {sleep 5; dayTime > 12};

    your code

    waitUntil {sleep 5; dayTime <= 12};

  };

};

 

 

Does skiptime affects the loop? I tried skipping it a day it won't repeat.

Share this post


Link to post
Share on other sites
2 minutes ago, SOVIET_IDIOT said:

Does skiptime affects the loop? I tried skipping it a day it won't repeat.

I decrease the sleep time....from 5 to 2.   It's just because you're testing without waiting the condition meets the code. let waituntil works.

  • 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

×