Frictional Games Forum (read-only)
[LVL ED] Monster Path Help - 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: [LVL ED] Monster Path Help (/thread-12269.html)

Pages: 1 2 3 4


Monster Path Help - eagledude4 - 01-02-2012

I want a monster to follow a path, and based on which area the player enters, the monster will enter the same area via a path node. I'm having trouble getting it to work.

Code:
void EnteredEnemyTriggerArea(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, "");
    if(GetEntitiesCollide("Player", "SonRoomArea") == true) {
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 5, "");
    } else if(GetEntitiesCollide("Player", "DadRoomArea") == true) {
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 5, "");
    }
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
    
}

pathNodes 1 + 2 help the enemy get up the stairs and into the hallway, pathNodes 4 + 5 are for seperate rooms, and pathNode 3 is at the bottom of the stairs, so the monster retreats after entering one of the rooms.



RE: Scripting a Monster chase - Linus Ă…gren - 01-02-2012

If you use the ShowEnemyPlayerPosition script, the enemy ignores all PathNodeAreas untill he stops chasing the player. He will return to the nodes after that. (Which one I am unsure, but probably the closest one, or the one after the last one he passed before the chase)


RE: Scripting a Monster chase - eagledude4 - 01-02-2012

(01-02-2012, 04:07 AM)junkfood2121 Wrote: If you use the ShowEnemyPlayerPosition script, the enemy ignores all PathNodeAreas untill he stops chasing the player. He will return to the nodes after that. (Which one I am unsure, but probably the closest one, or the one after the last one he passed before the chase)
Thanks.



RE: Scripting a Monster chase - eagledude4 - 01-02-2012

Update the first post, please re-read.


RE: Scripting a Monster chase - eagledude4 - 01-03-2012

Hep please.



RE: Scripting a Monster chase - Your Computer - 01-03-2012

Sounds like you have only 5 path nodes and expect the monster to find its way to the path nodes. Path nodes are used to help the monster navigate its way around. You're going to need more than 5 path nodes if you want the monster to move as expected.


Solved - Please remove - eagledude4 - 01-05-2012

(01-03-2012, 09:40 PM)Your Computer Wrote: Sounds like you have only 5 path nodes and expect the monster to find its way to the path nodes. Path nodes are used to help the monster navigate its way around. You're going to need more than 5 path nodes if you want the monster to move as expected.

Is this better?

[Image: pic3.png]

There are now 31 PathNodes instead of 5. The enemy still isn't following the paths correctly though.

Code:
void EnteredEnemyTriggerArea(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, "");
    if(GetEntitiesCollide("Player", "SonRoomArea") == true) {
        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", 8, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_14", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "");
    } else if(GetEntitiesCollide("Player", "DadRoomArea") == true) {
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_16", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_17", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_18", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_19", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_20", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_21", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_22", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_23", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_24", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_25", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_26", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_27", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_28", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_29", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_30", 8, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_29", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_28", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_27", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_26", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_25", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_24", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_23", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_22", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_21", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_19", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_18", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_17", 0, "");
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_16", 0, "");
    }
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_31", 0, "");
}






RE: Monster Path Help - Your Computer - 01-05-2012

You're not supposed to add all the path nodes to the monster, only the starting path node, the ones that are in the center of an intersection (because the monster has trouble walking around corners), and the ending path node.


RE: Monster Path Help - eagledude4 - 01-05-2012

(01-05-2012, 07:09 AM)Your Computer Wrote: You're not supposed to add all the path nodes to the monster, only the starting path node, the ones that are in the center of an intersection (because the monster has trouble walking around corners), and the ending path node.
Gaw, all that work for nothing Tongue I removed all the pathnodes except for _1 to start the path, _5 which is in the middle of the intersection, and _15 and _30 which are in seperate rooms for my if statements. The monster still doesn't walk the path's correctly.

Code:
void EnteredEnemyTriggerArea(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_5", 0, "");
    if(GetEntitiesCollide("Player", "SonRoomArea") == true) {
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_15", 8, "");
    } else if(GetEntitiesCollide("Player", "DadRoomArea") == true) {
        AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_30", 8, "");
    }
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_31", 0, "");
}







RE: Monster Path Help - Your Computer - 01-05-2012

What is the monster supposed to do?