Page 1 of 1

[SOLVED]How to stop a sound?

Posted: Wed May 27, 2015 7:46 pm
by Riclo
For example, I have a sound that's going to be activating within a map using the ThingSound ACS command. How would I be able to cut the sound off?

So far removing the mapspot the sound is being spawned from doesn't work, and creating a decorate item that triggers the sound and removing that doesn't work either.

Solved:
[spoiler]

Code: Select all

Actor Musicsound
{
-NOGRAVITY
reactiontime 999
states
{
spawn:
TNT1 A 0
TNT1 A 0 A_PlaySoundex ("Music", CHAN_VOICE, 9.0, 0) 
goto butloop

butloop:
TNT1 A 35
TNT1 A 0 A_JumpIf (ACS_ExecuteWithResult(20), "cutoff") 	
TNT1 A 0 A_CountDown
loop

cutoff:
TNT1 AA 0 A_Stopsoundex("Voice")

Death:
TNT1 A 0 
stop
}
}
//////
Script 20 (void)
{
{
        If(!Situation()) {
            SetResultValue(FALSE);
        } else {
            SetResultValue(TRUE);
        }
}
}
[/spoiler]

RE: How to stop a sound?

Posted: Wed May 27, 2015 8:07 pm
by Ænima
The only way to do this is with a_playsoundex and a_stopsoundex. Unfortunately a_stopsoundex has no ACS equivalent so you'll have to use some hackery and make your script spawn DECORATE actor that calls a_stopsoundex on itself when you need to.

RE: [SOLVED]How to stop a sound?

Posted: Wed May 27, 2015 8:47 pm
by Riclo
Ænima wrote: The only way to do this is with a_playsoundex and a_stopsoundex. Unfortunately a_stopsoundex has no ACS equivalent so you'll have to use some hackery and make your script spawn DECORATE actor that calls a_stopsoundex on itself when you need to.
Thanks alot, it seems to be working now

RE: [SOLVED]How to stop a sound?

Posted: Wed May 27, 2015 9:31 pm
by Ænima
Awesome. That code is pretty much exactly how I would have done it.

RE: [SOLVED]How to stop a sound?

Posted: Wed May 27, 2015 10:24 pm
by FateLord
sounds like a tracker suggestion: add an ACS-equivalent to a_stopsoundex

RE: [SOLVED]How to stop a sound?

Posted: Thu May 28, 2015 8:24 am
by Ænima
FateLord wrote: sounds like a tracker suggestion: add an ACS-equivalent to a_stopsoundex
That's more of a ZDoom suggestion.