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

    SchmidtMathias

    Hi fellow board members,

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

    My first Problem:
    Code:
    Zombie target = (Zombie)event.getEntity();
    target.setTarget(entity);
    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:
    Code:
    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.
    Mathias
     
  2. Offline

    Fell

    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

    Gcity306

    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

    EnvisionRed

    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:
    Code:
    EntityCreature ec = ((CraftCreature)target).getHandle();
    Navigation nav = ec.al();
    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

    unforgiven5232

    Code:
    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

    Barinade

    Any way to do that with EntityHuman?
     
  8. Offline

    EnvisionRed

    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