PDA

View Full Version : Global Custom Sentences Replacement Guide



Hezus
14-05-2018, 03:04 PM
Sentence replacement has been possible for many long years through Global Sound Replacement (https://forums.svencoop.com/showthread.php/21020-Global-Sound-Replacement-Guide) 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 (https://forums.svencoop.com/showthread.php/21020-Global-Sound-Replacement-Guide?p=240339&viewfull=1#post240339).

Important!
- 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.

kmkz
15-05-2018, 07:18 PM
Thanks, this was useful to me.

Frel2.0
03-08-2019, 05:08 AM
Hezus, I'm having some issues getting this to work. As far as I can tell I've followed the various steps, but the sounds don't initiate in-game and it outputs an error message saying it can't be found. If it's easiest I'm happy to provide you the source files direct and see if I'm just making a stupid mistake?

Edit: see console log below

] developer 1
] maxplayers 1
"deathmatch" changed to "0"
] sv_cheats 1
"sv_cheats" changed to "1"
] map sc_reactivist
Flushing cached sound list files...
Sound list file 'svencoop/maps/soundcache/sc_reactivist.txt' is currently in use, not flushing.
Adding game library "svencoop/dlls/server.dll"
Dll loaded for mod Sven Co-op 5.20
Angelscript: Registering Sven Co-op Angelscript API
Angelscript version: 2.33.0
Sven Co-op API version: 1.20
Angelscript: Finished registering Sven Co-op Angelscript API
Angelscript: Clearing temporary directory './scripts/plugins/temp'
Angelscript: Clearing temporary directory './scripts/maps/temp'
Spawn Server sc_reactivist
Clearing memory
No detail texture mapping file: maps/sc_reactivist_detail.txt
Using WAD File 'barney.wad'
Using WAD File 'bmt.wad'
Using WAD File 'poke646.wad'
Using WAD File 'halflife.wad'
Using WAD File 'decals.wad'
Skipping WAD File 'gfx.wad'
Using WAD File 'liquids.wad'
Using WAD File 'svencoop1.wad'
Using WAD File 'svencoop2.wad'
Using WAD File 'vendetta.wad'
Using WAD File 'gmantowers.wad'
Using WAD File 'jailbreak2.wad'
Using WAD File 'judgement.wad'
Using WAD File 'mistral.wad'
Using WAD File 'scopfor.wad'
Using WAD File 'storage.wad'
Using WAD File 'submerged.wad'
Using WAD File 'submerged_addons.wad'
Using WAD File 'svencoop_training.wad'
Using WAD File 'th_escape.wad'
Using WAD File 'op4ctf.wad'
Using WAD File 'nw.wad'
Using WAD File 'sc_reactivist.wad'
Texture load: 114.8ms
WARNING: failed to locate sequence file sc_reactivist
"mp_consistency" changed to "0"
Executing listen server config file 'listenserver.cfg'.
execing listenserver.cfg
"deathmatch" changed to "1"
Executing map vote config file 'mapvote.cfg'.
execing mapvote.cfg
39 map(s) loaded into the vote list.
Angelscript: Loading plugin lists
Angelscript: Loading plugin list 'default_plugins.txt'
Angelscript: Loading plugins from file 'default_plugins.txt'
Angelscript: Plugin list 'default_plugins.txt' - 1 plugin(s) listed
Angelscript: Included script 'StringUtils'
Angelscript: Included script '../../Cfg'
Angelscript: Beginning plugin 'PlayerManagement' compilation
Angelscript: Starting compilation: 3 scripts
Angelscript: Plugin script compilation succeeded
Angelscript: Registering hook: module 'PlayerManagement', hook 'ClientSay', function 'PlayerManagement::ClientSay'
PlayerManagement: config file scripts/plugins/admin/Config/PlayerManagement.cfg loaded
Angelscript: Adding console command 'plrmgr.admin_slap'
Angelscript: Adding console command 'plrmgr.admin_slay'
Angelscript: Adding console command 'plrmgr.admin_kick'
Angelscript: Adding console command 'plrmgr.admin_ban'
Angelscript: Adding console command 'plrmgr.admin_teleport'
Angelscript: Adding console command 'plrmgr.admin_teleportto'
Angelscript: Adding console command 'plrmgr.admin_sethealth'
Angelscript: Adding console command 'plrmgr.admin_setarmor'
Angelscript: 1 plugin(s) total
Angelscript: 1 plugin(s) successfully compiled
Parsing default_map_settings.cfg
"mp_banana" changed to "1"
"sv_maxspeed" changed to "270"
Parsing maps/sc_reactivist.cfg
"sv_maxspeed" changed to "300"
"mp_banana" changed to "0"
Game skill level: 2
Parsing skill.cfg
Couldn't open maps/sc_reactivist_skl.cfg, no config file parsed
Next map in cycle is: -sp_campaign_portal
0 server administrator(s) and 0 owner(s) read.
Loading materials list "sound/materials.txt"...
*Graph Loaded!
Angelscript: Beginning scan for m_iszScriptFile keyvalues
Angelscript: Finished scanning for m_iszScriptFile keyvalues
MessageEnd: Unknown User Msg 113
0 entities inhibited
Loading sentence list "sound/default_sentences.txt"...
Loading sentence list "sound/sc_reactivist/reactivist_sentences.txt"...

