Home   Help Search Login Register  

Author Topic: Intro, variables, dedi and JIP again...  (Read 1399 times)

0 Members and 1 Guest are viewing this topic.

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Intro, variables, dedi and JIP again...
« on: 30 Sep 2009, 00:09:37 »
init.sqf
Code: [Select]
private ["_showIntro"];

if (isMultiplayer) then
{
   // Multiplayer get choice, but never see it if JIP.
   _showIntro = (param1 == 0) and (not isNull player);
}
else
{
   // Single player people like intros.
   _showIntro = true;
};



if (_showIntro) then {[] exec "film.sqs"} else {if (isServer) then {introdone = true; publicVariable "introdone"}};

How do I make introdone=true NOT happen until the intro is over (or skipped by: param1 == 1) for a game on a dedicated server? If intro is chosen, film.sqs makes introdone=true at the end of that script.

As it is now I believe introdone=true happens from mission start on a dedi, while the intro is running for the players. NOT GOOD!

Would this work:

Code: [Select]
  _showIntro = (param1 == 0) and ((not isNull player) or (isDedicated));I suspect this will make the intro run also on the dedi, which could be OK.


Or:

Code: [Select]
if (_showIntro) then {[] exec "film.sqs"} else {if (isPlayer) then {introdone = true; publicVariable "introdone"}};
I guess this will have any JIP during the intro make introdone=true, which could cause problems.

Is there a perfect solution?
Extremely grateful for help, this stuff is making my brain bleed.

Laggy
« Last Edit: 30 Sep 2009, 00:18:14 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 tcp

  • Members
  • *
    • Violator Gaming
Re: Intro, variables, dedi and JIP again...
« Reply #1 on: 03 Oct 2009, 07:17:40 »
I don't know at what point publicVariables are synchronized for JIP, but you could try this in film.sqs:
? isServer OR !isNil "introdone" : exit

introdone = true
publicVariable "introdone"


If that doesn't work then, I am sure Xeno's code would work in your init.sqf:

Code: [Select]
X_INIT = false;
X_Server = false; X_Client = false; X_JIP = false;X_SPE = false;

X_MP = isMultiplayer;

if (isServer) then {
X_Server = true;
if (!isDedicated) then {
X_Client = true;
X_SPE = true;
[] spawn {waitUntil {!(isNull player)};X_INIT = true; [] exec film.sqs;};
} else {
X_INIT = true;
};
} else {
X_Client = true;
if (isNull player) then {
X_JIP = true;
[] spawn {waitUntil {!(isNull player)};X_INIT = true};
} else {
X_INIT = true;
[] exec film.sqs;
};
};
« Last Edit: 03 Oct 2009, 07:21:11 by tcp »

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: Intro, variables, dedi and JIP again...
« Reply #2 on: 07 Oct 2009, 20:25:18 »
Thanks a lot tcp,

Will try it asap.

Laggy
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.