Zh/L4D2 Level Design/Foot Lockers: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Undo revision 484686 by Payne酱 (talk))
Tag: Undo
m (finish)
Line 148: Line 148:
In The Passing, a foot locker can have randomized item spawn types. For example, instead of having an overwhelming amount of [[Weapon_pain_pills_spawn|pain pills]] in a round, the contents a particular foot locker may contain a large cache of [[Weapon_molotov_spawn|Molotovs]] instead. This only involves a few more entities and modifications.
In The Passing, a foot locker can have randomized item spawn types. For example, instead of having an overwhelming amount of [[Weapon_pain_pills_spawn|pain pills]] in a round, the contents a particular foot locker may contain a large cache of [[Weapon_molotov_spawn|Molotovs]] instead. This only involves a few more entities and modifications.


{{todo|finish article (steps, pictures, testing, condense, and finally celebrate the existence of a diverse set of foot lockers in-game).}}


== Prefab ==
== Prefab ==
[http://l4d2.gamebanana.com/prefabs/6281 Download] the footlockers, taken out of "The Passing".
[http://l4d2.gamebanana.com/prefabs/6281 Download] 模版


{{NavBar|L4D2 Level Design/Boss Prohibition|L4D2 Level Design|L4D2 Level Design/Hard Rain}}
{{NavBar|L4D2 Level Design/Boss Prohibition|L4D2 Level Design|L4D2 Level Design/Hard Rain}}


[[Category:Left 4 Dead 2]]
[[Category:Left 4 Dead 2]]

Revision as of 00:15, 2 July 2025

Under construction.png
This page is actively undergoing a major edit.
As a courtesy, please do not edit this while this message is displayed.
If this page has not been edited for at least several hours to a few days, please remove this template. This message is intended to help reduce edit conflicts; please remove it between editing sessions to allow others to edit the page.

The person who added this notice will be listed in its edit history should you wish to contact them.

Info content.png
This page is being translated.
You can help by finishing the translation.
If this page cannot be translated for some reason, or is left untranslated for an extended period of time after this notice is posted, the page should be requested to be deleted.
Also, please make sure the article complies with the alternate languages guide.(en)
English (en)中文 (zh)Translate (Translate)

本简体中文页面由Payne酱翻译。 求生之路系列求生之路系列“储物柜”(叫其他名字也可以) 是在DLC《短暂时刻》更新时加入的,可塑性很强。这些储物箱不像Half-Life 2那样是一个单独的实体,而是由现有实体构成。实际上,更新中加入的新素材就是模型和音效。这里我们来讨论的是静态储物柜、可生成的储物柜和包含多个物品的储物柜。


静态(Static)储物柜

这是最基础的储物柜类型:始终存在于游戏地图内(与游戏中随机生成的储物柜不同),想放什么东西进去都可以。

The locker. Foot locker.

在Hammer编辑器看的话,什么也看不清楚。没关系,下面是制作教程。

1:储物柜模型和碰撞体


The locker model.

第一个是储物柜模型,一个简单的 prop_dynamic。将其插入到一个空白地图中(最好用想要的实例名称保存),并赋予它以下属性(其余可保持默认):


  • World Model: models/props_waterfront/footlocker01.mdl - 使用的模型
  • Name: static_locker - 模型的名称在实例插入地图时,根据需要修改。
  • Start Fade Dist: 1500 - Valve用于开始淡出储物柜模型的通用距离,用于优化
  • End Fade Dist: 1900 - 在这个距离之外,储物柜将不再可见。请确保在这个距离上储物柜在视野之外,否则可能看到里面的物品悬空着。
  • Collisions: Not Solid - 储物柜模型本身没有实际的碰撞体,因此设置此选项将确保游戏中的控制台不会报错。
Collision brushes.

接下来,放入几个使用 nodraw 纹理的笔刷,以便玩家和物体能与储物柜产生碰撞。Valve并没有为储物柜制作碰撞,可能是因为 VPhysics 计算十分消耗性能(因为储物柜是凹形),因此使用笔刷来充当储物柜的实体侧面和底座。

碰撞笔刷应为 2 单位厚,并沿着储物柜的边缘放置。为储物柜底座放一个笔刷很有用。不要忘了将所有的这些笔刷转换成 func_detail ,否则会严重影响visleaves的计算。

Note.png注意:你可能需要设置储物柜的动画以帮助创建碰撞笔刷。在模型的属性中,转到“Model”选项卡并选择序列“open”。完成后别忘了将其设置回“ref”,因为在此选项卡中更改默认动画可能会在 Hammer 中引起bug


2:储物柜物品及其他实体


Items in the locker.

将想要的物品放入储物柜并旋转/定位它们。这里使用了医疗包和手枪,因为设计这个储物柜用于出现在我的战役开头。如果您使用其他物品,最好几乎铺满整个储物柜模型底部的物品层。

如果使用的是诸如土制炸弹(pipe bombs)、燃烧瓶(molotovs)或boomer胆汁罐(boomer bile)之类的物品,您需要将它们的 Count 值设置为 10,或者可能更高。这意味着玩家在游戏中能拾取多个物品;当然,你只想要单次拾取的物品(如图中的医疗包),请将 Count 值设置为 1。

Tip.png提示:某些物品,例如肾上腺素(adrenaline),默认没有计数值(count value)且只允许拾取一次。可以通过禁用“Smart Edit”并添加一个名为 count 的键值(KeyValue)来覆盖,值设置为您选择的任何数字。

将添加的所有物品命名为 "static_locker_items"。.

The locker opening sound.

将储物柜动画设置成 "ref"(关上柜子的动画),并在储物柜附近某处添加一个 ambient_generic,位置并不重要,因为我们将在 ambient_generic 的属性中指定声音的原点。

属性可以保持默认,除了这些:

Name: static_locker_snd_open - 这将允许我们稍后触发声音。

Sound Name: Trunk.Open - 储物柜开启音效的声音脚本条目。

SourceEntityName: static_locker - 这是 prop_dynamic 储物柜模型的名称。当被触发时,声音将源自储物柜模型本身,而不是 ambient_generic 实体的位置。

  • Name: static_locker_snd_open - 这将允许我们稍后触发声音。
  • Sound Name: Trunk.Open - 储物柜开启音效的Soundscript
  • SourceEntityName: static_locker - 这是prop_dynamic的模型名称. 当被触发时,声音将来源自储物柜模型本身,而不是 ambient_generic 实体的位置。

生成物品

The template spawner.

接下来,我们需要一个 point_template,以便在我们想要的时候生成我们的物品。仅仅勾选物品上的 Must Exist 标志可能会导致它们的发光效果透过储物柜模型,因此 point_template 确保物品只在需要时才被创建。对于那些可能不存在的储物柜,point_template 允许仅在储物柜存在时才生成物品(它被视为一个集合)。

设置 point_template :

  • Name: static_locker_template - point_template 的名称。
  • Template 1: static_locker_items - 当被触发时,point_template 会在它们对应的生成点上生成我们之前命名的 static_locker_items。

logic_game_event


添加一个logic_game_event实体用于触发储物柜已被打开的事件。之所以需要这个,是因为它不是一个“专用”的实体(对于该实体类的每个实例都会触发游戏事件)。这个实体可能在 Hammer 的实体列表(FGD)中找不到,因此添加一个不同的实体(例如 info_target),然后在下拉框中将其名称更改为 logic_game_event。您可能需要手动添加这些键值(KeyValues):


  • Key: targetname, Value: static_locker_event - 实体的名称
  • Key: eventName, Value: foot_locker_opened - 此实体被触发时将触发的游戏事件的名称。
  • Key: spawnflags, Value: 1 - 不清楚这个标志的作用。为了保险起见,我是从 Valve 的地图里复制这些值的。

The func_button to open the locker.

现在用一个刷子围绕储物柜,并将其绑定到 func_button 实体上。按钮使用 nodraw 纹理。它通常应比储物柜模型的每侧(当然底部除外,它应与储物柜底座平齐)向外延伸约 4 个单位。

需要更改以下属性:

  • Name: static_locker_button - 以便您随时可以通过输入(inputs)锁定/解锁按钮。
  • Glow Entity: static_locker - When the player is in range of the button and looks at it, the prop_dynamic model of the locker will glow to invite the player to open it.

These spawnflags will need to be set:

  • Don't Move.

The button also needs the following outputs:

  • OnPressed, static_locker -> SetAnimation: opening.
  • OnPressed, self -> Kill.
  • OnPressed, static_locker_snd_open -> PlaySound.
  • OnPressed, !activator -> Speakresponseconcept: OpenLocker.
  • OnPressed, static_locker_template -> ForceSpawn.
  • OnPressed, static_locker_event -> FireEvent.

All of these need the "Fire Once Only" box ticked. An explanation of each:

1. Sets the animation of the locker model, to open it. The animation stops automatically, so there's no need to send another input to do so.
2. Gets rid of the func_button, so that it can't be pressed again and doesn't block the top of the box, prohibiting the player from picking up the items.
3. Plays the locker opening sound.
4. Tells the character who "opened" the locker (the one who pressed the button) to say a line, mainly to tell the other players that they've found the items.
5. Spawns the items inside the locker.
6. Fires the game event to the Director. Only include this output if you followed the optional step 5.5 above.

info_remarkable


The info_remarkable.

The final step is to add an info_remarkable, to let the engine know that the characters should say something when they spot the locker. Set these properties:

  • Name: static_locker_remarkable - The name of the entity.
  • Subject Context: WorldFootLocker - This tells the game that the characters should say something related to spotting the locker, like "Let's open it up" or similar.

3: Testing

Your locker should look something similar to this:

The locker in-game.

Compile and load your map to test your foot locker in-game.

Spawnable lockers

A spawnable locker is similar to a static locker with the exception of a few modifications.

Multiple items

In The Passing, a foot locker can have randomized item spawn types. For example, instead of having an overwhelming amount of pain pills in a round, the contents a particular foot locker may contain a large cache of Molotovs instead. This only involves a few more entities and modifications.


Prefab

Download 模版