User Tools

Site Tools


Sidebar

Torchmodders Site


Wiki Navigation

adding_new_sounds_via_new_sound_definitions

Adding New Sounds Via New Sound Definitions

Overview

You can introduce any new sound you like into the game. First, define the sound so the game knows about it, then use the new sound by calling its GUID in .LAYOUT files, or calling its NAME in .ANIMATION files.

Sound sources

It's safest to use .wav files but .ogg and (I believe) .mp3 work too.

Define the new sound

All sounds need to be defined so the game can recognize and find them. This is done by .DAT files of the [SOUNDDATA] type. The game reads them from the MEDIA/SOUNDS/ game directory. Here are a few example lines from SKILLS.DAT…

[SOUNDDATA]
	[SOUND]
		<STRING>CATEGORY:Skills
		<STRING>NAME:GroundShockwave
		<BOOL>LOOPS:false
		<FLOAT>VOLUME:0.6
		<FLOAT>VOLUMEVARIATION:0.1
		<FLOAT>FREQUENCYVARIATION:2345
		<FLOAT>RADIUS:12
		<INTEGER64>GUID:4315959026107486686
		[FILES]
			<STRING>FILE:media/sounds/skill/slamshockwave.wav
		[/FILES]
	[/SOUND]
[/SOUNDDATA]

That block defines the sound “GroundShockWave”. You'd use this format to define your own new sound. You don't need to edit any of the existing vanilla [SOUNDDATA] .DAT files. Just go ahead and make a new .DAT using the above format.

The variables are pretty self-explanatory and you shouldn't need to change them too much in your own definition block, but try to assign the right <STRING>CATEGORY: variable - meaning, if it's a sound for a skill, use the value “SKILL” (no quotes). If it's for your player class, use “PLAYER”, etc. It is okay to define multiple sounds with differing CATEGORIES in one single .DAT file. And just like in all .DAT files, make sure each new sound has a unique GUID and NAME of is own.

Use it in the game

There's 2 ways I know of to call a sound in the game.

1. Calling a sound in a .LAYOUT file

Without this becoming a tutorial for .LAYOUT file editing, i'll just say that .LAYOUTs call sounds with a DESCRIPTOR block like this…

		[BASEOBJECT]
			[PROPERTIES]
				<STRING>DESCRIPTOR:Sound
				<STRING>NAME:Sound0
				<INTEGER64>PARENTID:-1
				<INTEGER64>ID:1996780824375005662
				<BOOL>START ON ACTIVATE:false
				<FLOAT>RADIUS:14
				<STRING>GUID:156804347996279262
			[/PROPERTIES]
		[/BASEOBJECT]

That last <STRING>GUID: line is the GUID of whatever sound it's calling, as defined in the sound's SOUNDDATA. You can actually just substitute the GUID of your new sound and that's what will play. This will be true whether it's a [Layout] or a [Particle Creator] .LAYOUT file.

If the timing of your sound is important, you can call it from within a [Layout] (the .LAYOUT files called within skill .DATs) so that you can set it on the layout's timeline (assuming there is one).

Particle .LAYOUT files can have timelines too, but usually don't. So you can call your sound from a particle .LAYOUT too, if timing is not important.

2. Calling a sound via the .ANIMATION file

You can also call a sound as part of an animation. Here are some code examples of that…

	[ANIMATION]
		<STRING>FILE:attack3.skeleton
		<STRING>NAME:Attack3
		<FLOAT>DURATION:1.33333
		[KEY]
			<STRING>NAME:HIT
			<FLOAT>FRAME:24.086
		[/KEY]
		[KEY]
			<STRING>NAME:PLAYSOUND
			<FLOAT>FRAME:7.31181
			<STRING>SOUND:ARMADAXSNORT
		[/KEY]
		[KEY]
			<STRING>NAME:PLAYSOUND
			<FLOAT>FRAME:21.8494
			<STRING>SOUND:ARMADAXROLL
		[/KEY]
	[/ANIMATION]

That last [KEY] block has a PLAYSOUND command set to go off on FRAME 21.8494 and it calls the “ARMADAXROLL” sound by its NAME from the sound's SOUNDDATA definition.

The way those grunting sounds are called when your character attacks is a little different - the [KEY] for it just mentions the name directly, so like “<STRING>NAME:EFFORT” (instead of a PLAYSOUND command). Also I think you can do it this way only for sounds which have been defined in the .DAT of the class. This all gets murky so let's not go there atm. Suffice it to say, using the PLAYSOUND key should give you what you wnat 90% of the time.

Calling a sound via a .ANIMATION file is useful for when you want the sound used to be gender-specific, since you've got both a male and a female .ANIMATION file so you can specify different sound NAMEs for eaach one.

adding_new_sounds_via_new_sound_definitions.txt · Last modified: 2018/08/16 02:03 by phanjam