Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Moving NPCs

Page: 1 of 1
 Zanatio
03-21-2005, 1:44 PM
#1
Quick stupid question:

I want to have non-enemy NPCs wandering around my level, but I can't get them to move. I've tried using waypoints, but that didn't work either. What gives?
 lassev
03-22-2005, 6:09 AM
#2
Well, you could have a good waypoint network built, and try bs_wander (behavior_state). If you wanted a more intelligent behavior for them, you would need to place navgoals here and there, along the waypoint network, and specifically command the npcs to head to the navgoals.
 Zanatio
04-11-2005, 3:33 PM
#3
Gonna need a bit more technical detail here lassev. I'm really dumb when it comes to anything behind moving-mouse-to-create-brush :)
 kessno11
04-11-2005, 5:29 PM
#4
What lassev means is, make a script for the non-npc by bringing up the entity window and type:

Key: spawnscript

Value: test

This is done in Gtk Radiant, now if you have BehavEd (a scripting tool) go to the set_types command on the left of the screen, scroll down until you find the bs_wander command. Click the save button then click compile!:)

Make sure the script saves itself under the JO or JA default scripting folder, or whatever folder your using.

Also make sure (as lassev stated) that you put navgoals in your map, you should be able to find them in Gtk Radiant their listed with the entities.

Good luck dude.;)
 lassev
04-12-2005, 8:31 AM
#5
Originally posted by kessno11
Also make sure (as lassev stated) that you put navgoals in your map, you should be able to find them in Gtk Radiant their listed with the entities.

Actually you only need navgoals if you want to designate specific locations where you want the npcs to go to. For bs_wander, it's enough to have the ordinary, dummy waypoints networked properly. The npcs will then aimlessly wander from one waypoint to another.

Also take care the waypoints are resting on the floor, not inside the floor. The game will report errors for waypoints inside architecture, and possibly not use them at all.

LoS must be maintained between waypoints at all times! This must be remembered especially when dealing with doors. The npc is not able to see the waypoint behind a closed door, and so you must have a waypoint on both sides of the door, so close that the door opens to reveal the other waypoint, when the npc has reached the one on his side of the LoS block.
 Zanatio
04-20-2005, 3:48 PM
#6
Still no luck. I’ve set up the script and NPC as you guys suggested, but it still refuses to move. I’m pretty certain the script is being accessed, because another script that I’ve got in the same directory is working ok, so I’m not sure what else it could be. I’ve got my NPC, a droid, targeted at a waypoint, which in turn is targeted at a second waypoint, which is targeted at a third waypoint, which is targeted back at the first waypoint, so basically the droid should be walking in circles. I’m obviously still doing something wrong, though, cos like I said it still will not move.
 demo
04-20-2005, 9:39 PM
#7
i had a rancor move around by putiing some linked waypoint navgoals and point_combat
 lassev
04-21-2005, 8:08 AM
#8
Originally posted by Zanatio
Still no luck. I’ve set up the script and NPC as you guys suggested, but it still refuses to move. I’m pretty certain the script is being accessed, because another script that I’ve got in the same directory is working ok, so I’m not sure what else it could be. I’ve got my NPC, a droid, targeted at a waypoint, which in turn is targeted at a second waypoint, which is targeted at a third waypoint, which is targeted back at the first waypoint, so basically the droid should be walking in circles. I’m obviously still doing something wrong, though, cos like I said it still will not move.

That doesn't do anything. It's no use to target an NPC to a waypoint. There exist no function in the code to use that kind of connection in any way. You can connect waypoints to each other, and that's also recommended, although the game will also do that automatically, as well, but it might miss some connections.

Hmph... Have a look at what Raven chaps told about the navigation system (http://www.map-center.com/modules.php?name=Forums&file=viewtopic&t=1519) of JA. Maybe you will learn something...
 Zanatio
04-21-2005, 2:44 PM
#9
Originally posted by lassev
That doesn't do anything. It's no use to target an NPC to a waypoint. Then how does the NPC know which waypoints to follow?
 MDN14
04-21-2005, 3:44 PM
#10
It is probably coded into the game to just go to the nearest waypoint and then try to get to the next nearest one and so on. Unless he has a specific script that says to go to a specific navgoal.
 lassev
04-22-2005, 3:53 AM
#11
Originally posted by MDN14
It is probably coded into the game to just go to the nearest waypoint and then try to get to the next nearest one and so on. Unless he has a specific script that says to go to a specific navgoal.

Exactement.

It's good to bear in mind that, if things worked optimally, you could have a single nav_goal on the other side of the map, many rooms and corridors away, but if you had a fully working passive waypoint network, the NPC would find that nav_goal on its own if given the order to go there.

And that lenghty sentence in fact descipbed the fundamental characteristic of waypoints quite well: They are passive, only used by the game AI. You can't use them directly, only indirectly.
 Zanatio
04-22-2005, 4:16 PM
#12
So you're saying I can just stick waypoints anywhere and any NPCs in the area will automatically go to the nearest one?
 MDN14
04-22-2005, 7:27 PM
#13
They should probably start relatively close to a waypoint. But they probably would.
 lassev
04-23-2005, 4:10 AM
#14
Originally posted by Zanatio
So you're saying I can just stick waypoints anywhere and any NPCs in the area will automatically go to the nearest one?

Why would they go there? They only go there, if they have a need to go there, like to find a point_combat, when you attack them. Most NPCs of JA are really passive, and they don't do anything when left alone (except for some bahavior_states like Wander).

Your city can build a road next to where you live, but you probably don't just go to stand in the middle of the road just because it's there. But you will use the road to go to shops or wherever. That's the idea of waypoints. Without them, many NPCs don't know how to move.
Page: 1 of 1