Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: viktor on Tue 11/05/2004 20:37:28

Title: Stoping sound efects
Post by: viktor on Tue 11/05/2004 20:37:28
Hy
A few day back I asked a question about hotspots and sounds.
I set my musik as a sound efect (that is the only way I know how) and I want it to stop when the character leaves the room. How do I do that?

Have a nice day  ;)
Title: Re: Stoping sound efects
Post by: Ishmael on Tue 11/05/2004 20:41:34
Room Interactions -> Player Leaves Screen -> Run Script

and use either StopMusic, or StopChannel(?).. See manul for PlayMusic and PlaySound, their "See also" should have links to the stopping commands.
Title: Re: Stoping sound efects
Post by: Phemar on Wed 12/05/2004 15:17:14

You don't need to set your music as a sound effect?

Play it with the Play music on room load: []

And check it and type in what music you want to play. AGS will carry on playing the music when you step into another room, unless there is a different file set to play in that room.
Title: Re: Stoping sound efects
Post by: viktor on Wed 12/05/2004 17:31:10
NO NO...
I have a hotspot. When a character interacts with it it plays musik ( as a sound efekt couse I don't know how to set it otherwise).
And I want THAT SOUND effectto stop playing when I leave the room or interact with another hotspot.
Title: Re: Stoping sound efects
Post by: .. on Wed 12/05/2004 18:29:33
QuoteYou don't need to set your music as a sound effect?

Play it with the Play music on room load: []
Yeh he had a stereo which plays music on interaction.

I'm not that good at scripting but I had a go...

Try

StopChannel (3);

with Run Script on the hotspots that you want it to stop on and when player
leaves room

Or if that don't work try

StopChannel (4);

or

StopChannel (5);

I'm not that well informed on channels so correct me if this is wrong.
Title: Re: Stoping sound efects
Post by: Scorpiorus on Wed 12/05/2004 18:38:15
The problem with stopping a specific channel is that you can't say for sure what channel the sound is playing on. It can even be changed on the next game start, because the PlaySound() function is given a channel which is currently free.

To stop the sound pass -1 to PlaySound()

On Player leaves screen interaction:

PlaySound(-1);