Sentences.txt Last edited 2 years ago2021-08-12 08:53:26 UTC

You are viewing an older revision of this wiki page. The current revision may be more detailed and up-to-date. Click here to see the current revision of this page.
In a GoldSrc game, the sentences.txt file sets the sound files used by monsters, doors, buttons, the speaker entity, and scripted_sentence entities.

The file is located in the sound/ folder of a game or mod. Each line of the file sets a sentence name, and a series of sound files to be emitted by the calling entities. The sound files are referenced by its name, without the .wav suffix.

Syntax

Here's a little snippet from the file:
// HUMAN GRUNTS
HG_GREN0 hgrunt/clik(p120) grenade! clik
Where: More on this in the following sections.

Identifiers

Each entry starts with the sentence identifier. It must be unique, and there is a max limit in vanilla GoldSrc of 1023 sentences.
In general, the identifiers are constructed as following: The max length of the sentence identifiers is 16 characters.

Sounds

The sound files to play in order, separated by spaces.

By default, the sound files are picked from vox/ to make the iconic announcer voice, and typed into sentences.txt generally like an English sentence. In order to change the folder, specify the folder name followed by a slash and then the file name. The folder name must be relative to "sound/", so "sound/" must not itself be included. The folder change remains in effect for the remainder of the sentence.

To further support the English sentence paradigm, commas and periods are translated to "_comma" and "_period" files, containing the appropriate amount of silence. Example usage:
SC_HEAL4 scientist/youwounded, letstrythis

Modifiers

Modifiers apply dynamic processing to the sounds, allowing you for example to to change the pitch, or truncate a sound from the file without editing the files themselves. Modifiers are in the form of (a# b# c#), where the "abc" are the modifier codes and the "#" are the modifier amounts in percent.

Modifiers take effect in two modes: For example, in the following:
C1A0_10 doop (e95 p103) doctor freeman, (e95) to(e70) anomalous materials test lab immediately(e100)
The following lists the modifiers:
CodeDescriptionto reset
eChanges the ending position. Allows you to truncate the end of the file.e100
pChanges the pitch. It also speeds up the sound by the same amount.p0
sChanges the starting position. Allows you to truncate the beginning of the file.s0
vChanges the volume.v100
tTime compression. It can only speed up, and starts from 0 (normal speed). Doesn't affect pitch. See below.t0
Time compression works by chopping off little bits of the sound, so a higher value and/or a longer sound degrades the sound more.

Note that if a single modifier in a modifier group is invalidated, the entire group is discarded.

Usage

Talking monsters each have their groups of sentences in the file. The group names are hard-coded in each game, but you can edit sentences.txt to change/add sentences in the existing groups.

scripted_sentence

To use a sentence from the sentences file, add a ! followed by the sentence name in the "Sentence name" key in scripted_sentence.
See scripted_sentence for more information.

speaker

Choose from a preset, or specify a "Sentence Group Name" in the speaker entity. Unlike in scripted_sentence, ! is not prefixed when specifying a group, but prefixed when specifying a single sentence.
See speaker for more information.

doors and buttons

Doors and buttons have a "locked" and "unlocked" sentence values, which lets you select from the predefined sentence groups. You cannot specify a sentence name/group directly.

speak command

In console, you can test your sentences by typing speak "sentence" where "sentence" is the whole sentence. Modifiers are supported.

Alternatives

Sequence files (.seq) allows sequences to be loaded on a per map basis. It has its own associated entities and syntax, but increases portability of custom sentences in custom maps. It's also used, for example in Condition Zero Deleted Scenes, to overcome the 1023 entry limit of sentences.txt.

Sven Co-op has its own way to load a custom sentences.txt-syntaxed file per map/entity.

Resources

2 Comments

Commented 2 years ago2021-08-12 08:56:24 UTC Comment #103666
By yours truly.

Let this be the definitive guide for sentences.txt, especially for the scant information on the modifiers.
Commented 11 months ago2023-06-01 08:06:29 UTC Comment #105320
Thanks for this, I was wondering what the things in the parentheses were.

You must log in to post a comment. You can login or register a new account.