Frictional Games Forum (read-only)

Full Version: StopSound not working on certain .SNT
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I'm having lots of trouble getting a sound to stop in one of my maps. When the player enters a certain area, I want a prisoner chained to the wall to start muttering. However, since the muttering has such a wide range I want it to stop when the player leaves the area, but the sound won't stop.

"Prisoner" is the offending sound:

PHP Code:
void OnStart{
    
AddEntityCollideCallback("Player""TerrorArea""CollideTerrorArea"false0);
}

void CollideTerrorArea(string &in asParentstring &in asChildint alState)
{
    if(
alState == 1)
    {
        
FadeSepiaColorTo(0.75f0.7f);
        
FadeRadialBlurTo(0.025f0.02f);
        
AddTimer("terror"0"TimerTerrorDrain");
        
SetLocalVarInt("InTerror"1);
        
PlaySoundAtEntity("Prisoner""24_mb_02.snt""chained_prisoner_3"1.0ftrue);
    }
    else if(
alState == -1)
    {
        
FadeSepiaColorTo(0.0f1.0f);
        
FadeRadialBlurTo(0.0f0.02f);
        
RemoveTimer("terror");
        
SetLocalVarInt("InTerror"0);
        
StopSound("Prisoner"1.0f);
    }


Every other script works when the player leaves; Sepia and Radial Blur return to normal, but the muttering continues. When the player then re-enters the area, a second muttering sound will start and overlap the original.
It seems like the script is wider, the issue should be in another part (because I don't see anything wrong in the StopSound thing). Please, show us the whole script that implicated the prisoner (That Variable, for example).
Is the rest of the else if executing?
Actually, I realized that the Timer and Variable are parts of the script that I'm no longer using. So I took those out, but the sound is still not stopping. Here is the whole script having to do with this room:

PHP Code:
void OnStart{
    
AddEntityCollideCallback("Player""TerrorArea""CollideTerrorArea"false0);
}

void CollideTerrorArea(string &in asParentstring &in asChildint alState)
{
    if(
alState == 1)
    {
        
FadeSepiaColorTo(0.75f0.7f);
        
FadeRadialBlurTo(0.025f0.02f);
        
PlaySoundAtEntity("Prisoner""24_mb_02.snt""chained_prisoner_3"1.0ftrue);
    }
    else if(
alState == -1)
    {
        
FadeSepiaColorTo(0.0f1.0f);
        
FadeRadialBlurTo(0.0f0.02f);
        
StopSound("Prisoner"1.0f);
    }



void Transform(string &in asEntity)
{
    
SetEntityActive("chained_prisoner_3"false);
    
SetEntityActive("shackles_single_19"true);
    
SetEntityActive("shackles_single_20"true);
    
SetEntityActive("servant_brute_1"true);
    
PlayMusic("26_event_brute.ogg"false0.70.310false);
    
AddTimer("scare"1.0f"TimerGruntScare");
    
AddTimer("breath"3.0f"TimerGruntScare");
}

void TimerGruntScare(string &in asTimer)
{
    if(
asTimer == "breath")
    {
        
PlayGuiSound("react_breath"0.6f);
        
FadeImageTrailTo(0,0.2f);
        
SetPlayerRunSpeedMul(1.0f);
        
SetPlayerMoveSpeedMul(1.0f);
        return;
    }
    
    
GiveSanityDamage(10.0ftrue);
    
PlayGuiSound("react_scare6"0.7f);
    
StopSound("Prisoner"0);
    
FadeImageTrailTo(2,1);
    
SetPlayerRunSpeedMul(0.8f);
    
SetPlayerMoveSpeedMul(0.8f);
}


The strangest thing is that the muttering sound stops when I activate the brute, which at first I thought had to do with setting the shackled prisoner inactive. But when I try to do that in the first script, it still doesn't make the sound stop when the player leaves:

PHP Code:
void CollideTerrorArea(string &in asParentstring &in asChildint alState)
{
    if(
alState == 1)
    {
        
FadeSepiaColorTo(0.75f0.7f);
        
FadeRadialBlurTo(0.025f0.02f);
    
SetEntityActive("chained_prisoner_3"true);
        
PlaySoundAtEntity("Prisoner""24_mb_02.snt""chained_prisoner_3"1.0ftrue);
    }
    else if(
alState == -1)
    {
        
FadeSepiaColorTo(0.0f1.0f);
        
FadeRadialBlurTo(0.0f0.02f);
        
StopSound("Prisoner"1.0f);
    
SetEntityActive("chained_prisoner_3"false);
    }


(12-25-2012, 08:41 PM)Adrianis Wrote: [ -> ]Is the rest of the else if executing?

Yes, the rest of it is working. Sepia and Radial Blur are both reset the 0 when the player leaves the room.
Try have a look inside the .snt

Maybe it gives some answers...
(12-25-2012, 08:56 PM)beecake Wrote: [ -> ]Try have a look inside the .snt

Maybe it gives some answers...

I took a look, but I can't see anything that can help me.

PHP Code:
<SOUNDENTITY>
  <
SOUNDS>
      <
Main>
          <
Sound File="24_mb_02_01" />
        <
Sound File="24_mb_02_02" />
        <
Sound File="24_mb_02_03" />
        <
Sound File="24_mb_02_04" />
        <
Sound File="24_mb_02_05" />
        <
Sound File="24_mb_02_06" />
      </
Main>
  </
SOUNDS>
  <
PROPERTIES Volume="0.9" MinDistance="10" MaxDistance="20" Random="1" Interval="0.05" FadeEnd="False" FadeStart="False" Stream="False" Loop="True" Use3D="True" Blockable="False" BlockVolumeMul="0.7" Priority="0" />
</
SOUNDENTITY
Set the blockable thing to true and the Loop to false. Maybe it fixes it.
Yea maybe the blockable thingy Wink
or just set it's volume to zero
Make sure you didn't place a Sound on the map, I've gone bonkers once before looking for a sound that I called through script, but would sound on startup every time I entered the map. Because I had accidently placed a sound near where I started.
Pages: 1 2