How to move a zombie without pathfinding

Discussion in 'Plugin Development' started by ACampingNoob, Jul 27, 2013.

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

    ACampingNoob

    I'd like to be able to NOT use the Minecraft pathfinding, and have a zombie move to a location.

    I think I'm going to have to use NMS.
     
  2. Offline

    Milkywayz

    Code:
    .teleport(); 
    If you mean moving the zombie smoothly, doing so without path finding would be quite complex-something I would not be helpful with.
     
    MehrPvM likes this.
  3. Offline

    ACampingNoob

    Code:
    PathEntity pathGoTo = new PathEntity(pp);
    Navigation n = ((EntityInsentient)((CraftLivingEntity) z).getHandle()).getNavigation();
    n.a(pathGoTo, speed);
    This worked to move the zombie to one place however, registering the individual path points and having it move to each of them failed.
     
  4. Offline

    xTrollxDudex

  5. Offline

    ACampingNoob

    Sure I could get a repeating task to move him to one block at a time, but it seems that Minecraft has a way to just pass an array of PathPoints.
    Right now, when passed the PathEntity, the zombie just walks away diagonally, even though the tiles seem to work.
     
  6. Offline

    xTrollxDudex

    ACampingNoob
    Wait, are you making a zonbie walk towards a moving object?
     
  7. Offline

    ACampingNoob

    You can't set a PathEntity to a moving target. Yes it's moving, but the zombie should follow the path it's being given (an array of PathPoints)
    I have the path set every 7 seconds or so, and in the first 7 seconds of it being given the correct array of PathPoints, it moves diagonally.
    I want to know if I'm using PathEntity/PathPoint wrong.
     
  8. I have the same problem, I generated a PathEntity using A* Pathfinding, the paths are correct (I tested it by replacing all blocks in the path to diamond blocks) however my zombies just got suicidal and are moving diagonally off the map and into the void, it's strange though..

    when I use this in the PathFinderGoal:
    Code:java
    1. @Override
    2. public boolean a() {
    3. boolean flag = this.entitycreature.getNavigation().c();
    4. this.entitycreature.getNavigation().b(false);
    5.  
    6. this.path = new EntityPath(new EntityPathPoint[]{
    7. new EntityPathPoint(-912, 34, 1266),
    8. new EntityPathPoint(-924, 34, 1253),
    9. new EntityPathPoint(-933, 34, 1244),
    10. new EntityPathPoint(-947, 34, 1230),
    11. new EntityPathPoint(-960, 34, 1218)
    12. });
    13.  
    14. this.entitycreature.getNavigation().b(flag);
    15.  
    16. return this.path != null;
    17. }

    EDIT: EntityPath and EntityPathPoint are my custom classes extending PathEntity and PathPoint

    It actually works, but when I set the path outside of this function as a class variable it doesn't work, not sure why though in both cases the PathEntity stays the same whenever the function gets called, all I can think of now is that it perhaps bugs out when too much pathpoints are provided or when the last pathpoint is too far away.. would be weird, but that's the only thing I can think of.
     
Thread Status:
Not open for further replies.

Share This Page