Solved Zombie Stops Following?

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

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

    Scizzr

    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?

    Thanks.
     
  2. Offline

    xTrollxDudex

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

    Scizzr

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

    xTrollxDudex

  5. Offline

    Scizzr

    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:
    Code:
    Chicken
    Cow
    Creeper
    Horse
    Iron Golem
    Mushroom Cow
    Ocelot
    Pig
    Sheep
    Skeleton
    Snowman
    Villager
    Witch
    Wolf
    
    And I have these working by using a custom Entity to spawn it in and override the Goal selections:
    Code:
     - Pig Zombie
     - Zombie
    
    My question to you is how can I do the other mobs? Here's the problems I'm having with each:
    Code:
    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

    xTrollxDudex

    Scizzr
    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

    Scizzr

    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.
    Thanks.
     
  8. Offline

    Scizzr

    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

    jeremytrains

    Scizzr
    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