Damascus
Senior Member
Posts: 646
Threads: 118
Joined: Mar 2012
Reputation:
29
|
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:
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 |
|
The chaser
Posting Freak
Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation:
113
|
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)
Aculy iz dolan.
|
|
12-25-2012, 08:22 PM |
|
Adrianis
Senior Member
Posts: 620
Threads: 6
Joined: Feb 2012
Reputation:
27
|
RE: StopSound not working on certain .SNT
Is the rest of the else if executing?
|
|
12-25-2012, 08:41 PM |
|
Damascus
Senior Member
Posts: 646
Threads: 118
Joined: Mar 2012
Reputation:
29
|
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:
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); 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); 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", false, 0.7, 0.3, 10, false); 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.0f, true); 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:
void CollideTerrorArea(string &in asParent, string &in asChild, int alState) { if(alState == 1) { FadeSepiaColorTo(0.75f, 0.7f); FadeRadialBlurTo(0.025f, 0.02f); SetEntityActive("chained_prisoner_3", true); 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); 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 |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
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 |
|
Damascus
Senior Member
Posts: 646
Threads: 118
Joined: Mar 2012
Reputation:
29
|
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.
<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 |
|
The chaser
Posting Freak
Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation:
113
|
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)
Aculy iz dolan.
|
|
12-25-2012, 10:37 PM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: StopSound not working on certain .SNT
Yea maybe the blockable thingy
Trying is the first step to success.
|
|
12-25-2012, 10:37 PM |
|
Daemian
Posting Freak
Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation:
49
|
RE: StopSound not working on certain .SNT
or just set it's volume to zero
|
|
12-26-2012, 02:01 AM |
|
Rapture
Posting Freak
Posts: 1,078
Threads: 79
Joined: May 2011
Reputation:
30
|
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 |
|
|