Mapping/Sentences Replacement Guide

From Sven Co-op
Jump to navigation Jump to search

Sentence replacement has been possible for many long years through Global Sound Replacement but it's also possible to make your own sentences. This is how it's done!

1 What are sentences?

The sentences.txt (or default_sentences.txt) file handles all speech and sounds within the game. For instance:

OT_ANSWER0 otis/yes

Using 'OT_ANSWER0" will make Otis use the yes.wav file stored in ../svencoop/sound/otis/.

Another example is the intercom announcer:

C1A1_0 bizwarn bizwarn bizwarn warning, high energy detonation detected in materials lab

As you can see, you can create full sentences with seperate words, as long as they have a corresponding .wav file. And it's not limited to words. It will play whatever is stored in the .wav file. You can also add a comma (,) to make the speaker pause for a second.

2 How to make your own sentences?

Since the default_sentences.txt is used by the game, you should not edit it. It's better to make your own! Create a text file and the following line to it:

SECTORSEC vox/doop, sector secured

As you can see, it uses the doop.wav, sector.wav and secured.wav from the ../sound/vox/ folder to create a sentence. Save your file as 'mymap_sentences.txt' and store it in ../svencoop/sound/mymap/.

Now, open your maps' CFG file and add this line to it:

sentence_file sound/mymap/mymap_sentences.txt

This will now point the game towards your custom sentence file.

3 How to put them ingame?

Open your map and add an 'ambient_generic' entity. Give it a targetname and in the 'Sound File' field type: !SECTORSEC .Make sure you start with an exclamation mark (!) so the engine knows it is loading that sound from a sentence.txt file.

To make sure my sound is only heard after triggering it and everywhere in the map, I'll check the 'Play Everwhere' and 'Start Silent' flags. Now set up a button/trigger targeting your ambient_generic and the intercom will speak your custom sentence.

You can also do this with NPCs such as scientists, so they will lipsync your custom sentence. To do this, you must use a 'scripted_sentence' entity. Give it a targetname (scientist1_speak), in 'Sentence Name' add your custom sentence starting with a ! (!LEAVEBRITNEYALONE), and in 'Speaker Type' use the name of the NPC you want to use (scientist).

It's also possible to put custom sentences for using and unusing NPCs. Just add your custom sentence to the 'Use Sentence' (!DOYOUWANTTOBUILDASNOWMAN) and 'Un-use Sentence' (!OKBYE). Note that this is only applies to friendly units.

Lastly, you can replace existing sentences. If you want your scientist to have different screams than the default ones, you can use Global Sound Replacement. More info on that here.

4 Notes

  • Never start your sentence names with symbols or numbers. The game will not be able to find them.
  • Save your custom sentence file in ANSI format. By default Windows saves .txt files in UTF-8, but the game engine can't read that format.