Walking NPCs

Discussion in 'Plugin Development' started by r0306, Jul 4, 2013.

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

    r0306

    Is it me or is TopCat's NPC Library create choppy NPC movment? I'm calling the npc.walkTo(location) right now and I can see a some lag in their movements. No sure if I'm just doing it wrong or if there's a newer version of the library out but here's what I have.


    Code:
    public static void spawnNPC(String name)
    {
     
          final NPC npc = manager.spawnHumanNPC(name, arena.getRandomLocation());
     
            int id = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(Plugin.getPlugin(), new Runnable()
            {
     
                @Override
                public void run()
                {
     
                    processActions(npc);  //Makes NPC walk to a random location.
       
                }
     
            }, 1L, 100L);
     
            npc.setId(id);
     
    }
     
        public static void processActions(NPC npc)
        {
     
                Location location = npc.getArena().getRandomLocation();
                humanNPC.walkTo(location);
     
        }
     
  2. Offline

    njb_said

    This may be an old thread but would you mind sharing you random location code?
     
  3. Offline

    xTrollxDudex

    Technes and Twisted_Panda like this.
  4. Offline

    njb_said

    Yeah, is there a problem?
     
  5. Offline

    Technes

    r0306 was last seen: Jul 7, 2013
     
Thread Status:
Not open for further replies.

Share This Page