pwnvader360 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 11 
	Threads: 3 
	Joined: Jan 2011
	
 Reputation: 
0
		
	 | 
	
		
			
Newbie needs help! [SOLVED] 
			 
			
				As you can probably tell, I'm a newbie to scripting in the HPL Amnesia Level Editor. What I want to happen is the Player collides with ScriptArea_1, and the grunt behind the door becomes active and follows the PathNode. Once the grunt has reached the last PathNode, I want him to become inactive. 
 
I have created EXTREMELY basic scripts before, but never could advance from there. Would it hurt to make the script and explain it to me for future reference?
			 
			
			
			
				
(This post was last modified: 01-13-2011, 06:22 PM by pwnvader360.)
 
				
			 
		 |  
	 
 | 
 
	| 01-12-2011, 06:37 PM  | 
	
		
	 | 
 
 
	
		
		Tottel 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 307 
	Threads: 9 
	Joined: Nov 2010
	
 Reputation: 
0
		
	 | 
	
		
 | 
 
	| 01-12-2011, 06:39 PM  | 
	
		
	 | 
 
 
	
		
		Seragath 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 34 
	Threads: 1 
	Joined: Jan 2011
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Newbie needs help! 
			 
			
				I say try first, then ask later. Lets see if I can make it work anyway. (New and thirsty for scripting.) 
void OnStart() 
{ 
AddEntityCollideCallback("Player", "ScriptArea_1", "Monster", true, 1); 
} 
 
void Monster(string &in asParent, string &in asChild, int alState) 
{ 
SetEntityActive("NAME OF YOUR MONSTER" , true); 
AddEnemyPatrolNode("NAME OF YOUR MONSTER", "NAME OF YOUR PATHNODE", 0, ""); 
}
 
Something like this ? O.O
			  
			
			
			
		 |  
	 
 | 
 
	| 01-12-2011, 06:45 PM  | 
	
		
	 | 
 
 
	
		
		pwnvader360 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 11 
	Threads: 3 
	Joined: Jan 2011
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Newbie needs help! 
			 
			
				 (01-12-2011, 06:39 PM)Tottel Wrote:  http://wiki.frictionalgames.com/hpl2/tut...y_tutorial 
To see if it would work, I entered the script that gives the player a lantern on start, and...failure. Why is this. If thats not what the script does, then what DOES it do?
 
In case you need to know, heres the code:
 //////////////////////////// 
// Run first time starting map 
void OnStart() 
{    
   GiveItemFromFile("lantern", "lantern.ent"); 
  
   for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");     
} 
  
//////////////////////////// 
// Run when entering map 
void OnEnter() 
{ 
  
} 
  
//////////////////////////// 
// Run when leaving map 
void OnLeave() 
{ 
  
}
  
			 
			
			
			
		 |  
	 
 | 
 
	| 01-12-2011, 06:45 PM  | 
	
		
	 | 
 
 
	
		
		Tottel 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 307 
	Threads: 9 
	Joined: Nov 2010
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Newbie needs help! 
			 
			
				Well, what exactly is the error?
			 
			
			
			
		 |  
	 
 | 
 
	| 01-12-2011, 06:47 PM  | 
	
		
	 | 
 
 
	
		
		pwnvader360 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 11 
	Threads: 3 
	Joined: Jan 2011
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Newbie needs help! 
			 
			
				 (01-12-2011, 06:45 PM)Seragath Wrote:  I say try first, then ask later. Lets see if I can make it work anyway. (New and thirsty for scripting.) 
 
 
void OnStart() 
{ 
AddEntityCollideCallback("Player", "ScriptArea_1", "Monster", true, 1); 
} 
 
void Monster(string &in asParent, string &in asChild, int alState) 
{ 
SetEntityActive("NAME OF YOUR MONSTER" , true); 
AddEnemyPatrolNode("NAME OF YOUR MONSTER", "NAME OF YOUR PATHNODE", 0, ""); 
}
  
