Jump to content
Sign in to follow this  
Acecool

MP Loading and saving! I need help with getting a few things passed.

Recommended Posts

ccLogic is the name of a gameLogic in the game.

first if its nil then it should create a new variable on the server called Acecool, and set it to true, then display the hint. Passed from client to server.

If person dcs, then it should not be nil when it does getVariable, and it should hint its value!

It doesnt seem to be working, can anyone check my syntax since I am getting no hints, from either side!! This script is being executed AFTER waitUntils for player!!

//
// Initializes the Player so that their info is saved and reloaded if they DC!!
//
_playerVar = ccLogic getVariable name player;
if ( isNil( _playerVar ) ) then
{
// Initialize the variables!
ccLogic setVariable [name player, true];

hint "Done saving player var!";
}
else
{
hint format [ "%1", _playerVar ];
};

Edited by Acecool

Share this post


Link to post
Share on other sites

Editor placed game logics only exists on the server. You can't do anything with those on the client-only side.

Share this post


Link to post
Share on other sites

You can publicVariable a gamelogic, and use the namespace on all clients - this is how BIS pass all their variables around in the official missions. If you need a variable passed to all clients, you need to specifically broadcast it (and any changes made to it), or the new variable will only exist where it was changed:

// Ran server-side
_missionScopeGroup = createGroup sideLogic;
"Logic" createUnit [[0, 0, 0], _missionScopeGroup, "myGameLogic = this"];
publicVariable "myGameLogic";
myGameLogic setVariable ["SupGuys", 10, [color="Red"]true[/color]];

You'll need to make sure the clients have the logic on their side before using it, (usually in init.sqf or some kind of JIP script)

waitUntil {!(isNil "myGameLogic")};
_clientVar = myGameLogic getVariable "SupGuys";

Edited by bhaz
client example

Share this post


Link to post
Share on other sites

Awesp,e.t jaml ypi sp ,icj!

... Let me try that again.

Awesome thank you so much! It ended up being if ( isNil( _playerVar ) ) then

needed to be: if ( isNil "_playerVar" ) then

quotes blehhhh!!!! :-P

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  

×