Zombies Spawn

Discussion in 'Spigot Plugin Development' started by Nosmakos, May 21, 2016.

  1. hey guys i want a few steps about how i can make zombies spawn around a player for example every 10 minutes? but not exactly spawn infront of the player but a few blocks around like 10 and also set the amount of the zombies.
     
  2. I'd probably do something like this.

    X = player_X + (10 - random.nextInt(20)); // adds a random value between -20 and 20.
    Z = player_Z + (10 - random.nextInt(20)); // adds a random value between -20 and 20.

    Then, start at Y = 256 (or lower is performance is of importance) and iterate through the blocks (downwards) until you find a solid block (not air). Then spawn a mob at (player_X, iterated_Y - 1, player_Z).

    Unfortunately, this doesn't work in caves, but that would require more more advances spawning algorithms.
     
    #2 sander2798, May 21, 2016
    Last edited: May 21, 2016
  3. thank you so much for the ideas!
     
  4. No problem, good luck! :) Let us know if you have any trouble.
     
  5. of course will do!! but im thinking if it's better making mobs spawning at daylight or just doing this way