[SOLVED] How to set mobs as enemies?

Discussion in 'Plugin Development' started by AussieBacom, Apr 2, 2012.

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

    AussieBacom

    I have the List Entities as "AffectedEntities", how does one set the mobs to enemies?
    What I have so far:
    This is able to tell me the string length of the nearby mobs. I'm unsure if the DamageEvent works or weather I should get that from a String of the player.
    Also I'm unsure how to further set mobs to enemy, and set mobs that run away like pigs.

    SOLVED

    Cheers for any help.
     
  2. Offline

    CorrieKay

    im fairly sure you have to manually set the target of the mob.

    However, thats... not really working last i checked
     
  3. Offline

    AussieBacom

    Well I have my EntityArray working now, I have no idea how to set a mob's target thou. If someone could help me that would be appreciated.
     
  4. Offline

    AussieBacom

    I have this working, VERY MESSY, works though. It makes sure its something living and then it will make it a creature, that way it wont get the ExperienceOrbs/DroppedItems/Other Entities
    PHP:
                            if(type == "SHEEP" || type == "OCELOT" || type == "MUSHROOM_COW" || type == "SKELETON" || type == "CREEPER" || type == "SLIME" || type == "ZOMBIE" || type == "SPIDER" || type == "CHICKEN" || type == "CAVE_SPIDER" || type == "COW" || type == "ENDERMAN" || type == "WOLF" || type == "PIG_ZOMBIE" || type == "SQUID" || type == "GHAST" || type == "MAGMA_CUBE" || type == "BLAZE" || type == "VILLAGER" || type == "SILVERFISH" || type == "SNOWMAN" || type == "IRON_GOLEM") {
                                
    Creature creature = (Creature)entitylist.get(i);
                                
    creature.damage(damageshooter);
                            }
     
Thread Status:
Not open for further replies.

Share This Page