Hey all, I'm trying to write a script that would force all underground tree variants to start growing as discovering three cavern layers is not a guarantee to obtaining all the underground tree types. I'm not a very script savvy person, so I looked around and tried to copy and adapt
this code for starting Nethercap growth:
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
However running that particular script returns the following error from DFHack:
Cannot read field world.T_cur_savegame.map_features: not found.
stack traceback:
[C]: in function '_index'
TreeScript.lua:1: in main chunk
[C]: in function 'safecall'
...DF/hack/scripts/lua.lua:11: in function 'f'
...DF\hack\lua\dfhack.lua:461: in function <...DF\hack\lua\dfhack.lua:425>
(...tail calls...)
It's all greek to me, but I guess DFHack doesn't like this script written from over a year and a half ago. Anyone point me in the right direction?