Code for spawning and killing monsters periodically not working

  • 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!

DPPPPP

Member
Jul 22, 2023
25
0
1
25
My code, as listed below, shows no errors or problems when running through the server, yet when I tested it, it did not work. I meant that sometimes the monsters spawned, and sometimes they did not. Sometimes they die randomly (not accompanied with the sea lanterns appearing), and sometimes they die when the lights appear.
.One note is that the monsters do not spawn during the time in which the sea lanterns appear. Please help me with my code!


every 19 ticks:
chance of 10%:
set {_loc1} to location(-213,54,-261)
set {_loc2} to location(-323,54,-332)
if the blocks within location(-213,54,-261) and location(-323,54,-332) do not contain sea lanterns:
loop all blocks within block at {_loc1} and block at {_loc2}:
set loop-block to polished andesite
chance of 7.5%:
set loop-block to sea lantern
loop all zombies within 200 blocks of location(-323,54,-332):
kill loop-zombie
every 20 ticks:
chance of 6%:
set all blocks within location(-213,54,-261) and location(-323,54,-332) to polished andesite
spawn 3 of zombie at location(-265,50,-319)
loop all zombies within 10 blocks of location(-265,49,-319):
set the health of the loop-zombie to 10000
apply swiftness 4 to the loop-zombie for 2000 years
apply resistance 100 to the loop-zombie for 2000 years
apply strength 7 to the loop-zombie for 2000 years
wait 3 ticks
equip the loop-zombie with tinted glass of infinity
set the name of loop-zombie to "&4Entity"