本文与游戏《求生之路》有关。点击这里查看更多信息。
这篇条目有关 Source引擎。如需详情,点击这里。

求生之路声音脚本

From Valve Developer Community
< Zh
Jump to: navigation, search
English (en)中文 (zh)Translate (Translate)
Info content.png
This page is being translated.

You can help by updating the translation.

Also, please make sure the article tries to comply with the alternate languages guide.


介绍

求生之路 求生之路声音脚本(en)位于路径 /left4dead/scripts 中。它们是纯文本文件(扩展名是 .txt),用于在声音播放器输出的事件期间调用游戏中的声音,例如武器、音景(en)和音乐。脚本game_sounds_manifest.txt将在加载求生之路时预加载或预缓存声音脚本。所有声音文件的基本路径是 /rootDir/sounds/。这意味着所有声音脚本都将在 /rootDir/sounds/soundscript entry 中查找声音资产,其中 rootDir 指向 VPK 插件(en)/left4dead/

求生之路的大多数声音脚本文件都以起始标签 game_sounds_* 命名。

如何在自定义战役系列中使用 Valve 的 Soundscript 文件(音乐)之一

请参阅此处:L4D Custom Music Tutorial(en)

Custom L4D Soundscripts

Note.png注意:There is a proper way to create custom L4D soundscripts. Packing and shipping edited soundscripts found in the scripts folder, including the manifest itself, to end users would conflict with VPK addons following the same incorrect method. This is because a soundscript file found in a .vpk will completely replace the original one with the same name.

Many L4D soundscripts are linked with the AI Director and therefore is a little bit more complicated than other Source engine-based games. Some L4D soundscripts, especially the entries for music, depend on the content of three things: the mission text file, the actual soundscript, and the navigation mesh.

  1. The missions/<mission name>.txt(en) file registers a unique name, an entry called "NAME", that are important for L4D soundscripts such as the music soundscript. The mission file also lists all of the actual map files that are part of the mission. Many entries in the music soundscript depends on the "NAME" entry found in the mission file, where "NAME" is used by the Sound Emitter with the maps registered under it.
  2. As with any source game, a soundscript found as maps/<mapname>_level_sounds.txt can override official soundscript entries without affecting other campaigns. Official Valve campaigns may use sound_games_music.txt for music soundscript entries.
  3. The nav mesh must be properly marked with attributes to invoke certain events

No Mercy Campaign (Example)

The following details will use a music soundscript entry in No Mercy (an official Valve campaign) as an example.

  • Mission File
    • The No Mercy mission text file is found as missions/hospital.txt.
    • "NAME" entry is uniquely labeled as "Hospital."
    • hospital.txtcontains a list of the exact names of the maps: l4d_hospital01_apartmentl4d_hospital05_rooftop.
  • Sound Script and Nav Mesh
    • Event.MissionStart_Hospitalis an entry in the soundscript sound_games_music.txt
    • In the initial spawning point of the No Mercy campaign, the Sound Emitter invokes an event called Event.MissionStart_Hospital
    • The event is only invoked in the map files listed in the mission file if the navigation mesh is labeled with the attribute CHECKPOINT and the mission has just started.

When Entries Occur

Some occurrences of entries found in soundscripts are easier to predict than others. For example, Player.PickupWeapon occurs during moments when the map initially loads and when a player picks an item or a weapon. Other entries are for NPCs, and therefore takes the current situation and map into consideration. Some entries occur in L4D only when the nav mesh is properly labeled at a specific part of the map. Some entries even depend on the atmosphere (such as a room fully clear of common infected), textures, entities, etc.

There are ways to see how some certain entries occur. One way is to look at comments found in the soundscripts provided by Valve or just the name of the entry itself.

Another way is to see what entries are being invoked in-game. This can be done by temporarily copying the soundscripts to another directory, deleting the entries in all the soundscripts temporarily, and running the game in developer mode in order to see when the Sound Emitter invokes a sound to play but cannot find a sound entry in the soundscripts loaded. An example would be Sound Emitter warning about the missing sound file for Event.MissionStart_NAME if an entry has not been created yet. One may have to investigate the navigation mesh, consider the situation and documentation, the change in visibility of the map, etc.

