OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: sharkattack on 11 Mar 2008, 22:34:00
-
hi
something im stuck on with intros and co op games
what would be the easiest way to make an intro not play , once it has been played once .
eg
the jip or reconnect does not have to sit through if it has already been played ...
many thanx in advance
-
You'll need to test these of course but here goes. ;)
Example 1
Use a line in the init file that runs only on the server to create a variable, like so:
init.sqf
if (isServer) then {intro = true; publicVariable "intro";};
Then have a line to check if that variable exists at the start of intro.sqs and exit if it does not. All machines that started with the server will have the variable and any subsequent clients will not and will exit out of the intro.
intro.sqs
? (isNil "intro") : exit
;
; Camera Code
;
exit
That should do what you want with a minimum of fuss. If that isn't what you are looking for then try the example below for something more advanced.
Example 2
init.sqf
if {isServer} then {shark_introStarted = false; publicVariable "shark_introStarted"; _nul = [] execVM "sendnewplayerinfo.sqf";};
if {!isServer} then {_nul = [] execVM "requestnewplayerinfo.sqf";};
requestnewplayerinfo.sqf
_infoRecieved = false;
sleep .1;
if (!isNil "shark_introStarted") then
{
_infoRecieved = true;
};
while {!_infoRecieved} do
{
shark_newPlayer = true;
publiceVariable "shark_newPlayer";
sleep 1.2;
_infoRecieved = true;
if (isNil "shark_introStarted") then
{
_infoRecieved = false;
};
};
if (true) exitWith {};
sendnewplayerinfo.sqf
shark_newPlayer = false;
while {true} do
{
sleep 1.1;
if (shark_newPlayer) then
{
shark_introStarted = true;
publicVariable "shark_introStarted";
shark_newPlayer = false;
};
};
intro.sqs
cutText ["","black faded"]
#checkagain
~ 1.2
? (isNil "shark_introstarted") : goto "checkagain"
? (shark_introstarted) : goto "exitwithout"
;
; intro code here
;
exit
#exitwithout
cutText ["","black in"];
exit
-
thanks seven will give it a try :good: