Home   Help Search Login Register  

Author Topic: intro s in mp  (Read 1346 times)

0 Members and 2 Guests are viewing this topic.

Offline sharkattack

  • Former Staff
  • ****
intro s in mp
« 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
"HOLY SARDINE" - see Shark-Attack meet his match

Offline [seven]

  • Members
  • *
Re: intro s in mp
« Reply #1 on: 13 Mar 2008, 02:37:27 »
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
Quote
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
Quote
? (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
Quote
if {isServer} then {shark_introStarted = false; publicVariable "shark_introStarted"; _nul = [] execVM "sendnewplayerinfo.sqf";};
if {!isServer} then {_nul = [] execVM "requestnewplayerinfo.sqf";};

requestnewplayerinfo.sqf
Quote
_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
Quote

shark_newPlayer = false;

while {true} do
{
   sleep 1.1;
   if (shark_newPlayer) then
   { 
      shark_introStarted = true;
      publicVariable "shark_introStarted";
      shark_newPlayer = false;
   };
};

intro.sqs
Quote
cutText ["","black faded"]
#checkagain
~ 1.2
? (isNil "shark_introstarted") : goto "checkagain"
? (shark_introstarted) : goto "exitwithout"


;
; intro code here
;

exit

#exitwithout
cutText ["","black in"];
exit

« Last Edit: 13 Mar 2008, 02:45:06 by [seven] »

Offline sharkattack

  • Former Staff
  • ****
Re: intro s in mp
« Reply #2 on: 13 Mar 2008, 10:32:32 »
thanks seven  will give it a try    :good:
"HOLY SARDINE" - see Shark-Attack meet his match