NpcSpawner lib - spawn basic NPCs

Discussion in 'Resources' started by Redecouverte, Feb 3, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    jeremytrains

    It seems to be that c_ was renamed to b_, but since I haven't fixed the other problem I can't test it yet. For the new super constructor, just at MinecraftServer.getServer().getLogger() as the first argument. Again, that is what it seems, but I have not been able to test it yet. If you figure out the problem in Node.java, let me know.
     
  2. Tank you :)

    I got it ;) the 'e' is replaced by 'b'.
    https://github.com/Bukkit/CraftBukkit/commit/d3d98a166f05f8fadfcd11adc0318c548da8a25b
    In old line 322 and new line 313

    But I can't find the new name for the 'az' field in EntityLiving or EntityPlayer.
    You need this in NPCHuman in the lookAtPoint method.
    EDIT: 'az' is replaced by 'aA'. I just tried all float fields ^^
    By the way: You have to replace the line:

    Code:
    Field f = NetworkManager.class.getDeclaredField("m");
    in NPCNetworkManager.java
    with
    Code:
    Field f = NetworkManager.class.getDeclaredField("n");
     
  3. Offline

    The_Coder

    Hello I am a noob when it comes to libs like this. I am currently trying using Top_Cat 's npclib. I have no idea how to use it.
    Thanks for everyones hard work.
     
  4. Offline

    jeremytrains

    caliog
    yep I just got those two. Thanks!

    The_Coder
    You need to take the source code and add it to your src folder/build path. I use the Eclipse IDE (your profile pic?). If you use Eclipse, copy the com folder (wich containt the topcat folder) into the src folder of your project (located in WORKSPACE_DIR/PROJECT_NAME/src).

    Then, in your onEnable method, you need to initialize an NPCManager (com.topcat.npclib.NPCManager). This is the manager you will use to create/edit/remove NPCs. Try playing around with that class and see what you can do.

    Remember, the NPCs must be saved into a file on server shudown/reload and loaded on enable
     
  5. Offline

    The_Coder

    jeremytrains Thanks a lot for the replay I have loaded them in like you said and it seemed to work. How do I now create the npc?
    Thanks.
     
  6. Offline

    jeremytrains

    The_Coder
    There is a method in the NPCManager class called spawnHumanNPC. You must give it the NPC's name and the location to spawn the NPC at. You may also (optionally) give it an id for the NPC (I just use numbers). If you do not pass it an id, it will make one for you. It will return an NPC object. Cast the object to the type HumanNPC. Then that is your npc object. I personally (in NPCWarehouse) store the NPCs in a big array. If you want to access the NPC later, there are other methods in the NPCManager class to get the NPC by its ID, the entity, or name.
     
  7. Offline

    The_Coder

    jeremytrains Great. Thanks. I looked in the class an found a ton of errors, so I am trying to clean it up. I am just updating the imports, because I am using 1.5 R2 dev build. Is that ok to use?
     
  8. The_Coder I am not sure about the dev build but you can use the beta build 1.5.1 R2

    Wouldn't it be better to create a github page for this lib and let some authors update it regularly ? I would like to do that but I am not sure if topcat is ok with that ^^
     
  9. Offline

    The_Coder

    caliog ya I changed everything that had v1_4_1 to v1_5_R2 and that cleared most of the errors then I got an error in the NPCNetworkManager here:
    Code:
    public NPCNetworkManager() throws IOException {
            super( new NullSocket(), "NPC Manager", new Connection() {
                @Override
                public boolean a() {
                    return true;
                }
            }, null);
    Eclipse says: "The constructor NetworkManager(NullSocket, String, new Connection(){}, null) is
    undefined"
     
  10. The_Coder
    Insert this new line ;)
    Code:
    super(MinecraftServer.getServer().getLogger(), new NullSocket(),
                    "NPC Manager", new Connection() {
                        @Override
                        public boolean a() {
                            return true;
                        }
                    }, null);
    I just created a github repo for the npclib where you can download latest versions of the lib.
    If somebody wants to help update and extend the lib he can become a author at github, just write me a message ;)

    https://github.com/caliog/NPCLib

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

    NoLiver92

    How Do I Download This?
     
  12. Offline

    jeremytrains

  13. Offline

    zeddio

    Hello everyone, trying to implements NPC's on my server but how do i do so they look at a direction / to a point?

    I have both tried to calculated and set their pitch & yaw and do npc.lookAtPoint(loc);
    Nothing works, any ideas?

    //zeddio
     
  14. What craftbukkit version are you using and do you have the latest version of the NPCLib ?
     
  15. Offline

    zeddio

    caliog I'm using craftbukkit for 1.5.2
     
  16. Offline

    Ultimate_n00b

    I wonder when a 1.5.2 version will come out..
    EDIT: Just updated it myself, just replace v1_5_R2 with v1_5_R3, or whatever version you're compiling/using it with.
     
  17. Offline

    Techy4198

    caliog can you please tell me how do i initialize the NPCManager?
     
  18. Offline

    kevinspl2000

    I am getting WAAY too may errors... I have the latest CraftBukkit and Bukkit added to my build path but I have 100 errors...
     
  19. Offline

    Ultimate_n00b

    This is an old tool. I suggest Citizens, they have a great API.
     
  20. Offline

    kevinspl2000

    Isn't citizens API for 1.2.5?
     
  21. Offline

    Ultimate_n00b

    Citizens 1 is. That's why I would suggest looking into Citizens 2.
     
  22. Offline

    kevinspl2000

    Link?

    Ultimate_n00b
    Can't seem to find it on bukkit.org

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

    viper_monster

  24. Offline

    kevinspl2000

  25. Offline

    viper_monster

  26. Offline

    Ultimate_n00b

    spoljo666 likes this.
  27. Offline

    Luloak2

    @kevinspl2000
    Citizens 1 (and 2 also) are based on this lib, but the developers brought much more features to it, so better use the Citizens API ;)
    A year ago, I used this api for one of my (inactive) plugins - it was very difficult and I had to fix it every update for myself, because support for this lib is outdatet..
     
  28. Offline

    HeroWorkbrine

    where is the download link?
     
  29. Offline

    Luloak2

    HeroWorkbrine As said in his post, just look into the wiki - there you will find the answers you need.


    PS: This is post number #600 in this thread - yeahh :D
     
  30. Offline

    Maczen01

    Would this work for every version of bukkit. (After changing packets and stuff ofcourse). And if it doesnt. Could you make one that works. I really love the functions that this adds. And sorry if this is too much but it'd be awesome if you could add a followEntity(Entity entity, int dist) where entity is who its gonna follow and the dist is the distance it is going to hold from the entity/player. Got some other ideas too. PM me if you got time to listen
     
Thread Status:
Not open for further replies.

Share This Page