Frictional Games Forum (read-only)
StopSound not working on certain .SNT - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: StopSound not working on certain .SNT (/thread-19678.html)

Pages: 1 2


StopSound not working on certain .SNT - Damascus - 12-25-2012

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.


RE: StopSound not working on certain .SNT - The chaser - 12-25-2012

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).


RE: StopSound not working on certain .SNT - Adrianis - 12-25-2012

Is the rest of the else if executing?


RE: StopSound not working on certain .SNT - Damascus - 12-25-2012

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.


RE: StopSound not working on certain .SNT - FlawlessHappiness - 12-25-2012

Try have a look inside the .snt

Maybe it gives some answers...


RE: StopSound not working on certain .SNT - Damascus - 12-25-2012

(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



RE: StopSound not working on certain .SNT - The chaser - 12-25-2012

Set the blockable thing to true and the Loop to false. Maybe it fixes it.


RE: StopSound not working on certain .SNT - FlawlessHappiness - 12-25-2012

Yea maybe the blockable thingy Wink


RE: StopSound not working on certain .SNT - Daemian - 12-26-2012

or just set it's volume to zero


RE: StopSound not working on certain .SNT - Rapture - 12-26-2012

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.