Saren 
 
 
		
			Member 
			
			
			
 
			
	Posts: 196 
	Threads: 20 
	Joined: Jan 2012
	
 Reputation: 
1
		
	 | 
	
		
			
Nothing happens 
			 
			
				Hey guys, so I wanted to try out the script where you pick up an item and a monster spawns.... yet it don't work even though I watched Your Computers tut on it... here's da script: 
void OnStart() 
{ 
SetEntityPlayerInteractCallback("Upperfloorkey", "ActivateMonster", true); 
} 
 
 
//Spawn Infected 
void ActivateMonster(string &in item) 
{ 
SetEntityActive("character_infected_1", true); 
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_1", 2, ""); 
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_2", 0, ""); 
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_3", 0, ""); 
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_4", 0, ""); 
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_5", 0, ""); 
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_6", 0, ""); 
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_7", 0, ""); 
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_8", 0, ""); 
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_9", 0, ""); 
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_10", 0, ""); 
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_11", 0, ""); 
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_12", 0, ""); 
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_13", 0, ""); 
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_14", 0, ""); 
} 
void Despawncharacter_infected_1(string &in asParent , string &in asChild , int alState) 
{ 
SetEntityActive("character_infected_1", false); 
} 
 
void OnLeave() 
{ 
} 
			 
			
			
 
			
		 |  
	 
 | 
 
	| 03-27-2012, 05:04 PM  | 
	
		
	 | 
 
 
	
		
		ClayPigeon 
 
 
		
			Member 
			
			
			
 
			
	Posts: 214 
	Threads: 13 
	Joined: Mar 2012
	
 Reputation: 
8
		
	 | 
	
		
			
RE: Nothing happens 
			 
			
				It should be a callback func, not an interaction func. 
Here:
 void OnStart() 
{     
    SetEntityCallbackFunc("Upperfloorkey", "ActivateMonster"); 
} 
 
