setTarget() doesn't work & PotionEffects on Zombies?

Discussion in 'Plugin Development' started by SchmidtMathias, Mar 28, 2012.

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


    Hi fellow board members,

    I'm just on programming a new plugin that should change some mob behaviors.

    My first Problem:
    Zombie target = (Zombie)event.getEntity();
    This is part of my code. entity is another Zombie. And the zombie (target) just ignores the setTarget() order. Anyone an idea why?

    My second Problem is the following:
    target.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,100,2), true);
    target is still a zombie. The Effect is being displayed but he doesn't seem to walk faster. Is there a way to give an Zombie an PotionEffect?

    Thanks for help.
  2. Offline


    Im also having issues with setTarget()... It might be a bukkit issue
  3. Offline

    Father Of Time

    I actually tried using this three nights ago with villagers to make them face people who are interacting with them, and sure enough I noticed no results either... As previously stated, is this a Bukkit bug?

    EvilSeph Would you be able to confirm whether or not this is a bug?

    *runs off to check bug reports*
  4. Offline


    The problem with the potions is that the Mobs don't know how to handle the speed potions, from what I've heard, (Actually any kind of potions, with the jumping effect on the only will try jump over 1 high blocks) So you should change the AI from the mob :)
  5. Offline


    SetTarget doesn't work anymore. Add craftBukkit as a source because this uses native minecraft server methods.
    If you want it to follow a player, you need to set a scheduler to call this every second or so, and do something like this:
    EntityCreature ec = ((CraftCreature)target).getHandle();
    Navigation nav =;
    Location entityLoc = entity.getLocation();
    nav.a(entityLoc.getX(), entityLoc.getY(), entityLoc.getZ(), 0.25F); //change the 0.25F as needed, it controls the movement speed.
  6. Offline


    Player p = event.getPlayer();
    PotionEffect po = new PotionEffect(PotionEffectType.SPEED,
                        100, 0);
                p.addPotionEffect(po, true);
    For me i keep the 2 number always set to 0. But if your issue is that you do get the effect regardless if its under a boolean, 100 is about 5 seconds.
  7. Offline


    Any way to do that with EntityHuman?
  8. Offline


    Yes. The same way, although that's changed a bit since it's been a few months since i posted that.
Thread Status:
Not open for further replies.

Share This Page