Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Mats Berglinn on Thu 05/05/2005 11:24:02

Title: Character sound effect playing
Post by: Mats Berglinn on Thu 05/05/2005 11:24:02
I've recently started on a Star Wars parody for this month MAGS and I've stumbled on a little problem. One of the characters is a Darth Vader spin-off called Dark Waker and I want the character to breath everytime he is around (the sound of the hissing Darth Vader breath). I have a sound for the breathing but I don't know how to script that everytime Dark Waker is around you hear the breathing. Does anyone know how to tackle this problem?
Title: Re: Character sound effect playing
Post by: Ashen on Thu 05/05/2005 11:45:13
A couple of ways come to mind, most basicaly:

//in rep_ex
if (character[WAKER].room == character[EGO].room) {
  if (IsSoundPlaying()==0) PlaySound(BREATH);
}


You could also add checks to the character's coords, so it only plays when they're within a certain distance of each other. You could use an int or GlobalInt to check if the sound has started, rather than IsSoundPlaying(). You could use PlayAmbientSound() so it loops automaticly, and gets louder the closer the player is to Waker. If you use PlaySoundEx () instead of PlaySound(), you can use IsChannelPlaying (), which would be a bit more specific than IsSoundPlaying().

It depends on how exactly you want the sound to behave.
Title: Re: Character sound effect playing
Post by: Mats Berglinn on Thu 05/05/2005 12:07:13
Thanks for the help!