Trigger changelevel: Difference between revisions
(-added class hierarchy) |
Copperpixel (talk | contribs) m (Replace deprecated {{game name}} templates with {{software}}) |
||
Line 4: | Line 4: | ||
{{CD|CChangeLevel|file1=triggers.cpp}} | {{CD|CChangeLevel|file1=triggers.cpp}} | ||
{{entity|trigger_changelevel|type=e2}} Upon being triggered, it will prompt the game to load another level. | {{entity|trigger_changelevel|type=e2}} Upon being triggered, it will prompt the game to load another level. | ||
{{note|This brush entity does not work in {{ | {{note|This brush entity does not work in {{hl2dm|4}}}} | ||
{{note|In {{l4ds}} use [[info_changelevel]]}} | {{note|In {{l4ds}} use [[info_changelevel]]}} | ||
{{bug|If the <code>Start Disabled</code> option is set to <code>Yes</code> the brush will become solid to the [[player]], getting it stuck if the transition happens within its volume.}} | {{bug|If the <code>Start Disabled</code> option is set to <code>Yes</code> the brush will become solid to the [[player]], getting it stuck if the transition happens within its volume.}} | ||
Line 35: | Line 35: | ||
==Inputs== | ==Inputs== | ||
{{IO|ChangeLevel|Cause the level change. Use this when triggering the level change with a button, etc.}} | {{IO|ChangeLevel|Cause the level change. Use this when triggering the level change with a button, etc.}} | ||
{{Warning|Since {{ | {{Warning|Since {{src07|4}} this input will do nothing when used on a multiplayer server.}} | ||
==Outputs== | ==Outputs== |
Revision as of 17:33, 8 November 2023
![]() |
---|
CChangeLevel |
![]() |
Template:Entity Upon being triggered, it will prompt the game to load another level.





Notes
Place an info_landmark in both maps to mark the same location in both maps. 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. This name must not have any spaces in it. They also must not be inside a solid brush. Both the landmark name and the map name must be less than 32 characters in length.

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).

To fire events in the next level, use a trigger output to turn on an env_global in the current level. The entity has a few pre-defined states but you can manually type your own custom state. Create a logic_auto in the next level that checks for the state set by the env_global. Now use the OnChangeLevel output of the logic_auto to trigger events.
To control which entities go through the level transition, create one or more trigger_transitions and give them the same name as the landmark. Any entities within the trigger_transition(s) will go to the next map.
Keyvalues
- Landmark Name ([todo internal name (i)]) <targetname>
- Name of the landmark to use. (See above for details!)
Flags
- Disable Touch : [2]
- To Previous Chapter : [4]
Inputs
- ChangeLevel
- Cause the level change. Use this when triggering the level change with a button, etc.


Outputs
- OnChangeLevel
- Fired when the level changes.