Ogg Vorbis decoder
How to record a voiceclip?
Attaching the voiceclip to the mod.
For this we need to get into the .d-file (or the .tra, in case you use it) and add a few things. After every string you wish to have voiced, you need to add the appropriate soundfile within -tags, but without the .wav-extension.
~This is the string~ [clip][clip] refers to the file clip.wav, a file which must be located in the override-directory.
For a little longer example of a .d-structure, watch this example from the Hubelpot-mod:
IF ~NumTimesTalkedTo(0)~ Hub SAY ~Excuse me mah <LADYLORD>, but Ah was wonderin’ if Ah might hae a word with ye. Ye hae the look o’ the gallowglass, an Ah could surely use yer help.~ [SC#Hub57] ++ ~Of course good merchant. How may we assist?~ + Hub_2 ENDHere, [SC#Hub57] refers to the file SC#Hub57.wav.
@1 = ~Excuse me mah <LADYLORD>, but Ah was wonderin’ if Ah might hae a word with ye. Ye hae the look o’ the gallowglass, an Ah could surely use yer help.~ [SC#Hub57] @2 = ~Very well, mah <LADYLORD>. Ah am sore in need, and shall wait an’ hope ye’ll change yer mind.~ [SC#Hub59]Here, [SC#Hub57] refers to the file SC#Hub57.wav and[SC#Hub59] refers to the file SC#Hub59.wav. As I mentioned before, these files needs to be in the override directory
How to get them there? Well, follow the next step:
Most mods have a single folder where all of the soundfiles are stored in. If this is the case, it is easy to implent a single:
COPY ~mymodfolder\Audio~ ~override~into the .tp2. This will copy all files from the Audio-folder into the override. Simple as that.
.ogg or .wav?
Most mods today come with .ogg-files, to keep the overall size of the mod down. The game, however, can't play .ogg-files, which mean that we need to decode the .ogg-files into .wav-files. This is the tricky part, since it involves several steps.
First, we must add a file named oggdec.exe. It is located in the Ogg Vorbis-decoder at the top of this tutorial. Secondly, we need to place this oggdec.exe in the same folder as the soundclips, the Audio-folder.
Secondly, we need to create two .bat-files (one install and one uninstall), which you can edit with any text-editor.
The install.bat will look like this:
@echo off cd override oggdec SC#Hub*.ogg del SC#Hub*.ogg del oggdec.exe cd ..This short .bat-file will tell oggdec.exe to decode all .ogg files that begin with SC#Hub, which means SC#Hub57.ogg and SC#Hub14.ogg, etc. After that, the .bat-file will delete all .ogg-files it has decoded, and the oggdec.exe.
The uninstall.bat is even shorter:
del override\SC#Hub*.wav @ECHO @ECHO Hubelpot Audio Uninstalled @ECHOThis .bat-file will delete all .wav files that begin with SC#Hub, the same files as it decoded previously. We do this since WeiDU won't delete these files, like the other files in the mod. Why? Well, WeiDU has no memory of these files, since it copied over .ogg-files at install, and not .wav. After that, it will show the string "Hubelpot Audio Uninstalled" in the DOS-prompt-screen at uninstall.
But things isn't over yet, we need to add a few lines to the .tp2:
COPY ~SC#Hub\Install.bat~ ~Install.bat~ AT_INTERACTIVE_EXIT ~Install.bat~ AT_UNINSTALL ~Uninstall.bat~The first line instructs WeiDU to copy the Install.bat-file to the main BGII-directory, where it needs to be. The second lines instructs WeiDU to execute the Install.bat at interactive exit, when the user presses the [ENTER] button at install. The third line instructs WeiDU to execute the Uninstall.bat at uninstall of the mod.
Now, this requires two things. The Install.bat must be in the folder where you have specified it to be. This isn't difficult, since you can change that to any folder you want, as long as the line in the .tp2 matches. The other thing is more crucial, though. The Uninstall.bat must be in the same directory as the setup.exe and the .tp2, i.e. the main BGII-directory. We can't copy it over with WeiDU as we do with the Install.bat, since WeiDU would reverse that action at uninstall, before it would even be executed to remove the files.
Good luck modding!
Â© Copyright Sebastian Conrad 2004.
Edited by SConrad, 08 October 2004 - 07:28 PM.