Jump to content
Ninjaisfast

Dedicated server yeilds varying results in testing

Recommended Posts

So I'm trying to make small scene where an AI driver gets in a boat, waits for the two other players to board the boat, then drives away. But when I test things out on a dedicated server, I get varying results without even changing the code. Hoping someone can enlighten me. Code might be a bit of a mess because I've been trying different things to see if they would help.

Trigger 1:

[Intro_BoatSaviour,[1,"Where the fuck are the other two?"]] remoteExec ["customChat", 0, false]; deleteVehicle thisTrigger; 

Trigger 2:

[Intro_BoatSaviour,[1,"Quick, get in."]] remoteExec ["customChat", 0, false]; _Intro_BoatScript = execVM "Intro_BoatScript.sqf"; deleteVehicle thisTrigger;

Intro_BoatScript.sqf: (hints are just for debugging)

if !(isServer) exitWith {};
"waiting for enter boat" remoteExec ["Hint",0,false];
waitUntil {(vehicle Escapee1 == Intro_boat) && (vehicle Escapee2 == Intro_boat)};
"STEP 1" remoteExec ["Hint",0,false];
Intro_BoatSaviour moveInDriver Intro_boat; Intro_boat lockDriver true; Escapee1 moveInCargo [Intro_boat,1]; Escapee2 moveInCargo [Intro_boat,2]; Intro_boat lockCargo true; 
Intro_boat lock 2; 
"should be locked" remoteExec ["Hint",0,false];

I should only be getting each customChat message once, but sometimes they happen twice. Sometimes the boat locks correctly, sometimes it doesn't, but still shows the 'should be locked' hint. 
I'm really stumped here. I don't understand why I'm getting different results when I do the exact same thing during testing.

Share this post


Link to post
Share on other sites

From some other threads it looks like I need to limiting things to the server side more? I have some confusion about triggers that I think is causing this -
if a trigger is activated, is the code in the activation field run on everyone's machine, including the server?
If the 'Server Only' checkbox is ticked, does that mean the CONDITION is only evaluated on the server, but the on activation field is still run on everyones end? Or is it both condition and activation?
 

Thanks in advance. Multiplayer scripting is confusing as heck to noobie.

Share this post


Link to post
Share on other sites
6 minutes ago, Ninjaisfast said:

If the 'Server Only' checkbox is ticked,

means the whole trigger is considered on server only.

Share this post


Link to post
Share on other sites

Maybe there are some locality problems in your code. as u told MP scripting is confusing sometimes.

You have to consider that the locality of a vehicle changes if a player enters that vehicle. The locality of the vehicle should shift from server to players client.

If a player is driver then the locality of the vehicle should shift to that player.

 

why could this be a problem?

the thing is that you are using commands which arguments have to be local to work properly.

in wiki look at upper left corner for "AL"- Arguments Local and "AG"-Arguments Global.

 

those commands have to be executed on that client where the object (argument) is local.

In the case of your vehicle it should be on the players client which entered the vehicle.

 

you can use owner to get the clients ID of that client where your vehicle is local.

then you can use this ID to execute the needed commands with remoteExec on that specific client.

  • 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

×