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

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:
{{LanguageBar}}
{{LanguageBar}}
{{L4D2 level intro menu}}
{{L4D2 level intro menu}}
本简体中文页面由[[User:Payne%E9%85%B1|Payne酱]]翻译于2025年7月1日。最后更新于2025年7月1日。(部分内容由机器翻译)
本简体中文页面由[[User:Payne%E9%85%B1|Payne酱]]翻译于2025年7月1日。(部分内容由机器翻译,未完成)
{{l4ds}}“储物柜”(叫其他名字也可以) 是在DLC《短暂时刻》更新时加入的,可塑性很强。这些储物箱不像[[Half-Life 2]]那样是一个单独的实体,而是由现有实体构成。实际上,更新中加入的新素材就是模型和音效。这里我们来讨论的是静态储物柜、可生成的储物柜和包含多个物品的储物柜。
{{l4ds}}“储物柜”(叫其他名字也可以) 是在DLC《短暂时刻》更新时加入的,可塑性很强。这些储物箱不像[[Half-Life 2]]那样是一个单独的实体,而是由现有实体构成。实际上,更新中加入的新素材就是模型和音效。这里我们来讨论的是静态储物柜、可生成的储物柜和包含多个物品的储物柜。



Revision as of 20:48, 30 June 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酱翻译于2025年7月1日。(部分内容由机器翻译,未完成) 求生之路系列求生之路系列“储物柜”(叫其他名字也可以) 是在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.

Set your locker's animation back to "ref" (to close the lid) and add an ambient_generic somewhere near the locker. The position doesn't really matter, as we'll be specifying the origin point of the sound in the ambient_generic's properties.

The properties can be left at the defaults, apart from these:

  • Name: static_locker_snd_open - This will allow us to trigger the sound later on.
  • Sound Name: Trunk.Open - The soundscript entry for the locker opening sound.
  • SourceEntityName: static_locker - This is the name of the prop_dynamic locker model. When triggered, the sound will originate from the locker model rather than from the position of the ambient_generic itself.

Spawning the items

The template spawner.

Next, we need a point_template in order to spawn our items when we want them. Simply ticking the "Must Exist" flag on the items may cause their glow effect to be visible through the edges of the locker model, so the point_template ensures that the items are only created when they are needed. For lockers which may or may not be present, the point_template allows the spawning of the items only if the locker exists (it's considered a set).

Setting up the point_template is simple:

  • Name: static_locker_template - The name of the point_template.
  • Template 1: static_locker_items - When triggered, the point_template will spawn our static_locker_items (that we named earlier) at their appropriate spawn points.

logic_game_event


Add in a logic_game_event entity that the locker has been opened. It is assumed that this is needed because it is not a "specialized" entity where the game event would be triggered for every instance of the entity class. This may not be in Hammer's entity list (FGD), so add in a different entity (such as an info_target) and change its name in the drop-down box to logic_game_event. You may have to add these KeyValues manually:

  • Key: targetname, Value: static_locker_event - The name of the entity.
  • Key: eventName, Value: foot_locker_opened - The name of the game event this entity will fire when triggered.
  • Key: spawnflags, Value: 1 - No idea what this flag does. I'm copying the values from Valve's maps to be on the safe side.

The func_button to open the locker.

Now surround the foot locker with a brush and tie it to the func_button entity. Texture the button in nodraw. It should typically extend about 4 units further out from each side of the locker model (apart from the bottom, of course, where it should be in-line with the locker base).

The following properties will need to be changed:

  • Name: static_locker_button - In case you want to lock/unlock the button at any time though 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.

待完善: finish article (steps, pictures, testing, condense, and finally celebrate the existence of a diverse set of foot lockers in-game).

Prefab

Download the footlockers, taken out of "The Passing".