KHShox 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 28 
	Threads: 11 
	Joined: Apr 2011
	
 Reputation: 
0
		
	 | 
	
		
			
I want the player to react to a door that closes. 
			 
			
				I have been trying to get my player to react when a door closes. The door closes perfectly, and I have tried looking at many forums, videos, and the wiki. None of which really helped me. Here is the current code that I have. 
Yes, I also added a scream to the script.
 Quote://////////////////////////// 
// Run when entering map 
void OnEnter() 
{ 
	 
} 
  
//////////////////////////// 
// Run when leaving map 
void OnLeave() 
{ 
  
} 
 
//////////////////////////// 
// Run first time starting map 
void OnStart() 
{ 
	AddEntityCollideCallback("Player", "DoorClose", "CollideScript", true, 1);  
} 
 
void CollideScript(string &in asParent, string &in asChild, int alState) 
{ 
	SetSwingDoorClosed("castle_2", true, true); 
 
 
	 
	AddEntityCollideCallback("Player", "DoorClose", "ScriptArea_2", true, 1); 
} 
void DoorClose(string &in asParent, string &in asChild, int alStates) 
{ 
   AddTimer("Timer", 6.0f, "ScriptArea_2_Trigger"); 
} 
 
void Scream_Trigger(string &in asTimer) 
{ 
   PlaySoundAtEntity("ScriptArea_2", "12_girl_scream.snt", "ScriptArea_2", 0, false); 
   PlaySoundAtEntity("ScriptArea_2", "react_scare.snt", "ScriptArea_2", 0, false); 
   StartPlayerLookAt("ScriptArea_2", 2, 2, ""); 
   AddTimer("Timer", 6.0f, "ScriptArea_2_Trigger"); 
} 
void ScriptArea_2_Trigger(string &in asParent, string &in asChild, int alStates) 
{ 
   StopPlayerLookAt(); 
} 
			 
			
			
 
![[Image: bf3_sig-1298673357.jpg]](http://artificialanimation.com/upload/images/bf3_sig-1298673357.jpg)  
			
		 |  
	 
 | 
 
	| 04-03-2011, 09:01 PM  | 
	
		
	 | 
 
 
	
		
		Russ Money 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 360 
	Threads: 25 
	Joined: Dec 2010
	
 Reputation: 
4
		
	 | 
	
		
			
RE: I want the player to react to a door that closes. 
			 
			
				What do you mean by react?  Stifled breath?  The sanity damage effect?
			 
			
			
			
		 |  
	 
 | 
 
	| 04-03-2011, 09:33 PM  | 
	
		
	 | 
 
 
	
		
		KHShox 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 28 
	Threads: 11 
	Joined: Apr 2011
	
 Reputation: 
0
		
	 | 
	
		
			
RE: I want the player to react to a door that closes. 
			 
			
				 (04-03-2011, 09:33 PM)Russ Money Wrote:  What do you mean by react?  Stifled breath?  The sanity damage effect? 
I mean by having sanity damage and stifled breath.
			  
			
			
 
			
		 |  
	 
 | 
 
	| 04-03-2011, 10:18 PM  | 
	
		
	 | 
 
 
	
		
		Russ Money 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 360 
	Threads: 25 
	Joined: Dec 2010
	
 Reputation: 
4
		
	 | 
	
		
			
RE: I want the player to react to a door that closes. 
			 
			
				GiveSanityDamage(float afAmount, bool abUseEffect); 
 
Make sure the bool is true. 
 
And also, 
 
PlaySoundAtEntity("ScriptArea_2", "react_scare.snt", "ScriptArea_2", 0, false); 
 
If you wanted to play that so it seems like it's coming from the player, change it to 
 
PlaySoundAtEntity("ScriptArea_2", "react_scare.snt", "Player", 0, false);
			 
			
			
			
				
(This post was last modified: 04-03-2011, 10:42 PM by Russ Money.)
 
				
			 
		 |  
	 
 | 
 
	| 04-03-2011, 10:42 PM  | 
	
		
	 | 
 
 
	
		
		KHShox 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 28 
	Threads: 11 
	Joined: Apr 2011
	
 Reputation: 
0
		
	 | 
	
		
			
RE: I want the player to react to a door that closes. 
			 
			
				Ahh thanks man! This really helped a TON!
			 
			
			
 
			
		 |  
	 
 | 
 
	| 04-03-2011, 11:14 PM  | 
	
		
	 | 
 
 
	 
 |