Frictional Games Forum (read-only)
Path Nodes. - 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: Path Nodes. (/thread-21539.html)



Path Nodes. - Bonehead - 05-18-2013

Alright. I'm new to scripting and seeking some help. I have a basic system set up for when the player grabs a key, a grunt spawns in an outside hallway, then walks into the room. The player must hide in a provided cabinet in the room and stay hidden until he has left. My problem is, is that the grunt is pausing at EVERY patrol node. I'd like him to pause at 2 or two of them.. but not at ALL of them. Here's my script.


void ActivateMonster(string &in item)
{
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, "");
}


Also if anyone can give me info on how to have him DESPAWN at his final patrolnode, that'd be great.


RE: Path Nodes. - i3670 - 05-18-2013

You could use an area and a collidecallback. When the monster collides with the area just use the SetEntityActive command.


RE: Path Nodes. - Bonehead - 05-18-2013

(05-18-2013, 11:38 PM)i3670 Wrote: You could use an area and a collidecallback. When the monster collides with the area just use the SetEntityActive command.

As for despawning? I'll try that out.. I'm still having the issue of him pausing for about 2-3 seconds on every node. Do I have a command wrong or should I reduce the amount of patrol nodes?


RE: Path Nodes. - palistov - 05-19-2013

Don't assign him each path node. Assign only the one you want him to travel to. The AI will select path based on the path nodes you place. If you don't like the path he takes, split it up into segments (every 4th node or so), or you could just adjust the path node placement in your map.

Edit: To clarify, don't DELETE any nodes. You want to have plenty in your map. Just don't assign grunty every single one.


RE: Path Nodes. - Your Computer - 05-19-2013

The monster pauses at every path node because you told it to walk up to every path node (also, 0 doesn't mean don't waste any time on the path node). Don't use an entity collide callback, since the monster will still despawn even if the player isn't hiding or if the player is looking at the monster. Instead, make use of the Callbackfunc field for the monster in the level editor and check for OnAutoDisabled.


RE: Path Nodes. - Bonehead - 05-19-2013

(05-19-2013, 12:07 AM)Your Computer Wrote: The monster pauses at every path node because you told it to walk up to every path node (also, 0 doesn't mean don't waste any time on the path node). Don't use an entity collide callback, since the monster will still despawn even if the player isn't hiding or if the player is looking at the monster. Instead, make use of the Callbackfunc field for the monster in the level editor and check for OnAutoDisabled.

I'll check it out.. and do monsters automatically de-spawn after a certain distance? I got the nodes working.. and when I have him walk a decent bit away, he just despawns.. Is that normal and automatic?


RE: Path Nodes. - Your Computer - 05-19-2013

(05-19-2013, 04:45 AM)Bonehead Wrote: I'll check it out.. and do monsters automatically de-spawn after a certain distance? I got the nodes working.. and when I have him walk a decent bit away, he just despawns.. Is that normal and automatic?

Monsters automatically despawn if the player is outside the monster's activation distance. Monsters also automatically despawn if they reach the last path node assigned to them and the player does not see the monster.


RE: Path Nodes. - Bonehead - 05-19-2013

Okay thank you.