Jump to content
Sign in to follow this  
Lolsav

How to skip intros on reconnect/player arrive late

Recommended Posts

This is the way i do it, might be anothers.

If a player arrives late in the mission or reconnects, if the Intro was "ON" he shouldnt be forced to watch it all over again. So the way to do this is to tell ARMA that guy has arrived late.

On init.sqs file place the following code:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if !(local Server) then {exit}

onPlayerConnected " publicVariable ""missionstarted""";

And in intro, where you set the parameters, have something like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(param1) == 1 AND missionstarted = false : goto "start" else goto "end"

?(param1) == 0: goto "end";

Where #start is where camera coding begins and #end where it ends... obviously.

In the mission place a trigger set condition to "TRUE" with a countdown of 10 seconds or more, depends of your choice. In trigger, on activation, set the condition "missionstarted" to true, like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">missionstarted = true; PublicVariable "missionstarted";

and the player wont see the intro after 10 seconds in the mission.

The onplayerconnected is very usefull to publicize the state of the variables to the late commers players. It really helps on intros, and i believe it has much more utility on other type of missions.

Hope this is helpfull smile_o.gif

Share this post


Link to post
Share on other sites
...
Nice m8 and thanks for Sharing...

But a few things are loose ends to me:

[*] onPlayerConnected "STATEMENT"; This will execute STATEMENT when a player is connected... I do not understand why you put ""missionstarted"" in there, as it will merely try to execute the boolean 'missionstarted' (which is either true or false) and that is not possible as it is not code or string, but a boolean smile_o.gif so as far as I know... it should be: onPlayerConnected "publicVariable ""missionstarted""";

[*] Why waste a trigger while you can do a: sleep 10; missionstarted = true; publicVariable "missionstarted";

in the init.sqf after if(!local server)exitwith{};

[*] on a side note: go SQF m8, really, why not go 100% to the newer, optimized format smile_o.gif

Since it is working anyway either says that just placing ""variable""  in the onPlayerConnected function, will in fact publicVariable ""variable""

or that variables that have been made public before (publicVariable "variable") .. will be synced to joining in clients, automaticly...

or that the outcome of triggers since the game started, are synced to clients while joining, but I see that as a small chance and a weird setup if that's true.

Just trying to understand it smile_o.gif Don't shoot me pistols.gif

Share this post


Link to post
Share on other sites

Dont shoot me either, i had made a "copy paste" from my init and skiped the Publicvariable banghead.gif

Was fixed on main post smile_o.gif

Share this post


Link to post
Share on other sites

Okidoki smile_o.gif))

BTW... I personally feel that intro's are supposed to run for anyone, even if they join later.

This is of coarse a problem... in the way we are used to make intro's in the sqs/sqf scripts... but I think that if you would setup such intro in the "Intro" part of the game (In the editor you can choose if you wish to edit the intro, outro or mission itself)... then you would be able to show the intro to everyone as I guess that intro parts are built and played sort-of-'locally' and as such ur not starting at already blown up, moved etc. etc. vehicles (the problem you get when using the intro-in-the-mission part biggrin_o.gif), what's ur opinion/findings?

Share this post


Link to post
Share on other sites

Old issue Sickboy. Sincerely didnt even tryed it on Arma. In OFP the intro/outros in editor would not work in multiplayer, was designed for singleplayer only.

Share this post


Link to post
Share on other sites
Old issue Sickboy. Sincerely didnt even tryed it on Arma. In OFP the intro/outros in editor would not work in multiplayer, was designed for singleplayer only.

I know it was in OFP, but I didn't know that there it didn't work in Multiplayer...

I'll share my info if I tested it, will you do the same? biggrin_o.gif

Share this post


Link to post
Share on other sites

Sure.. but i just cant do it now.. off to work. Anyway i dont really believe its diffrent in Arma.

Share this post


Link to post
Share on other sites

I've taken roughly the same approach as stated in the opening post, apart from the trigger in the mission. I've taken the first @camCommited in the intro (taking place some 5 seconds after start of the intro), and set the missionstarted=true after that.

If a player connects during the intro (or even if someone has a slow system), the player may skip the intro while the others still have to wait for it to finish, which might give an advantage in being able to start early (obviously depending on the duration of your intro). Because of this I've also added a introfinished public var, which will get set at the end of the intro. I've then added

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(missionstarted) and (!introfinished): goto "WAIT"

.

.

