[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

    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
     
  2. 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.
  3. Offline

    bigteddy98

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

    lenis0012

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

    bigteddy98

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

    lenis0012

    Last edited by a moderator: Jun 8, 2016
  7. You're like another Bukkit god (the only other one I know is Comphenix).

    Edit: Can you please check out my Pull Request?
     
  8. 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
  9. 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.
  10. 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.
  11. Offline

    thecrystalflame

    KingFaris11 and desht like this.
  12. Offline

    Phasesaber

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

    lenis0012

    If you meant get rid.
    try doing npcfactory.despawnAll()
     
  14. 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. }
     
  15. 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.
  16. 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
  17. 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.
  18. 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.
  19. 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.
  20. Offline

    BungeeTheCookie

    KingFaris11 likes this.
  21. You're implying I'm Christian, which I'm not. :)
     
  22. Offline

    thecrystalflame


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

    lenis0012

    dont' go off-topic please :s
     
  24. 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]
     
  25. 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:)
     
  26. Offline

    lenis0012

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

    Perphaps i should try to work around that
     
  27. 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.
     
  28. Offline

    lenis0012

  29. Offline

    lenis0012

    It will be a bit more advanced than that.

    Working on animal behavior.
    Its kind of funny

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
    KingFaris11 likes this.
Thread Status:
Not open for further replies.

Share This Page