JavaScript:
every 10 seconds:
loop all players:
chance of 80%:
loop all monsters in radius 15 of loop-player:
add loop-monster to {_monsters::*}
if size of {_monsters::*} > 4 <=50:
if time in world "world" is night:
loop all blocks in radius 10 of loop-player:
if loop-block is air:
if block above loop-block is air:
add loop-block's location to {_locs::*}
if {_recentpatrol::*} contains loop-player's uuid:
stop
else:
set {_spawn} to a random element out of {_locs::*}
play sound "minecraft:block.trial_spawner.spawn_mob" with volume 1 at {_spawn}
play 1 explosion emitter at {_spawn}
chance of 30%:
spawn zombie at {_spawn}
chance of 30%:
spawn skeleton at {_spawn}
chance of 30%:
spawn spider at {_spawn}
chance of 30%:
spawn creeper at {_spawn}
add loop-player's uuid to {_recentpatrol::*}
delete {_spawn}
wait 60 seconds
remove loop-player's uuid from {_recentpatrol::*}
It doesn't work like i want it to, at the beginning it just wouldn't start, then the spawn position {_spawn} wouldn't be deleted after the mobs spawning and they would just keep spawning in the same spot every 10 seconds ignoring the wait time.
I already rewrote the whole script 2 or 3 times and I can't understand what I'm doing wrong.
I should add that I learnt skript all by myself and I'm pretty sure there are many things I'm doing wrong and many that I could improve so any suggestion is well accepted.