Jump to content

waypoint, waypoint_navgoal, and point_combat


Recommended Posts

Hi folks. I'm tinkering with making some single player maps for JA and have run into a bit of difficulty understanding exactly how the NPC waypoint system works. The few tutorials I've found on it have either been vague or haven't produced the right results when I followed them (particularly true of https://jkhub.org/mapping/richdiesal/Entities220_Lesson_5_NPCSpawning_files/en220lsn5.htm), so I thought perhaps I could find some enlightenment here. :3

 

What I can do: use ICARUS scripts to move NPCs among waypoint_navgoals via a waypoint chain. It took some time to figure out that NPCs apparently can't detect a waypoint that isn't relatively close to them, but looking at the original Raven maps seems to support that this is the case.

 

What I can't quite do: get point_combat to work correctly. That old tutorial I linked above seems to claim that NPCs will use the waypoint network to find a point_combat from which they can attack the player, but I can't get this to work...or, more accurately, I can't get it to work with most NPCs.

 

For example, take this setup:

1965eafed4e015f6a43ab21ba6ff40c4.jpg

 

The entity on the left is info_player_start. On the right we've got an enemy. If the enemy is NPC_Stormtrooper, it'll attack you if you're in its line of sight, but never pursue you if you go outside of it (even if you use an ICARUS script on spawn to toggle its SET_CHASE_ENEMIES to true). This seems right -- without waypoints, it can't really figure out where to go.

 

However, if I add waypoints that would allow the stormtrooper a path around the wall (having first set the stormtrooper's behavior states using a script, of course), then get in combat with him before hiding behind the wall again, he stubbornly stays where he is. Likewise, point_combats seem to do nothing...but only for the stormtrooper! If I change the enemy to a Gran, for instance, it will actively try to reach the point_combat entities when the player is out of line of sight. It's easy to track this by using nav show all in-game and watching the arrows.

 

I know that the type of weapon held by an enemy factors into its AI, and I've looked through the JKA source code enough to see that the various NPC classes have pretty different reactions to various combat situations, but I still feel like I'm missing something (probably something quite simple!).

Link to comment

Update: figured most of this out by trial and error. Turns out that waypoint networks can't be comprised of only two waypoints -- they need at least three to be functional.

 

Now I see why Raven used so many closely-packed sets of triple waypoints in their example maps. :D

Link to comment

Update: figured most of this out by trial and error. Turns out that waypoint networks can't be comprised of only two waypoints -- they need at least three to be functional.

 

Now I see why Raven used so many closely-packed sets of triple waypoints in their example maps. :D

 

https://jkhub.org/files/file/2293-a-plot-is-brewing-in-the-outer-rim/

 

Download my project. In the APIBITOR.pk3 file is the original map files in .map format that shows how I did the nav goal  / combat point so they chase after you. All of my scripts are in that pk3 as well and feel free to use them if you want.  You'll be able to see how I did my NPC's which were all scripted and would chase you. I could not get any NPC to follow the traditional waypoint system so i had to script them. 

Odeyseis likes this
Link to comment

https://jkhub.org/files/file/2293-a-plot-is-brewing-in-the-outer-rim/

 

Download my project. In the APIBITOR.pk3 file is the original map files in .map format that shows how I did the nav goal  / combat point so they chase after you. All of my scripts are in that pk3 as well and feel free to use them if you want.  You'll be able to see how I did my NPC's which were all scripted and would chase you. I could not get any NPC to follow the traditional waypoint system so i had to script them. 

 

Thanks! I'll check it out for sure.

 

I've mostly gotten waypoints working, but it's been a chore. I wish the AI were a bit less clunky.

Link to comment

You basically want the waypoint network to span your entire map so NPCs know how to walk from one end to the other. Try "nav show all" in the console in SP to see whether they connect properly (they don't if there's an obstacle, for example).

 

Yeah, I eventually figured that out. Nav show all makes it easier to tell where the system breaks down, but it's not foolproof. I've found that even a well-connected waypoint network doesn't work properly without navgoals at various places along it. Not sure if that's intended or not.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...