Home   Help Search Login Register  

Author Topic: JIP and changed variables during a mission.  (Read 1807 times)

0 Members and 1 Guest are viewing this topic.

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
JIP and changed variables during a mission.
« 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
« Last Edit: 19 Mar 2009, 11:49:06 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: JIP and changed variables during a mission.
« Reply #1 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
  {
     ....
  };
};
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: JIP and changed variables during a mission.
« Reply #2 on: 19 Mar 2009, 18:45:59 »
Thanks a lot Spooner  :)
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: JIP and changed variables during a mission.
« Reply #3 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.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)