HomeJavaModsThe Wandering NPC
The Wandering NPC
Vahlokath on the Citizens's IRC channel gave me the idea to create this plugin to extend the wander waypoint provider for citizens. The main issue was that the NPC's when set with the wander waypoint provider, they would just endlessly wander and there are no limits on how far they can go, or climb. You also have no control over the surfaces they can walk on. So this plugin semi addresses that. Keep in mind it's far from realistic on the path finding, and this whole plugin was less than an hours work.

While this project is not abandoned, it is only maintained for bugs, and to keep it working. It will not have new features added to it. For newer features please look at the NPCDestinations plugin.

Features:

Usage:
Generate an NPC, and type /waypoint provider wanderingnpc. The plugin will auto assign the trait to the NPC as well as set the center point to the NPC's current location.


You can fine tune the wandering by using the following commands:
/wanderingnpc info
This shows settings on the currently selected NPC for the wanderingnpc trait.​
/wanderingnpc setcenter
Sets the centerpoint for the NPC from which it can wander out from.​
/wanderingnpc tpcenter
Teleports you to the NPC's center location.​
/wanderingnpc maxdistance
Sets the maximum distance from the center the NPC can wander​
/wanderingnpc pathdistance
Sets the maximum distance for to look for the next destination​
/wanderingnpc climbingdistance
Sets the max height up or down that the NPC can go in a single path finding event. This is not total from the center, but per attempt to move somewhere.​
/wanderingnpc pathhistory {#}
Enable or Disable the path history. Helps prevent backtracking. You can also define the # of locations to tract by adding a number to this command.​
/wanderingnpc pauseplayer {#}
Tell the NPC to pause when a player is # blocks away. 0 or blank disables this function. This is good if your NPC is a quest giver.​
/wanderingnpc addblock
Adds the blocktype selected in your hand to the allowed surfaces that the NPC can choose as a destination​
/wanderingnpc removeblock
Removes the blocktype selected in your hand from the allowed surfaces that the NPC can choose as a destination​

Permissions:
wanderingnpc.settings
This gives a user the ability to change the NPC's wander settings
wanderingnpc.tpcenter
Ability to teleport to the NPC's center /wanderingnpc tpcenter
wanderingnpc.info
Permission to see the settings /wanderingnpc info

Notes:
The path finding is random and uses the same idea that was in citizens to begin with, I just expanded on that and made a trait around it for configuration. While this could be done without adding commands or a trait, I wanted the ability to change the NPC's settings live and without editing the saves.yml file.

*
If you want to use the /npc path command after setting an NPC to use this. You will have to reset the waypoint provider back to the linear waypoint. Use /waypoint provider linear to reset it. You will also have to set the waypoints again.

Note from Azfaloth regarding soul sand:
Another piece of info you should add in the description is that the npc jump height is very important for some blocks. NPCs will get stuck on things like the edges of soul sand unless the jump height is at least 2. Because soul sand is slightly smaller than normal blocks. This may lead to players reporting bugs for improper movement.
Click to expand...
* This plugin uses the plugin Metrics system. If you want to disable it, open /PluginMetrics/Config.yml and set opt-out to true. Mostly for my curiosity :)


Let me know if this is handy for anyone, if enough people chime in, I will work on a better path finding system.

Source:
My GitHub

[​IMG]

Commands

Plugin details

Read from the plugin's own plugin.yml.

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

The Wandering NPC is a free Minecraft Java mod. Compatible with Minecraft 1.8, 1.9, 1.10, 1.11 and newer. Downloaded 12,963 times (via Spigot). Download it and open it directly in the game.

Explore more