Trigger changelevel: Difference between revisions
m (→Notes) |
Dr. Orange (talk | contribs) (Moved bug notice and used proper bug template.) |
||
Line 2: | Line 2: | ||
{{code class|CChangeLevel|triggers.cpp}} | {{code class|CChangeLevel|triggers.cpp}} | ||
{{note|This brush entity does not work in [[Half-Life 2: Deathmatch]].}} | {{note|This brush entity does not work in [[Half-Life 2: Deathmatch]].}} | ||
{{bug|If the "start disabled" option is set to "yes" the brush will become solid to player, getting it stuck if the transition happens within its volume.}} | |||
==Notes== | ==Notes== | ||
Place an [[info_landmark]] in both maps to mark the ''same'' location in both maps. | Place an [[info_landmark]] in both maps to mark the ''same'' location in both maps. | ||
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 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. |
Revision as of 00:31, 22 February 2021
Template:Base brush It triggers a level change.


Notes
Place an info_landmark in both maps to mark the same location in both maps.
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.
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. This name must not have any spaces in it.
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.

Keyvalues
- Landmark Name ([todo internal name (i)]) <targetname>
- Name of the landmark to use. (See above for details!)
Flags
- 2 : Disable Touch
- 4 : To Previous Chapter
Inputs
- ChangeLevel
- Cause the level change. Use this when triggering the level change with a button, etc.

Outputs
- OnChangeLevel
- Fired when the level changes.