woot903 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 5 
	Threads: 2 
	Joined: Mar 2012
	
 Reputation: 
0
		
	 | 
	
		
			
  
Amnesia Level Editor: AREA SCRIPTS NOT WORKING 
			 
			
				For some odd 
reason all of my area scripts work except for any new ones I try to create. All 
of the entity collide callbacks used refer to script areas. Please take a look 
at my code and you will notice the test_this function and scare_light function. 
BOTH of these functions do not work. What I mean by that is that clearly in the 
game the player will collide with these areas but nothing at all will happen. I 
have double checked spelling and such and all is good. I even enabled physics 
debug to make sure that the player actually collides with the invisible script 
area (which they do) and still haven't found the problem. All other functions 
and script areas work fine.
If someone 
could please help me debug this little problem I would appreciate a lot!  
Thanks,
Woot903
MY SCRIPT:
Quote:void OnStart () 
{ 
PlayMusic("02_amb_strange.ogg", true, .8, 0, 1, true); 
AddEntityCollideCallback("Player", "scare_1_trig", "MonsterFunction", true, 1);  
SetEntityCallbackFunc("key_1", "scare_2_trig"); 
AddEntityCollideCallback("Player", "testing", "test_this", true, 1);  
AddEntityCollideCallback("Player", "scare_3", "scare_light", true, 1); 
AddEntityCollideCallback("Player", "scare_2_text", "scare_2_t", true, 1); 
SetEntityActive("scare_3_trig1", true); 
//DEBUG (DEVELOPER TOOLS) 
 
} 
 
//Functions 
void test_this(string &in asEntity, string &in type) 
{ 
SetEntityActive("test", true); 
} 
void scare_light(string &in asEntity, string &in type) 
{ 
SetLampLit("r1", true, true); 
} 
void MonsterFunction(string &in asParent, string &in asChild, int alState) 
{ 
PlaySoundAtEntity("", "react_scare.snt", "Player", 0.0F, false); 
PlaySoundAtEntity("", "amb_alert.snt", "scare_1", 0.0F, false); 
PlaySoundAtEntity("", "react_pant.snt", "Player", 0.0F, false); 
GiveSanityDamage(50.0f, true); 
 
SetEntityActive("scare_1", true);  
AddEnemyPatrolNode("scare_1", "PathNodeArea_1", 0, ""); 
} 
 
void scare_2_trig(string &in asEntity, string &in type) 
{ 
//removes items from room and creates statue when script area is triggered 
SetEntityActive("c1", false); 
SetEntityActive("c2", false); 
SetEntityActive("c3", false); 
SetEntityActive("c4", false); 
SetEntityActive("c5", false); 
SetEntityActive("c6", false); 
SetEntityActive("c7", false); 
SetEntityActive("c8", false); 
SetEntityActive("c9", false); 
SetEntityActive("c10", false); 
SetEntityActive("c11", false); 
SetEntityActive("c12", false); 
SetEntityActive("c13", false); 
SetEntityActive("c14", false); 
SetEntityActive("c15", false); 
SetEntityActive("c16", false); 
SetEntityActive("c17", false); 
SetEntityActive("c18", false); 
SetEntityActive("c19", false); 
SetEntityActive("c20", false); 
SetEntityActive("c21", false); 
SetEntityActive("c22", false); 
SetEntityActive("c23", false); 
SetEntityActive("c24", false); 
SetEntityActive("c25", false); 
SetEntityActive("c26", false); 
SetEntityActive("c27", false); 
SetEntityActive("c28", false); 
SetEntityActive("c29", false); 
SetEntityActive("c30", false); 
SetEntityActive("c31", false); 
 
SetEntityActive("t1", false); 
SetEntityActive("t2", false); 
SetEntityActive("t3", false); 
SetEntityActive("t4", false); 
//tables incactive 
SetEntityActive("scare_2_by", false); 
SetEntityActive("scare_2_text", true); 
SetEntityActive("scare_2_shad", true); 
SetEntityActive("scare_2_stat", true); 
SetLightVisible("scare_2_light", true); 
SetLightVisible("scare_2_light_2", true); 
//turns off lights 
SetLightVisible("c32", false); 
SetLightVisible("c33", false); 
} 
 
void scare_2_t(string &in asParent, string &in asChild, int alState) 
{ 
SetMessage("Messages", "Popup2", 6); 
} 
			 
			
			
			
		 |  
	 
 | 
 
	| 03-06-2012, 04:05 AM  | 
	
		
	 | 
 
 
	
		
		Mackiiboy 
 
 
		
			Member 
			
			
			
 
			
	Posts: 101 
	Threads: 7 
	Joined: Jan 2012
	
 Reputation: 
11
		
	 | 
	
		
			
RE: Amnesia Level Editor: AREA SCRIPTS NOT WORKING 
			 
			
				 (03-06-2012, 04:05 AM)woot903 Wrote:  If someone could please help me debug this little problem I would appreciate a lot!  Thanks,Woot903 .
Callback syntax must be:  void MyFunc(string &in asParent, string &in asChild, int alState) when you are using "AddEntityCollideCallback". So change for example;  void test_this(string &in asEntity, string &in type) to  void test_this(string &in asParent, string &in asChild, int alState) 
			 
			
			
			
		 |  
	 
 | 
 
	| 03-06-2012, 09:51 PM  | 
	
		
	 | 
 
 
	
		
		woot903 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 5 
	Threads: 2 
	Joined: Mar 2012
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Amnesia Level Editor: AREA SCRIPTS NOT WORKING 
			 
			
				Thank You Very Much! I'll be sure to check by syntax more accurately 
next time!
 
			 
			
			
			
		 |  
	 
 | 
 
	| 03-08-2012, 04:32 AM  | 
	
		
	 | 
 
 
	 
 |