Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
can't stop looping sound!
Author Message
nekrodamus Offline
Junior Member

Posts: 8
Joined: Jan 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Equil Offline
Member

Posts: 94
Joined: Sep 2010
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Tottel Offline
Senior Member

Posts: 307
Joined: Nov 2010
Reputation: 0
Post: #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. Tongue
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 all posts by this user Quote this message in a reply
nekrodamus Offline
Junior Member

Posts: 8
Joined: Jan 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Tanshaydar Offline
From Beyond

Posts: 3,091
Joined: Mar 2009
Reputation: 66
Post: #5
RE: can't stop looping sound!
You ask, I learn.

01-20-2011 12:39 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)