Jump to content
Sign in to follow this  
xealot

moveInCargo not working at mission start in multiplayer

Recommended Posts

Hello

 

I have observed that using moveInCargo in init.sqf will not work for clients in a multiplayer session but it does for the server.

However if a fairly large delay is introduced like a waitUntil { time > 10}; then it works but it is not a good solution.

 

To reproduce:

Place a helicopter anywhere flying with the name hkp

Add an infantry group with at least two playable slots

In init.sqf:

player moveInCargo hkp;

Host the mission, have another client join. (I used two games running simultaneously to check myself)

Once the mission is started the host will be in the helicopter whereas the client will not be.

 

If you add waitUntil{time > 10}; above the moveInCargo line in init.sqf then both players will be moved to cargo after 10 seconds.

I dont know where the threshold is but checking for time > 0 is insufficient.

I also tried to run finishMissionInit; before the moveInCargo command but that did not help either.

 

Is this a bug or is there a condition I should check for?

Share this post


Link to post
Share on other sites
if (!isDedicated) then {
    waitUntil {!isNull player};
    waitUntil {player == player};
};

That could probably help.

Share this post


Link to post
Share on other sites

Adding the line into the initPlayerLocal.sqf should also solve the issue. However, the best way in my opinion would be to give the unit a variable name. Then it doesn't matter if it's a player or not.

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  

×