PDA

View Full Version : Playing a sound using scripting


Silveredge9
10-23-2006, 10:27 PM
How would I script a sound to play? The method below that I've tried doesn't seem to work. (I'm working on KOTOR1)


object oSound = GetObjectByTag("NAMEOFSOUND");
SoundObjectPlay(oSound);

Thanks for any help on this in advance. :)

Tupac Amaru
10-24-2006, 03:44 AM
The script is correct. You have to make a sound object first. Look in the _s.rim->Blueprint, Sound module files for some examples. Then you need to specify the position of the sound object in the .git file under SoundList.
Most sound object have a cutoff distance. When playing them with a script, don't be too far away from its centre or you won't hear.

A simpler method is to use the PlaySound(string sSoundName) command, where sSoundName is the name of the .wav in StreamSounds, but you can't freely position the sound that way.