Frictional Games Forum (read-only)
PathNode loop - 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)
+--- Thread: PathNode loop (/thread-11738.html)



PathNode loop - i3670 - 12-07-2011

Hello Forum! I'm working on a monster right now and I'm trying to make it loop it's pathnodes. But I do not understand how to script it. I've read the script on the wiki, but don't get it.

wiki page: http://wiki.frictionalgames.com/hpl2/tutorials/script/monsterpathnodes

Can someone explain how to do it?



RE: PathNode loop - Your Computer - 12-07-2011

The monster will only continue on its patrol path under one of two conditions: The player is still within its activation distance, or the player is still looking at the monster. If neither of these conditions are met, the monster will be automatically deactivated. That wiki article shows how to add path nodes to the monster, so i won't show how here.


RE: PathNode loop - i3670 - 12-07-2011

Ok, too bad. But, is there a way to compress the path nodes, so that I don't have put like a hundred
"AddEnemyPatrolNode" in the script?



RE: PathNode loop - Statyk - 12-07-2011

(12-07-2011, 08:47 PM)i3670 Wrote: Ok, too bad. But, is there a way to compress the path nodes, so that I don't have put like a hundred
"AddEnemyPatrolNode" in the script?
If you're not moving the enemy across the Atlantic Ocean or up TONS of stairs, you don't need a HUNDRED pathnodes... I covered a large area in my 24-hour challenge with about 15-20 pathnodes in total >> and that was 3 different enemies.

Just copy and paste as many as needed and change the number of the path node



RE: PathNode loop - i3670 - 12-07-2011

Have you been hacking my computer? Big Grin


No, I'm putting him in a corridor, don't want him to get stuck in the walls.



RE: PathNode loop - Juby - 12-07-2011

(12-07-2011, 08:47 PM)i3670 Wrote: Ok, too bad. But, is there a way to compress the path nodes, so that I don't have put like a hundred
"AddEnemyPatrolNode" in the script?
Yes
Code:
for (int b = 1; b <=100; b++) AddEnemyPatrolNode("ENEMY", "PathNodeArea_"+b, 0.01f, "");
(this example adds 100 pathnodes to ENEMY starting from PathNodeArea_1. Most useful for walking a straightforward path. )



RE: PathNode loop - palistov - 12-07-2011

If you add all 100 path nodes, the grunt will pause momentarily at each one. If you want the grunt to move from the first path node to the last, simply script the enemy to move to the last one. The AI will handle the pathing, and the monster will take the shortest route to that node, and use the path nodes only if a direct path to the destination is obstructed.

On the flipside of that, if the grunt tries to make a straight line for the destination but you want it to take a very specific route, script it to move to waypoints along the path -- say, every 20th node. That way the monster isn't constantly stopping, and it takes the path you want it to.


RE: PathNode loop - i3670 - 12-07-2011

(12-07-2011, 09:57 PM)palistov Wrote: If you add all 100 path nodes, the grunt will pause momentarily at each one. If you want the grunt to move from the first path node to the last, simply script the enemy to move to the last one. The AI will handle the pathing, and the monster will take the shortest route to that node, and use the path nodes only if a direct path to the destination is obstructed.
Will that work if I put it like this:

Let's say we have a + shaped map. There are 3 pathnodes. The monster starts at the upper arm. PathNode1 is in the left arm, Pathnode2 in the bottom and 3rd in the right one. I want him to follow the 1-2-3.

AddEnemyPatrolNode("grunt_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_2", 2, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_3", 2, "");






RE: PathNode loop - Your Computer - 12-07-2011

Monsters have trouble with turning corners or going around corners, so if you want a monster to go around a corner, you'll need at least three path nodes so that it forms the shape of a L per corner turn. For a plus sign intersection, i would expect 5 path nodes would be required for best results.


RE: PathNode loop - palistov - 12-08-2011

Yeah if it's a cross shape, you'll need a node in the intersection, so the grunt knows to path to the center and turn the corner. There's no real need for any other nodes, but the AI for detecting and investigating sounds/player sightings requires nearby path nodes, so populate the cross with a node every 1-2 meters, regardless of whether or not you'll actually tell the grunt to move to that exact location.