Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
StopSound not working on certain .SNT
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#1
StopSound not working on certain .SNT

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: (Select All)
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.

(This post was last modified: 12-26-2012, 08:10 PM by Damascus.)
12-25-2012, 08:16 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#2
RE: StopSound not working on certain .SNT

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

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
12-25-2012, 08:22 PM
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#3
RE: StopSound not working on certain .SNT

Is the rest of the else if executing?
12-25-2012, 08:41 PM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#4
RE: StopSound not working on certain .SNT

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: (Select All)
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: (Select All)
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.

(This post was last modified: 12-25-2012, 08:50 PM by Damascus.)
12-25-2012, 08:49 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#5
RE: StopSound not working on certain .SNT

Try have a look inside the .snt

Maybe it gives some answers...

Trying is the first step to success.
12-25-2012, 08:56 PM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#6
RE: StopSound not working on certain .SNT

(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: (Select All)
<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

12-25-2012, 08:58 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#7
RE: StopSound not working on certain .SNT

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

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
12-25-2012, 10:37 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#8
RE: StopSound not working on certain .SNT

Yea maybe the blockable thingy Wink

Trying is the first step to success.
(This post was last modified: 12-25-2012, 10:38 PM by FlawlessHappiness.)
12-25-2012, 10:37 PM
Find
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#9
RE: StopSound not working on certain .SNT

or just set it's volume to zero

12-26-2012, 02:01 AM
Find
Rapture Offline
Posting Freak

Posts: 1,078
Threads: 79
Joined: May 2011
Reputation: 30
#10
RE: StopSound not working on certain .SNT

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.
(This post was last modified: 12-26-2012, 03:51 AM by Rapture.)
12-26-2012, 03:50 AM
Find




Users browsing this thread: 4 Guest(s)