Sudden 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 10 
	Threads: 4 
	Joined: Jan 2011
	
 Reputation: 
0
		
	 | 
	
		
			
Monster appear 
			 
			
				How do i make a monster appear from nowhere and start patroling when i enter a area?
			 
			
			
			
		 |  
	 
 | 
 
	| 01-29-2011, 11:54 AM  | 
	
		
	 | 
 
 
	
		
		Vradcly 
 
 
		
			Member 
			
			
			
 
			
	Posts: 100 
	Threads: 6 
	Joined: Jan 2011
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Monster appear 
			 
			
				Create the monster in your map and make sure its not active (there is a checkbox for that), create pathnodes for where you want the enemy patrol (areas, pathnode), make sure not to set the pathnodes to far apart. Then open your map script and add the first and last point in the enemy path inside void OnStart() 
{ 
AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_1",0.0f, ""); 
AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_50",0.0f, ""); 
} 
like that for example. 
 
Then create a area of type script and put it in your map where you want the player to be when the enemy activates. Then add a collide callback for that area: 
AddEntityCollideCallback("Player", "Script_Area_1", "CollideScript_Area_1", true, 1); 
Something like that. 
 
Then you put the CollideScript_Area_1 function outside of your OnStart(), ex above: 
 
void  CollideScript_Area_1(string &in asParent, string &in asChild, int alState)	 
{ 
 
} 
void OnStart() 
{ 
(lots of code) 
} 
 
and at last put the SetEntityActive("servant_grunt_1", true); inside your callision function: 
 
void  CollideScript_Area_1(string &in asParent, string &in asChild, int alState)	 
{ 
SetEntityActive("servant_grunt_1", true);  
} 
 
like that. Hope that helps, if not I suggest you look at the guides for this, there are lots of information out there...
			 
			
			
			
		 |  
	 
 | 
 
	| 01-29-2011, 01:01 PM  | 
	
		
	 | 
 
 
	
		
		Robby 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 2,549 
	Threads: 38 
	Joined: Jun 2009
	
 Reputation: 
47
		
	 | 
	
		
			
RE: Monster appear 
			 
			
				Here is a script file that I used as an example. 
//////////////////////////// 
// Run first time starting map 
void OnStart() 
{ 
     AddEntityCollideCallback("Player", "ScriptArea_1", "MonsterFunc1", true, 1); 
} 
void MonsterFunc1(string &in asParent, string &in asChild, int alState) 
{ 
     SetEntityActive("servant_grunt_1", true); 
} 
//////////////////////////// 
// Run when entering map 
void OnEnter() 
{ 
  
} 
//////////////////////////// 
// Run when leaving map 
void OnLeave() 
{ 
  
}
 
Notes: At the SetEntityActive line, you must use the monster's exact name.
 
If you have servant_grunt_1 in your level, for example, then you must use "servant_grunt_1" at the SetEntityActive line in the script file.
 
Just copy-paste the code, and check your entity and scriptarea in your map and in your script file.
			  
			
			
 
Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active. 
			
				
(This post was last modified: 01-29-2011, 01:05 PM by Robby.)
 
				
			 
		 |  
	 
 | 
 
	| 01-29-2011, 01:04 PM  | 
	
		
	 | 
 
 
	
		
		Sudden 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 10 
	Threads: 4 
	Joined: Jan 2011
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Monster appear 
			 
			
				It worked!    Thanks alot   
			 
			
			
			
		 |  
	 
 | 
 
	| 01-29-2011, 02:55 PM  | 
	
		
	 | 
 
 
	
		
		CrushedRaiD 
 
 
		
			Member 
			
			
			
 
			
	Posts: 115 
	Threads: 10 
	Joined: Dec 2010
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Monster appear 
			 
			
				Having problems with this script: 
 
//////////////////////////// 
// Run first time starting map 
void OnStart() 
{ 
     AddEntityCollideCallback("Player", "ScriptArea_1", "MonsterFunc1", true, 1); 
} 
void MonsterFunc1(string &in asParent, string &in asChild, int alState) 
{ 
     SetEntityActive("servant_grunt_1", true); 
} 
 
AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_1",0.0f, ""); 
AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_4",0.0f, ""); 
} 
//////////////////////////// 
// Run when entering map 
void OnEnter() 
{ 
 
} 
//////////////////////////// 
// Run when leaving map 
void OnLeave() 
{ 
 
} 
 
Any help plox =)[/quote]
			 
			
			
			
		 |  
	 
 | 
 
	| 02-05-2011, 08:35 AM  | 
	
		
	 | 
 
 
	
		
		Oscar House 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 302 
	Threads: 3 
	Joined: Nov 2010
	
 Reputation: 
9
		
	 | 
	
		
			
RE: Monster appear 
			 
			
				Your AddEnemyPatrolNodes are not in a function. 
void OnStart() 
{ 
AddEntityCollideCallback("Player", "ScriptArea_1", "MonsterFunc1", true, 1); 
} 
void MonsterFunc1(string &in asParent, string &in asChild, int alState) 
{ 
SetEntityActive("servant_grunt_1", true); 
AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_1",0.0f, ""); 
AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_4",0.0f, ""); 
} 
 
//////////////////////////// 
// Run when entering map 
void OnEnter() 
{ 
 
} 
//////////////////////////// 
// Run when leaving map 
void OnLeave() 
{ 
 
}
  
			 
			
			
 
			
		 |  
	 
 | 
 
	| 02-05-2011, 09:28 AM  | 
	
		
	 | 
 
 
	
		
		CrushedRaiD 
 
 
		
			Member 
			
			
			
 
			
	Posts: 115 
	Threads: 10 
	Joined: Dec 2010
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Monster appear 
			 
			
				 (02-05-2011, 09:28 AM)Oscar House Wrote:  Your AddEnemyPatrolNodes are not in a function. 
 
void OnStart() 
{ 
AddEntityCollideCallback("Player", "ScriptArea_1", "MonsterFunc1", true, 1); 
} 
void MonsterFunc1(string &in asParent, string &in asChild, int alState) 
{ 
SetEntityActive("servant_grunt_1", true); 
AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_1",0.0f, ""); 
AddEnemyPatrolNode("servant_grunt_1","PathNodeArea_4",0.0f, ""); 
} 
 
//////////////////////////// 
// Run when entering map 
void OnEnter() 
{ 
 
} 
//////////////////////////// 
// Run when leaving map 
void OnLeave() 
{ 
 
}
  Thank you ill try that one   
			 
			
			
			
		 |  
	 
 | 
 
	| 02-05-2011, 09:43 AM  | 
	
		
	 | 
 
 
	 
 |