ERROR: [Sound Engine] - Failed to open custom sentence file "sound/sc_reactivist/reactivist_sentences.txt"
Loading materials list "sound/materials.txt"...
Game started
Flushing cached sound list files...
Sound list file 'svencoop/maps/soundcache/sc_reactivist.txt' is currently in use, not flushing.
Local connection.
Connection accepted.
Compressing split packet (3 -> 39 bytes) [0]
Compressing split packet (8480 -> 4748 bytes) [0]
Sven Co-op 5.20
Server Engine: 5.0.1.3 (build 8206)
Server Number: 1
Serverinfo packet received.
Remote host: Sven Co-op
Spooling demo header.
Compressing split packet (11035 -> 4635 bytes) [0]
Unexpected result compressing packet (41 -> 37 bytes) [-8]
Verifying and downloading resources...
Setting up renderer...
SKY: city_nitert, city_nitelf, city_nitebk, city_niteft, city_niteup, city_nitedn, done
Unexpected result compressing packet (11 -> 7 bytes) [-8]
Verifying and uploading resources...
Custom resources total 6.15K
Decals: 6.15K
----------------------
Resources to request: 0 bytes
**Graph Pointers Set!
Compressing split packet (130 -> 88 bytes) [0]
Compressing split packet (8886 -> 7012 bytes) [0]
Custom resource propagation complete.
**Graph Pointers Set!
"Frel<1><STEAM_ID_LAN><players>" has entered the game
Compressing split packet (1716 -> 1000 bytes) [0]
CL_SignonReply: 1
449.9 MB cache free
CL_SignonReply: 2
WARNING: Cannot render portals, mirrors or monitors due to FBO being set by engine. (To fix this, use borderless window instead of fullscreen mode, or restart the game using -nofbo as start parameter.)
Loading materials list "sound/materials.txt"...
[Sound Engine] Finished loading sound list: 394 loaded, 0 failed.
Flushing cached sound list files...
Sound list file 'svencoop/maps/soundcache/sc_reactivist.txt' is currently in use, not flushing.
] god
God mode ON

Hezus
04-08-2019, 04:48 AM
Could you check the formatting of text file? The windows default is often UTF-8, but the default_sentences.txt is stored in ASCI format.

Frel2.0
04-08-2019, 01:21 PM
Could you check the formatting of text file? The windows default is often UTF-8, but the default_sentences.txt is stored in ASCI format.

That appears to have done the trick, thanks.