Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support


Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie needs help! [SOLVED]
Author Message
pwnvader360 Offline
Junior Member

Posts: 11
Joined: Jan 2011
Reputation: 0
Post: #1
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
Find all posts by this user Quote this message in a reply
Tottel Offline
Senior Member

Posts: 307
Joined: Nov 2010
Reputation: 0
Post: #2
RE: Newbie needs help!

http://wiki.frictionalgames.com/hpl2/tut...y_tutorial
01-12-2011 06:39 PM
Find all posts by this user Quote this message in a reply
Seragath Offline
Junior Member

Posts: 34
Joined: Jan 2011
Reputation: 0
Post: #3
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
Find all posts by this user Quote this message in a reply
pwnvader360 Offline
Junior Member

Posts: 11
Joined: Jan 2011
Reputation: 0
Post: #4
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
Find all posts by this user Quote this message in a reply
Tottel Offline
Senior Member

Posts: 307
Joined: Nov 2010
Reputation: 0
Post: #5
RE: Newbie needs help!

Well, what exactly is the error?
01-12-2011 06:47 PM
Find all posts by this user Quote this message in a reply
pwnvader360 Offline
Junior Member

Posts: 11
Joined: Jan 2011
Reputation: 0
Post: #6
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
Find all posts by this user Quote this message in a reply
Seragath Offline
Junior Member

Posts: 34
Joined: Jan 2011
Reputation: 0
Post: #7
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
Find all posts by this user Quote this message in a reply
pwnvader360 Offline
Junior Member

Posts: 11
Joined: Jan 2011
Reputation: 0
Post: #8
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
Find all posts by this user Quote this message in a reply
Tottel Offline
Senior Member

Posts: 307
Joined: Nov 2010
Reputation: 0
Post: #9
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
Find all posts by this user Quote this message in a reply
pwnvader360 Offline
Junior Member

Posts: 11
Joined: Jan 2011
Reputation: 0
Post: #10
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...?Sad
(This post was last modified: 01-12-2011 08:12 PM by pwnvader360.)
01-12-2011 07:45 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)