.

#WAIT

@introfinished

.

.

exit

so you still have to wait for the (fastest system's) intro to finish.

At the end of the intro you'll of course get <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">introfinished = true; publicVariable "introfinished"

Share this post


Link to post
Share on other sites
I've taken roughly the same approach as stated in the opening post, apart from the trigger in the mission. I've taken the first @camCommited in the intro (taking place some 5 seconds after start of the intro), and set the missionstarted=true after that.

Let me see that was a clever solution HitmanFF. But i do wonder if the time is the same for all players in that case. Why i make the question is simple: for my understanding all cutscenes are always local to clients, not to Server, therefor the time where your variable becomes true it will be diffrent on all clients.

I went to the trigger solution because it was the first i rememberd of, not because it was the optimal solution. But, since its a trigger inside the mission, and its early in mission (hence no desynch at all), when the trigger becomes true it will send the condition of true/false at same time for all clients, right? Therefor i prefer my way, because i feel its more reliable.

In my years of OFP ive learned a hard lesson: "Logic its not applyable to multiplayer behaviour or choppers" wink_o.gif

Share this post


Link to post
Share on other sites

How did you finally get this working. I have tried with a trigger set to gamelogic not present, that makes intro = 1; then set it to pubvar. then at the end of a intro, the Gamelogic is moved into the trig area, therefore anyone connecting later, the intro start trig would be false, i also set the intro var back to 0 when i move the gamelogic.

Any help would be great, as i have a 2 1/2 min intro, which i dont want to see when i spawn into the middle of a fire fight.

Cheers

GC

Share this post


Link to post
Share on other sites

If I had to make a skip intro feature, this is how I'd make it:

init.sqs:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?!local server:goto "jump"

started=0

publicvariable "started"

#jump

?started==1:goto "skipintro"

[] exec "intro.sqs"

#skipintro

?!local server:exit

~<insert length of intro>

started=1

publicvariable "started"

exit

Share this post


Link to post
Share on other sites
If I had to make a skip intro feature, this is how I'd make it:

init.sqs:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?!local server:goto "jump"

started=0

publicvariable "started"

#jump

?started==1:goto "skipintro"

[] exec "intro.sqs"

#skipintro

?!local server:exit

~<insert length of intro>

started=1

publicvariable "started"

exit

Cheers mate,

i will try it later.

Cheers

GC

Share this post


Link to post
Share on other sites

i tested Celery´s version on a dedicated server and it works without probs! wink_o.gif

Share this post


Link to post
Share on other sites
i tested Celery´s version on a dedicated server and it works without probs! wink_o.gif

Cheers for that.

All i need to do now is move all my trigger executions of the vehicleCam script (from ofp), to a script.

Seems if a trigger has triggered once, then it is set to true when players connect later.

Cheers

GC

Share this post


Link to post
Share on other sites
If I had to make a skip intro feature, this is how I'd make it:

init.sqs:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?!local server:goto "jump"

started=0

publicvariable "started"

#jump

?started==1:goto "skipintro"

[] exec "intro.sqs"

#skipintro

?!local server:exit

~<insert length of intro>

started=1

publicvariable "started"

exit

Does this work on Dedicated server, 1.02. I am using this script with my intro.sqs. and the intro still happens on JIP. After the wait time.

Cheers

GC

Share this post


Link to post
Share on other sites
If I had to make a skip intro feature, this is how I'd make it:

init.sqs:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?!local server:goto "jump"

started=0

publicvariable "started"

#jump

?started==1:goto "skipintro"

[] exec "intro.sqs"

#skipintro

?!local server:exit

~<insert length of intro>

started=1

publicvariable "started"

exit

Does this work on Dedicated server, 1.02. I am using this script with my intro.sqs. and the intro still happens on JIP. After the wait time.

Cheers

GC

Did you use it exactly like pointed, in the init.sqs file while the intro itself is in intro.sqs and launched only by init.sqs? In all of Frantic's maps it works. Make sure you have a game logic named server on the map.

Share this post


Link to post
Share on other sites
Did you use it exactly like pointed, in the init.sqs file while the intro itself is in intro.sqs and launched only by init.sqs? In all of Frantic's maps it works. Make sure you have a game logic named server on the map.

I have used it as you have said, but i havnt used a Gamelogic called server. I was using a gamelogic, to try and stop the intro after the game has started, but never called it server.

i will try that,

cheers

GC

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×