Frictional Games Forum (read-only)
Urgently need help, loop monster path. - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Urgently need help, loop monster path. (/thread-14053.html)



Urgently need help, loop monster path. - Mojake - 03-17-2012

I read the wiki on pathnodes but I really don't understand it. I'm still pretty new to scripting.

I have 4 pathnodes that a monster follows, then I want it to follow; 5,6,7,8 in a continuous loop but I really can't get my head around it.

void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1",
for (int i = 1; i <11; i++)
{
int x = i;
if (i == 1)
{
x = 2;
}
if (i = 10)
{
x = 4;
}
if (i != 1 || i != 10)
{
x = 0;
}
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_"+i, x, "");
}
}
That's what the wiki says about pathnodes but I don't understand what values stand for and how to manipulate them to suit me. Would really appreciate some help here, it's been bugging me for 2 hours Sad



RE: Urgently need help, loop monster path. - Your Computer - 03-17-2012

When you add a path node to a monster it will be placed in the monster's "memory," and it will head to each path node in its "memory" in the order they were added. You don't need to make such a complicated loop like that for the monster to patrol.


RE: Urgently need help, loop monster path. - Equil - 03-17-2012

Code:
    for(int i=0;i<5;i++) {
        if(i == 5) {
            i = 0;
            }
        
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_"+i, 0.0f, "");
        }

This works if you want him to go in a continuous loop. Just change add 1 to i< for however nodes you want him to loop. i.e, you wanted 4 nodes, so I put i<5. That's just the way I do it though, since I usually start i at 0. However, this way he will still eventually dissapear if the player hides from him, i'm not too sure how to stop that myself.