• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[TFS 1.1] Lua map generator (beta)

they're released already -.-

Excuse me Zbizu, that means i need to update my files :) i was already puzzling with editing ids :p

I'll redownload and check example.lua... Does it generate houses like your screenshots?
 
Damn this is crazy cool.
Too bad the included example is just a plain old cave with some green floor and water.

I'd love to get my hands on some custom generators you've already done, must take an incredible amount of time to script a detailed map generator file.
 
Damn this is crazy cool.
Too bad the included example is just a plain old cave with some green floor and water.

I'd love to get my hands on some custom generators you've already done, must take an incredible amount of time to script a detailed map generator file.

He has it as open source on github, its not "generators" its a generator, uses the same code, all you have to do is learn to use the configurations if you want to be able to make something more complex than the example
 
He has it as open source on github, its not "generators" its a generator, uses the same code, all you have to do is learn to use the configurations if you want to be able to make something more complex than the example

I know that, but having an example of detailed / decorated dungeons makes it a lot easier to teach yourself the way it works.

I've pulled the older generator code from the datapack release:
https://otland.net/threads/10-40-mystera-5-aka-evorpg-final-release.227200/

The tomb dungeons are a perfect example of what this can do, and its brilliant.
If you're a not an lua god, you could still splice the code to create new dungeons using walls and doodads with the same limitations:

Code:
    [2] = {
       map_name = "Ancient Tomb",
       map_corner = {x = 690, y = 171, z = 11},
       map_exit = {x = 1041, y = 893, z = 9},
       map_size = {96, 96, 3},
       map_spawn_room_radius = 5,
       map_void = {1071},
       map_floor = {412, 419, 420},
       map_time = 60 * 60 * 1000,
       map_shape = {
         [1] = {GEN_TUNNEL, 50, size = {3, 5}, length = {3, 9}},
       },
       borders = {
         [1] = BORDER_TOMB_WALL,
         [2] = BORDER_TOMB_SAND,
         [3] = BORDER_TOMB_SARC
       },
       structures = {
         [1] = {chance_per_tile = 30, str = {STRUCTURE_TOMB_I, STRUCTURE_TOMB_II, STRUCTURE_TOMB_III, STRUCTURE_TOMB_IV, STRUCTURE_TOMB_V, STRUCTURE_TOMB_VI, STRUCTURE_TOMB_VII, STRUCTURE_TOMB_VIII, STRUCTURE_TOMB_IX}},
       },
       details = {
         [1] = {chance_per_tile = 10, {1549, 12850, 12852, 12853, 1486}},
         [2] = {chance_per_tile = 10, {12950, 12951, 1481, 1482, 1483, 1484}},
         [3] = {chance_per_tile = 8, {13722, 13723, 13733}}, -- 13724, 13725
         [4] = {chance_per_tile = 60, ARRAY_SMALL_ROCKS}
       },
       hangables = {
       [1] = {chance_per_tile = 150, onwall = {1061, 1064}, d = {12215, 12218, 12220, 1888, 1896, 1898, 13688, 13692, 13695, 13696, 13698, 13700, 13702, 2040, 3944, 1829, 1819}},
       [2] = {chance_per_tile = 150, onwall = {1060, 1064}, d = {12216, 12217, 12219, 1889, 1897, 1899, 13691, 13693, 13694, 13697, 13699, 13701, 13703, 2038, 3946, 1830}}
       },
       c_cpt = 8,
       chests = {5675, 5676, 13902, 13903},
       chest_dist_from_spawn = 5,
       m_cpt = 20,
       monsterwaves = 20,
       monsters = {
         {"scorpion", 50},
         {"scarab", 30},
         {"ancient scarab", 20},
         {"skeleton", 70},
         {"ghoul", 50},
         {"mummy", 20},
         {"sandstone scorpion", 20},
         {"nerubian", 40},
         {"undead gladiator", 10}
       },
       fc_cpt = 10,
       floorchangers = {
         [1] = {{action = 2, trapdoor = 369, ladder = 1386}, 2},
         [2] = {{action = 3, small = {1405, 1399, 1403, 1401}, big = {1404, 1398, 1402, 1400}, top = {410, 410, 410, 410}, fix = {1061, 0, 0, 1060}}, 2}
       },
     },

That sort of thing is really helpful for self-teaching, sadly there are no examples like this with his new generator code.

So you have to really figure it all out yourself...

EDIT: I've just re-read the thread.
New generator code doesn't have any advanced functions like item/decoration detail - yet.

So with that said, using the code from the Mystera release is going to be better at this point.
 
Last edited:
I still dont get how to get this working, where do I execute
Code:
map_demo(map_id, frompos, topos, seed)
?
 
anywhere - lever, talkaction, movement, whatever
 
Theres something strange with the folders on @linux
Code:
ERROR: Failed to load script 'init.lua': LUA ERROR:
unable to open file '/data/map_generator/data/map_generator/config.lua': No such file or directory
stack traceback:

Aparently it's concatenating the folder again, so after changing loader.lua:4 to
Code:
local mapGeneratorDir = ""

It now seems to detect file and get a new error instead
Code:
ERROR: Failed to load script 'init.lua': LUA ERROR:
/data/map_generator/loader.lua:13: attempt to index global 'jit' (a nil value)
stack traceback:
which is
Code:
if jit.os == "Windows" then
   dirCommand = {'dir "', '" /b /aa'}
end

Im gonna keep checking in a little while and update post
EDIT:
Commenting this will suffice
Code:
-- if jit.os == "Windows" then
--    dirCommand = {'dir "', '" /b /aa'}
-- end
EDIT2:
I feel really stupid, thinking this was for otclient, how could it? Anyway, leaving aside that
This works on arch linux
Code:
------------------------------
-- Loader config
------------------------------
local mapGeneratorDir = "data/map_generator/"

------------------------------
-- loader
------------------------------
dofile(mapGeneratorDir .. 'config.lua')
local prefix = ">> "

local dirCommand = {'find ', ' -maxdepth 1 -type f'}

local folders = {'core', 'resources', 'mods'}

local filesCount = 0
for i = 1, #folders do
   if map_lib_cfg.debugOutput then
     io.write(prefix .. 'Loading ' .. map_lib_cfg.generatorName .. ' ' .. folders[i] .. '... ')
   end

   for dir in io.popen(dirCommand[1] .. mapGeneratorDir .. folders[i] .. '/' .. dirCommand[2]):lines() do
     filesCount = filesCount + 1
     dofile(dir)
   end

   if map_lib_cfg.debugOutput then
     print(filesCount .. ' file(s) loaded')
   end
   
   filesCount = 0
end
 
Last edited:
solution which doesn't require LuaJIT:
Code:
local dirCommand = {'find ', ' -maxdepth 1 -type f'}

-- Windows compability
if io.popen("ver"):read("*all"):find("Windows") then
	dirCommand = {'dir "', '" /b /aa'}
end
 
how is the progres?
edit: I get working it <3
but I need some news "maps" to be created, advanced stuff, can someone give me it?
 
Last edited:
if you're looking for more advanced generator, check my evo datapack
it has better autoborder and more features
 
if you're looking for more advanced generator, check my evo datapack
it has better autoborder and more features
I'm sorry for the time to answer :oops: today I see what you said, then I followed what you said about the datapack, but there is different than the code that you post here, how I can install the code from the datapack ? only copying
Code:
008_gen_lib.lua
009_gen_cfg.lua
010_gen_core.lua
also, what the function call the "generation" of maps with these advanced features?
 
Back
Top