SonOfLiberty796 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 371 
	Threads: 39 
	Joined: Aug 2011
	
 Reputation: 
2
		
	 | 
	
		
			
Drain sanity while looking at something? 
			 
			
				Yet another question I have. Can someone help me and explain how to drain the players sanity when he is looking at something? Like, if he looks at a dead body part (torso or whatever else) he starts to drain sanity, but when he looks away, the draining stops. 
 
Please help and thanks.
			 
			
			
			
		 |  
	 
 | 
 
	| 09-21-2011, 02:44 AM  | 
	
		
	 | 
 
 
	
		
		Your Computer 
 
 
		
			SCAN ME! 
			
			
			
 
			
	Posts: 3,456 
	Threads: 32 
	Joined: Jul 2011
	
 Reputation: 
235
		
	 | 
	
		
			
RE: Drain sanity while looking at something? 
			 
			
				I haven't used them yet, but you might want to try insanity areas.
			 
			
			
 
			
		 |  
	 
 | 
 
	| 09-21-2011, 02:56 AM  | 
	
		
	 | 
 
 
	
		
		SonOfLiberty796 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 371 
	Threads: 39 
	Joined: Aug 2011
	
 Reputation: 
2
		
	 | 
	
		
			
RE: Drain sanity while looking at something? 
			 
			
				 (09-21-2011, 02:56 AM)Your Computer Wrote:  I haven't used them yet, but you might want to try insanity areas. Insanity areas? I suppose those script functions are on the wiki correct? But how do I use them?
			  
			
			
			
		 |  
	 
 | 
 
	| 09-21-2011, 03:00 AM  | 
	
		
	 | 
 
 
	
		
		Rapture 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 1,078 
	Threads: 79 
	Joined: May 2011
	
 Reputation: 
30
		
	 | 
	
		
			
RE: Drain sanity while looking at something? 
			 
			
				I think the insanity areas are only triggered when your Insanity is low (25 or less I think). Thats how I've seem them work so far, you get a random sound played back at you. 
 
I've tried placing multiple ones close to eachother (5 seconds apart) but the 2nd or 3rd one won't trigger. 
 
			 
			
			
			
		 |  
	 
 | 
 
	| 09-21-2011, 03:07 AM  | 
	
		
	 | 
 
 
	
		
		SonOfLiberty796 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 371 
	Threads: 39 
	Joined: Aug 2011
	
 Reputation: 
2
		
	 | 
	
		
			
RE: Drain sanity while looking at something? 
			 
			
				 (09-21-2011, 03:07 AM)Rapture Wrote:  I think the insanity areas are only triggered when your Insanity is low (25 or less I think). Thats how I've seem them work so far, you get a random sound played back at you. 
 
I've tried placing multiple ones close to eachother (5 seconds apart) but the 2nd or 3rd one won't trigger. Ohhh...Well isnt there another way to do what I mentioned without insanity areas? 
			  
			
			
			
		 |  
	 
 | 
 
	| 09-21-2011, 03:08 AM  | 
	
		
	 | 
 
 
	
		
		Your Computer 
 
 
		
			SCAN ME! 
			
			
			
 
			
	Posts: 3,456 
	Threads: 32 
	Joined: Jul 2011
	
 Reputation: 
235
		
	 | 
	
		
			
RE: Drain sanity while looking at something? 
			 
			
				 (09-21-2011, 03:08 AM)Xvideogamer720X Wrote:  Ohhh...Well isnt there another way to do what I mentioned without insanity areas? 
Possibly:
 void LowerSanity(string &in entity, int state) 
{ 
     if (entity == "script_area_name" && state == 1) 
     { 
          LowerSanity(entity); 
     } 
 
     else RemoveTimer(entity); 
} 
 
void LowerSanity(string &in timer_name) 
{ 
     GiveSanityDamage(1, false); 
     AddTimer(timer_name, 1, "LowerSanity"); 
}
  
SetEntityPlayerLookAtCallback("script_area_name", "LowerSanity", false);
   
			 
			
			
 
			
				
(This post was last modified: 09-21-2011, 03:26 AM by Your Computer.)
 
				
			 
		 |  
	 
 | 
 
	| 09-21-2011, 03:22 AM  | 
	
		
	 | 
 
 
	
		
		MrBigzy 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 616 
	Threads: 18 
	Joined: Mar 2011
	
 Reputation: 
8
		
	 | 
	
		
			
RE: Drain sanity while looking at something? 
			 
			
				Insanity areas just make a random insanity event happen, from a predefined list. You can look at and choose an event while in the debug menu too. Things like flies on the screen, screen going red, Daniel talking to himself, that sort of thing. 
			 
			
			
			
				
(This post was last modified: 09-21-2011, 03:37 AM by MrBigzy.)
 
				
			 
		 |  
	 
 | 
 
	| 09-21-2011, 03:37 AM  | 
	
		
	 | 
 
 
	
		
		Homicide13 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 323 
	Threads: 41 
	Joined: Nov 2010
	
 Reputation: 
14
		
	 | 
	
		
			
RE: Drain sanity while looking at something? 
			 
			
				So first what you're going to do is make a script area to cover the object that drains the person's insanity. 
Then you use the  
SetEntityPlayerLookAtCallback(string& asName, string& asCallback, bool abRemoveWhenLookedAt); function to check if the player is looking at it. Make sure abRemoveWhenLookedAt is false, and have it call a function that starts a timer function that drains the player's sanity when alState is 1 and removes the timer when alState is -1. You can add in sound effects and screen distortion effects etc too if you would like. 
 
make sense? 
			 
			
			
 
			
				
(This post was last modified: 09-21-2011, 08:52 PM by Homicide13.)
 
				
			 
		 |  
	 
 | 
 
	| 09-21-2011, 08:52 PM  | 
	
		
	 | 
 
 
	
		
		SonOfLiberty796 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 371 
	Threads: 39 
	Joined: Aug 2011
	
 Reputation: 
2
		
	 | 
	
		
			
RE: Drain sanity while looking at something? 
			 
			
				Alright Ill try some of these methods out. Thanks guys
			 
			
			
			
		 |  
	 
 | 
 
	| 09-23-2011, 02:24 AM  | 
	
		
	 | 
 
 
	 
 |