OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting Multiplayer => Topic started by: laggy on 30 Sep 2009, 00:09:37
-
init.sqf
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:
_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:
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
-
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:
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;
};
};
-
Thanks a lot tcp,
Will try it asap.
Laggy