Frictional Games Forum (read-only)
Help with grunt maze pathfinding? - 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: Help with grunt maze pathfinding? (/thread-21075.html)

Pages: 1 2


RE: Help with grunt maze pathfinding? - zergling50 - 06-13-2013

(06-12-2013, 12:41 PM)Amn Wrote: Your first solution may work using the ResetProp function on the grunts.
I'm not sure if this works for enemies. Give a try.

But i wouldn't use ShowEnemyPlayerPosition on a maze.
I think it's better to just put a slow walking grunt and give him a set of pathnodes to follow.
Then, after a while, you repeat this with a timer.

I might just go with that. By the way, when you say repeat this with a timer what do you mean?

(06-12-2013, 07:59 AM)GrAVit Wrote: That script which was suggested has to do with monster patrolling.

If you want the grunt to effectively chase you down in a maze, this script really does nothing about it.

The way to stop the grunt from getting stuck in walls is to add pathnodes, you can add them using the area tool and selecting pathnodes from the dropdown menu.



Pathnodes help the grunt navigate the maze. They don't have to be scripted to work. Place them approximately the same distance away from each other. Also, they don't have to be too close to each other, but stairs should have a pathnode on every step of the stairs. If you want an idea of how to place them even better, check out one of the original Amnesia maps.

So if I just add pathnodes with no script the grunt will follow them?
Sorry if that sounds really stupid, lol, im just trying to make sure I get what your saying.


RE: Help with grunt maze pathfinding? - GrAVit - 06-13-2013

(06-13-2013, 08:17 PM)zergling50 Wrote:
(06-12-2013, 12:41 PM)Amn Wrote: Your first solution may work using the ResetProp function on the grunts.
I'm not sure if this works for enemies. Give a try.

But i wouldn't use ShowEnemyPlayerPosition on a maze.
I think it's better to just put a slow walking grunt and give him a set of pathnodes to follow.
Then, after a while, you repeat this with a timer.

I might just go with that. By the way, when you say repeat this with a timer what do you mean?

(06-12-2013, 07:59 AM)GrAVit Wrote: That script which was suggested has to do with monster patrolling.

If you want the grunt to effectively chase you down in a maze, this script really does nothing about it.

The way to stop the grunt from getting stuck in walls is to add pathnodes, you can add them using the area tool and selecting pathnodes from the dropdown menu.



Pathnodes help the grunt navigate the maze. They don't have to be scripted to work. Place them approximately the same distance away from each other. Also, they don't have to be too close to each other, but stairs should have a pathnode on every step of the stairs. If you want an idea of how to place them even better, check out one of the original Amnesia maps.

So if I just add pathnodes with no script the grunt will follow them?
Sorry if that sounds really stupid, lol, im just trying to make sure I get what your saying.

He will passively use them to navigate to you, so he doesn't get stuck.


RE: Help with grunt maze pathfinding? - Daemian - 06-13-2013

I mean a timer to repeat the process.
Mostly to keep the grunt controlled.
Because sometimes, as you know, they disappear, get stuck and such. Grunt stuff.

I would make a function that resets the grunt, adds all the pathnodes again and starts a timer to call itself later.


RE: Help with grunt maze pathfinding? - zergling50 - 06-16-2013

(06-13-2013, 10:31 PM)Amn Wrote: I mean a timer to repeat the process.
Mostly to keep the grunt controlled.
Because sometimes, as you know, they disappear, get stuck and such. Grunt stuff.

I would make a function that resets the grunt, adds all the pathnodes again and starts a timer to call itself later.

Im going to test the resetprop function on the grunts and see if it works, but here is what I gathered from what you said.

ResetProp("servant_grunt_1");
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "node1", 1.0f, "idle");
AddTimer("gruntPath", 2.0f, "GruntMazePatrol");

Is this the kind of code you meant? (Of course with more nodes that is)

I just wanted to report that I tested out some code (which I am posting below) and it seemed to work. I have no way of knowing if the resetprop function worked, but no errors showed up and the test grunt patrolled the area repeatedly with no problems (I disabled his triggers so I could observe). I am going to try implementing this code with the main grunt and will let you know if it works or not. If I am not doing something right, please respond and let me know.
CODE:
void GruntTest(string &in asParent, string &in asChild, int alState)
{
ResetProp("servant_grunt_2");
SetEnemyDisableTriggers("servant_grunt_2", true);
SetEntityActive("servant_grunt_2", true);
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_1", 1.0f, "idle");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_2", 1.0f, "idle");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_3", 1.0f, "idle");
AddTimer("gruntPath", 2.0f, "GruntTest");
}

I tested it out and it worked great except for one small error which I believe I know how to fix.
As soon as he reached node 17 (the last node I made) he began to wander around trying to walk through the walls. Since I did not make his path loop back on itself I believe he was trying to walk through the bookshelves to node 1. I will make his path loop back to an area where he can easily walk to node 1. Other than that, I am thankful for all of your help. If I am missing anything or if there are any other suggestions please let me know. I will mark this post as sovled at the end of the day just in case I am missing something.


RE: Help with grunt maze pathfinding? - Daemian - 06-16-2013

That's exactly what i meant, sir. I'm glad it's working.
About the node 17, the last node it's usually hidden from the player's sight, where the grunt finally disappears. But if you want him to loop his nodes, go ahead. Good luck.