[FUN/MECH] npcx (v0.0.31) - The NPC eXtender (now for 1.8.1) [1097-1157]

Discussion in 'Inactive/Unsupported Plugins' started by wizjany, May 9, 2011.

  1. Offline


    npcx - The NPC eXtender
    Version: 0.0.31

    UPDATE: mixxit has took the initiative to update the npclib to 1.8, all credit for this update goes to him! it should work on any 1.8 version of craftbukkit

    If you are having trouble, please read the old thread here and the included readme.txt that mixxit left. If you know of any other tutorials, do post and I'll add them.

    Info Update: Well long story short I am beginning to get bored of Minecraft and I don't have as much time as I would like to develop this plugin. This probably means that the rewrite I had planned is just going to die. Besides lack of time and motivation, I find it extremely pointless to write an API for NPCs outside of bukkit/craftbukkit, which makes the rewrite I was working on very frustrating. However, I will continue to update mixxit's code for new versions of minecraft, but don't expect any new features or anything.
    Update 2: As NPCs are being planned natively for 1.8 (the adventure update), I will probably be working on a (separate) plugin or directly with the NPC API if I have time.

    Note: If you have iConomy, make sure you have at least version 5+ or you'll get an error like this.
    [SEVERE] Could not pass event WHATEVER_EVENT to npcx
    java.lang.NoClassDefFoundError: com/iConomy/iConomy
    You should also be able to add "use-iConomy=false" in the npcx properties file.

    If you're having trouble installing MySql on windows, here's a nice guide: http://forums.bukkit.org/posts/293544, thanks to Atticus Craft. Basic WAMP/LAMP/MAMP servers should work fine too, just make sure you have the username/password correct and the database with permissions to the right user.

    • You can create npcs
    • And they do stuff
    • Everything should work like it did in mixxit's last version
    And by "work like it did" I mean I have no clue if there were bugs from then, but they're probably still around now. Please report any you find so I can take them into consideration.

    For MC 1.8.1 (1097+, no RB yet) Download
    For MC 1.7 (937+, 953, 1k): Download
    For MC 1.6 (807+): Download
    For MC 1.5 (740-803): Download
    Source Code

    Version 0.0.31
    • Updated to MC 1.8.1 (by Mixxit)
    Version 0.0.3
    • Updated for Grum's internal renaming
    Version 0.0.2
    • Updated for 1.6
    Version 0.0.1
    • Updated for 1.5
    • Began code revamp
    All credits go to mixxit for his work. Special thanks to sk89q and fullwall, even if they don't know they helped.
    wassilij, Zoaen, nathanaelps and 2 others like this.
  2. Offline


    is it by any chance for this to work with SQLite now? or is it impossible or something... that would be PERFECT if it did and i would love you but i dont like MySQL too complicated -.-
  3. Offline


    pretty sure he has already said there are no plans to support it.
    I don't know technical details but as far as I am aware MySQL is a LOT faster than sqlite, so the fact that groups of NPCs lag players as it is, I feel even if this mod did work on sqlite it would be unusable from lag, so thats probably where there is no support for it.
  4. Offline


    well every time i need to start server, i need to open xxamp and then run MySQL... is there an EASIER way to run MySQL... like so i start server and MySQL starts too?
  5. Offline


    I cant Attack Npcs and i cant delete the Npcs.

    pls help
  6. Offline


    To everyone experiencing issues - this plugin is still based off Mixxit's codebase, which was slightly buggy, so you may want to wait until @wizjany has simplified the code and made it a better laid out and optimised plugin before reporting bugs.
    wizjany and mbsuperstar1 like this.
  7. Offline


    also that i cant attack npcs is a bug that has erveryone ?
  8. Offline


    hy. when i write /npcx npc triggerword 1 ATTACK NPCATTACK , and when i attack him, it dont want to respond anything. what have i to do?
  9. Offline


    Again, is 1.5 gigs enough ram?
  10. Offline


    That would be it

    You know, you could just run the plugin and find out if it lags or not.
  11. Offline


    I xampp if you check the little check-box beside svc that will install MYSQL as a service, meaning it will start up in the background when the computer boots.
  12. Offline


    Hy i have a problem. When i want to chat with the npc it write this to the console:
    2011-05-12 19:57:34 [SEVERE] Could not pass event PLAYER_CHAT to npcx
    java.lang.NoClassDefFoundError: com/iConomy/iConomy
        at net.gamerservices.npcx.myPlayer.getPlayerBalance(Unknown Source)
        at net.gamerservices.npcx.myNPC.variablise(Unknown Source)
        at net.gamerservices.npcx.myNPC.parseChat(Unknown Source)
        at net.gamerservices.npcx.myNPC.onPlayerChat(Unknown Source)
        at net.gamerservices.npcx.npcxPListener.onPlayerChat(Unknown Source)
        at org.bukkit.plugin.java.JavaPluginLoader$6.execute(JavaPluginLoader.java:236)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:59)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:257)
        at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:646)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:634)
        at net.minecraft.server.Packet3Chat.a(Packet3Chat.java:32)
        at net.minecraft.server.NetworkManager.a(NetworkManager.java:195)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:74)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:370)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:285)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:394)
    Caused by: java.lang.ClassNotFoundException: com.iConomy.iConomy
        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:36)
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:24)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 17 more
    I have Craftbukkit 740, and Permissions, SimleWarp, SimpleHome, PwnCraft, Blacksmith, this NPCX, xAuth, Nether, Lockette, HeroicDeath, SimpleSave, NoWeather, NoSpawn.
  13. Offline


    Thanks for the tip! :) Sorry all, don't use forums much... haha. I can come have a look if you like, not sure how much looking will help though :(. The triggerwods etc. work fine for me, maybe its an issue of syntax? It could also be incompatibility with another plugin, which would be annoying to deal with :confused:... I'm happy to come on and check it out first hand though ;). Besides it'd be nice to just login and see some of the many wonders of someone elses server anyway. Feel free to PM me if you'd like.
    No worries mate! :) I'll set my irc client back up at some point this week. Really keen to help out, so just let me know if you want a hand with the coding. Don't mind simply error checking either :) Good to hear you plan to redo the whole structure of the coding too. mixxit did an awesome job, and I don't want to do him any disservice, but I have to say, I'm not the biggest fan of his coding style :rolleyes:. Anyways, keen as dude, so feel free to gimme any task you like to 'test me out' if you're keen for a programming assistant :p
    Hmm, I guess first thing to do would be check the name length of the npc. I'd say try to make sure it stays under 15 for each npc. Personally I like to keep mine simple and easy to retype. (G1 for Guard type 1 etc.). If your NPCs name is shorter then 15 characters it could probably be any one (or multiples) of a number of things. I'd say to check your MySQL database is set up the way that is described in mixxit's readme, and to check for plugin conflicts (try backing up then removing all the plugins except the one for npcx). Also, not sure if its an issue or not, but I think someone mentioned it on the other thread... You should probably set yourself as an op if you have that option, because I think someone mentioned that causes issues if you don't.
    Yes, for now at least, possibly forever. For now I think we should just be happy that it is working at all. I didn't know anything about MySQL before I found this plugin, but its really not that hard to set up if you follow the steps in mixxit's readme. If you are really having trouble with this, that is understandable, but for now its all we have. Most of the code appears to be built around MySQL databases so there's probably not a whole lot the mighty plugin saviour (wizjany) can do there for now (his powers are not quite as godly as we like to believe :p). Perhaps in future, with politely infrequent requests wizjany may decide to implement a simpler system, I cannot say.
  14. Offline


    Is there anybody who is able to condescend to make a detailed tutorial on how to configure mysql for the plugin?

  15. Offline


    Will you make a wiki for this plugin? This thread obviously doesn't have documentation, but the previous thread doesn't either- I'm not as much a fan of videos as I am a fan of a list of commands when it comes to plugins.
  16. Offline


    Hmm, I removed iChat but it hasn't made any difference.

    If I type something with no trigger, for example "Test" it just tells me I said it to the NPC. If i type a word that DOES have a trigger, for example "Hello", it both says it to the guard and inputs it into normal chat, which other players can also hear.
    I didn't realize this until just now when I typed "hello" and about 4 players all said hey at the same time... Then had to pretend nothing happened :D (They don't know about the NPCs yet...)
  17. It seems that there is not that much documentation, so I have been browsing the source to try to figure out everything. Here are some useful comments.

    // Overview:
    // A spawngroup is like a container. It contains many npcs and
    // any one of them could spawn randomly.
    // If you placed just one npc in the group only one npc would
    // spawn. This allows you to create 'rare' npcs

    // Spawngroups need to be assigned to a location with
    // 'spawngroup place' Once assigned that group
    // will spawn in that location and remain stationary

    // If a path is assigned to the spawn group, the npc will follow
    // the path continuously after spawning
    // at the location of 'spawngroup place'

    // todo: functionality
    // creates a new spawngroup with name
    // adds an npc to a spawngroup with a chance
    // makes the spawngroup spawn at your location
    // assigns a path to the spawngroup
  18. Offline


    This pretty much sums stuff up.

    As for
    [SEVERE] Could not pass event PLAYER_CHAT to npcx java.lang.NoClassDefFoundError: com/iConomy/iConomy
    it's because you're running a version of iconomy older than 5.x

    Wrong triggerwords, check the readme. Should be "EVENT_ATTACK" I believe.
  19. Offline

    XLawless BaronX

    OMG awesome love this plugin
  20. Offline


    Is it possible to delete pathgroups? If it's not... then please add this if you have the time! It clutters things a bit, of course, to not have that ability without delving into the sql!

    Also, once again bravo on getting this plugin back in workig order and thank you for sharing. After finally getting the time to try it out, I can say it's pretty much the coolest thing since iConomy :p It adds a lot more than iConomy to any server, too!
  21. Offline


    thanks but everytime i do that, and restart my computer, its not running and the box is unchecked... the only thing that DOES run on startup is the Apache thingy but thats been like that since i installed xampp. u know how to fix that problemo??
  22. Offline


    The previous thread has a readme which contains all the commands
  23. Offline

    Atticus Craft

    I was actually about to mention this God damage issue, but I suppose you already know about it :)

    However this same issue probably is the reason behind another, where the NPC's can attack inside "protected" zones, when using other plugins (like residence or worldgaurd) where pvp is turned off.. they just keep raping you while they become invincible. I imagine its related to the issue you mentioned however, just figure the more information the better.

    I'm glad to hear you will be re-writing it, I imagine that means you'll be modifying the way some of the commands work? Personally I think a good deal of it is overcomplicated for the sake of over-complication.

    You rock, keep up the awesome work!

    For those having MySQL issues, here's a bit of a walkthrough on how to set it up for Windows 7 (I'll try to add one for linux later):
    First download the MySQL installer that best fits your machine from: MySQL.com

    I chose the: Windows (x86, 64-bit), MSI Installer
    (Currently MySQL Community Server is on 5.5.12 as of this writing)

    1. Run the installer (double click the .msi file, click Run when prompted)
    2. Click "Next" in the intro window.
    3. In the following screen select Custom Installation which will allow you to specify the folder to which MySQL will be installed.
    4. Click the "Change" button and enter C:\MySQL in the Folder name field. Hit "OK" when done.
    5. The installer will change the MySQL installation folder to the one specified by you.
    6. You are now ready to install MySQL on Windows 7 operating system. Click "Install".
    7. It would take some time for the progress bar to move ahead... be patient.
    8. You may also get messages along the way - simply click on "Next" to proceed
    9. When the process finishes, you'll get to see the final screen. Congratulations - MySQL has been installed on your computer. You are now prompted to Configure the MySQL server and register the product. In the interest of time, you can skip registering it (if it asks) and clicked "Finish".
    10. MySQL instance configuration is important - you cannot use the software until you do so. Click "Next" to proceed.
    11. Select "Detailed Configuration" option.
    12. Choose "Developer Machine".
    13. I suggest going ahead with "Multifunctional Database" unless you know what you are doing.
      • Personally, I prefer the middle option, which sets InnoDB as the default...
    14. In the following screen, don't mess with the default values and click "Next".
    15. The same goes for the subsequent screen - click "Next".
    16. For the networking options configuration, put a check mark in front of "Enable Strict Mode" if it's not there.
    17. Yes, it's recommended to install MySQL as a Windows service and have the system include the MySQL bin directory in the Windows PATH variable.
    18. The password for the MySQL server instance has to be typed in twice. Remember to keep a note of it - Don't lose this MySQL password.
    19. The configuration wizard has received all the information it needs and is ready to create a MySQL server instance. Click "Execute" button.
    20. The instance should be configured without problems. If you do get a message from an anti-virus program or the Windows 7 operating system - choose the option to move ahead.
    Checking the MySQL Installations Integrity:
    The easiest way to check MySQL installation and confirm that it's working properly is to use the MySQL Command Line Client. Fire it up from "All Programs" -> "MySQL" -> "MySQL Server 5.1".
    Now enter the MySQL password - the characters you type will be replaced by the asterisk sign (the password is not shown for security reasons - obviously).
    The MySQL client displays the mysql> prompt on successful login - [Slide 25]. Type: show databases; (the semi-colon at the end is not a typo) and hit the enter key. This simple SQL command instructs MySQL to display the names of the installed databases, which should be three. Hurray - rejoice because you have been able to correctly install MySQL on Windows 7!
    That will get your MySQL setup correctly, which is the first most important step. After that, I personally recommend Navicat Lite (MySQL version - Click the Navicat for MySQL Tab) to manage my databases and db users. Its lightweight and extremely easy to use.
    Once you have installed and opened Navicat:
    Click "Connection" and select MySQL (to create a new Connection)
    1. You can name it whatever you want, but I suggest "Local" or "Localhost" as the Connection Name.
    2. Host Name/IP Address: keep this as "localhost"
    3. Port: 3306
    4. User Name: root
    5. Password: (whatever you setup in the MySQL Install)
    Hit Ok.
    Using Navicat to setup Npcx:
    You should see 3 tables by default in the list. Right click in this left pane and select "New Database..."
    1. Database Name: "npcx"
    2. Character Set: utf8 -- UTF-8 Unicode
    3. Collation: utf8_general_ci
    Next you need to create the Npcx user, to do this Click on the giant "User" button.
    Right click on the Right pane and select, "New User":
    1. User Name: npcx
    2. Host: localhost
    3. Password: p4ssw0rd!
      • This is the default for npcx, but can be changed in the config located under bukkit/plugins/npcx/npcx.properties
      • Personally, I changed this password, you can too.
    4. Retype the password to confirm
    5. Hit "Save"
    Close the user window (but not the Navicat Main window)

    Now click "Privilege Manager" on the Right Hand side (above the list of your two users):
    1. Select the "npcx" Db and click on "Add Privilege" at the top left-hand corner
    2. A new window will popup, select 'npcx'@'localhost' on the left
    3. Select ALL checkboxes on the Right hand side
    4. Hit Ok
    5. Click Save
    You are done! Start up your server running NPCX (or just do a reload all) and it should create the tables in the DB.

    If you mucked up anywhere along the way or get some sort of error, I can try to help you correct it, but I only check back here a few times a day (and may skip a few days).

    Hope that helps some of you :)
    Once you've gotten a good way into re-writing the Code @wizjany, I wouldn't mind giving a hand with SQL optimization if you end up modifying or adding tables.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jul 16, 2016
  24. Offline


    Thanks a lot for your efforts, but I get a "no callback/reaction" (don't know whats the message in english), when I execute the configuration. It appears while trying to do the third point.
  25. Offline

    Atticus Craft

    Hmm.. which version are you trying to install and what are your PC's specs? Operating system?

    And which step exactly did you encounter the issue? You said 3, but 3 is just selecting "custom config" and that doesn't make sense.

    I've noticed that there seems to be a whole slew of undocumented "faction" commands... at least, I can't seem to figure out what the tables "npc_faction" and "faction_entries" are for... I have factions created, and npc's in those factions, but these tables remain empty...

    Also, how does the "player_faction" table work in conjunction with NPC factions?

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


    Hello, i'm french so escuse me for my spelling mistake
    I've follow the readme to create a database with MySQL, I've done exactly what he said but it doesn't work my Bukkit console wrote a series of errors and finally saids that npcx can't connect to the db but Mysql workbench said that the server is running. I don't understand why it doesn't work, have you a better tutorial than this old video, because it doesn't help me for MySQl.

  27. Offline


    Hey, are the SQL tables apt to change in the next while? If they're not, I hope to create a web-based front-end (probably PHP, for those counting at home) for them... I love the detail built into this little mod, but (frankly) the interface has a STEEP learning curve, beginning with the fact that my fingers try to type my initials--nps--every time I come to a place that I need to type '/npcx'.

    Should I get started on that now, or give it a few weeks while the tables are updated/stabilized?
  28. Offline


    "3" meant not one of your steps. I meant the third of the 4 steps the wizard executes (something about "services"). My Operating system is windows 7, i try to install mysql 5.5.9

    When I tried it earlier on my own, there was no error, but i used other configurations.

    EDIT: I just tried it again with the version you mentioned, but it is the same error: The configwizard is not able to create a windows service.

  29. Offline

    Atticus Craft

    You may be trying to use the 64 bit version on 32 bit windows? I used the x64, but you may need the x32. Whatever version of MySQL you tried to use before, I would say use again just follow these steps to set it up.

    I would be somewhat interested in assisting with this.

    I imagine this would be a front end everyone runs locally, although that would require them to have PHP running on their machines, in addition to MySQL (which as we've seen can already be a headache).

    Anyway, I'm interested in the development of this front end idea. I imagine you could get started (at least with the interface) before receiving confirmation on the table structure.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jul 16, 2016
  30. Offline


    Yep, rewriting a lot of stuff, I already have an outline of what I want to do, and I'll probably have time to get a good chunk of it done this weekend. Also if I integrate with anything, it'll probably be worldguard, as I am most familiar with it (and I help develop it too, so I can always add API if i need it). Also nice writeup on mysql, linking in first post if you don't mind.
    player faction table is for players' reputation with factions
    some of the other tables are as of yet unused as far as I can tell

    very likely to change now, as I plan the rewrite. Awesome idea though, it would be very useful and I don't know much php myself (read: none).
  31. Offline

    Atticus Craft

    I don't mind at all :)

    I would like to suggest a feature, because I'm currently unable to figure out how to make it happen...
    Have faction status towards other factions... where you've got Hostile, Friendly, Neutral.. and hostile will attack on sight.

    Having a "Bandits" faction and a "Guards" faction is sort of useless if the guards won't attack the bandits unless the bandits attack the guards on accident.

Share This Page