Changing the Speed of Monsters

Discussion in 'Plugin Development' started by Glorfindel22, Dec 23, 2012.

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

    Glorfindel22

    I have been working on a survival server for some time now and I am trying to change the speed of monsters. I read these posts:

    http://forums.bukkit.org/threads/cant-change-zombies-speed-damage.84490/
    http://forums.bukkit.org/threads/best-way-of-changing-mobs-move-speed.65378/#post-1118928

    However, I am currently using the Beta build (1.4.6) which according to this post included new safeguards to prevent plugins from accessing craftbukkit and minecraft.server packages.

    http://forums.bukkit.org/threads/sa...cked-and-potentially-damaging-plugins.116749/

    As far as I can tell both of those thread used code that accessed those packages. So my question is, "Is there any way that I can do this without violating this safeguard?"

    Thanks in advance for any help :)
     
  2. Offline

    tommycake50

    speed potions or setting velocity
     
  3. Offline

    Glorfindel22

    How do I set velocity?
     
  4. Offline

    fireblast709

    <some entity>.setVelocity(Vector)
     
  5. Offline

    Glorfindel22

    Okay so I am trying to make the monsters become faster when they target an entity. However, I still don't know how to set the speed. Here's my code:

    Code:
    package net.richardsprojects.bukkit.apocalypse;
     
    import org.bukkit.entity.Entity;
    import org.bukkit.entity.Zombie;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.EventPriority;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
    import org.bukkit.util.Vector;
     
    public class ApocalypseEntityTargetEntityEvent implements Listener {
     
         @EventHandler(priority = EventPriority.HIGH)
          public void onEventPlace(EntityTargetLivingEntityEvent event) {
               Entity entity = event.getEntity();
     
               if (entity instanceof Zombie) {
                    Vector newSpeed = entity.getVelocity().clone();
               }
           }
    }
     
  6. Offline

    fireblast709

    Isn't it easier to just give it a PotionEffect?
     
  7. Offline

    Glorfindel22

    I thought I read somewhere that zombies weren't smart enough to use the increased speed.
     
  8. Offline

    fireblast709

    Well I threw a bottle of Speed on one of them, certainly he got the brainz and ran after me like hell
     
  9. Offline

    funkystudios

    Code:
    Entity entity = Le Bukkit Entity;
    EntityCreature ec = ((CraftCreature) entity).getHandle();
    ec.getNavigation().a(SPEED);
    I believe this would work?

    SPEED is a float with 0.25 as the norm.
     
  10. Offline

    GodzOfMadness

    lol
     
  11. Offline

    Glorfindel22

    Well I still want something a little bit more precise if I can get it.

    Code:
    Entity entity = Le Bukkit Entity;
    EntityCreature ec = ((CraftCreature) entity).getHandle();
    ec.getNavigation().a(SPEED);
    Doesn't that access the craftbukkit and minecraft server packages?
    Is there anyway to do by setting velocity like we were originally thinking. Also I can't get the right event. I was using the EntityTargetLivingEntityEvent but it doesn't seem to be called when the Monsters chase me. I tested it out by going in survival and having it print a message to the console when the event was run. Some monsters chased me but nothing was printed to the console.

    Hate to double post but any ideas?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 30, 2016
Thread Status:
Not open for further replies.

Share This Page