Cutscenes

Does anybody know how to create a “cutscene” (im pretty sure that’s not what they are called in gmod terms) like when you join an openAura server and you get the little cutscene at the start.

Any help would be appreciated.

**[Gamemode.CalcView

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Gamemode.CalcView)**
**[Gamemode.HUDShouldDraw

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Gamemode.HUDShouldDraw)**

These 2 hooks should be enough for you. Just attach a variable to the player on their first spawn. Then use the CalcView hook to swerve the camera everywhere, as well as the HUDShouldDraw hook to hide the HUD. Do this only when the variable is true, after the cut scene is over set the variable back to false.

Ok, is there any way to play a video when the spawn (I know its a long shot)

Also - 200th post (:D)

[lua]

– serverside st00f
hook.Add(“PlayerInitialSpawn”, “VideoOnSpawn”, function(ply)
umsg.Start(“YourVideo”, ply)
umsg.End()
end)

usermessage.Hook(“YourVideo”, function()
– clientside st00f
end)

[/lua]

Is the video one you record or one that is map based? Should there be players in the video that are currently on the server?

It should be one that is pre-recorded (Like a kinda, intro to the gamemode/server).

[editline]24th October 2011[/editline]

What formats does that support?

None.

Its alot of http://luasearch.overvprojects.nl/?keywords=timer.Create
And http://luasearch.overvprojects.nl/?keywords=surface

The best if not only way to do it would be to upload it to be a youtube video and then play it, can you upload it and give us the link please.

what about the 3596 Ads there?

what if a player joins and he sees an ad and he is like WHAT THE FUCK IS THIS and then disconnect.

Im working on a video and ill upload it as soon as its done.

Ok, ive got an “intro” ready.

(I only spent 20 minutes or so on it, its temporary.)

You can always use a HTML5 video. Just make a HTML panel, surround it with fancy borders and shit. Then do something like:



pnl:SetHTML([[
<video poster="star.png" autoplay="autoplay" loop="loop" controls="controls" tabindex="0">
  <source src="movie.webm" type='video/webm; codecs="vp8, vorbis"' />
  <source src="movie.ogv" type='video/ogg; codecs="theora, vorbis"' />
</video>
]])


How are you going to send the video to the client?

[editline]25th October 2011[/editline]

I guess if it was on an external source it would work.

Is there any way to run it from the HUD?

Here:

[lua]
if SERVER then
hook.Add(“PlayerInitialSpawn”, “VideoOnSpawn”, function(ply)
umsg.Start(“YourVideo”, ply)
umsg.End()
end)
elseif CLIENT then
usermessage.Hook(“YourVideo”, function()
local pnl = vgui.Create (“HTML”)
pnl:SetSize(ScrW() / 2, ScrH() / 2)
pnl:SetPos(ScrW() / 4, ScrH() / 4)
pnl:SetHTML([[
<video poster=“star.png” autoplay=“autoplay” loop=“loop” controls=“controls” tabindex=“0”>
<source src=“movie.webm” type=‘video/webm; codecs=“vp8, vorbis”’ />
<source src=“movie.ogv” type=‘video/ogg; codecs=“theora, vorbis”’ />
</video>
]])
end)
end
[/lua]

Im guessing that I replace “YourVideo” with the video url? (Does it work for youtube, im guessing not) and where does that go?

No, read the code and try again.

Do I replace movie.webm/movie.ogv?

Good job.

Do I have to do both or can I choose which one I do?