It seems like there’s some kind of error here – i isn’t being passed anywhere. Or should i be n instead? I tried it in the game with your version, and creatures spawned in the first two locations. Good thing they have a fixed spawn, otherwise the game would crash from lag 😆
I made a few minor adjustments, ran it again – now the monsters spawn in different locations, but still in a list, i.e., I run the function a second time, and it spawns the monsters in the same locations.
--All sorts of things before these lines
local n = random(length(creatures_positions))+1
local x = creatures_positions[n].x
local y = creatures_positions[n].y
--All sorts of things after these lines, k replaced with nAnd now the random function works, and creatures spawn in random saved coordinates 😇 Still, a huge thank you for correcting the function for saving coordinates and helping with the respawn function!