Wolf does not attack?

Discussion in 'Plugin Development' started by Gabum, Jan 21, 2014.

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

    Gabum

    Hello Minecraftians/Bukkitters!
    I'm currently creating a Boss Plugin, and one Boss makes a wolf spawn everytime the boss is attacked, which is supposed to attack a random player.

    So, I now have this code:
    Code:java
    1. if (e.getEntity() == TheHoundmaster){
    2. LivingEntity entity = (Zombie) TheHoundmaster;
    3. if (entity.getHealth() <= 10 + e.getDamage()){
    4. Location[] jails = new Location[] {
    5. new Location(hideout, 63, 4.5, 1211),
    6. new Location(hideout, 49, 4.5, 1217),
    7. new Location(hideout, 49, 4.5, 1211),
    8. new Location(hideout, 63, 4.5, 1217)
    9. };
    10. Wolf w = (Wolf) hideout.spawnEntity(jails[(int) (Math.random() * 3)], EntityType.WOLF);
    11. w.setAngry(true);
    12. w.setCustomName("Angry Wolf");
    13. Player random = hideout.getPlayers().get((int) (Math.random() * hideout.getPlayers().size() - 1));
    14.  
    15. }
    16. }


    How do I make the Wolf attack Player "random"?

    I already tried .setTarget(random), but the wolf still did nothing.
    And I tried w.damage(0,random), but from unknown reasons the wolf dies immediately.
    So, any ideas how to fix it?
     
  2. Offline

    Warreo

  3. Offline

    Gabum

    Would something be possible like setting the Houndmaster as the owner of the dogs?
     
Thread Status:
Not open for further replies.

Share This Page