void ActivateMonster(string &in asEntity, string &in type) 
{     
    if(type == "OnPickup")     
    {         
        SetEntityActive("character_infected_1", true);         
        for(int i = 1; i < 15; i++)         
        {             
            AddEnemyPatrolNode("character_infected_1", "PathNodeArea_"+i", 0, "");         
        }     
    } 
}
  
			 
			
			
			
				
(This post was last modified: 03-27-2012, 05:19 PM by ClayPigeon.)
 
				
			 
		 |  
	 
 | 
 
	| 03-27-2012, 05:17 PM  | 
	
		
	 | 
 
 
	
		
		Saren 
 
 
		
			Member 
			
			
			
 
			
	Posts: 196 
	Threads: 20 
	Joined: Jan 2012
	
 Reputation: 
1
		
	 | 
	
		
			
RE: Nothing happens 
			 
			
				 (03-27-2012, 05:17 PM)ClayPigeon Wrote:  It should be a callback func, not an interaction func. 
 
Here: 
 
void OnStart() 
{     
    SetEntityCallbackFunc("Upperfloorkey", "ActivateMonster"); 
} 
 
void ActivateMonster(string &in asEntity, string &in type) 
{     
    if(type == "OnPickup")     
    {         
        SetEntityActive("character_infected_1", true);         
        for(int i = 1; i < 15; i++)         
        {             
            AddEnemyPatrolNode("character_infected_1", "PathNodeArea_"+i", 0, "");         
        }     
    } 
}
  Thx man, Ima try that 
EDIT: (1.1) No matching signatures to void OnEnter() 
(30.1) unexpected end of file
			  
			
			
 
			
				
(This post was last modified: 03-27-2012, 06:17 PM by Saren.)
 
				
			 
		 |  
	 
 | 
 
	| 03-27-2012, 06:06 PM  | 
	
		
	 | 
 
 
	
		
		SilentStriker 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 950 
	Threads: 26 
	Joined: Jul 2011
	
 Reputation: 
43
		
	 | 
	
		
			
RE: Nothing happens 
			 
			
				It should actually work with the interactcallback but try Claypigeon's code  
  
I found what's wrong with your code 
 
it's (string &in item) 
 
it's supposed to be (string &in asEntity) 
 
and the despawn_character_infected doesn't go anywhere nothing calls that function. 
			
			
			
 
			
				
(This post was last modified: 03-27-2012, 06:09 PM by SilentStriker.)
 
				
			 
		 |  
	 
 | 
 
	| 03-27-2012, 06:07 PM  | 
	
		
	 | 
 
 
	
		
		ClayPigeon 
 
 
		
			Member 
			
			
			
 
			
	Posts: 214 
	Threads: 13 
	Joined: Mar 2012
	
 Reputation: 
8
		
	 | 
	
		
			
RE: Nothing happens 
			 
			
				 (03-27-2012, 06:07 PM)SilentStriker Wrote:  It should actually work with the interactcallback but try Claypigeon's code  
 
I found what's wrong with your code 
 
it's (string &in item) 
 
it's supposed to be (string &in asEntity) 
 
and the despawn_character_infected doesn't go anywhere nothing calls that function. I noticed that also but anyway I think PickUp will be a better way, but whatever floats your boat...
			  
			
			
			
		 |  
	 
 | 
 
	| 03-27-2012, 06:22 PM  | 
	
		
	 | 
 
 
	
		
		Saren 
 
 
		
			Member 
			
			
			
 
			
	Posts: 196 
	Threads: 20 
	Joined: Jan 2012
	
 Reputation: 
1
		
	 | 
	
		
			
RE: Nothing happens 
			 
			
				Yea.... made the script work but not the monster spawning business... 
			 
			
			
 
			
		 |  
	 
 | 
 
	| 03-27-2012, 06:41 PM  | 
	
		
	 | 
 
 
	
		
		ClayPigeon 
 
 
		
			Member 
			
			
			
 
			
	Posts: 214 
	Threads: 13 
	Joined: Mar 2012
	
 Reputation: 
8
		
	 | 
	
		
			
RE: Nothing happens 
			 
			
				 (03-27-2012, 06:41 PM)Saren Wrote:  Yea.... made the script work but not the monster spawning business... Isn't the spawning business all the script? What works besides it? 
			  
			
			
			
		 |  
	 
 | 
 
	| 03-27-2012, 06:48 PM  | 
	
		
	 | 
 
 
	
		
		Your Computer 
 
 
		
			SCAN ME! 
			
			
			
 
			
	Posts: 3,456 
	Threads: 32 
	Joined: Jul 2011
	
 Reputation: 
235
		
	 | 
	
		
			
RE: Nothing happens 
			 
			
				 (03-27-2012, 06:07 PM)SilentStriker Wrote:  I found what's wrong with your code 
 
it's (string &in item) 
 
it's supposed to be (string &in asEntity) 
Parameter names are irrelevant. You could have something like this:
 void Function(string &in, int) { } 
 
 
and the engine won't complain about missing parameter variables. 
			  
			
			
 
			
				
(This post was last modified: 03-27-2012, 06:52 PM by Your Computer.)
 
				
			 
		 |  
	 
 | 
 
	| 03-27-2012, 06:52 PM  | 
	
		
	 | 
 
 
	
		
		Saren 
 
 
		
			Member 
			
			
			
 
			
	Posts: 196 
	Threads: 20 
	Joined: Jan 2012
	
 Reputation: 
1
		
	 | 
	
		
			
RE: Nothing happens 
			 
			
				 (03-27-2012, 06:48 PM)ClayPigeon Wrote:   (03-27-2012, 06:41 PM)Saren Wrote:  Yea.... made the script work but not the monster spawning business... Isn't the spawning business all the script? What works besides it? Well the key works and stuff, and there's no FATAL ERROR.... the monster just don't spawn
			  
			
			
 
			
		 |  
	 
 | 
 
	| 03-27-2012, 06:54 PM  | 
	
		
	 | 
 
 
	
		
		SilentStriker 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 950 
	Threads: 26 
	Joined: Jul 2011
	
 Reputation: 
43
		
	 | 
	
		
			
RE: Nothing happens 
			 
			
				 (03-27-2012, 06:52 PM)Your Computer Wrote:   (03-27-2012, 06:07 PM)SilentStriker Wrote:  I found what's wrong with your code 
 
it's (string &in item) 
 
it's supposed to be (string &in asEntity)  
Parameter names are irrelevant. You could have something like this: 
 
void Function(string &in, int) { } 
 
  
and the engine won't complain about missing parameter variables. Cool I just learn't something new    So when ever you use a callback you just write (string &in, int) and it should work?   
			 
			
			
 
			
		 |  
	 
 | 
 
	| 03-27-2012, 07:13 PM  | 
	
		
	 | 
 
 
	 
 |