| Simpanra   Senior Member
 
 Posts: 314
 Threads: 28
 Joined: Mar 2011
 Reputation: 
0
 | 
			| RE: Ending a Looping sound [NEED HELP] 
 
				 (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:
 
 
 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*...
			 |  | 
	| 05-09-2011, 06:02 PM |  | 
	
		| Kyle   Posting Freak
 
 Posts: 911
 Threads: 36
 Joined: Sep 2010
 Reputation: 
7
 | 
			| RE: Ending a Looping sound [NEED HELP] 
 
				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 |  | 
	
		| Simpanra   Senior Member
 
 Posts: 314
 Threads: 28
 Joined: Mar 2011
 Reputation: 
0
 | 
			| RE: Ending a Looping sound [NEED HELP] 
 
				 (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 ^_^
			 |  | 
	| 05-11-2011, 09:20 PM |  |