RUST: Taming the Speaker Entity Last edited 5 years ago2019-11-09 10:46:14 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.
The "speaker" entity creates the effect of having a public-address system in your level. It is designed to make random announcements every 3 to 10 minutes while it is active. What many Half-Life level editors fail to realize is that this entity is completely customizable!

There is a file in your half-life\sounds directory called sentences.txt. This is the file that Half-Life reads in order to play sentences (named strings of wave files). The sentences.txt file defines the sentences spoken by the PA announcer and the monsters in the game. If this file is not located in your half-life\sounds directory, then you will need to extract it from the pak0.pak file using a utility such as PakExplorer or Wally (a texture editor that also features the ability to handle Windows long file names in PAK files). You will need to edit the sentences.txt file in order to add your own custom announcements. Once extracted, your custom sentences.txt file will now override the version in the PAK file.

Once you have extracted sentences.txt from the PAK file, open it up in a text editor, such as Notepad. Scroll down to where the lines begin with one of the Valve single-player map names (such as C1A1). Notice that the sentences are grouped. In each group, the sentences all have the same name, except that they are numbered sequentially from 0 to 9. The name of the sentences without the number is called the sentence group name, and you will need that information when you create your custom announcements.

Scroll all the way down to the end of the file. It is a good idea to add any custom sentences to the end of the file, so that you do not mess up established sentences (unless you are into that sort of thing).

Now add your custom sentences. First, come up with a name for the sentence group. The speaker entity will play sentences randomly from this group. For the purposes of this tutorial, use TUTOR. Then create the sentences in the group. They will be sequentially named <group name>0 through <group name>9. You can make up to 10 custom sentences per sentence group, as long as they are numbered in order.

Example:
TUTOR0 vox/buzwarn buzwarn unauthorized access detected in sector thirty two
TUTOR1 vox/buzwarn buzwarn warning freeman is armed and danger us
(yadda yadda yadda)
TUTOR9 vox/deeoo doctor freeman please report topside for questioning
Note that all sentences in sentences.txt must appear on one line each -- don't be fooled by the example formatting above!

Next, open your level up in your favorite editor and create a "speaker" entity. Set the preset (WorldCraft: Announcement Presets) field to 0 (WC: "None") -- any other setting will play hard-coded announcements (I found this out the hard way!). Enter the name of your custom sentence group (in this case, TUTOR) under the message (WC: Sentence Group Name) field. Then set an appropriate volume level in the health (WorldCraft: Volume) field.

Now compile your map and load it into Half-Life. The speaker should start spewing your custom sentences as soon as the level loads.

If you want more control over the speaker, note that it can be triggered on and off. Give the speaker a name in the targetname (WC: "Name") field, and then you can use external triggers to turn the speaker on and off. If you want the speaker to be quiet at first, set its spawnflags to 1 (in WC, Check the "Start Silent" flag).

You can force the speaker to make a single announcement by making it reference a single-sentence sentence group. Otherwise, you would need a scripted_sentence and an associated "dummy" monster to accomplish the same thing; the custom speaker thus ends up saving you an entity.

NOTE:

This method is not particularly well suited to multi-player maps, unless they are part of a Half-Life mod that has its own sentences.txt file. Many players are uncomfortable with others mucking around with their sentences.txt file (myself included). Thus, for multi-player maps, a better choice would be to string a series of ambient_generic entities together using a multi_manager, since you do not have to distribute any files other than the map itself if you do this.
This article was originally published on Gamedesign.net RUST.
TWHL only archives articles from defunct websites. For more information on TWHL's archiving efforts, please visit the TWHL Archiving Project page.

Comments

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