Frictional Games Forum (read-only)

Full Version: Ending a Looping sound [NEED HELP]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(05-09-2011, 09:44 AM)Apjjm Wrote: [ -> ]
(05-09-2011, 06:52 AM)Simpanra Wrote: [ -> ]what is the function for changing the bool value of the sound function? =)

Use "GetLocalVarInt" using 0 for false (not 0 for true). You could use a "bool x = false;" outside the function, but the status of that variable wouldn't be saved as it is with the function based approach. In the case of your code, you would do something like this:

Code:
void onStart()
{
AddEntityCollideCallback("Player", "StartSoundsArea", "PlaySounds");
SetLocalVarInt("breakSndLoop", 0);
}

void PlaySounds(Parent, Child, State)
{
PlaySoundAtEntity("EnemyGrunting", "Player");
if(GetLocalVarInt("breakSndLoop") == 0) AddTimer(1.5f, "PlaySounds2");
}

void PlaySounds2( Timer)
{
PlaySoundAtEntity("EnemyGrowling", "Player");
if(GetLocalVarInt("breakSndLoop") == 0)  AddTimer( 1.5f, "PlaySounds3");
}

void PlaySounds3( Timer)
{
PlaySoundAtEntity("EnemyGrunting", "Player");
if(GetLocalVarInt("breakSndLoop") == 0)  AddTimer( 1.5f, "PlaySounds2");
}

void StopLoop()
{
SetLocalVarInt("breakSndLoop", 1);
//If wanted, a removeTimer() and stopSound() can be used too here
//But it shouldn't be necessary - and may sound very sudden.
}

Your great! =D Thanks man =) Can't wait for your super secret project....that i dont know about...*shifty eyes*...
I think I figured it out! Have you tried to use it like this:

PlaySoundAtEntity("sound01", "react_sigh.snt", "Player", 0, false);

With this:

StopSound("sound01", 0);
(05-11-2011, 09:07 PM)Kyle Wrote: [ -> ]I think I figured it out! Have you tried to use it like this:

PlaySoundAtEntity("sound01", "react_sigh.snt", "Player", 0, false);

With this:

StopSound("sound01", 0);
hmmmm, no i havent =D i shall try ^_^
Pages: 1 2