The rest of this article documents what is already known and what is not known for all soundscript entries in L4D.

Soundscripts Manifest

The L4D soundscripts manifest, game_sounds_manifest.txt, is a list of soundscripts that are either preloaded or precached when the game is loaded. The following is the actual manifest for L4D. The soundscripts are separated in this manner mostly for the sake of organization. All of the scripts, in this case, could have been combined into two soundscript files for either precaching or preloading:

game_sounds_manifest
{
	 "precache_file"  	"scripts/game_sounds_bots.txt"
	 "precache_file"  	"scripts/game_sounds_terror.txt"

	 "precache_file"  	"scripts/game_sounds_infected_common.txt"
	 "precache_file"  	"scripts/game_sounds_infected_special.txt"

	 "precache_file"  	"scripts/game_sounds_player.txt"
	 "precache_file"  	"scripts/game_sounds_biker.txt"
	 "precache_file"  	"scripts/game_sounds_manager.txt"
	 "precache_file"  	"scripts/game_sounds_namvet.txt"
	 "precache_file"  	"scripts/game_sounds_teengirl.txt"
	 "precache_file"  	"scripts/game_sounds_npcs.txt"
	 "precache_file"  	"scripts/game_sounds_npc2.txt"


	 "precache_file"  	"scripts/game_sounds_music.txt"
	 "precache_file"  	"scripts/game_sounds_doors.txt"

	 "preload_file"  	"scripts/game_sounds.txt"
	 "preload_file"  	"scripts/game_sounds_physics.txt"
	 "preload_file"  	"scripts/game_sounds_weapons.txt"
	 "preload_file"		"scripts/game_sounds_ambient_generic.txt"
	 "preload_file"		"scripts/game_sounds_world.txt"

	 // Level sounds

	 "preload_file"		"scripts/level_sounds_general.txt"
}

List of L4D Soundscripts

Navigation Mesh Editor and Legacy Counter-Strike Entries

game_sounds_bots.txt

game_sounds_terror.txt

NPCs and Player

game_sounds_infected_common.txt

game_sounds_infected_special.txt

game_sounds_player.txt

game_sounds_biker.txt

game_sounds_manager.txt

game_sounds_namvet.txt

game_sounds_teengirl.txt

game_sounds_npcs.txt

game_sounds_npc2.txt

Music and Environmental

game_sounds_music.txt

Music is generated based upon varying mixes of criteria.

  • Gamemode (Campaign, Scavenge, Survival)
  • Campaign (No Mercy, Dead Center…)
  • Checkpoint type:
    • The very first one waiting for a campaign to start
    • Saferoom exits waiting for a round to start.
  • Game events (player death, mob spawns…)

Here is an example of some of the entries involved with round starts…

Entry Occurence/Trigger/Description
Event.MissionStart_<mission "NAME"> Music played during the opening sequence of a campaign and within the safe area.
Event.MissionStart_BaseLoop_<mission "NAME"> Intro music will transition into this if the survivors don't leave the safe area.
Event.MissionStart_Holdout This applies to all maps that are in survival mode in the beginning of player spawn.
Event.CheckPointIntro_<mission "NAME"> Saferoom music that is played at every round start after the first map.
Event.CheckPointBaseLoop_<mission "NAME"> CheckPointIntro transitions into this if the survivors don't leave the safe room.
Event.LeavingSafety_<mission "NAME"> Sounds played when the player leaves the starting checkpoints.
Event.StartAtmosphere_<mission "NAME"> Played when the player leaves the starting checkpoint and the LeavingSafety sound has/is played.

game_sounds_doors.txt

game_sounds.txt

game_sounds_physics.txt

game_sounds_weapons.txt

game_sounds_ambient_generic.txt

game_sounds_world.txt

level_sounds_general.txt