Zombies walk to a certain location.

Discussion in 'Plugin Development' started by MeTim, Mar 2, 2013.

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

    MeTim

    Is there a way to control the zombie and let him walk to a location? And check if the location still exists, because i want the zombies to move to a dropped item.
     
  2. Offline

    kabbage

    This code should be able to do it.
    Code:
    public void moveTo(LivingEntity entity, Location moveTo, float speed)
        {
            EntityLiving nmsEntity = ((CraftLivingEntity) entity).getHandle();
            // Create a path to the location
            PathEntity path = nmsEntity.getNavigation().a(moveTo.getX(), moveTo.getY(), moveTo.getZ());
            // Move to that path at 'speed' speed.
            nmsEntity.getNavigation().a(path, speed);
        }
     
  3. Offline

    MeTim

    I know this is an old thread... The code is done now but I have 1 problem if a player is a target of the zombie they go to the player and I want that they go first to the location. Maybe you can set the "zombie target radius" or what ever you call it to 1 block for 60 ticks?
     
  4. Offline

    Rprrr

    MeTim
    Or: you set the target to null.
     
  5. Offline

    MeTim

    Rprrr Does that work? Because I think if you set the target to null it just automatically set it back to the player doesn't it?
     
  6. Offline

    Rprrr

    MeTim
    Not if you cancel the targetting event..
     
Thread Status:
Not open for further replies.

Share This Page