trigger_changelevel
Code classes:
CChangeLevel
CBaseTrigger
(triggers)CBaseToggle
CBaseEntity
(all ents)
trigger_changelevel
is a brush entity present in all Source games. In Half-Life 2 and the Portal games, this entity causes the map to change once the player steps inside it. For , use info_changelevel
.
Notes[edit | edit source]
Place an info_landmark
in both maps to mark the same in-world point in space in both maps.
Create one or more trigger_transition
s and give them the same name as the landmark. Any entities within the transition triggers will go to the next map.
Level transitions must be two-way. That is to say, there must be a trigger_changelevel
in the next level that points to the current level, as well as the trigger_changelevel
taking the player to the next level. If a one-way level transition is desired, simply make this second trigger_changelevel
inaccessible to the player (and/or check the Disable Touch flag).
The info_landmark
must be in the player's PVS when the level change is triggered. If it is not, the level change will fail. Both info_landmark
entities must have the same name.
Although the info_landmark
should be in a corresponding position in both levels, the two trigger_changelevel
brushes must NOT be in the same place in each level. If they are, you will be thrown into an infinite loop, endlessly ping-ponging back and forth between the two levels.
Flags[edit | edit source]
- 2: Disable Touch - Prevents the trigger from changing the level when touched. Use for one-way transitions.
- 4: To Previous Chapter - If the map is loaded directly (i.e. the
map
command or through the game's menu), the trigger is completely disabled and becomes solid. Used in Half-Life 2 to keep players from going back to levels in previous chapters.
Keyvalues[edit | edit source]
- New Map Name
(map)
<string>
- Name of the map to load.
- Landmark Name
(landmark)
<target_destination>
- An
info_landmark
which is in the exact same in-universe spot as anotherinfo_landmark
in the new map.
Inputs[edit | edit source]
- ChangeLevel
- Makes the level change regardless of the player's position. Input is ignored if the player is dead or in challenge mode (Portal 1/2).
Outputs[edit | edit source]
- OnChangeLevel
- Fires when the player enters the trigger and causes the level change. To do: Purpose?