Bors 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 6 
	Threads: 2 
	Joined: Feb 2012
	
 Reputation: 
0
		
	 | 
	
		
			
Piano Scare script 
			 
			
				So, i have a problem with a script. (im not getting errors).    
the script should do like this, the piano plays a song in a loop, but when you enter an a script area it will stop play and it will slam with dust comming.
 
The music loop works but not the slam and the dust particels. (sorry for bad english)    
So here is the Script= 
 
void OnStart() 
{ 
AddTimer("pianotimer", 0, "pianotimer"); 
AddEntityCollideCallback("player", "pianostop", "pianostop", true, 1); 
}
 
void pianotimer(string &in asTimer) 
{ 
PlaySoundAtEntity("piano", "general_piano03", "piano", 0, false); 
AddTimer("pianotimer", 18, "pianotimer"); 
}
 
void pianostop(string &in asParent, string &in asChild, int alState) 
{  
StopSound("piano", 0); 
RemoveTimer("pianotimer"); 
SetLeverStuckState("piano", 0, true); 
AddPropImpulse("piano", 0, 0, 100, "world"); 
PlaySoundAtEntity("piano", "break_wood", "piano", 0, false); 
CreateParticleSystemAtEntity("", "st_impact.ps", "impact", false); 
}
			  
			
			
			
				
(This post was last modified: 02-04-2012, 05:41 PM by Bors.)
 
				
			 
		 |  
	 
 | 
 
	| 02-04-2012, 05:29 PM  | 
	
		
	 | 
 
 
	
		
		S4n1tyM0rs0 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 14 
	Threads: 2 
	Joined: Feb 2012
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Piano Scare script problem. 
			 
			
				void OnStart() 
{ 
AddTimer("pianotimer", 0, "pianotimer"); 
AddEntityCollideCallback("player", "pianostop", "pianostop", true, 1); 
} 
 
void pianotimer(string &in asTimer) 
{ 
PlaySoundAtEntity("piano", "general_piano03", "piano", 0, false); 
AddTimer("pianotimer", 18, "pianotimer"); 
} 
 
void pianostop(string &in asParent, string &in asChild, int alState) 
{  
StopSound("piano", 0); 
RemoveTimer("pianotimer"); 
SetLeverStuckState("piano", -1, true); 
AddPropImpulse("piano", 0, 0, 100, "world"); 
PlaySoundAtEntity("piano", "break_wood", "piano", 0, false); 
CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "impact", false); 
} 
			 
			
			
			
		 |  
	 
 | 
 
	| 02-04-2012, 05:41 PM  | 
	
		
	 | 
 
 
	
		
		Bors 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 6 
	Threads: 2 
	Joined: Feb 2012
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Piano Scare script problem. 
			 
			
				 (02-04-2012, 05:41 PM)S4n1tyM0rs0 Wrote:  void OnStart() 
{ 
AddTimer("pianotimer", 0, "pianotimer"); 
AddEntityCollideCallback("player", "pianostop", "pianostop", true, 1); 
} 
 
void pianotimer(string &in asTimer) 
{ 
PlaySoundAtEntity("piano", "general_piano03", "piano", 0, false); 
AddTimer("pianotimer", 18, "pianotimer"); 
} 
 
void pianostop(string &in asParent, string &in asChild, int alState) 
{  
StopSound("piano", 0); 
RemoveTimer("pianotimer"); 
SetLeverStuckState("piano", -1, true); 
AddPropImpulse("piano", 0, 0, 100, "world"); 
PlaySoundAtEntity("piano", "break_wood", "piano", 0, false); 
CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "impact", false); 
} yes you have right i think, i did test but it still didnt work :/
 
thanks for the help tho.
			  
			
			
			
		 |  
	 
 | 
 
	| 02-04-2012, 05:46 PM  | 
	
		
	 | 
 
 
	
		
		Elven 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 862 
	Threads: 37 
	Joined: Aug 2011
	
 Reputation: 
26
		
	 | 
	
		
			
RE: Piano Scare script 
			 
			
				player has to be with capital letter Player, I think   
			 
			
			
 
			
		 |  
	 
 | 
 
	| 02-04-2012, 09:45 PM  | 
	
		
	 | 
 
 
	
		
		Ninami 
 
 
		
			Member 
			
			
			
 
			
	Posts: 59 
	Threads: 6 
	Joined: Feb 2012
	
 Reputation: 
2
		
	 | 
	
		
			
RE: Piano Scare script 
			 
			
				void OnStart() { AddTimer("pianotimer", 0, "pianotimer"); AddEntityCollideCallback("player", "pianostop", "pianostop", true, 1); } 
 
 
is the name for the Area that stops the music "pianostop"?
 
If it is then you should try changing the name since you have 1 function and 1 area with the same name.
			  
			
			
			
				
(This post was last modified: 02-04-2012, 09:53 PM by Ninami.)
 
				
			 
		 |  
	 
 | 
 
	| 02-04-2012, 09:52 PM  | 
	
		
	 | 
 
 
	
		
		Elven 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 862 
	Threads: 37 
	Joined: Aug 2011
	
 Reputation: 
26
		
	 | 
	
		
			
RE: Piano Scare script 
			 
			
				That cant be problem   . Function and area name can be same. I use that method a lot, since I am lazy to think new names   .
			  
			
			
 
			
		 |  
	 
 | 
 
	| 02-04-2012, 10:03 PM  | 
	
		
	 | 
 
 
	
		
		Ninami 
 
 
		
			Member 
			
			
			
 
			
	Posts: 59 
	Threads: 6 
	Joined: Feb 2012
	
 Reputation: 
2
		
	 | 
	
		
			
RE: Piano Scare script 
			 
			
				Oh didn't know that    Sorry for misleading hah
			  
			
			
			
		 |  
	 
 | 
 
	| 02-05-2012, 01:20 PM  | 
	
		
	 | 
 
 
	
		
		Elven 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 862 
	Threads: 37 
	Joined: Aug 2011
	
 Reputation: 
26
		
	 | 
	
		
			
RE: Piano Scare script 
			 
			
				NP, we all study one or two things   
			 
			
			
 
			
		 |  
	 
 | 
 
	| 02-05-2012, 02:07 PM  | 
	
		
	 | 
 
 
	
		
		Bors 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 6 
	Threads: 2 
	Joined: Feb 2012
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Piano Scare script 
			 
			
				Its now fixed!    thanks for everything tho   
			 
			
			
			
		 |  
	 
 | 
 
	| 02-05-2012, 10:22 PM  | 
	
		
	 | 
 
 
	 
 |