Skip to content
User Avatar
#3826
Auto-translated
Azgalor

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.

I’ve solved the problem. I wrote this:
--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 n

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