Frictional Games Forum (read-only)

Full Version: can't stop looping sound!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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:
Code:
void OnStart()
{
    AddEntityCollideCallback("Player", "ScriptArea_2", "OnEnterArea2", true, 1);
}
This is the Script area code:
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...
Code:
void TimerFinSonido01(string &in asTimer)
{
    StopSound("cuiqui", 6.0f);
}
But set a timer for each sound i play is a little annoying...Sad
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.
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. ^^
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!
You ask, I learn.