A quick and dirty guide to perfect level changes
✔️ Download example
Level changes are often over explained, and too complicated for their own good. There really is nothing to them and if you follow this tutorial step by step, you should have absolutely no trouble whatsoever.
What is a level change?
A level change is, simply put, a transition or displacement from one map (.bsp file) to another. And the reason you're reading this is because you're lost or trying to get a level change to work properly.
Why do I need level changes?
If you're thinking to yourself:
"I can get by without them, and save myself a lot of hassle...", then think again!
Half-Life maps have limits. These limits should never be reached or pushed, you can read more about these in the
general MAX_MAP limits part of Tommy14's errors page. If your levels are getting too big you should consider splitting them into 2 or more separate levels to avoid reaching these limits. This can be really useful for reducing r_speeds when working with two or more complex areas, or just to help you keep track of where you are in your map. Huge detailed maps are really difficult to work with in Hammer, as you probably already know.
How do I create level changes?
There are 3 types of level changes:
- Seamless: The simplest level change you can have - walk through a corridor, see some loading text, end up in another map, but your position in the corridor and the environment around you does not change. The place you end up in is a carbon copy of the place you have come from.
- Teleport: Same as above only the environment changes - i.e. go through a corridor in a lab and end up in your office/classroom searching for the 'check for problems' button in your life...It is a bit like teleporting, but you are doing it across maps.
- One-way: You can get there, but you can never return.
Seamless level changes
The only entities you'll need - since you just want a simple level change - will be
trigger_changelevel (one in each map) and an
info_landmark (also one in each map).
Start by making a suitable corridor:
A suitably suitable corridor
Now to add the info_landmark. Read very carefully is these details are critical:
The info_landmark sets up a constant point of reference in the origin and destination maps. It must appear in both maps otherwise the level change will not work correctly.
The origin and destination info_landmark must both have the same Name (targetname)
Always put names of maps and info_landmarks in lowercase!!! And do not use spaces or other characters except numbers and letters, _ underscores are ok.
So basically, it's the same info_landmark in both maps.
Landmark
The Origin map trigger_changelevel:
Set these properties you need to change:
New map name: map2
Landmark Name: landmark1 (or whatever you called your two identical landmarks - one in each map)
The Destination map trigger_changelevel:
Set these properties you need to change:
New map name: map1
Landmark Name: landmark1 (or whatever you called your two identical landmarks - one in each map)
Trigger
Make sure the trigger_changelevel
brushes are far enough away from each-other (relatively speaking) that the player cannot touch the trigger going back to the previous map as soon as they've entered the second map through the first level change. If they are too close, the engine will block all level change triggers that occur in the map from that point onwards!
To avoid this problem, make sure the level change triggers in the two maps have at least 56 units between them. Players are 32 units wide and long, but their bounding box can become larger if they walk through at an angle. 56 units is enough space to avoid this problem.
Relative Distance
Now, compile the maps through hammer or any other front-end compiler but remember not to run the game!, fire up hl with the console, and test the transition. If you did this correctly you should seamlessly jump from one map to the next no matter how you enter the trigger_changelevel.
One way level changes
You would think a one way level change would only require one trigger_changelevel?
Wrong.
You have to set the level change up exactly as you would for a normal change. The difference is that in the second map, reduce the size of the trigger_changelevel brush and move it somewhere that the player cannot get to it. That is what stops the player from going back. Also check the
Use Only Flag just to make sure those NoClipping players still can't get back.
Teleporting level changes
A teleporting level change is a bit more involved but is actually a lot less of a headache, provided you're only going to make it a one-way affair. It can also be a cheat a modding team can use when passing between chapters where team A work on the previous chapter, and team B work on the next, without worrying about passing the transitional level geometry between the two.
We will assume 2 maps
map1
and
map2
and the setup is a one-way teleport from
map1
to
map2
.
map1 setup
In map1, the setup would involve a tiny player-sized room (slightly above 32x32x72), textured with
BLACK
(or
WHITE
, whichever you fancy), with these three entities overlapping each other:
info_teleport_destination
placed on the floor
- Name:
tp_to_map2
- Pitch Yaw Roll or Angle: (facing where you want the player to face in the destination map map2)
trigger_changelevel
placed covering the whole room
- New map name:
map2
- Landmark:
tp_landmark
info_landmark
placed at least 36u above the floor
And then elsewhere in map1, have a
trigger_teleport
target
tp_to_map2
in our setup (with delay if desired).
map2 setup
In map2 the setup can go two ways; the easy way (with favourable conditions) or the other way.
If in the previous map's teleport room the player's position is well constrained close to the
info_landmark
and the
info_teleport_destination
is already facing the correct way, then it's simply a matter of placing a single
info_landmark
at the destination point:
Otherwise, another teleportation room is warranted to "catch" the player and place them in the correct position. This room should be bigger than the room in the previous map (about 2x, but can go higher just to be safe). Place the following entities:
And finally, in the main level:
info_teleport_destination
placed on the floor
- Name:
tp_dest
- Pitch Yaw Roll or Angle: (facing where you want the player to face)
And don't forget the obligatory [non-functional] return
trigger_changelevel
!:
- New map name:
map1
- Landmark:
tp_landmark
- Flag: ☑️ USE Only (2)
Common problems and solutions
Players stuck in a random place at the other end
Don't forget to add the return
trigger_changelevel
! Even for testing, the setup pair needs to exist on both maps.
This is exactly what happens when you changelevel through the inaccessible broken elevator in "Forget About Freeman!"
Players transition seamlessly but now stuck at the other end
Make sure both
info_landmarks
are at the same position relative to the level geometry in the transition area. For example, you
cannot have
landmark1
16u above the floor in
map1
but then have
landmark1
64u above the floor in
map2
. This applies to walls as well.
You may be tempted to offset one of the landmarks to fix a problem, but that's actually
creating this exact problem going the other way. Just make sure the landmark is identically positioned.
Some error occurred and now all level changes don't work
You had the two
trigger_changelevels
too close to each other, making it so that as soon as you changed level, you're inside the other
trigger_changelevel
. The game engine will freak out about this and disable all level transitions.
The solution is to have the trigger_changelevels further apart from the center of the transitional area. It should be about 56u apart or more face-to-face when you compare the two maps.
I can't make a level change that rotates 90° (or some other angle)
Unfortunately, no you can't (at least not in vanilla Half-Life). The orientation of the transitional areas need to be identical.
Objects (like pushable crates) disappear at the transition area
Brush entities need a unique global name to be able to be "carried over" across levels.
I have three maps and the player traverses them in this order:
Map a
Map b
Map c
The transition between Map b and Map c didn't work because the trigger_changelevel from "map a" to "map b" had a wrong "New map name", like "Map C". So I guess The Value you type in for "New map name" is Case-Sensitive.
The transition from 1st map to 2nd map worked correctly.
But when I tried to return to 1st map, it didn't worked. Why?
On the superior of the screen it say : CHANGELEVEL Map1 Map1toMap2
The error was solved when I moved the trigger a bit more far than the other. Thanks for read.
EDIT: fixed it. i put a info_player_start in the second map and it was interfering.