Jump to content
Sign in to follow this  
PlacidBox

publicVariableServer oddities

Recommended Posts

Hey, I'm doing some multiplayer scripting and am running in to strange behavior with "publicVariableServer."

The problem is that with a non-dedicated server, the publicVariableEventHandler only gets called when the

local player does publicVariableServer, not when any remote players do.

init.sqf is esentially:

playerDeath = objNull;
if (isServer) then {
   on_player_death = {
       hint "player died";
   };
   "playerDeath" addPublicVariableEventHandler on_player_death;
};

if (isDedicated) then {exit};

on_death = {
   playerDeath = playerSide;
   publicVariableServer "playerDeath";
};

sleep 0.01; // wait for mission to begin
player addEventHandler ["killed", on_death];

Swapping the publicVariableServer for just a normal publicVariable works as expected (remote deaths cause the function to be called, local ones don't.)

Is there something extra that I need to do to get these calls though, or is it just bugged?

Share this post


Link to post
Share on other sites

You're right, it's a mistake, i'd swapped it from

if (!isDedicated) then {
   // client code here
};

but it doesn't matter, anyway, since this isn't being run on a dedicated server at any point.

Share this post


Link to post
Share on other sites

hint is local should do nothing on dedicated server and would probably work on client if client is server

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  

×