这篇条目有关 Source引擎。如需详情,点击这里。

trigger_changelevel

来自Valve Developer Community
跳转至: 导航搜索
English (en)中文 (zh)
... Icon-Important.png
Info content.png
This page needs to be translated.
本页面需要翻译。

本页面或包含不完全的翻译、不正确的翻译,或未有翻译。
如果本页面出于某些原因无法被翻译,或长时间地处于未翻译的状态,则应予删除。

另外,请确保文章在尽量遵守 多语言指导。

trigger_changelevel是一个固实体存在于所有的 起源 起源 游戏。 It triggers a level change.

在源代码中,它由 class CChangeLevel 代表,定义于 triggers.cpp
Note.png注意:This brush entity does not work in Half-Life 2: Deathmatch.

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.

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.

Note.png注意:Although the Landmark entity must be in the same place geometry-wise, it doesn't need to be in the exact location in the map's coordinates (This also includes height). A landmark could literally be placed anywhere in the new map grid thats being changed too, as long as the transition geometry surrounding it is exactly as the previous level's geometry. This can help with scenarios such as having large maps, i.e: The player traverses east of the top view, and must continue to do so in the next map, which would be impossible given starting the next map in the ending location. Simplifying your geometry near level transitions can make working on them much easier!

Keyvalues

Name (???) <target_source>
Name of the brush.
New Map Name (???) <string简体中文> | 字符串
Name of the map to change to.
Landmark Name (???) <target_destination>
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.
Warning.png警告:Since the 2007 engine this input will do nothing when used on a multiplayer server.

Outputs

OnChangeLevel
Fired when the level changes.