Melvin 
 
 
		
			Member 
			
			
			
 
			
	Posts: 245 
	Threads: 38 
	Joined: Jun 2012
	
 Reputation: 
5
		
	 | 
	
		
			
  
I'm having trouble with the timer.. {Solved} 
			 
			
				I want to make a '''Bang on Door Effect'' 7 seconds after the event: void ArmScare( 
 
I've tried some stuff but it didn't worked out as planned... can anyone fix this? 
 
 
 
//////////////////////////// 
// Run first time starting map 
void OnStart() 
{ 
AddEntityCollideCallback("Player", "StairArea", "Sound", true, 1); 
SetEntityPlayerLookAtCallback("MonsterArm", "ArmScare", true); 
AddTimer(MonsterDoorSlam, 7, MonsterDoorSlam1); 
} 
 
void MonsterDoorSlam1(string &in asParent, string &in asChild, int alState) 
{ 
AddPropImpulse("Door01", 0, 0, 5, "World"); 
PlaySoundAtEntity("", "21_bang_door.snt", "Door01", 0, false); 
StartPlayerLookAt("BangDoor", 2, 2, ""); 
AddTimer("", 6, "AfterOwShit"); 
} 
 
void ArmScare(string &in asEntity, int alState)  
{ 
PlaySoundAtEntity("", "Ow_Shit", "Player", 0, false); 
GiveSanityDamage(8.0f, true); 
} 
 
 
void Sound(string &in asParent, string &in asChild, int alState) 
{ 
PlaySoundAtEntity("sound", "whatthehell", "StairArea", 0.0, false); 
} 
 
void OnEnter() 
{ 
PreloadSound("whatthehell"); 
} 
 
void OnLeave() 
{ 
 
}
			 
			
			
 
			
				
(This post was last modified: 08-08-2012, 02:05 AM by Melvin.)
 
				
			 
		 |  
	 
 | 
 
	| 08-07-2012, 11:14 PM  | 
	
		
	 | 
 
 
	
		
		Ongka 
 
 
		
			Member 
			
			
			
 
			
	Posts: 225 
	Threads: 3 
	Joined: Nov 2010
	
 Reputation: 
20
		
	 | 
	
		
			
Solution 
			 
			
				void OnStart() 
{ 
AddEntityCollideCallback("Player", "StairArea", "Sound", true, 1); 
SetEntityPlayerLookAtCallback("MonsterArm", "ArmScare", true); 
} 
 
void MonsterDoorSlam1(string &in asParent, string &in asChild, int alState) 
{ 
AddPropImpulse("Door01", 0, 0, 5, "World"); 
PlaySoundAtEntity("", "21_bang_door.snt", "Door01", 0, false); 
StartPlayerLookAt("BangDoor", 2, 2, ""); 
AddTimer("", 6, "AfterOwShit"); 
} 
 
void ArmScare(string &in asEntity, int alState)  
{ 
PlaySoundAtEntity("", "Ow_Shit", "Player", 0, false); 
GiveSanityDamage(8.0f, true); 
AddTimer(MonsterDoorSlam, 7, MonsterDoorSlam1);  
} 
 
void Sound(string &in asParent, string &in asChild, int alState) 
{ 
PlaySoundAtEntity("sound", "whatthehell", "StairArea", 0.0, false); 
} 
 
void OnEnter() 
{ 
PreloadSound("whatthehell"); 
} 
 
void OnLeave() 
{ 
 
} 
 
Your script plays 7 seconds after the map starts, with this script it happens 7 seconds after the ArmScare.
			 
			
			
 
			
		 |  
	 
 | 
 
	| 08-07-2012, 11:53 PM  | 
	
		
	 | 
 
 
	
		
		Melvin 
 
 
		
			Member 
			
			
			
 
			
	Posts: 245 
	Threads: 38 
	Joined: Jun 2012
	
 Reputation: 
5
		
	 | 
	
		
			
RE: Solution 
			 
			
				 (08-07-2012, 11:53 PM)Ongka Wrote:  void OnStart() 
{ 
AddEntityCollideCallback("Player", "StairArea", "Sound", true, 1); 
SetEntityPlayerLookAtCallback("MonsterArm", "ArmScare", true); 
} 
 
void MonsterDoorSlam1(string &in asParent, string &in asChild, int alState) 
{ 
AddPropImpulse("Door01", 0, 0, 5, "World"); 
PlaySoundAtEntity("", "21_bang_door.snt", "Door01", 0, false); 
StartPlayerLookAt("BangDoor", 2, 2, ""); 
AddTimer("", 6, "AfterOwShit"); 
} 
 
void ArmScare(string &in asEntity, int alState)  
{ 
PlaySoundAtEntity("", "Ow_Shit", "Player", 0, false); 
GiveSanityDamage(8.0f, true); 
AddTimer(MonsterDoorSlam, 7, MonsterDoorSlam1);  
} 
 
void Sound(string &in asParent, string &in asChild, int alState) 
{ 
PlaySoundAtEntity("sound", "whatthehell", "StairArea", 0.0, false); 
} 
 
void OnEnter() 
{ 
PreloadSound("whatthehell"); 
} 
 
void OnLeave() 
{ 
 
} 
 
Your script plays 7 seconds after the map starts, with this script it happens 7 seconds after the ArmScare. Ohwwwww dangit I didn't see that. Anyway, I get the following fatal Error : DoorMonsterSlam is not declared?
			  
			
			
 
			
		 |  
	 
 | 
 
	| 08-08-2012, 12:02 AM  | 
	
		
	 | 
 
 
	
		
		MyRedNeptune 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 553 
	Threads: 3 
	Joined: May 2012
	
 Reputation: 
33
		
	 | 
	
		
			
RE: Solution 
			 
			
				I think you forgot the quotes: 
 
AddTimer("MonsterDoorSlam", 7, "MonsterDoorSlam1");  
 
^^
			 
			
			
 
^(;,;)^ 
			
		 |  
	 
 | 
 
	| 08-08-2012, 12:29 AM  | 
	
		
	 | 
 
 
	
		
		Kazakarumariou 
 
 
		
			An angry man. 
			
			
			
 
			
	Posts: 283 
	Threads: 8 
	Joined: Jul 2012
	
 Reputation: 
14
		
	 | 
	
		
			
RE: I'm having trouble with the timer.. 
			 
			
				You have two threads?! I posted on the second one
			 
			
			
			
		 |  
	 
 | 
 
	| 08-08-2012, 12:30 AM  | 
	
		
	 | 
 
 
	
		
		Your Computer 
 
 
		
			SCAN ME! 
			
			
			
 
			
	Posts: 3,456 
	Threads: 32 
	Joined: Jul 2011
	
 Reputation: 
235
		
	 | 
	
		
			
RE: I'm having trouble with the timer.. 
			 
			
				Don't create multiple topics on the same issue!
			 
			
			
 
			
		 |  
	 
 | 
 
	| 08-08-2012, 12:30 AM  | 
	
		
	 | 
 
 
	
		
		Melvin 
 
 
		
			Member 
			
			
			
 
			
	Posts: 245 
	Threads: 38 
	Joined: Jun 2012
	
 Reputation: 
5
		
	 | 
	
		
			
RE: I'm having trouble with the timer.. 
			 
			
				 (08-08-2012, 12:30 AM)Your Computer Wrote:  Don't create multiple topics on the same issue! Sorry I didn't wanted to start another subject on this thread..
  
 (08-08-2012, 12:30 AM)Harthex Wrote:  You have two threads?! I posted on the second one I didn't wanted to start another subject on this thread. But anyways, what did you post on there? It got removed so I can't go check it out.
			  
			
			
 
			
				
(This post was last modified: 08-08-2012, 12:36 AM by Melvin.)
 
				
			 
		 |  
	 
 | 
 
	| 08-08-2012, 12:31 AM  | 
	
		
	 | 
 
 
	
		
		Kazakarumariou 
 
 
		
			An angry man. 
			
			
			
 
			
	Posts: 283 
	Threads: 8 
	Joined: Jul 2012
	
 Reputation: 
14
		
	 | 
	
		
			
RE: I'm having trouble with the timer.. 
			 
			
				 (08-08-2012, 12:31 AM)SmokeMelvin Wrote:   (08-08-2012, 12:30 AM)Harthex Wrote:  You have two threads?! I posted on the second one I didn't wanted to start another subject on this thread. But anyways, what did you post on there? It got removed so I can't go check it out. I had a whole script set up for you  
ill repost it in just a second.
 
 
void ArmScare(string &in asEntity, int alState)  
{ 
PlaySoundAtEntity("", "Ow_Shit", "Player", 0, false); 
GiveSanityDamage(8.0f, true);  
AddTimer("1", 7, "MonsterDoorSlam1"); 
}
 
void MonsterDoorSlam1(string &in asTimer) 
{ 
if(asTimer == "1"){ 
AddPropImpulse("Door01", 0, 0, 5, "World"); 
PlaySoundAtEntity("", "21_bang_door.snt", "Door01", 0, false); 
StartPlayerLookAt("BangDoor", 2, 2, ""); 
AddTimer("", 6, "AfterOwShit");  
} 
}
			  
			
			
			
				
(This post was last modified: 08-08-2012, 12:41 AM by Kazakarumariou.)
 
				
			 
		 |  
	 
 | 
 
	| 08-08-2012, 12:40 AM  | 
	
		
	 | 
 
 
	
		
		Your Computer 
 
 
		
			SCAN ME! 
			
			
			
 
			
	Posts: 3,456 
	Threads: 32 
	Joined: Jul 2011
	
 Reputation: 
235
		
	 | 
	
		
			
RE: I'm having trouble with the timer.. 
			 
			
				It's not a different subject, since it follows directly from your timer.
			 
			
			
 
			
		 |  
	 
 | 
 
	| 08-08-2012, 12:42 AM  | 
	
		
	 | 
 
 
	
		
		Melvin 
 
 
		
			Member 
			
			
			
 
			
	Posts: 245 
	Threads: 38 
	Joined: Jun 2012
	
 Reputation: 
5
		
	 | 
	
		
			
RE: I'm having trouble with the timer.. 
			 
			
				 (08-08-2012, 12:42 AM)Your Computer Wrote:  It's not a different subject, since it follows directly from your timer. Yea.. If you put it that way..this is the first forum I've ever joined and I didn't want to take any risks.  
I'll think twice before posting again in the future.
 
My apologies.
  
 (08-08-2012, 12:40 AM)Harthex Wrote:   (08-08-2012, 12:31 AM)SmokeMelvin Wrote:   (08-08-2012, 12:30 AM)Harthex Wrote:  You have two threads?! I posted on the second one I didn't wanted to start another subject on this thread. But anyways, what did you post on there? It got removed so I can't go check it out. I had a whole script set up for you  
ill repost it in just a second. 
 
void ArmScare(string &in asEntity, int alState)  
{ 
PlaySoundAtEntity("", "Ow_Shit", "Player", 0, false); 
GiveSanityDamage(8.0f, true);  
AddTimer("1", 7, "MonsterDoorSlam1"); 
} 
 
void MonsterDoorSlam1(string &in asTimer) 
{ 
if(asTimer == "1"){ 
AddPropImpulse("Door01", 0, 0, 5, "World"); 
PlaySoundAtEntity("", "21_bang_door.snt", "Door01", 0, false); 
StartPlayerLookAt("BangDoor", 2, 2, ""); 
AddTimer("", 6, "AfterOwShit");  
} 
} Its worked! Thanks bro I'll add another reputation for you   
 
 (08-08-2012, 12:40 AM)Harthex Wrote:   (08-08-2012, 12:31 AM)SmokeMelvin Wrote:   (08-08-2012, 12:30 AM)Harthex Wrote:  You have two threads?! I posted on the second one I didn't wanted to start another subject on this thread. But anyways, what did you post on there? It got removed so I can't go check it out. I had a whole script set up for you  
ill repost it in just a second. 
 
void ArmScare(string &in asEntity, int alState)  
{ 
PlaySoundAtEntity("", "Ow_Shit", "Player", 0, false); 
GiveSanityDamage(8.0f, true);  
AddTimer("1", 7, "MonsterDoorSlam1"); 
} 
 
void MonsterDoorSlam1(string &in asTimer) 
{ 
if(asTimer == "1"){ 
AddPropImpulse("Door01", 0, 0, 5, "World"); 
PlaySoundAtEntity("", "21_bang_door.snt", "Door01", 0, false); 
StartPlayerLookAt("BangDoor", 2, 2, ""); 
AddTimer("", 6, "AfterOwShit");  
} 
} the Player keeps looking at the door.. how do I fix this?
			  
			
			
 
			
				
(This post was last modified: 08-08-2012, 01:05 AM by Melvin.)
 
				
			 
		 |  
	 
 | 
 
	| 08-08-2012, 12:51 AM  | 
	
		
	 | 
 
 
	 
 |