All zombies are only spawning on one block

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

lateeagle

Active Member
Jan 29, 2025
77
8
8
25
This is the code

Code:
function zombieSpawn():
    if {selected_map} = "forest":
        delete {zombiespawnblocks::*}


        loop all blocks within location(535, -30, 66, world "zombie") and location(380, -64, -68, world "zombie"):
            if loop-block is black concrete powder:
                send "fart" to players
                add loop-block to {zombiespawnblocks::*}
                add 1 to {zombiespawningloop}


                zombieLoop()
                
        wait 5 tick


        removeZombies()
        removeRottenFlesh()


local function zombieLoop():
    set {_loopcount} to {zombiespawningloop}
    while {_loopcount} is {zombiespawningloop}:
        loop {zombiespawnblocks::*}:
            set {_loc} to location of block above loop-value
            spawn a zombie at {_loc}


            if {difficulty} = "easy":
                wait 60 seconds
            if {difficulty} = "normal":
                wait 30 seconds
            if {difficulty} = "hard":
                wait 20 seconds
            if {difficulty} = "nightmare":
                wait 10 seconds
 
This is the code

Code:
function zombieSpawn():
    if {selected_map} = "forest":
        delete {zombiespawnblocks::*}


        loop all blocks within location(535, -30, 66, world "zombie") and location(380, -64, -68, world "zombie"):
            if loop-block is black concrete powder:
                send "fart" to players
                add loop-block to {zombiespawnblocks::*}
                add 1 to {zombiespawningloop}


                zombieLoop()
               
        wait 5 tick


        removeZombies()
        removeRottenFlesh()


local function zombieLoop():
    set {_loopcount} to {zombiespawningloop}
    while {_loopcount} is {zombiespawningloop}:
        loop {zombiespawnblocks::*}:
            set {_loc} to location of block above loop-value
            spawn a zombie at {_loc}


            if {difficulty} = "easy":
                wait 60 seconds
            if {difficulty} = "normal":
                wait 30 seconds
            if {difficulty} = "hard":
                wait 20 seconds
            if {difficulty} = "nightmare":
                wait 10 seconds
This is likely because of how zombieLoop is called. It should be called only once and outside of the if statement in which checking if the loop block is black concrete powder