Pathfinding

Anable

Newbie
Joined
Nov 21, 2003
Messages
270
Reaction score
0
With the help of Farrowlesparrow's monster spawning tutorial I can make a million monsters appear. The problem is though that I want these monsters to appear around a corner and then come into the view of the player but left on its own, the monster will not move until it sees the player first. Is there a way where I can set a path for the monster so that it will come around the corner on its own and then use its standard AI?
 
Yes, you can. It will involve creating a scripted_sequence for the mosnter to follow when he is spawned.
 
http://collective.valve-erc.com/index.php?ent=scripted_sequence - Scripted Sequence

http://collective.valve-erc.com/index.php?doc=1045177834-81552500 - Putting a monster on a path

Have you put "info_node"s into the map? That helps mosnter path finding a lot. You just place them at key points, in doorways, behind "hiding places" etc..

You could also push the monster out from behind the corner with trigger push.

It depends on the layout of the map really. If the player isnt going to go round the corner then pushing the mosnter out would be the easiest option (Although it doesnt look brilliant seeing a monster just sliding out).
 
Thanks. It looks like the Scripted Sequence is going to work better for me. Now I have a little bit of a problem though.

I have a trigger_auto that sets off the scripted_sequence but it does it only once. I have a constant stream of zombies spawning but only the first one follows the script. How can I get that trigger_auto to keep looping itself?

Also I have a really odd problem. When I run my map through F9 everything is happy and great but when I actually into and create a LAN game, the monters aren't there. Even if I just do a simple monster entity it doesn't show up. Any idea on what the problem is?

Again, thanks for the help!
 
I dont think there is a way to loop a trigger_auto, but you can set it up so two multimanagers target each other, with one multimanager targeting the object you want to loop.

As far as the monsters not being in lan games. Are you trying to do it through regular HalfLife? If so, then you cant have monsters in multiplayer. The reason everything is fine through pressing F9, is because that runs the game in singleplayer. To get monsters you would have to download a mod, such as my favourite, www.svencoop.com. In fact that mod offers everything that you can get in regular halflife, plus a lot more. I suggest you get it if you have a connection that will let you.
 
Holy crap it's working! I've never actually been able to get any of my ideas to come to life. Wow. Amazing. Thank you so much. Now all I need to do is see if I can get it working under svencoop.
 
Unfortunately I spoke too soon. I have two more little problems.

First off, there's four spawners at the top, bottom, left, and right of the warehouse. When the monsters spawn they are always looking to the left. This leaves one facing the correct direction, two facing sideways, and one facing completely backwards. Other than placing another scripted_sequence that will turn them all in the right direction, is there a way to fix this?

Also, my warehouse is pretty large (but empty) and when I run away from a monster and out of its line of sight it stops following me. How can I get it to always know where I am and come after me?
 
As far as the momsnters not following you. I mentioned before about "info_node"s. Well, you need to palce them pretty much everywhere you want mosnters to walk, otherwise they are very poor at pathfinding. So basically, place the nodes at floor level, at every corner, behind every box etc.

When you place them at corners, you really need about three. One actually ont he corner and 2 on either side.

With regards to the mosnters coming out facing the wrong way. You need to go into the properties of the monster maker and change the direction on the little black circle in the top right, to the direction you want them to face when they come out.

If i coudl actually take screens of this stuff, then it woudl be so much easier to explain. Oh well.
 
Ah, don't worry about the screen shots. You explain well enough.

The direction problem is all fixed now but the following issue remains. I've tried the info_node thing but it doesn't work. If I'm understanding right, the info_nodes are to help the monsters get around a stage so that obstacles don't block them. That doesn't really apply to my map because the warehouse is barren. It's just a big open field. I think the issue is with the fact that I get too far away from the monster and it not longer registers me in its "line of sight" so to speak.
 
Yes i suspect its something like that. How large is the warehouse? I mean, they normally have to be huge for things like that to happen.
 
1664w by 1056l

Here's a screen shot

I doesn't seem that large to me.

Maybe it has something to do with the fact that I'm running past them so that now I'm not longer in front of them? I'm not too familiar with how the HL AI works.
 
The map doesnt appear to be that large, but its just one open space? I really have no idea of how far monsters can see. Maybe you should try testing to see when the monsters stop following you. If they really cant see you after a while, then perhaps you need more monsters or something that makes it so just running out of range is difficult i.e obstacles that you need to navigate a little.
 
I think I'll try and trim it down just to see if that helps. Also that way there's fewer zombies on the map and that will help with the lag I'm getting when more and more start appearing. Unfortunately I'll be busy here the next few days but hopefully this weekend I can have it done. Thanks again for the help Farrow.
 
You're welcome :D

I hope to get some work done on one of my maps this weekend too...although i'l probably end up doing nothing, as saturday i have to work and sunday il probably sleep.
 
Back
Top