Jump to content
Sign in to follow this  
Minters

Wait for Init to complete

Recommended Posts

I'm sure this is written a thousand times on the forum already but I can't find it today. So could someone please tell me the easiest way to get a mission to wait to start until the init.sqf has done it's thing (In this case; spawned enemies and objects) ?

Thanks in advance for all the help you're about to provide :p

Share this post


Link to post
Share on other sites

sleep 1;

sleep won't execute until mission is started so put it at the end of init.sqf

Share this post


Link to post
Share on other sites

Didn't seem to work. Bassically I want everything that the init.sqf is supposed to do to be done bofore the mission starts, and that means spawning a lot of stuff. Is that posible?

Share this post


Link to post
Share on other sites

I thought the init scripts do get executed before the start of the mission, so the effects are already visible when in game? If that's not the case, my guess is that the game has too much to process in the script file, so you should cover up the processing with a black screen with "Loading" text, for example. Then, using the scriptDone command, as tcp suggested above, check whenever the script is done processing and take the loading text away.

Share this post


Link to post
Share on other sites

You cant wait for init.sqf or delay the mission start. However, since you cant wait/sleep inside init.sqf, it will be executed as fast as possible.

So, basically, to get stuff done before mission start is to avoid sleep/waituntil.

Share this post


Link to post
Share on other sites

can be a newbish answer, but you could use something like a semaphore:

waituntil {!isnil semaphore}

and then in your init:

semaphore = "set";

Share this post


Link to post
Share on other sites

Right, my suggestion wouldn't work as it only waits until mission start to do stuff after the sleep or waitUntil. Spawning would still go on as usual.

However, what if you setAccTime to a really low value. It would slow time down so that stuff wouldn't happen until all the units were loaded. You would probably need a loading screen as suggested otherwise the player might wonder why he can't move for a second (or however long it needs to be).

No idea if this would work.

Share this post


Link to post
Share on other sites

what Rellikki and shk said: init.sqf actually runs _before_ the briefing! (How else would you get a briefing now, that the html-briefing is obsolete). But yes, there is a catch as shk said: no sleeping here! If you do sleep, init.sqf halts it's execution and goes on as the mission starts.

^^ I had a problem with my briefing not being shown (before mission/at briefing-time) due to exactly this problem (a black in cut with a sleep at the top of init.sqf, thus before the briefing-stuff, was the culprit.. haha, ain't gonna work, though once the mission has started, the briefing was there! So this should get you an idea on when (and why) things are executed.)

Btw. I'm not aware of any other limits, such as processing-power. Are there such restrictions?

Share this post


Link to post
Share on other sites

i dont think so, the init.sqf always runs before the briefing screen (if sleep isnt used as suggested above), it may prolong your loading but it will never do its stuff after the mision is started

Share this post


Link to post
Share on other sites

Ok, so I should actually just take the SLEEP thing out and leave it to run as is?

Share this post


Link to post
Share on other sites

I would say, not necessarily. First, spawning units seems to be independent of init.sqf. Secondly, if you have a command that will only work once the mission starts, i.e. player gear changes, then you can safely put < sleep 1; > followed by those commands at the end of init.sqf and the loading will not be slowed at all.

Share this post


Link to post
Share on other sites

Well, I think it's now settled that sleep/waituntil will make the script until the mission has actually started. To get any further in this topic, we should probably see the actual script or at least what exactly is being attempted.

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  

×