of     2   
chevron_rightchevron_rightchevron_right

Riderj
#63485312Sunday, February 26, 2012 5:39 PM GMT

Requirements: ----------------- - Basic Scripting Knowledge - How to access the CurrentCamera - Understanding of LocalScripts - Understanding of For loops - Basic GUI Creation Knowledge - Roblox Studio - CFrame Knowledge [Best viewed with the forum enhancer] Introduction --------------- Welcome guys, our lesson plan here is to first get all the client side stuff done first. Like inserting the scripts and making the GUI's. We will then get into the coding, it is quite simple. This tutorial is for your learning purposes, please do not redistribute it. Creating The GUI --------------------- First we should think of descriptive names for the GUI. I named my ScreenGui "IntroCover" and my Frame "Cover". The reason we are making this GUI is to restrict access to clicking and right clicking. This prevents the user from doing any harm to the intro. Set the Frame's size(Scale not Offset) to 1, on both the X and Y Axis. This will cover the whole screen, next we want events to not be passed through. So we will be checking the Active property making it true. This will disallow any clicks that are fired while the frame's state is visible. Inserting The Script, Getting Into The Good Stuff -------------------------------------------------------- We will be using a LocalScript so we can access the players CurrentCamera. Lets insert this script into the StarterPack. ** Note: if you want to use this with a tool or when a player first enters you will place it in the lighting then clone it when the players enters/selects the tool. ** This localscript will control our camera's movement, before we get started with scripting we need a few points of interest on your map. So get about 4 points using a 1x1 block, you want it's position. So copy that and place it somewhere safe, we will be using it later. Lets get started shall we? We want to declare three variables, tha player's PlayerGui and the players Character and The Players Camera, four if you want to shorten the typing to get to the local player. wait() local Player = game.Players.LocalPlayer local Char = Player.Character local Cam = game.Workspace.CurrentCamera local ICover = Player.PlayerGui.IntroCover -- Replace intro cover with whatever you used for your Gui's Name Now we must make the player not able to move, We do this by setting the players walkspeed to 0 wait() local Player = game.Players.LocalPlayer local Char = Player.Character local Cam = game.Workspace.CurrentCamera local ICover = Player.PlayerGui.IntroCover -- Replace intro cover with whatever you used for your Gui's Name Char.Humanoid.WalkSpeed = 0 Now that the player cannot move we want to activate the GUI to block all click events. wait() local Player = game.Players.LocalPlayer local Char = Player.Character local Cam = game.Workspace.CurrentCamera local ICover = Player.PlayerGui.IntroCover -- Replace intro cover with whatever you used for your Gui's Name Char.Humanoid.WalkSpeed = 0 ICover.Cover.Visible = true All clicks that are fired will now be handled by that GUI, so nobody can right click and mess with your Intro. Since we have finished all the basic stuff we will now move onto to actual camera stuff. We need to set two things at the same exact time or it will not work correctly, these two things are: **CoordinateFrame** - *Where your camera will be placed* **Focus** - *What your camera wil be focusing at (Pointing at)* For this tutorial I will set the CoordinateFrame to 0,20,0 but you can change the value of the coordinate frame the same way as we are the focus. You just need to do a lot more positioning to get it right. Lets start programming this son of a gun, we will first determine how many points we have. For this example I will settle with three random points. 5,1,22 55,44,2 12,34,1 For this part we will only be setting the Focus, as said above you can edit the coordinate frame to have a better looking Intro. We have three points so that means we will be using three for loops. You will be using as many for loops as you have points. Since this is a basic tutorial we will be leaving it at that, there are ways to make it more efficient but it is a bit more advanced. Lets get with it: wait() local Player = game.Players.LocalPlayer local Char = Player.Character local Cam = game.Workspace.CurrentCamera local ICover = Player.PlayerGui.IntroCover -- Replace intro cover with whatever you used for your Gui's Name Char.Humanoid.WalkSpeed = 0 ICover.Cover.Visible = true Cam.CoordinateFrame = CFrame.new(0,20,0) Cam.Focus = CFrame.new(0,0,0) -- Will fix this in the next steps for pos=0,1,.01 do -- First Position end wait(1) -- The time it takes before the next point shows. for pos=0,1,.01 do -- Second Position end wait(1) for pos=0,1,.01 do -- Third Position end We now have established the basic outlines for our intro, we will be multiplying CFrame values to get a smooth animation. As you can see in our for loop we have the range set from 0-1 and the interval set to .01, the interval will control how long the animation takes. If your animation does not get to its destination in time just modify the range. The higher the number the longer it will take. Also, to make it smooth and not jumpy we compose two CFrames after the first for loop. This is so is smoothly goes from one position to another. wait() local Player = game.Players.LocalPlayer local Char = Player.Character local Cam = game.Workspace.CurrentCamera local ICover = Player.PlayerGui.IntroCover -- Replace intro cover with whatever you used for your Gui's Name Char.Humanoid.WalkSpeed = 0 ICover.Cover.Visible = true Cam.CoordinateFrame = CFrame.new(0,20,0) Cam.CameraType = Enum.CameraType.Fixed -- We added this so we can manipulate the camera freely. for pos=0,1,.01 do -- First Position and figure Cam.Focus = CFrame.new(5*pos,1*pos,22*pos) wait() -- We add this so the animation is smooth and does not finish instantly. end wait(1) -- The time it takes before the next point shows. for pos=0,1,.01 do -- Second Position Cam.Focus = CFrame.new(5,1,22)*CFrame.new(55*pos,44*pos,2*pos) -- We removed the *pos from the first one because we already animated that, The first CFrame value is where the camera last left off. wait() end wait(1) for pos=0,1,.01 do -- Third Position Cam.Focus = CFrame.new(55,44,2)*CFrame.new(12*pos,34*pos,1*pos) wait() end ICover.Cover.Visible = false Cam.CameraType = Enum.CameraType.Follow -- I assume this is what it originally is. Char.Humanoid.WalkSpeed = 16 You can reset the cameras position if you like, but the main thing to change is the CameraType. Now we are just reseting the values to the default settings and we are good to go. There we have it, a fully functioning camera cutscene. I will have some notes below if you want to expand it... ## Notes ## - You might want to check where the camera is pointing at using some sort of marker, just to make sure it is pointing in the direction you want. - When composing the before and after CFrames you might have to change the Y Value to a negative or positive for it to point correctly. - If you want to position the coordinateframe like we did the focus, use the same method. You will just have to get three more points. Ask Questions Below!!
Riderj
#63513454Monday, February 27, 2012 12:59 AM GMT

