Jump to content
gc8

startLoadingScreen not working

Recommended Posts

Hi

Tried the startLoadingScreen command in my mission in init.sqf file but nothing happens. Is the command broken or how do you get the load screen to show up?

Also not sure when to call this function because missions also have their own loading screen

 

Tried this:

 

startLoadingScreen ["Loading My Mission"];

 

thx

Share this post


Link to post
Share on other sites

Found the reason it didn't work. Have to make this check first before trying to start the loading screen:

 

getClientStateNumber >= 10

 

Share this post


Link to post
Share on other sites
2 hours ago, gc8 said:

Also not sure when to call this function because missions also have their own loading screen

Use BI's functions BIS_fnc_startLoadingScreen BIS_fnc_endLoadingScreen BIS_fnc_progressLoadingScreen it will register and handle multiple loading screens that could happen at the same time( yours and BI own mission load ) and will only endLoadingScreen once all register loading screens have finished.

 

Notice the difference by running each of these scripts one at a time from the debug console whilst looking at output in RPT.

Spoiler

h = [] spawn {
	startLoadingScreen[ "load 1" ];
	diag_log "starting 1";
	uiSleep 3; 
	startLoadingScreen[ "load 2" ];
	diag_log "starting 2";
	uiSleep 3; 
	endLoadingScreen;
	diag_log "1st end";
	uiSleep 3; 
	endLoadingScreen;
	diag_log "2nd end";
};

h = [] spawn {
	[ "load 1" ] call BIS_fnc_startLoadingScreen;
	diag_log "starting 1";
	uiSleep 3; 
	[ "load 2" ] call BIS_fnc_startLoadingScreen;
	diag_log "starting 2";
	uiSleep 3; 
	[ "load 1" ] call BIS_fnc_endLoadingScreen;
	diag_log "ending 1";
	uiSleep 3; 
	[ "load 2" ] call BIS_fnc_endLoadingScreen;
	diag_log "ending 2";
};

 

First script will end at "1st end". Where as second will keep a loading screen up until "ending 2".

Share this post


Link to post
Share on other sites

@Larrow thanks , I tried that but the load screen is now freezing. The whole game freezes and I have to quit it. Probably because there is waituntils in the code. But with startLoadingScreen I did not have this problem

Share this post


Link to post
Share on other sites

I'm going to guess you are testing in SP environment?

28 minutes ago, gc8 said:

But with startLoadingScreen I did not have this problem

This is due to BI's initFunctions calling BIS_fnc_endLoadingScreen, and because yours is not registered the endLoadingScreen in there will end all loading screens( your frozen one due to waituntils ). At which point your script will unfreeze and continue execution, which really defeats the point of a loading screen running your script at full throttle 50ms.

 

If you run your test in MP it will freeze indefinitely as init.sqf is run after initFunctions so the endLoadingScreen in initFunctions will not rescue your frozen loading screen.

 

You would be better off handling loading screens in a postInit function and by using BI's functions. Plus sort out any hanging due to sleep/waituntil's.

 

Share this post


Link to post
Share on other sites
5 minutes ago, Larrow said:

I'm going to guess you are testing in SP environment?

 

MP. My code doesn't work in SP because I wait the briefing to complete...

 

Share this post


Link to post
Share on other sites

 @Larrow I don't know, I appreciate the help but I got my loading screen working just fine in multiplayer now. The trick was to wait until the default loading screen had finished so I could start mine. This is the check I have to make it work: 

getClientStateNumber >= 10 && count (missionnamespace getvariable ["BIS_fnc_startLoadingScreen_ids",[]]) == 0

 

  • 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

×