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...