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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
can't stop looping sound!
nekrodamus Offline
Junior Member

Posts: 8
Threads: 3
Joined: Jan 2011
Reputation: 0
#1
can't stop looping sound!

Is there a way a sound plays only once when a player collides with an area?
I play it when he collides, but it continues looping endlessly... i have to set a timer to cut it off... Is there a more direct way?
This is the Onstart code:
void OnStart()
{
    AddEntityCollideCallback("Player", "ScriptArea_2", "OnEnterArea2", true, 1);
}
This is the Script area code:
void OnEnterArea2(string &in asParent, string &in asChild, int alState)
{
    PlaySoundAtEntity("cuiqui", "scare_scratch.snt", "Player", 1.0f, false);
    AddTimer("sonido01", 5, "TimerFinSonido01");
}
And the timer that stops the sound...
void TimerFinSonido01(string &in asTimer)
{
    StopSound("cuiqui", 6.0f);
}
But set a timer for each sound i play is a little annoying...Sad
01-20-2011, 07:05 AM
Find
Equil Offline
Member

Posts: 94
Threads: 8
Joined: Sep 2010
Reputation: 0
#2
RE: can't stop looping sound!

An alternative way to timers for this particular sound would be to use "scare_wall_scratch_single.snt" instead, or edit the .snt file and change looping to false.
(This post was last modified: 01-20-2011, 07:25 AM by Equil.)
01-20-2011, 07:25 AM
Find
Tottel Offline
Senior Member

Posts: 307
Threads: 9
Joined: Nov 2010
Reputation: 0
#3
RE: can't stop looping sound!

In the level editor, set playerInteractAutoCallBackRemove -> on, on the area.

EDIT: What the guy above me said as well. :p
Check if it IS looping, the audio clip itself actually does a series of sounds already, might just be that. ^^
(This post was last modified: 01-20-2011, 07:28 AM by Tottel.)
01-20-2011, 07:25 AM
Find
nekrodamus Offline
Junior Member

Posts: 8
Threads: 3
Joined: Jan 2011
Reputation: 0
#4
RE: can't stop looping sound!

Yep... That was. I edit the .snt and it works!! The other sound was too short.
Thanks a lot!!!
I'll be back tomorrow with more annoying newbie questions!
01-20-2011, 07:51 AM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#5
RE: can't stop looping sound!

You ask, I learn.

01-20-2011, 12:39 PM
Website Find




Users browsing this thread: 1 Guest(s)