Jump to content
Sign in to follow this  
alleycat

How to front-load like a mofo?

Recommended Posts

I am coding a script that places AI units all over the map after examining a lot of locations. Basically it ends up with a few thousand lines of log (if each loop writes something in the log). The problem is that (so far only on a local server) the script creeps a few minutes into the mission start. How to front load stuff so the server (ideally) dedicated does all of it before players join the mission? I have tried waituntil but that did not appear reliable as the scripts stepped over each other.

Share this post


Link to post
Share on other sites

Avoid using interrupts (sleep, waitUntil) and change all execVM's to call compile preProcessFile within your initialization logic and the game will not progress past the loading screen until init.sqf has finished processing. If that cannot be done, you can create your own loading screen.

Share this post


Link to post
Share on other sites

Does this also work on scripts that call other scripts? For example if I want to precompile the toplevel script that itself calls 3 other lower scripts which then call each call another script for each town on the map? When I used waituntil the toplevel scripts called complete long before the actual work by the lower scripts was completed.

Also, are interrupts safe to use as in, not blocking the other scripts? If I would create a scripts that sets the weather to random then waits an hour until it repeats itself?

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  

×