The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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", false, 0);
}

void CollideTerrorArea(string &in asParent, string &in asChild, int alState)
{
    if(
alState == 1)
    {
        
FadeSepiaColorTo(0.75f, 0.7f);
        
FadeRadialBlurTo(0.025f, 0.02f);
        
AddTimer("terror", 0, "TimerTerrorDrain");
        
SetLocalVarInt("InTerror", 1);
        
PlaySoundAtEntity("Prisoner", "24_mb_02.snt", "chained_prisoner_3", 1.0f, true);
    }
    else if(
alState == -1)
    {
        
FadeSepiaColorTo(0.0f, 1.0f);
        
FadeRadialBlurTo(0.0f, 0.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


Messages In This Thread
StopSound not working on certain .SNT - by Damascus - 12-25-2012, 08:16 PM



Users browsing this thread: 1 Guest(s)