| 
		
	
		| Synestral   Junior Member
 
 Posts: 4
 Threads: 3
 Joined: Aug 2011
 Reputation: 
0
 | 
			| Enemy path script issue 
 
				alright, so i have been trying to get an enemy to walk a path, and disapppear.  this is the script i have  void OnStart(){
 SetEntityPlayerInteractCallback("Monster_Key_1", "Spawn_Monster", true);
 }
 
 void Spawn_Monster(string &in entity)
 {
 SetEntityActive("servant_brute_1", true);
 void AddEnemyPatrolNode("servant_grunt_1", "Node_1", float 0, string& "");
 void AddEnemyPatrolNode("servant_grunt_1", "Node_2", float 0, string& "");
 void AddEnemyPatrolNode("servant_grunt_1", "Node_3", float 0, string& "");
 void AddEnemyPatrolNode("servant_grunt_1", "Node_4", float 0, string& "");
 void AddEnemyPatrolNode("servant_grunt_1", "Node_5", float 0, string& "");
 void AddEnemyPatrolNode("servant_grunt_1", "Node_6", float 0, string& "");
 void AddEnemyPatrolNode("servant_grunt_1", "Node_5", float 0, string& "");
 void AddEnemyPatrolNode("servant_grunt_1", "Node_4", float 0, string& "");
 void AddEnemyPatrolNode("servant_grunt_1", "Node_3", float 0, string& "");
 void AddEnemyPatrolNode("servant_grunt_1", "Node_2", float 0, string& "");
 }
 
 void MosterEnd(string &in asParent, string &in asChild, int alState)
 {
 SetEntityActive("servant_grunt_1", false);
 }
and i get this error
 
FATAL ERROR: could not load script file 
'custom_stories/Stalker?maps/Beginning.hps'! 
main (9,60) : ERR : Expected '(' 
main (10,60) : ERR : Expected '(' 
main (11,60) : ERR : Expected '(' 
main (12,60) : ERR : Expected '(' 
main (13,60) : ERR : Expected '(' 
main (14,60) : ERR : Expected '(' 
main (15,60) : ERR : Expected '(' 
main (16,60) : ERR : Expected '(' 
main (17,60) : ERR : Expected '(' 
main (18,60) : ERR : Expected '('
   
Does anyone know ehat i am doing wrong?
 
			 |  |  
	| 08-05-2011, 10:10 PM |  |  
	
		| MrCookieh   Member
 
 Posts: 157
 Threads: 8
 Joined: Jul 2011
 Reputation: 
0
 | 
			| RE: Enemy path script issue 
 
				Yours: void Spawn_Monster(string &in entity)
How it should be:
 void Spawn_Monster(string &in asEntity)
you forgot the 'as' in front of the entity, and you put an e instead of an E.
 
ah, and remove those 'string&', same with the 'float'
			
 
				
(This post was last modified: 08-05-2011, 10:24 PM by MrCookieh.)
 |  |  
	| 08-05-2011, 10:22 PM |  |  
	
		| Apjjm   Is easy to say
 
 Posts: 496
 Threads: 18
 Joined: Apr 2011
 Reputation: 
52
 | 
			| RE: Enemy path script issue 
 
				void OnStart(){
 SetEntityPlayerInteractCallback("Monster_Key_1", "Spawn_Monster", true);
 }
 
 void Spawn_Monster(string &in entity)
 {
 SetEntityActive("servant_brute_1", true);
 void AddEnemyPatrolNode("servant_grunt_1", "Node_1", 0,"");
 void AddEnemyPatrolNode("servant_grunt_1", "Node_2", 0,"");
 void AddEnemyPatrolNode("servant_grunt_1", "Node_3", 0,"");
 void AddEnemyPatrolNode("servant_grunt_1", "Node_4", 0,"");
 void AddEnemyPatrolNode("servant_grunt_1", "Node_5", 0,"");
 void AddEnemyPatrolNode("servant_grunt_1", "Node_6", 0,"");
 void AddEnemyPatrolNode("servant_grunt_1", "Node_5", 0,"");
 void AddEnemyPatrolNode("servant_grunt_1", "Node_4", 0,"");
 void AddEnemyPatrolNode("servant_grunt_1", "Node_3", 0,"");
 void AddEnemyPatrolNode("servant_grunt_1", "Node_2", 0,"");
 }
 
 void MosterEnd(string &in asParent, string &in asChild, int alState)
 {
 SetEntityActive("servant_grunt_1", false);
 }
Angelscript was interpreting the "float 0" as an attempted cast, which, incidentally, would be written "float(0)". This is not necessary, as the game can implicitly cast from integers to floats correctly.
 
Edit: 
The "asEntity" correction is unnecessary, you can call your identifiers anything as long as the function signature is correct - you could call it "giantMarshmellow" without a problem, if you really wanted   .
			 
				
(This post was last modified: 08-05-2011, 10:37 PM by Apjjm.)
 |  |  
	| 08-05-2011, 10:33 PM |  |  |