Jump to content
elchupy

How-to know when player has finished loading and is in-game.

Recommended Posts

Hi,

I got a little trouble, i m trying to display a server rules rscTitles followed by a dialog (10s later) allowing the player to close the rules, either by hitting ESc or clicking on the button.

All is working perfectly on that side.

The issue i m having is that when hosted on a dedicated server, the rscTitles is displayed when player is still in the loading screen, and thus my 10s timeout is pretty mutch over when player sees the rules and thus is able to get rid of them almost directly.

 

So is there a way to know when player is actualy in-game ?

 

i tryed a waitUntil that checks the presence of the display #46, without success; it is created before loading screen goes away.

 

I also checked for the presence of loading displays with :

uiNamespace getVariable ["Loading_displays", []];

Unfortunatly even once the loading is completed and player is in-game, that display remains.

 

I also checked for the presence of the different RscDisplayLoading idd 101, 102, ,103, those are never present.

Share this post


Link to post
Share on other sites

already tried, triggered too soon :(

But i forgot to tell that i use that function to auto skip the briefing, like this in a preInit function :

 


if !( hasInterface ) exitWith {};

if !( isMultiplayer ) exitWith {};

if !( isNumber(missionConfigFile >> "briefing") ) exitWith {};

if ( getNumber(missionConfigFile >> "briefing") <= 0 ) exitWith {};

[] spawn {
	waitUntil {
		if ( getClientStateNumber >= 10 ) exitWith {true};
		private _dsp = [52, 53] select (isDedicated);
		if !( isNull findDisplay _dsp ) exitWith {
			ctrlActivate (findDisplay _dsp displayCtrl 1);
			findDisplay _dsp closeDisplay 1;
			true
		};
		false
	};
};

 

EDIT:

I also tried binding "ChildDestroyed" on allDisplays and "Destroy" on allControls of those displays, nothing is triggered when the loading screen goes away...

 

I guess a workaround would be to wait a for keyDown event on display #46, but even that is not a solution in my case, as i got a PLAIN cutRsc before, and i can not wait for an user input to start fading it away and display my rules.

Share this post


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

So is there a way to know when player is actualy in-game ?

 

I've tackled the same simply by testing if player started to move

if (speed player > 0) then {...}

I hope this helps

Share this post


Link to post
Share on other sites

Thx, for the reply.

But i was really hoping there was a more elegant solution to this.

As i told in the previous post, expecting a player to start moving with a black screen  + welcome message on his screen is not a good solution, some of them will just sit there waiting for the fadeOut ;).

Share this post


Link to post
Share on other sites

Thanks, but this is done way sooner.

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

×