help me for spawn zombie between loc and loc

Discussion in 'Plugin Development' started by kemalcik, Jan 20, 2022.

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

    kemalcik

    Hi! I use translation, some translations may be wrong.
    I have a polygon plugin that I developed and I want zombies to spawn in one location and another location.
    example: spawn zombie between location 10 5 10 and location 50 5 50.
     
  2. Online

    timtower Administrator Administrator Moderator

    kemalcik likes this.
  3. Offline

    pixelrider2000

    If you want the location between two other locations, you can use vectors:

    Location middle = location1#toVector()#getMidpoint(location2#toVector())#toLocation(world)
     
    kemalcik likes this.
  4. Offline

    kemalcik

    can you write the full code?
    My Code:

    Code:
    //Location Zombieloc = new Location(Bukkit.getWorld("world"), -100.500, 68.20000, 564.500;
                Zombie zombie = (Zombie) Bukkit.getWorld("world").spawnEntity(new Location(Bukkit.getWorld("world"), -100.500, 68.20000, 564.500), EntityType.ZOMBIE);
               
                ArmorStand hologram = (ArmorStand) Bukkit.getWorld("world").spawnEntity(zombie.getLocation(), EntityType.ARMOR_STAND);
               
                zombie.setCanPickupItems(false);
                zombie.getEquipment().setHelmet(helmet);
                zombie.setVillager(false);
                zombie.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 1000000, 2));
                zombie.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000000, 255));
                zombie.setCustomName("Normal Zombi");
                zombie.setBaby(false);
                zombie.setCustomNameVisible(false);
    
     
  5. Offline

    pixelrider2000

    I thought that you wanted to spawn a zombie in between two locations. You already have the code for spawning the zombie, so the only thing left is the code for the location. But I’ve given you the code for a location between two others. So what exactly do you want? Where even are your two locations, of which you want to get the middle?
     
  6. Offline

    kemalcik

    in a random location between a location I want and another location
    to spawn
    I want.

    I do not understand?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jan 21, 2022
  7. Online

    timtower Administrator Administrator Moderator

    You only said what you wanted. Not what part you need help with.
     
  8. Offline

    kemalcik

    sorry, I'm Coding Minecraft Plugin. I asked for help on this
     
  9. Online

    timtower Administrator Administrator Moderator

    You need to specify what kind of help though in your first message.

    Do you know how to make a random number?
     
  10. Offline

    kemalcik

    Isn't it done with new Random?
     
  11. Online

    timtower Administrator Administrator Moderator

    It is.
     
Thread Status:
Not open for further replies.

Share This Page