Jump to content
Sign in to follow this  
wiggum2

Wait for all players to load the game correctly (dedicated server/MP)

Recommended Posts

Hi !

i have always trouble with intros or helicopter/HALO insertions on dedicated servers or in MP generally.

Some players always fail to load the game quick enough and dont get the "correct" intro or are spawned on the ground instead of inside the helicopter or HALO jumping.

I have searched but did not found a solution that actually works.

I tried waitUntil {!isNull player}; and a combination with sleep 1; inside my init.sqf before i call my helicopter insertion script but nothing works ! :mad:

Is there no way to just wait till every human player is ready and correctly initialized ?

Share this post


Link to post
Share on other sites

In SP in works all the time but in MP there is some trouble sometimes and i think its because of this:

When i test in SP (editor) the Map (altis) is already loaded = game loads faster and the init.sqf goes like intended.

But in MP many people just start the game, click MP and choose the server now the Altis Map (or any other just a example) has to be loaded during the Mission loading and if this takes longer for some the players the ini.sqf goes out of sync...

I think thats the problem.

I have this at the beginning of my init.sqf and thought it would help to make sure everyone has loaded the game until the rest of the init.sqf is executed...but no:

if (not isDedicated) then

{

waitUntil {!isNull player};

waitUntil {player == player};

};

Edited by Wiggum

Share this post


Link to post
Share on other sites

I have heard that just moving around at mission start before every thing has loaded like V.A.S. can clause Desync issues through out the game maybe you need your vehicles to start off from the ground then fly them out to where they need to go after all players have loaded. my crew mostly just tells every one to wait till they get green light to move normally a cemlight or some one just says it.

Share this post


Link to post
Share on other sites

1. Try this:

if (!isDedicated && player != player) then 
{
waitUntil {player == player && time > 1};
} 
else 
{
waitUntil {time > 1};
};

2. Put everything you want to be run on clients in an initPlayerLocal.sqf instead of the init.sqf. That way you make sure that even people who are joining in progress get everything they need. For a dedicated server is player always = 0. Scripts putting players into vehicles or moving them about in general, have to go into the initPlayerLocal.sqf.

3. Take a look at this to know when a certain script is being executed.

Basics:

- init.sqf is executed on mission start and on mission start only. Every client who initializes or joins later can't receive the contents of the init.sqf. On dedicated servers player is always nil, so you can't really use player-related content in the init.sqf (not without some unnecessary effort).

- initPlayerLocal.sqf is executed on every client on joining a mission. This file is not executed on the server however.

Edited by Pergor

Share this post


Link to post
Share on other sites

Wiggum here is a workaround:

Make heli waypoints to circle.

Add action like "Begin mission" to the heli. This will terminate the circle waypoint and activate the next waypoint or other triggers, scripts.

The heli circle until all player is ready(Connected).

The squad leader use the "Begin mission".

For the topic:

The BIS should disable the AI activity until the player join into the avatar. The most annoying thing is when the AI start shooting/moving, while player is JIP. This can easily lead to unusable saves.

Share this post


Link to post
Share on other sites

@ Belbo

Thanks but this does also not work...

Is there no way to get a insertion at mission start (heli/boat whatever) done so that all players are inside the vehicle ?

It is always a issue with loading time...some players take 10sec longer to load and bullshit they are outside and not inside...arghhh !

I use this in initplayerlocal.sqf:

//-------------------------------------------------------------------------------------
if (local player) then {
  player enableFatigue false;
};

// Intro 1
//-------------------------------------------------------------------------------------
[ "BIS_ScreenSetup", false ] call BIS_fnc_blackOut;
titleText ["Loading...", "PLAIN"];
sleep 5;
titleText ["", "PLAIN"];

[
   [["OUT OF FUEL","<t align = 'center' shadow = '0' size = '1.5' font='PuristaBold'>%1</t><br/>"],
   ["by Wiggum","<t align = 'center' shadow = '0' size = '1.0'>%1</t><br/><br/>"],
       ["","<t align = 'center'  shadow = '0' size = '1.0'>%1</t><br/>"],
       ["","<t align = 'center' shadow = '0' size = '1.0'>%1</t><br/>"]],
   0,0.3,"<t color='#33CCFF' align='center'>%1</t>"
] spawn BIS_fnc_typeText;

// Insertion
//-------------------------------------------------------------------------------------
waitUntil {not isNull player && player == player && time > 1};
if (!isNil "sh_Intro") then {
 player setPosATL (getMarkerPos "lz"); // Yes i checked it, sh_Intro is really Nil because its created at the END of the helicopter insertion script.
} else {
 player moveInCargo h1; // Put every player inside the helicopter
};

// Intro 2
//-------------------------------------------------------------------------------------
sleep 5;
[ "BIS_ScreenSetup", true ] call BIS_fnc_blackIn;
titleRsc ["RscStatic","PLAIN"];
if (isNil "sh_Intro") then {
playMusic "RadioAmbient5";
};

My helicopter insertion script has this:

waitUntil { {_x in _heli} count _units == count ([] call BIS_fnc_listPlayers) };

And thats the point its stops, clearly because not all players are inside the helicopter.

I really dont know how to make sure that all players get moveInCargo into the helicopter.

I thought the initplayerlocal would run for every client and because of that put every client inside the helicopter but people that load the mission too late end up outside...

I also thought BIS_fnc_listPlayers would check for all players that have joined the server but still, if someone has not loaded the game fast enough hes not listed in BIS_fnc_listPlayers...

So beside a HUGE sleep, is there any way to make sure everyone has loaded the game and is fully initialized ?

How would you do it to get every player inside a helicopter at mission start (dedicated sever) ?

Edited by Wiggum

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  

×