[Lib] [1.7.10] NPCFactory v1.4 - Create walking npcs with custom names and skins!

Discussion in 'Resources' started by lenis0012, May 26, 2014.

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

    zombiekiller753

    lenis0012
    :3 Minecon cape
    I'm so jelly.

    The code is pretty awesome too. Do NPCs obey gravity though?
     
  2. Offline

    lenis0012

    Not yet.
    I will add a boolean for it later.

    New update 1.2
    • Added pathfidning to npc's
    • Fixed NPE when lookAt target entity logs out
    • Fixed non-entity damage not being applied
    • Added missing javadocs in NPC.java

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

    TeamJesus

    so what's the code to get them moving and looking around? or is that in the java docs? ( a little example maybe? ) thanks
     
  4. Offline

    lenis0012

    Check this page: http://mcduty.com/npcfactory-docs/com/lenis0012/bukkit/npc/NPC.html
    to look at a player (keeps looking at himas long as he is in a radius of 30 blocks):
    Code:java
    1. npc.setTarget(player);

    to look a location:
    Code:java
    1. npc.lookAt(player.getLocation());

    to walk to a location:
    default radius = 30
    default speed = 0.2 (max 1.0)
    Code:java
    1. npc.pathfindTo(player.getLocation(), speed, radius);
     
    TeamJesus likes this.
  5. Offline

    bigteddy98

    Check the solution for this problem I posted earlier here ;)
     
  6. Offline

    lenis0012

    I already implemted fully working pathfinding with custom speed
     
  7. Offline

    bigteddy98

    oh awesome, how did you do it?
     
  8. Offline

    lenis0012

    Last edited by a moderator: Jun 8, 2016
  9. Offline

    KingFaris11

    You're like another Bukkit god (the only other one I know is Comphenix).

    Edit: Can you please check out my Pull Request?
     
  10. Offline

    BungeeTheCookie

    Skins are connected to UUIDs and Nameplates. You can just force them to display on an EntityPlayer.

    You forgot about me. And chasechocolate. And xTrollxDudex. And bigteddy98. And Cirno. And @TheGuyOnTheStreetCorner

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

    KingFaris11

    Funny guy. I haven't really used any of your resources, but bigteddy's good, I just don't recognise him much.

    Anyway, is there a way to make it so the NPC can move? As in, firstly if I spawn it in the air, it doesn't drop, and secondly, I would like it to behave like an animal, moving randomly.
     
    Phasesaber likes this.
  12. Offline

    lenis0012

    Quite a lot of requests at once.
    For moving you can use NPC.pathfindTo
    I will add gravity and i will look at some animal behavior
     
    KingFaris11 likes this.
  13. Offline

    thecrystalflame

    KingFaris11 and desht like this.
  14. Offline

    Phasesaber

    Is there any way to get rig of the NPCs?
     
  15. Offline

    lenis0012

    If you meant get rid.
    try doing npcfactory.despawnAll()
     
  16. Offline

    Phasesaber

    I just want to get rid of one though.

    I have this:
    Code:java
    1. public void kill(){
    2. this.getBukkitEntity().remove();
    3. }
     
  17. Offline

    KingFaris11

    You can do that. I would recommend doing it like this though: npc.getBukkitEntity().remove();
    This refers to the actual npc object, and not having another method inside the NPC class.

    Thanks! Yeah I was mainly talking about animal behaviour. :D
    Have fun with the requests xD

    Ohhh dayumn I forgot about him too.

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

    BungeeTheCookie

    Because
    A. I don't post a lot of them
    B. I mostly make private plugins.
    C. How about my Complete List of Java Keywords that hasn't been updated in a year or so?

    Oh. desht

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

    lenis0012

    BungeeTheCookie Anyone who doesn't pretend to be more than he is is a bukkit god to me
     
    MCForger and DSH105 like this.
  20. Offline

    BungeeTheCookie

    No one is a Bukkit God because there are always ways to improve. It is just a complement for someone who is really proficient in an extracurricular activity or hobby.
     
    Comphenix and KingFaris11 like this.
  21. Offline

    KingFaris11

    That's a lie. Comphenix will always be the God of all Bukkit Gods <3

    Edit: Okay stop now, don't go off-topic. xD
     
    Someone_Like_You and lenis0012 like this.
  22. Offline

    BungeeTheCookie

    KingFaris11 likes this.
  23. Offline

    KingFaris11

    You're implying I'm Christian, which I'm not. :)
     
  24. Offline

    thecrystalflame


    you forgot about Icyene :p ^.^ anyway i stop now
     
  25. Offline

    lenis0012

    dont' go off-topic please :s
     
  26. Offline

    TomFromCollege

    lenis0012
    I can't for the life of me get the NPCInteractEvent to work >.<
    I am registering the listener, but it never gets called:
    [​IMG]
    [​IMG]

    Am I right in thinking that this event should call when a player right clicks the entity?
    I looked through the git and saw that this is being called on the a() method, but honestly, I have no idea what it's for :p

    Edit:
    Worked around it using:
    [​IMG]
     
  27. Offline

    Mirreducki

    If i create a npc with the same name and skin as me it seems like i also get the "NPC" metadata since we have the same UUID and isNPC() returns true for me. Anyway to prevent that? Not that it's a problem just wondering.

    Nice lib:) Just wanting that gravity boolean:)
     
  28. Offline

    lenis0012

    gravity comming very soon.
    You are right about the metadata.

    Perphaps i should try to work around that
     
  29. Offline

    KingFaris11

    Not to rush you for your awesome work, but any planned date? :p
    This is what I've come up with for now. I don't even know what the h() method is but I see it is called in the EntityPlayer class too soo... Yeah. This is at the bottom of the h() method in NPCEntity.
    Code:
            if (Math.random() > 0.75) {
                this.move(Utils.RandomUtils.getRandomDouble(0D, 2D), 0D, Utils.RandomUtils.getRandomDouble(0D, 2D));
            } else if (Math.random() > 0.95) {
                this.move(Utils.RandomUtils.getRandomDouble(0D, 2D), 1D, Utils.RandomUtils.getRandomDouble(0D, 2D));
            }
    
    RandomUtils.getRandomDouble() returns a random double inbetween the two parameters.
     
  30. Offline

    lenis0012

Thread Status:
Not open for further replies.

Share This Page