1
Utilities and 3rd Party Applications / DFHACK lua script question. (Spawn nethercaps)
« on: July 30, 2019, 09:24:21 am »
So im trying to force nethercap to spawn in an area after the game has started, been poking around for two days and all ive found is this code from 2014
Which claims to do exactly what Im trying to do, but i get this error
...\DWARFF~1\Dwarf Fortress 0.44.12/hack/scripts/nether.lua:1: Cannot read field world.T_cur_savegame.map_features: not found.
stack traceback:
[C]: in metamethod '__index'
...\DWARFF~1\Dwarf Fortress 0.44.12/hack/scripts/nether.lua:1: in local 'script_code'
...ktop\DWARFF~1\Dwarf Fortress 0.44.12\hack\lua\dfhack.lua:680: in function 'dfhack.run_script_with_env'
(...tail calls...)
I dont understand programming enough to understand what this is doing, or what the error is. Could someone help explain this to me? Or alternately direct me to a better tool to introduce biome/cavern appropriate trees/saplings/spores to an area? Its taken me nearly 4 days to generate a world i have any interest in playing in long term, and the only thing i lack is nethercap for a project. Thank you in advance, I hope this is the right forum.
Link to previous post on same topic I found. incase ive made a mistake or explained poorly.
http://www.bay12forums.com/smf/index.php?topic=135258.0
Code: [Select]
feat = df.global.world.cur_savegame.map_features[2]
num = #feat.feature.population
feat.feature.population:insert('#', { new = df.world_population, type = df.world_population_type.Tree, plant = dfhack.matinfo.find('PLANT:NETHER_CAP').index });
for i,j in pairs(df.global.world.populations) do if (j.population.cave_id == feat.layer and j.population.population_idx == num - 1) then df.global.world.populations:insert('#', { new = df.local_population, type = df.world_population_type.Tree, plant = dfhack.matinfo.find('PLANT:NETHER_CAP').index, population = {region_x = j.population.region_x, region_y = j.population.region_y, population_idx = num, cave_id = feat.layer, depth = feat.start_depth, unk_28 = -1 } } ) end end
Which claims to do exactly what Im trying to do, but i get this error
...\DWARFF~1\Dwarf Fortress 0.44.12/hack/scripts/nether.lua:1: Cannot read field world.T_cur_savegame.map_features: not found.
stack traceback:
[C]: in metamethod '__index'
...\DWARFF~1\Dwarf Fortress 0.44.12/hack/scripts/nether.lua:1: in local 'script_code'
...ktop\DWARFF~1\Dwarf Fortress 0.44.12\hack\lua\dfhack.lua:680: in function 'dfhack.run_script_with_env'
(...tail calls...)
I dont understand programming enough to understand what this is doing, or what the error is. Could someone help explain this to me? Or alternately direct me to a better tool to introduce biome/cavern appropriate trees/saplings/spores to an area? Its taken me nearly 4 days to generate a world i have any interest in playing in long term, and the only thing i lack is nethercap for a project. Thank you in advance, I hope this is the right forum.
Link to previous post on same topic I found. incase ive made a mistake or explained poorly.
http://www.bay12forums.com/smf/index.php?topic=135258.0