Bump [[ 7/10 - Scripting| 4/10 - Building | 10/10 - Confused ]]
miz656
#63515942Monday, February 27, 2012 1:36 AM GMT

Looks good but one thing... http://www.roblox.com/My/Groups.aspx?gid=188955 Kingkiller1000 scripting group had to do this for a contest. Many people might've copied this without reading.... Good tutorial but not a great time to post it at the moment...
kingkiller1000
#63519476Monday, February 27, 2012 2:24 AM GMT

It's alright. If everyone enters the same thing, then the best one that isn't copied will stand out.
miz656
#63521470Monday, February 27, 2012 2:53 AM GMT

Better.
Riderj
#63521840Monday, February 27, 2012 2:59 AM GMT

I did this because I was requested :O I guess it was not the best time haha. [[ 7/10 - Scripting| 4/10 - Building | 10/10 - Confused ]]
miz656
#63521942Monday, February 27, 2012 3:00 AM GMT

Who asked you to make this?
Riderj
#63522010Monday, February 27, 2012 3:01 AM GMT

knightmareXD [[ 7/10 - Scripting| 4/10 - Building | 10/10 - Confused ]]
miz656
#63522073Monday, February 27, 2012 3:02 AM GMT

-_- KnightmareXD...Really? That doesn't sound like him... How come you just didn't message him?
Riderj
#63522142Monday, February 27, 2012 3:03 AM GMT

Another person asked for it, plus at 100 views I'm going to put it on the SHG bulletin board. [[ 7/10 - Scripting| 4/10 - Building | 10/10 - Confused ]]
miz656
#63522457Monday, February 27, 2012 3:09 AM GMT

Why not just put it there now?
KnightmareXD
#63522490Monday, February 27, 2012 3:10 AM GMT

Nice. Although, I still hate using the camera because it either never does what I want, or I totally messed it up. † KMXD †
miz656
#63522569Monday, February 27, 2012 3:11 AM GMT

I don't use the Camera that much. Only thing I really use is CameraSubject.
epicfail22
#63524616Monday, February 27, 2012 3:51 AM GMT

Nice tutorial. Tracked.
miz656
#63524692Monday, February 27, 2012 3:52 AM GMT

Tracked :P
Navydev
#63524819Monday, February 27, 2012 3:55 AM GMT

Neat
miz656
#63524863Monday, February 27, 2012 3:56 AM GMT

Pretty well tutorial.
epicfail22
#63524945Monday, February 27, 2012 3:59 AM GMT

^*... good tutorial.
miz656
#63525202Monday, February 27, 2012 4:05 AM GMT

We get it, it's a good tutorial :P
Riderj
#63541478Monday, February 27, 2012 8:48 PM GMT

Bumps [[ 7/10 - Scripting| 4/10 - Building | 10/10 - Confused ]]
miz656
#63552397Tuesday, February 28, 2012 12:03 AM GMT

BUMPITY BUMP WITH THE B U M P
unholysoda
#63552566Tuesday, February 28, 2012 12:05 AM GMT

Very helpful guide, i learned how to do some pretty neat cutscene stuff from this model. http://www.roblox.com/Camera-Interpolation-item?id=72298388
Riderj
#63554816Tuesday, February 28, 2012 12:41 AM GMT

Cool bump. [[ 7/10 - Scripting| 4/10 - Building | 10/10 - Confused ]]
stroudie
#63554876Tuesday, February 28, 2012 12:42 AM GMT

Seems legitimately helpful. Thanks.
miz656
#63559402Tuesday, February 28, 2012 1:51 AM GMT

Lots of thanks from rider :D

    of     2   
chevron_rightchevron_rightchevron_right