Jump to content
56Curious

Player Loaded into Game

Recommended Posts

Is there a way to test if a player has loaded before executing some code or a command that is ran when the player exits the loading screen? Baisclly, some players load slower than their initPlayerLocal for some reason and therefore they're not seeing the whole intro?

Share this post


Link to post
Share on other sites

I use 

	waitUntil {
	sleep 1;
	
	(!isNull player && time > 0)
		
	};

and it seems to work well.

Share this post


Link to post
Share on other sites
18 hours ago, red62 said:

I use 


	waitUntil {
	sleep 1;
	
	(!isNull player && time > 0)
		
	};

and it seems to work well.

 

You've got that within the initPlayerLocal yes? code after the waitUnitl too obviously.

Share this post


Link to post
Share on other sites
On 10/12/2017 at 11:38 AM, 56Curious said:

Is there a way to test if a player has loaded before executing some code or a command that is ran when the player exits the loading screen? Baisclly, some players load slower than their initPlayerLocal for some reason and therefore they're not seeing the whole intro?

Do you have an example of that? In initPlayerLocal the variable player is consistent and point at the player.

So, the @red62seems to me a waste of code.

Share this post


Link to post
Share on other sites

The player can exist before they can "see".  So theres a chance they might miss part of a cut scene.

Share this post


Link to post
Share on other sites

I'd like to know this aswell and tried finishMissionInit, however it seems like it's not doing anything.

And the loading screen family is for starting your own loading screen.

 

Any other ideas?

 

 

-Dj

Share this post


Link to post
Share on other sites

Id just black the screen out,  use time > 5 or something and then execute the intro. 

Share this post


Link to post
Share on other sites

Hmm, was doing that aswell, but was really hoping to have some function or so.

SOme people have really slow PC's.... :D

 

Thanks for the reply!

 

 

Share this post


Link to post
Share on other sites

I think I tried that one already.

The state 10 is activated once the player clicked on Continue.

The loading screen after that is ignored :/

Share this post


Link to post
Share on other sites

Watching this topic because I want to know the definitive answer too

Share this post


Link to post
Share on other sites
1 hour ago, code34 said:

lol :) another trick is too wait that UI player appears.

Isn't it loaded before the loading screen ends?

If not; how would I achieve this? :D

Share this post


Link to post
Share on other sites

I'm thinking of brute-forcing this by waiting for the player to get a cursorobject (wouldn't work on vr) or wait for the player to actually move.

Share this post


Link to post
Share on other sites

Hmm, my Intros are mostly starting in vehicles. So checking if the player is moving is a nogo (As the vehcle stands still UNTIL all players are loaded in..)

The Cursor method could work, but do you even have a proper cursor when in no menus?

Share this post


Link to post
Share on other sites

Starting in vehicles? Perhaps wait for player head movement. Assuming, of course that this can't happen until the player properly in game.

Of course, the sure fire way of doing this is to have a dialog onscreen that the player must close before intro starts. It's nasty and won't be popular with mission makers or players, but it is making sure.

Share this post


Link to post
Share on other sites

Thought about that aswell, however I never worked with dialogs and I'm Kinda scared of them :D.

But I haven't checked them out in years, and I heard there are some tools nowadays, that make everything easy.

Might try it.

But still would be nice to have an implemented function for this..

Share this post


Link to post
Share on other sites

The way I fixed this was just pretending that something was loading, create a black screen and then just fade into that, here is a snippet for anyone:

if (side player == west) then {

		_subtitles = [
			[ "System",			"Loading, please wait. This may take some time...", 0],
			[ "System",			"Almost done, final touches...", 10],
			[ "System",			"Loading complete, transmitting data...", 20]
		];
		_subtitles spawn BIS_fnc_EXP_camp_playSubtitles;
		sleep 30;
		0 fadeMusic 0;
		sleep 0.1;
		titlecut ["","BLACK IN",7];
		playMusic "EventTrack01a_F_Tacops";
		6 fadeMusic 1;
		_camera = "camera" camCreate [12031.02,4828.08,0.92];
		_camera cameraEffect ["internal", "back"];
		... Blah Blah Blah
};

I've set the screen to be black by default in the init file so that you never actully see the game screen. Then just executed the above in a seperate file.
Best fix I can come up with if there isn't a set scripting command for multiplayer loading.

Share this post


Link to post
Share on other sites

As long as you are using the BI functions for any custom loading screens you may have (e.g not using startLoadingScreen command) just wait until the array holding loading screens IDs is empty (this also holds IDs for BI's own mission preload).

//initPlayerLocal.sqf

//Start custom loading screen aswell
[] spawn {
	[ "MyLoadingScreen" ] call BIS_fnc_startLoadingScreen;
	uiSleep 20;
	[ "MyLoadingScreen" ] call BIS_fnc_endLoadingScreen;
};

waitUntil {
	//If there are no current loading screens
	if ( missionnamespace getvariable ["BIS_fnc_startLoadingScreen_ids",[]] isEqualTo [] ) then {
		//Continue
		true
	}else{
		//Otherwise log current loading screens to RPT
		diag_log str ( missionnamespace getvariable ["BIS_fnc_startLoadingScreen_ids",[]] );
		false
	};
};

_loadedTime = time;

uiSleep 1;

hint format[ "Finished loaded %1 seconds ago", time - _loadedTime ];

 

  • Like 3

Share this post


Link to post
Share on other sites

Hi Larrow, I used your code above and it works but my loading screen doesn't appear. However it appear with the command startLoadingScreen.

 

I don't understand why, can you help me?

 

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

×