Frictional Games Forum (read-only)
Newbie needs help! [SOLVED] - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Newbie needs help! [SOLVED] (/thread-6181.html)

Pages: 1 2


Newbie needs help! [SOLVED] - pwnvader360 - 01-12-2011

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?


RE: Newbie needs help! - Tottel - 01-12-2011

http://wiki.frictionalgames.com/hpl2/tutorials/script/disable_gravity_tutorial


RE: Newbie needs help! - Seragath - 01-12-2011

I say try first, then ask later. Lets see if I can make it work anyway. (New and thirsty for scripting.)


Code:
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


RE: Newbie needs help! - pwnvader360 - 01-12-2011

(01-12-2011, 06:39 PM)Tottel Wrote: http://wiki.frictionalgames.com/hpl2/tutorials/script/disable_gravity_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:
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()
{

}



RE: Newbie needs help! - Tottel - 01-12-2011

Well, what exactly is the error?


RE: Newbie needs help! - pwnvader360 - 01-12-2011

(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.)


Code:
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?


RE: Newbie needs help! - Seragath - 01-12-2011

I haven't used pathnode that much but from what I know is that it's possible. for example

Code:
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


RE: Newbie needs help! - pwnvader360 - 01-12-2011

(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.


RE: Newbie needs help! - Tottel - 01-12-2011

This is on a custom map, right? One that you play as a custom story?


RE: Newbie needs help! - pwnvader360 - 01-12-2011

(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

Code:
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:
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