[INACTIVE][MECH]NpcSpirit v1.11 - Block based NPC system[cb617]

Discussion in 'Inactive/Unsupported Plugins' started by acegiak, Mar 6, 2011.

  1. Offline


    NpcSpirit: Npc Souls are stored in blocks!
    Version: 1.13

    The point of NpcSpirit is to create an Npc system that will tie in well with world economies and player constructed environments, rather than having them be an administrated constant. A certain kind of block (sponge by default but editable in config) is denoted as containing the souls of NPCs. When this is placed, it spawns an npc and will continue to do so when the npc is killed. Admins or the Npc's owner may change the npc's name(and associated skin pulled from minecraft.net), equipped item, greetings, threats and conversation.

    Requires permissions & sqlite.

    This is based heavily on Redecouverte's NpcSpawner lib which is craftbukkitbased, not bukkit based. So it may become unstable/stop working if craftbukkit changes the way it processes HumanEntities too much. But that's what we get for making plugins for in development software.

    Lastly, the ultimate goal of this plugin is to have a player scriptable AI system, so that players can have armies of Npcs battling each other or tilling their fields etc, provided they have the capital to invest in such extravagances.


    Place a sponge block to start spawning an NPC there. (they need headroom)
    while targeting the soulblock for the npc:
    /npcs rename [NEWNAME] - renames/reskins the npc on next respawn
    /npcs givethis - changes the NPC's held item to the player's held item on next respawn
    /npcs respawn - kills and respawns the npc
    /npcs sethi [TEXT] - adds a greeting to the npc
    /npcs delhi [KEYWORD] - removes all greetings with the keyword
    /npcs setow [TEXT] - adds a thread (damage message) to the npc
    /npcs delow [KEYWORD] - removes all threats with the keyword
    /npcs setclick [TEXT] - adds a chat phrase (said when right clicked) to the npc
    /npcs delclick [KEYWORD] - removes all chat phrases with the keyword

    First load up will generate the file plugins/NpcSpirit/global.yml .
    To change what kind of block acts as NPC spawner, just change the property "npcblocktype" to the decimal ID of the block you want to use. For example, to use a LapisLazuli Block set it to:
    npcblocktype: 22
    skins are set by the name of the npc. These are pulled from minecraft.net. there ia no way for bukkit or it's plugins to change that link. Names = skins. You have been told.

    npcspirit.admin - grants the right to F with everyones npcs, not just your own.

    • Persistence
    • Config File
    • Pathfinding
    • Scriptable AI system:
    Updated for build 617, may have broken persistence saving.
    Added debug methods to answer "why aren't they spawning?"
    moved NpcSpirit.db into it's plugin folder to conform with standards.
    Added config file to change blocktype
    Added sqlite persistence!
    Npcs now spawn anywhere there is space for them up to 10 blocks above their spawner.
    Made npcs despawn when their block gets changed by other mods.
    Added respawn command to remedy pvp issue found by Wulfspider
    Fixed a few bugs that popped up when updating to 493, including constructor troubles.
    Gave admins power over other people's soulblocks
    Added remove ability to chat lines
    Added chat customisation and held item customisation.
    Added skin changing & owner recognition over multiple logins
    Created soulmanager to make main class less bloated
    Associated NPC souls with blocks
    Got Redecouverte's library working
  2. Offline


    @Omniscient Can you tell me what version of craftbukkit, npcspirit and permissions you're using? Also, do you have the sqlite library in your root bukkit directory?

    @Solest Ah! Of course! This is cause I'm working on scripting. Grab the zip file here: http://machinespirit.net/ace/minecraft/NpcSpirit.zip and extract the contents into your base bukkit directory witht he file structure as is in the zip. Then try again :p
  3. Offline


    Hello! I was wondering if it would be possible to implement scripting in other language. Also, does importing works with the current python interpreter?

    Thank you.
  4. Offline


    @Wernesgruner I'm only gonna implement scripting in python because the Jython package makes it tie in nicely. I'm working on getting imports and stuff working properly. Once the feature is past alpha I'll provide an api doc.
  5. Offline


    Alright. So I before I start scripting, I was just wondering if its possible to catch bukkit events or its just a few functions you have to implement yourself? Because I'd like to make it possible for a npc's head to follow a player and replicate to attacks.
  6. Offline


    yeah I'll have to expose bukkit methods to the python interperter
  7. Offline


    10:59:31 [INFO] Starting minecraft server version Beta 1.3
    10:59:31 [INFO] Loading properties
    10:59:31 [INFO] Starting Minecraft server on *:27777
    10:59:31 [VARNING] The server will make no attempt to authenticate usernames. Be
    10:59:31 [VARNING] While this makes the game possible to play without internet a
    ccess, it also opens up the ability for hackers to connect with any username the
    y choose.
    10:59:31 [VARNING] To change this, set "online-mode" to "true" in the server.set
    tings file.
    10:59:31 [INFO] This server is running Craftbukkit version git-Bukkit-0.0.0-544-
    g6c6c30a-b556jnks (MC: 1.3)
    10:59:31 [INFO] Preparing level "world"
    10:59:31 [INFO] Preparing start region
    10:59:32 [INFO] npcx : load settings begun
    10:59:32 [INFO] jdbc:mysql://db4free.net:3306/kikotte
    10:59:32 [INFO] npcx : loadsettings() ended
    10:59:32 [INFO] NpcSpirit version 1.12 enabled.
    10:59:32 [INFO] NpcSpirit version 1.12not enabled. Permissions not detected
    10:59:32 [INFO] NpcSpirit version 1.12 disabled.
    10:59:32 [INFO] loading up the npcspirit db
    10:59:32 [ALLVARLIG] java.lang.ClassNotFoundException: org.sqlite.JDBC
    10:59:32 [ALLVARLIG]    at java.net.URLClassLoader$1.run(Unknown Source)
    10:59:32 [ALLVARLIG]    at java.security.AccessController.doPrivileged(Native Me
    10:59:32 [ALLVARLIG]    at java.net.URLClassLoader.findClass(Unknown Source)
    10:59:32 [ALLVARLIG]    at org.bukkit.plugin.java.PluginClassLoader.findClass(Pl
    10:59:32 [ALLVARLIG]    at java.lang.ClassLoader.loadClass(Unknown Source)
    10:59:32 [ALLVARLIG]    at java.lang.ClassLoader.loadClass(Unknown Source)
    10:59:32 [ALLVARLIG]    at java.lang.Class.forName0(Native Method)
    10:59:32 [ALLVARLIG]    at java.lang.Class.forName(Unknown Source)
    10:59:32 [ALLVARLIG]    at acegiak.NpcSpirit.DbMan.loadflats(DbMan.java:10)
    10:59:32 [ALLVARLIG]    at acegiak.NpcSpirit.NpcSoulManager.fill(NpcSoulManager.
    10:59:32 [ALLVARLIG]    at acegiak.NpcSpirit.NpcSoulManager.<init>(NpcSoulManage
    10:59:32 [ALLVARLIG]    at acegiak.NpcSpirit.NpcSpirit.onEnable(NpcSpirit.java:9
    10:59:32 [ALLVARLIG]    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlug
    10:59:32 [ALLVARLIG]    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(
    10:59:32 [ALLVARLIG]    at org.bukkit.plugin.SimplePluginManager.enablePlugin(Si
    10:59:32 [ALLVARLIG]    at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftSe
    10:59:32 [ALLVARLIG]    at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftS
    10:59:32 [ALLVARLIG]    at net.minecraft.server.MinecraftServer.e(MinecraftServe
    10:59:32 [ALLVARLIG]    at net.minecraft.server.MinecraftServer.a(MinecraftServe
    10:59:32 [ALLVARLIG]    at net.minecraft.server.MinecraftServer.d(MinecraftServe
    10:59:32 [ALLVARLIG]    at net.minecraft.server.MinecraftServer.run(MinecraftSer
    10:59:32 [ALLVARLIG]    at net.minecraft.server.ThreadServerApplication.run(Sour
    10:59:32 [INFO] npcx : registering monitored events
    10:59:32 [INFO] npcx : initialising database connection
    10:59:32 [INFO] npcx : loading spawngroups
    10:59:32 [INFO] npcx : + test
    10:59:32 [INFO] 1 spawngroups loaded
    10:59:32 [INFO] npcx version 0.01 enabled.
    10:59:32 [INFO] Done (0,089s)! For help, type "help" or "?"
  8. Offline


    @swedish2011 have you got sqlitejdbc-v056.jar in your bukkit root directory?
  9. Offline


    I have to download it. how do you do in the game?
  10. Offline


  11. Offline


    Never mind, I put the sqlitejdbc in the wrong map.
    Thanks anyway!
  12. Offline


    I know this plugin isn't designed for CB v.531 .... just wanted to say I tried it though... lots of errors in the console and no npcs work
  13. Offline


    I got it working now, and i can spawn NPCS, but i'm getting a SEVERE! error after spawning 4 or 5 npc's. Any idea what causes that?

    Oh, and i use CB 557 and GroupManager. Fake permissions 2.5.
  14. Offline


    @darkcammo I just tried it on my testing server with latest reccomended build, found it raised no new issues and updating my topic title. Does it still give you errors if you disable all plugins except this and permissions? Can you post the error here?

    @Omniscient this is a doozy is it a java.util.ConcurrentModificationException ? cause after some testing I got the same thing on my server after adding ~ 20 npcs, which I hadn't tried till now. The problem is that threads started by the timer are crashing into each other, I'm running a fairly powerful server for testing so I don't notice these things till the load gets larger. I'll try and work out how to fix it.
  15. Offline


    Something that I think would be really cool is if this Mod was somewhat combined with the Inactive Arrow Turret mod that creates blocks that shoot people with arrows if they get close. You could have NPC guards that shoot people if they get too close.
  16. Offline


    Okay, thanks.
  17. Offline


    Thanks for the fast reply Ace :) I unloaded the new zip file, put jython.jar in my main Bukkit folder and placed the new NPCSpirit folder and its associated .jar in the plugins file.

    After launching, however, and trying to place an NPC block, I keep getting this message every 2 seconds or so:
    17:54:14 [INFO] Infact, it is in need of spawning now. Let's try:
    17:54:16 [INFO] There are npc blocks placed in the world.
    17:54:16 [INFO] One of the npc blocks isCraftBlock{chunk=CraftChunk{x=8z=19}x=13
    17:54:16 [INFO] Infact, it is in need of spawning now. Let's try:
    17:54:18 [INFO] There are npc blocks placed in the world.
    17:54:18 [INFO] One of the npc blocks isCraftBlock{chunk=CraftChunk{x=8z=19}x=13
    17:54:18 [INFO] Infact, it is in need of spawning now. Let's try:
    17:54:20 [INFO] There are npc blocks placed in the world.
    17:54:20 [INFO] One of the npc blocks isCraftBlock{chunk=CraftChunk{x=8z=19}x=13
    17:54:20 [INFO] Infact, it is in need of spawning now. Let's try:
    17:54:22 [INFO] There are npc blocks placed in the world.
    17:54:22 [INFO] One of the npc blocks isCraftBlock{chunk=CraftChunk{x=8z=19}x=13
    17:54:22 [INFO] Infact, it is in need of spawning now. Let's try:
    17:54:24 [INFO] There are npc blocks placed in the world.
    17:54:24 [INFO] One of the npc blocks isCraftBlock{chunk=CraftChunk{x=8z=19}x=13
    17:54:24 [INFO] Infact, it is in need of spawning now. Let's try:
    17:54:26 [INFO] There are npc blocks placed in the world.
    17:54:26 [INFO] One of the npc blocks isCraftBlock{chunk=CraftChunk{x=8z=19}x=13
    17:54:26 [INFO] Infact, it is in need of spawning now. Let's try:
    17:54:28 [INFO] There are npc blocks placed in the world.
    17:54:28 [INFO] One of the npc blocks isCraftBlock{chunk=CraftChunk{x=8z=19}x=13
    17:54:28 [INFO] Infact, it is in need of spawning now. Let's try:
    17:54:30 [INFO] There are npc blocks placed in the world.
    17:54:30 [INFO] One of the npc blocks isCraftBlock{chunk=CraftChunk{x=8z=19}x=13
    17:54:30 [INFO] Infact, it is in need of spawning now. Let's try:
    17:54:32 [INFO] There are npc blocks placed in the world.
    17:54:32 [INFO] One of the npc blocks isCraftBlock{chunk=CraftChunk{x=8z=19}x=13
    17:54:32 [INFO] Infact, it is in need of spawning now. Let's try:
    17:54:34 [INFO] There are npc blocks placed in the world.
    17:54:34 [INFO] One of the npc blocks isCraftBlock{chunk=CraftChunk{x=8z=19}x=13
    17:54:34 [INFO] Infact, it is in need of spawning now. Let's try:
    17:54:36 [INFO] There are npc blocks placed in the world.
    17:54:36 [INFO] One of the npc blocks isCraftBlock{chunk=CraftChunk{x=8z=19}x=13
    17:54:36 [INFO] Infact, it is in need of spawning now. Let's try:
    17:54:38 [INFO] There are npc blocks placed in the world.
    It reads that repeatedly, allows me to rename the NPC, edit the text, but, unfortunately, it still seems to not recognize the /npcs respawn command which spawns the NPC.
    Let me know when you get the chance :)
  18. Offline


    @Solest ok that's very handy output and will help with my debugging. I'll be doing some work on this plugin about 7pm (gmt+9:30)
  19. Offline


    @acegiak Thanks again! Also, in case you need the information, our server is currently running CB v.556.

    I'll check back here later tonight, and if you need anything else just tag me and I'll see it. :)
  20. Offline


    2011-03-29 07:17:48 [SEVERE] Could not pass event BLOCK_PLACED to NpcSpirit
    java.lang.NoClassDefFoundError: org/python/util/PythonInterpreter
    at acegiak.NpcSpirit.JythonFactory.getJythonObject(JythonFactory.java:21)
    at acegiak.NpcSpirit.NpcBrain.loadMind(NpcBrain.java:198)
    at acegiak.NpcSpirit.NpcBrain.<init>(NpcBrain.java:28)
    at acegiak.NpcSpirit.NpcSoul.<init>(NpcSoul.java:55)
    at acegiak.NpcSpirit.NpcSoulManager.createSoul(NpcSoulManager.java:68)
    at acegiak.NpcSpirit.NpcSBlockListener.onBlockPlace(NpcSBlockListener.java:19)
    at org.bukkit.plugin.java.JavaPluginLoader$21.execute(JavaPluginLoader.java:264)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:59)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:255)
    at net.minecraft.server.ItemBlock.a(ItemBlock.java:107)
    at net.minecraft.server.ItemStack.a(ItemStack.java:56)
    at net.minecraft.server.ItemInWorldManager.a(ItemInWorldManager.java:160)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:495)
    at net.minecraft.server.Packet15Place.a(SourceFile:57)
    at net.minecraft.server.NetworkManager.a(SourceFile:230)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:76)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:357)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:272)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)
    Caused by: java.lang.ClassNotFoundException: org.python.util.PythonInterpreter
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:30)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 20 more

  21. Offline


  22. Offline


    Are you still planning to support NPCSpirit? I'm eagerly awaiting its release (since I happen to like python and strongly dislike java), but it's been ages since it updated. I administrate a server along with @Solest and he's been pulling for Citizens instead, which is similarly not updated and seems to have fewer features than your plugin but is at least functional. I strongly believe this plugin has some real potential to revolutionize the game the way redstone did.
  23. Offline


    yeah I second Cerealklr - any news on a 600+ update? I don't think there is anyone still on 493...

    Let me know either way, I'd love to install this until we at least get mySQL installed and if this is good enough we'll just keep it and not bother with MySQL...
  24. Offline


    @Flenix: We'll be installing MySQL anyway, but the NPCX plugin limits you by supplying no way to provide custom functionality. The whole purpose of NPCSpirit is its ease of extension through a simple Python API. I'm quite taken by the idea (being an AI buff) but I certainly don't have the time (or experience with Java) to try and whip something like it up from scratch. Provided the API, I'd be able to pump out Minecraft AI's that could do far more than NPCX user's could dream of. =P

    Speaking of which, if there isn't any progress at all by Saturday, we'll be stuck using NPCX at least during the interim. If that ends up being the case, I'll probably end up building a nice Django configuration interface for it (the in-game commands are an atrocity against mankind) overlaid atop a Cartographer-generated map (or whatever may've replaced Cartographer). Given both the opportunity and the need, I'd much rather dedicate that time to NPCSpirit. Do you think you'll be able to have something functioning by then?
  25. Offline


    I'm working on an update now guys. I'm really flattered that this is your prefered npc plugin. Ran into some major issues with jython, had a hissy fit and put the project down for a while to update juggernaut spirit and clear my head. Gonna rejig the plugin so that python scripting is an optional extra so that the default commands originally implemented continue to work for the time being, untill scripting is finished.

    Updated to work with 617. May have broken saving. Still requires jython.jar in bukkit dir as ai scripting is being developed in background. getting stuck with a dumb "java.lang.NoClassDefFoundError: Could not initialize class org.python.core.PyTraceback" error at the moment.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 11, 2016
  26. Offline


    Got another question/idea that I couldn't keep off my chest. Feel free to tell me where I can stick my ideas..!

    Are you planning on allowing (probably by AI script) the NPC to wander around randomly, rather like how mobs currently do? If so, have you considered the possibility of having it so you can restrict what block types the NPC can walk on (ie wooden planks, etc)? This way you could limit the area they can *patrol* (such as the wooden planks of the castle battlements, etc)?

    The other thing is I am quite interested in giving the NPC a *goal* (such a certain block to walk to, or destroy, or a certain person to follow, or kill). Have you had any plans or designs on how I might be able to do this in the script?
  27. Offline



    Is the sponge supposed to spawn an NPC as soon as its placed? I think I'm having a problem, its not spawning any NPCs, nothing is appearing on the log, and commands show nothing either. typing just /npcs just makes the command appear on my screen as /npcs but not said by me, just in plain white text..

    I literally just downloaded it. Any ideas whats wrong?
  28. Offline


    @Neko: Those are all API questions. As to the issue of having them randomly wander, I guarantee it'll be possible with _any_ sort of movement API. Provided he provides a system for detecting the information of surrounding blocks (judging by some of the hypothetical purposes he has listed, I'm reasonably certain he will) that means you'll be able to limit movement to certain block types as well. =] Same goes for the "goal" issue. It might not be able to find a path there itself, but D* or D lite are both fairly simple algorithms to implement that you can combine with a direct movement API in order to get the functionality you desire. Google is your friend! (though you might need to go to wikipedia first, since google results for "D*" tend to be useless).

    @Flenix: If you aren't getting _any_ messages, your issue is most likely a permissions error. Check to make sure your permissions are in order. =] If that isn't the issue, and you aren't getting any errors, but the mob still isn't spawning... well, no clue. I havn't installed the update yet myself. The server is being brought to my house tomorrow so I can install a proper OS on it (Ubuntu) and set up a full remote access suite and install all the latest stuff. =P

    @Acegiak: Sounds great! I don't know java itself, but if you need a brainstorming companion for any general programing issue i'm your man. =] Looking forward to seeing great things.
  29. Offline


    @Cerealklr: Ah, cheers. The question was mainly to see if he would provide a system for detecting the information, how complicated he planned his scripting language to be (so for example would he implement the pathfinding and just have a simple command to enable pathfinding to a specific location, or would it be up to the script to implement the pathfinding through the API). I did find the Wiki read very interesting, thanks! (did pathfinding for my final year of University, but back then I was focused on A*)
  30. Offline


    @Neko22, the plan was to have the api provide full information about surrounding blocks and also implement a simple pathfinding command as well. For the moment though I'm just trying to get jython to actually run again (it was working before, nothing's changed, wtf?!)

    shouldn't need to but see if putting http://machinespirit.net/ace/minecraft/jython.jar in your bukkit base directory helps. Also do you have permissions installed? also do you have the sqlite jar in your bukkit base directory?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 11, 2016
  31. Offline


    I'll try that, because its not there right now and didn't know where to find :p
    Yes we have sqlite there, and yes we have Permissions, but I'm admin with * so that shouldn't affect me.

Share This Page