Before you read this tutorial, make sure you have the latest version of Half-Life.
Remember the part in the original Half-Life where Gordon was captured by grunts? There was a little 'movie' of the grunts supposedly dragging Gordon. Well that was achieved with a trigger_camera and a tight setup. In this tut, I will try and explain how to use the trigger_camera, hopefully in a simple way!
That 'lil Half-Life moment
Introduction
The trigger_camera is essentially a
func_train. It has to follow a set of
path_corners, has options for speed and can also be set to target something (more on this later). There are varying ways of setting up a
trigger_camera. This depends on what type of 'movie' you would like to do. We'll try a simple one for now.
Simple
Create a room. Place an
info_player_start in it as well as a trigger_camera and some lights. Create a
trigger_once by creating a brush textured with the
AAATRIGGER texture, hitting 'To Entity' and then selecting '
trigger_once'. Go to the trigger_camera properties. Set these options:
- Name - This is the name you give to your camera so that you can trigger it.
- Hold time - This is how long, in seconds, that your camera will last for before reverting back to Gordon.
- Flags - Follow Player - This means that the camera will be 'looking' at Gordon.
Now for the trigger_once. Put the player in it so it activates straight away. Take a look at the properties for the trigger and set these options:
1.
Target - This would be the name of the camera. So if your camera is named 'cam1' put '
cam1' into this field.
That's it! Run the map and you will notice that you're looking at Gordon. When you move around the camera will follow you.
The finished product Simple and easy? Yes. Good looking? No. Right now your little movie looks pretty bad. The camera can't move from its point apart from moving on its axis. It's also very boring. Time to spice it up! From here on it gets harder so pay attention!
Advanced
For this part, we will try and make a camera that follows a path. For this section, you will need to know how to use a
multi_manager as well as a func_train and path_corners.
First, create a better looking room as I'm sure you wouldn't want your movie to consist of looking at grey walls. Put some things in it, chairs, desks, etc to make it interesting. Now for this to work, the camera has to look at something or more accurately an entity. This could be anything. This is what would happen:
The camera would travel along the path whilst looking at the object you told it to look at. Here's where the func_train comes in. The func_train can follow the same track as the camera! Set the trigger_camera to look at the train and voila: it now looks as if the camera is looking at its path. So how do you do this?
Set up a path of
path_corners. This is what the train and the camera will be following. The more path_corners you have (especially on turns) the smoother the camera will be. Take a look at the each of the path_corners properties and set these:
- Name - I would suggest something really simple here. Make sure they're numbered too. For example, the names could progress like this: c1, c2, c3, c4, etc.
- Next Stop Target - This is where you set where the path_corner that follows.
- Fire On Pass - This option is not necessary for this tutorial but is very useful. In essence, its like the 'Target' option in other entities, but will only activate what you set in here when the path is 'passed'.
- Wait here (secs) - Specifies how long you want the camera to stop at this point.
- New train speed - When the camera gets to this point you can set it to go faster or slower. '0' means no speeds change.
Now for the train. Make a small cube, textured with the '
{BLUE' texture. Place an origin brush in the centre of it and tie them together. Then hit '
To Entity' and select a '
func_train'. Now for the properties:
- Name - Obvious really. Make sure there's no capital letters in it!
- Render Mode - This is important unless you want to see the train. Set it to 'Solid'.
- FX amount - Set it to 255. The train will now be invisible when you run it.
- First Stop Target - This is very important. This will be the first path_corner the train has to follow. However, for the camera to work, you must put it one path_corner ahead of the path_corner the camera starts on. For example, if the trigger_camera starts on 'c1' the train will have to start on 'c2'. If this is not done the camera will not work properly.
- Speed (units per second) - This specifies how fast the train will move. The speed of the train has to be the same speed of the camera. Mess around with the speed to find a value that suits your needs.
- Flags - Not Solid - Self explanatory.
Last but not least the trigger_camera:
- Target - IMPORTANT! - This is where you specify what the camera is 'looking' at.
- Name - Getting a little tiring now, eh?
- Hold time - How long the camera goes for before it reverts back to player control.
- Path Corner - Specify the first path_corner here. Remember it must be one behind the func_train. If the train's first path is 'c2' then the camera one will more than likely be 'c1'.
- Initial Speed - How fast it should start.
- Acceleration units/sec^2 - How fast it'll speed up.
- Flags - Freeze Player - Prevents player from moving while the camera is activated.
Now it's all set up. But hold your horses we aren't done yet! You will need a
multi_manager to get it up and running. Multi_managers are great. They are very versatile and best of all, very simple to use. First put a multi_manager into your map. Take a look at its properties:
- Name - Hmmm, wonder what this does...
- SmartEdit[off] - This is where all the entities go. To add an entity, hit 'Add' and type the name of the entity. The 'Value' is the time delay after the multi_manager has been activated.
All that needs to be done is setup the multi_manager. For this example, the func_train will be called
traincam1; the trigger_camera will be called
cam1 and the multi_manager will be called
cammm ("
cam multi
manger" if you can't figure it out). Take off SmartEdit and add this to it:
Name
traincam1Value
1Name
cam1Value
1.5A neat and tidy entity setup. Setting it up similar to this makes it easier to see where things are and how things flow. So what does that mean? Well it means that 'traincam1' will be activated 1 second after the multi_manager has been activated and 'cam1' will be activated 1.5 seconds after the multi_manager has been activated. Make sure that trigger_once you put in before now targets the multi_manager (cammm). But wait! Gordon's in the way of the camera!
This is where it gets a little tricky. The trigger_camera has to 'see' Gordon somehow. This isn't the same as the 'Target' field. But what if you don't want to see Gordon at all? What if it's a cut scene like the one in Half-Life? There are a few solutions:
1. Place Gordon in a place in your map so that the camera doesn't see him.
This method would work if you didn't care where Gordon was when the camera reverted back to him. Not so good if you do care.
2. Shove Gordon in a wall
This method would work if your making a movie only and don't need to revert back to Gordon. If you do, it's pretty pointless.
3. Teleportin'
Warning, this is tricky. It involves a lot of entity setups. I'll only give the basic gist of it here. Here's the plan:
Build a small room outside of the main area and texture it black. Put the info_player_start in there. Now you will need to setup a teleport (see
Tutorial: Teleporters) that will teleport Gordon into the main room, start the camera and teleport him back to the place you want after the 'movie' has finished. Now your thinking "What a fool, the player will see the teleport!" This is where some handy env_fades come in. Add the env_fade to the multi_manager and the level will 'fade in'. If you put enough delay in, you can teleport the player in, start the train and camera, teleport him out and fade in to the moving camera! A little tricky but quite effective.
4. Func_wall
Trigger_cameras can 'see through' func_walls. In essence you could put Gordon in a room close to the map, make the walls func_walls and start the camera.
Notes
Well that wasn't too hard was it? By now you should have a camera running on a track. You want more? Well here are a few ideas:
- The train doesn't have to run on the same path as the camera. They can run on two separate tracks. It'd result in a little more work but you could get some real nifty effects working.
- Path_corners can trigger multi_managers. Imagine the cool scripted sentences and things you could do
- Env_fades work well to add to the effect as well as disguise background work
- The Spirit of Half-Life mod allows greater control and flexibility over what you can do with the trigger_camera as well as entities in general.
- Take a look at other mappers' work. Take a look at Jobabob's excellent Star Wars map for starters.
There are a couple of good examples in the Map Vault by BJ:
Loading embedded content: Vault Item #1885
Loading embedded content: Vault Item #1889
If You set speed on paths, do not set speed on camera.
I can see it tracking the train though.
Thanks for the Tutorial!