Something like this ? O.O 
For the pathnode script, do I make a script for every pathnode?
			  
			
			
			
		 |  
	 
 | 
 
	| 01-12-2011, 06:48 PM  | 
	
		
	 | 
 
 
	
		
		Seragath 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 34 
	Threads: 1 
	Joined: Jan 2011
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Newbie needs help! 
			 
			
				I haven't used pathnode that much but from what I know is that it's possible. for example 
void Monster(string &in asParent, string &in asChild, int alState) 
{ 
SetEntityActive("NAME OF YOUR MONSTER" , true); 
AddEnemyPatrolNode("NAME OF YOUR MONSTER", "NAME OF YOUR PATHNODE", 0, ""); 
AddEnemyPatrolNode("NAME OF YOUR MONSTER", "NAME OF YOUR PATHNODE2", 0, ""); 
AddEnemyPatrolNode("NAME OF YOUR MONSTER", "NAME OF YOUR PATHNODE3", 0, ""); 
}
 
etc etc
			  
			
			
			
		 |  
	 
 | 
 
	| 01-12-2011, 06:52 PM  | 
	
		
	 | 
 
 
	
		
		pwnvader360 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 11 
	Threads: 3 
	Joined: Jan 2011
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Newbie needs help! 
			 
			
				 (01-12-2011, 06:47 PM)Tottel Wrote:  Well, what exactly is the error? 
The problem is, I insert the code (and trust me, the .hps file is in the correct location with the correct file name) and when I test it in Amnesia, it tells me that I need to find a lantern before one can be turned on.
			  
			
			
			
		 |  
	 
 | 
 
	| 01-12-2011, 07:26 PM  | 
	
		
	 | 
 
 
	
		
		Tottel 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 307 
	Threads: 9 
	Joined: Nov 2010
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Newbie needs help! 
			 
			
				This is on a custom map, right? One that you play as a custom story?
			 
			
			
			
		 |  
	 
 | 
 
	| 01-12-2011, 07:45 PM  | 
	
		
	 | 
 
 
	
		
		pwnvader360 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 11 
	Threads: 3 
	Joined: Jan 2011
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Newbie needs help! 
			 
			
				 (01-12-2011, 06:52 PM)Seragath Wrote:  I haven't used pathnode that much but from what I know is that it's possible. for example 
 
void Monster(string &in asParent, string &in asChild, int alState) 
{ 
SetEntityActive("NAME OF YOUR MONSTER" , true); 
AddEnemyPatrolNode("NAME OF YOUR MONSTER", "NAME OF YOUR PATHNODE", 0, ""); 
AddEnemyPatrolNode("NAME OF YOUR MONSTER", "NAME OF YOUR PATHNODE2", 0, ""); 
AddEnemyPatrolNode("NAME OF YOUR MONSTER", "NAME OF YOUR PATHNODE3", 0, ""); 
}
  
etc etc 
I tried that and nothing happened. Here's the code:
 void OnStart() 
     { 
        AddEntityCollideCallback("Player", "ScriptArea_1", "Monster", true, 1); 
     } 
      
     void Monster(string &in asParent, string &in asChild, int alState) 
        { 
            SetEntityActive("servant_grunt_1", true); 
            AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, ""); 
            AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, ""); 
            AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, ""); 
            AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, ""); 
            AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, ""); 
            AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, ""); 
            AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, ""); 
            AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, ""); 
            AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, ""); 
            AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0, ""); 
            AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, ""); 
            AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0, ""); 
            AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0, ""); 
            AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_14", 0, ""); 
            AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_15", 0, ""); 
            AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_16", 0, ""); 
            AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_17", 0, ""); 
            SetEntityActive("servant_grunt_1", false); 
        } 
  
 void OnEnter() 
     { 
         
     } 
 
void OnLeave() 
     { 
         
     }
  
 (01-12-2011, 07:45 PM)Tottel Wrote:  This is on a custom map, right? One that you play as a custom story? 
Yes it is. I named it Test Map. 
 
Anyone help meh...?  
			 
			
			
			
				
(This post was last modified: 01-12-2011, 08:12 PM by pwnvader360.)
 
				
			 
		 |  
	 
 | 
 
	| 01-12-2011, 07:45 PM  | 
	
		
	 | 
 
 
	 
 |