An issue constantly surrounded in questions is that of level changes. They remain a mystery to many designers, and for no real reason as their concept is rather simple.
Level Change Mechanics
Regardless of what style of level change you're setting up, every level change will be based on the same premise. Every level change will contain two
entities (one in each level), and two
entities (again, one in each level). The
entities will both have the same Name
), and this name will be used as the value for both
's Landmark name
) property. The value of the New map name
) property for the
in the origin map will be the map name ('change2
' for example) of the destination map, and vice versa for the
in the destination map.
In the example map below, you start in a section of hallway. If you walk forward, you will pass through a level transition. You will see some "loading..." text, then you'll be in the second map. Generally, you wouldn't notice that you're in a new map except for the "loading..." text, but I've placed a biohazard sign at the end of the hallway of the second map to make it more apparent. You can walk backward to go back through the level transition into the first map.
Above is the most basic kind of level change. Whenever you need to split a large level into smaller sections, it can be done like that.Note: this is very important - when testing level transitions, you should not run your map from the editor or through a frontend-compiler. Compile the map(s) without running the game, then load Half-Life manually and load the maps from the console. If you don't know how to access the console, refer to the Accessing the Half-Life Console article.
There are basically three types of level transitions:
- seamless (as described above)
All of these can also be triggered. If you are going to trigger a
, give it a Name
) and set its ' USE Only
' flag. This will prevent it from working until it has been activated by another event.
The only other variation on level transitions is with using a
Displacement Level Transitions
A seamless level transition is when the player goes to a new level but his environment stays the same. A displacement level transition, therefore, is when a player not only changes to a new level, but his actual physical environment is different as well.
This would be useful for making a level transition disguised as a teleporter or portal. The main difference here between the basic transition mentioned above is that you need to make sure that the player doesn't end up stuck in anything when he switches to the new level. This means you need a clear area around the
in the second map equal to any area in the first map that the player could teleport from.
In the example map below, two "room" levels are linked by teleport portals. You can change levels simply by walking through the portals.
The One-Way Transition
A one-way transition is any transition where you go from the origin map to the destination map, but you cannot return to the origin map. This is the type of transition that usually gives people headaches. Logic would seem to tell you that you don't need a
in the destination map, just the
. For some reason, this isn't correct. The destination map must have a
in it that correctly references the previous map in the New Map Name
property, and identifies the
in the Landmark Name
The example map below demonstrates a one-way transition, modeled loosely after the Star Trek teleportation style. The transition is setup like the above displacement transition, except that the
is a small cube positioned just above the
(to keep easy track of it), and its "USE Only
" flag is set so that it will never accidentally be activated by the player.
There's one more thing to discuss, and that's how to carry brush-based entities through a level transition. For example, say you're riding an elevator down a shaft and you want to do a level change. You would have to use a Global Entity Name
Note: a newer version of the game date files added the Global Entity Name property to many of the func entities. It will be much easier to use them if you have the most current game data file]]. If you want to manually add the Global Name property to an entity, access its properties and deselect SmartEdit, then add a globalname key and value.
As you can see (I hope!), the concept of level transitions really isn't all that complicated. The basic elements involved are all quite easy to use and setup. Whenever problems arise, they can usually be attributed to either not putting a
in the destination level (in the case of one-way transitions), or some error with the
entities - either not placing them correctly, or not referencing them correctly. By knowing the information presented here, you should be able to make level changes easily.
A very common problem people experiene is when a level transition doesn't work and the following error message appears in the console ...
CHANGE LEVEL: map1 landmark1
is the name of the map you are trying to change to, and
is the name of the info_landmark being referenced in the change.Note: You will only see the above error in the console if you've run the game with the -dev parameter, or manually specified developer 1 in the console prior to loading the map.
This problem occurs because the area in map1 where the player would spawn is already occupied, in whole or in part, by another trigger_changelevel. When setting up level transitions, it is a good idea to put a bit of dead space (that is, space not occupied by a trigger_changelevel) around the landmarks, like this: If the error is already occurring, the solution is simple, move the trigger_changelevels futher away from the info_landmark.