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


Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ending a Looping sound [NEED HELP]
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#10
RE: Ending a Looping sound [NEED HELP]

(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:

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.
}
(This post was last modified: 05-09-2011, 09:47 AM by Apjjm.)
05-09-2011, 09:44 AM
Find


Messages In This Thread
Ending a Looping sound [NEED HELP] - by Simpanra - 05-08-2011, 07:52 PM
RE: Ending a Looping sound [NEED HELP] - by Apjjm - 05-09-2011, 12:52 AM
RE: Ending a Looping sound [NEED HELP] - by Apjjm - 05-09-2011, 09:44 AM
RE: Ending a Looping sound [NEED HELP] - by Kyle - 05-11-2011, 09:07 PM



Users browsing this thread: 1 Guest(s)