Working with sound files
Wp:PlayAttenuatedSoundWithLipsync("file", delay);
Wp:PlaySoundWithLipsync("file", delay);
These two functions work the same, with PlaySoundWithLipsync having the same volume regardless of distance, and PlayAttenuatedSoundWithLipsync having the volume fade over distance.
You can play any ogg file with these functions. I haven't tried mp3 but wav files definitely don't work. The "file" component is the path name within the speech folder followed by the file name without the extension. The delay variable tells how long, in seconds, to delay before playing the sound, so you can sync it up with a movement, tie multiple sounds together etc.
Quote:
Wp:PlayAttenuatedSoundWithLipsync("ChiefEngineer\N ormal\MC_CR_CHIEF_53", 15.0); # "fore planes"
Wp:PlayAttenuatedSoundWithLipsync("ChiefEngineer\N ormal\MC_CR_CHIEF_140", 16.4); # "eight"
Wp:PlayAttenuatedSoundWithLipsync("ChiefEngineer\N ormal\MC_CR_CHIEF_55", 17.2); # "degrees down"
|
Note that the delay is from the first command. Each character can only be playing one sound at a time, it you set the delay too low, and the previous sound isn't finished, the sound won't play. The German and English speech files are not exactly the same length, so you should test with both to make sure it works ok in both versions.
You can't play any of the sounds other than those in the speech folder. There's ways around that though. Just copy the sound you want, convert it to an ogg, then put it in the speech folder.
I used the helmsman to 'speak' the dive alarm bell when the dive command is given. I used the non-attenuated version, so the sound isn't localized. I copied the Submarine Bell.wav file from the sounds folder, used an audio editor to loop it three times so it'd play longer, then saved it as an ogg. Note, you can't have spaces in the file name.
Quote:
Wp:PlaySoundWithLipsync("MFCM\Submarine_Bell", 0.0);
|