Chaosforge Forum
DoomRL => Modding => Topic started by: Uranium on October 16, 2017, 13:15
-
so, i've started to put together a module for the first time (the first version of which i *hope* to have released by halloween but ehhhh), but i'm running into issues with randomly generating levels. the first map is an entrance map, upon exiting via the stairs, the game freezes. My module.onGenerate() is simply
function hospital.OnGenerate()
generator.reset()
generator.generate_tiled()
end
which is exactly the same as in the doomrl source, and as far as i can ascertain, should produce no errors whatsoever. I suppose it's correct in that it doesn't actually produce an error, it just freezes the game. Any help appreciated.
cheers!
-
I don't actually have the source, but would guess that generator.generate_tiled() is causing your hospital.OnGenerate() to be called again, giving you an infinite loop.
-
I don't actually have the source, but would guess that generator.generate_tiled() is causing your hospital.OnGenerate() to be called again, giving you an infinite loop.
This makes sense - i had this suspicion as I couldn't find raw code for generator.generate_tiled(). If i replace it with generator.generate_caves_dungeon() (which I can find the code for) I expected it to work, as generate_caves_dungeon() doesn't have any reference to an OnGenerate() hook and seems completely self contained, but it still seems to jam the game in an infinite loop.
I hope I'm not missing something horrendously obvious...
-
Try this:
function hospital.OnGenerate()
generator.reset()
generator.run( generators.gen_tiled )
end
-
Ah, thanks very much Tavana! Works great!
-
Glad that helped! :)