Jump to content
Raffal

Problem with trigger in multiplayer & dedicated

Recommended Posts

Hi guys,

 

I have a problem with a trigger in multiplayer and on dedicated server . In editor and single player this works perfectly . The trigger must show some markers on the map when two players meet at a distance of about 5m . I used this condition but not work for multy & dedi .

 

 

 

 

Trigger name "INTEL"

 

 

 

Trigger condition : p1 distance p2 <5;

 

On act: hint "Intel acquired"; mark = createMarker [format["%1marker",pos1],getpos pos1];  mark setMarkerType "hd_destroy";  mark setMarkerColor "ColorEAST";  mark setMarkerText "AA"; mark setMarkerColor "ColorEAST"; 

 

 

 

 

 

 

 

can someone help me?

 

Thank you

Share this post


Link to post
Share on other sites

Are the markers still being displayed in multiplayer, or is your only issue that the hint isn't displaying?

Share this post


Link to post
Share on other sites

either...but in editor & singleplayer trigger work & hint & marker too...think it's a problem of variable in the trigger

Share this post


Link to post
Share on other sites

if its working in editor with no errors then it should work in MP.  there are a few things that i notice that you may want to consider though.

triggers placed in the editor are global, so you may want to add an isServer check to the condition as well.  (otherwise each player connected can trip the trigger and they are all checking the conditions and all going to add lots of markers to the map. also there can only be 1 marker with the name you're giving it. without the server check, each player is trying to create it and that would explain why it works when only 1 person trys the mission).   may also want to add in an isserver check to the marker creation part as well so only the host creates the markers. (createMarker is a global command, there are local ones as well you can use if you want though).   you are also setting the color twice.  

condition: 
isServer && (p1 distance p2) <5 

on activation: 
hint "Intel acquired"; 
if (isServer) then {
mark = createMarker[format["%1marker",pos1],getPosWorld pos1];
mark setMarkerType "hd_destroy";  
mark setMarkerColor "ColorEAST";  
mark setMarkerText "AA"; 
};

i added in the "getPosWorld" command simply because it returns the position the fastest of all the position commands.

Share this post


Link to post
Share on other sites

getPosWorld is the fastest ? Interesting, gotta test this right now :D

Share this post


Link to post
Share on other sites

First thing:

getPosATL, getPosASL and getPosWorld are pretty much fast (0.43 seconds for 100.000 iterations). The only position commands slower than that are getPosASLW (0.48 seconds) and getPos/position (0,9 seconds).

 

E.g. for buildings, getPosASL is some meters away from getPosWorld while both return PositionASL, because a mode's center is usually the absolute center, meaning a few meters above ground, so that could lead to confusion at some point. In most cases you're better off using getPosATL as long as you're above solid ground.

 

 

And now for the actual question:

For effects to happen on the server, the trigger statements must be set on the server, because as of the BIKI page:

effects_local.gif

"Effects of these scripting commands are not broadcasted over the network and remain local to the client the command is executed on".

 

I couldn't test this theory yet, but that's one thing why triggers should always be handled server side only.

 

What is "pos1" in your case? The way you're using it, it must be an object, despite the name. But stringifying an object into a string is somewhat unusual if not advisable. At least for testing purposes, give it a proper name until you got it to work the way you want it and then think about the final name you want to give. But please don't stringify objects into identifying strings like marker names.

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

×