Solved Zombie Stops Following?

Discussion in 'Plugin Development' started by Scizzr, Oct 1, 2013.

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


    So I'm working on making a custom zombie that will follow me. Everything except for one thing is working. The problem I'm encountering is that the zombie stops passively following me and starts attacking me when I attack surrounding zombies. Is there any way to override this?

    I'm using NMS code, such as a custom class that extends EntityZombie and in that class, I have set a custom PathfinderGoalNearestAttackableTarget. I tried not setting one and while it works, it doesn't allow the zombie to follow me after I shoot the other nearby zombie (since my checks for the zombie being too far are inside the a() method in the PathfinderGoalNearestAttackableTarget, and shooting the zombie somehow makes it ignore the PathfinderGoalNearestAttackableTarget).

    Is there something I'm missing that would cause the zombie to change to aggressive mode, even when I have explicitly overridden the PathfinderGoalNearestAttackableTarget selector?

  2. Offline


    I think PathfinderGoalMeleeAttack also plays a part but I need to check that
    Scizzr likes this.
  3. Offline


    You rock. It's 100% working now. :)
  4. Offline


  5. Offline


    Another question, if you don't mind.

    So I've got the following mobs working by using a scheduler and casting them to EntityCreature and setting their PathEntity target:
    Iron Golem
    Mushroom Cow
    And I have these working by using a custom Entity to spawn it in and override the Goal selections:
     - Pig Zombie
     - Zombie
    My question to you is how can I do the other mobs? Here's the problems I'm having with each:
    Cannot cast to Entity Creature (ClassCastException; EntityBat.getHandle() is not an instance of EntityCreature)
     - Bat
     - Magma Cube
     - Slime
    Mobs ignore being told where to move (casting to EntityCreature and setting their PathEntity target)
    Probably need to make a custom class for these I guess
     - Blaze
     - Cave Spider
     - Enderman
     - Ender Dragon
     - Silverfish
     - Spider
     - Squid
     - Wither
    I've been delving deeper into NMS to learn more about the AI, and it seems that they have two or more systems. They have the old system which relies on setTarget() and then they have the new system which relies on PathEntity and Navigation.
    I'm gonna keep trying to get those ones working, but just checking if you have any ideas.

    Thanks :)
  6. Offline


    I'm not an expert at NMS but those mobs clearly have different attack strategies and AI entirely, but are similar to eachother: notice Slime and Magma cubes both don't work, notice Endermen and Ender Dragons also don't work.
    Those other mobs that DO work have very different attack AI or none at all other than gawking at you (chickens, cows, pigs...)
  7. Offline


    Figured as much, just wasn't sure if you knew what the cause was. I'm trying different things and using MCP to see what the actual game has each mob do.
  8. Offline


    So I've got them all working by writing custom classes for them, but I can't seem to get Bat to move. It's probably the weirdest of the mobs that I've encountered so far.

    Anyone know how to make a Bat fly to a given location? (not teleport)
  9. Offline


    Could I see your code on how you moved an EntityHorse? I am trying to have a Horse walk to a specific location by getNavigation().[anything] just returns true and doesn't move the horse. It seems the rider's WASD movements are overriding the navigation AI. Any help?
Thread Status:
Not open for further replies.

Share This Page