OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: laggy on 19 Mar 2009, 11:46:55

Title: JIP and changed variables during a mission.
Post by: laggy on 19 Mar 2009, 11:46:55
Hi,

Does anyone know of a good solution to make sure the JIP player's init.sqs or .sqf is updated with the correct (changed during game) variables, as they are on the server and the in-game players?

What I'm looking for are simple boolean values as: objectiveDone, skiptime or skipintro.

Laggy
Title: Re: JIP and changed variables during a mission.
Post by: Spooner on 19 Mar 2009, 14:04:49
Just do not set them on any client machine initially:
Code: (init.sqf) [Select]
if (isServer) then
{
  objectiveDone = false;
  publicVariable "objectiveDone";
};
Then to change during the game, which will automatically update jippers:
Code: [Select]
objectiveDone = true;
publicVariable "objectiveDone";
Remember that a jipper won't get any public values updated until after his player object has been created:
Code: [Select]
// Run only on client (player machines) including the MP host.
if ((not isServer) or (not (isNull player))) then
{
  waitUntil { not (isNull player) };
  if (objectiveDone) then
  {
     ....
  };
};
Title: Re: JIP and changed variables during a mission.
Post by: laggy on 19 Mar 2009, 18:45:59
Thanks a lot Spooner  :)
Title: Re: JIP and changed variables during a mission.
Post by: Spooner on 19 Mar 2009, 22:12:27
Of course, you can also just use a trigger or addPublicVariableEventHandler to detect creation/changes in the variable rather than waiting until the value has been jipped, rather than just waiting until the values are synced. I was mainly just explaining that the last public value will be synced with jipping players, but that they won't have the value updated until after normal init time (which is when the host/SP player would have the value set), so you have to give it time before trying to use it.