Jump to content

Home

Moving NPCs


Zanatio

Recommended Posts

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.

Link to comment
Share on other sites

  • 3 weeks later...

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.;)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

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 of JA. Maybe you will learn something...

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...