Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 243 244 [245] 246

Author Topic: DFHack 51.05-r1  (Read 917630 times)

Salmeuk

  • Bay Watcher
    • View Profile
Re: DFHack 50.14-r1.1
« Reply #3660 on: December 10, 2024, 03:26:39 pm »

amazing work! that 'unstick wildlife' bugfix, paired with the force wildlife event command, look extremely useful for maps where you simply cannot get interesting animals to arrive.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 50.15-r1.2
« Reply #3661 on: December 17, 2024, 11:41:35 pm »

DFHack 50.15-r1.2 was released recently with support for all DF 50.15 builds. Get it here: https://github.com/DFHack/dfhack/releases/tag/50.15-r1.2
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 50.14-r1.1
« Reply #3662 on: December 22, 2024, 03:33:46 pm »

-snip-
probably in the future dig through an old de-resident script and just make it a resident script so one could just walk away from a place and not worry about killing everyone... and or give the hermit a stack of bad emotions of realizing all their friends are dead.

ok so this bit ended up working for the citizens but not the pets, and had led to figuring out how to keep the pets alive, the process ended up being converting the pets and livestock into citizens of the fort and give them historical figures, practically recreating the process unretiring does to the locals.

this toggles on the resident flag and saves the units to the site you were about to walk away from, be it you probably want to do this on a lair,
Code: ("hermit-settle.lua") [Select]
function hermitsettle()
for de,oe in pairs(df.global.world.units.active) do
if oe.civ_id==df.global.plotinfo.civ_id or oe.flags1.tame==true  then
oe.flags2.resident=true
oe.flags1.tame=false
end
if oe.custom_profession == 'Hermit' then
oe.flags2.resident=false
end
end
end
hermitsettle()
and  this one is for un-residenting followers or squad members you brought along on the hermit trip.
Code: ("hermit-de-settle.lua") [Select]
function hermitdesettle()
for de,oe in pairs(df.global.world.units.active) do
if oe.civ_id==df.global.plotinfo.civ_id or oe.flags1.tame==true then
oe.flags2.resident=false
end
end
end
hermitdesettle()

Code: ("animaltokencivpatchhermit.lua") [Select]
ui=df.global.plotinfo

local function allocateNewChunk(hist_entity)
  hist_entity.save_file_id = df.global.unit_chunk_next_id
  df.global.unit_chunk_next_id = df.global.unit_chunk_next_id+1
  hist_entity.next_member_idx = 0
  print("allocating chunk:",hist_entity.save_file_id)
end

local function allocateIds(nemesis_record,hist_entity)
  if hist_entity.next_member_idx == 100 then
    allocateNewChunk(hist_entity)
  end
  nemesis_record.save_file_id = hist_entity.save_file_id
  nemesis_record.member_idx = hist_entity.next_member_idx
  hist_entity.next_member_idx = hist_entity.next_member_idx+1
end

function createFigure(unit,he,he_group)
  local hf = df.historical_figure:new()
  hf.id = df.global.hist_figure_next_id
  df.global.hist_figure_next_id = df.global.hist_figure_next_id+1

  hf.unit_id = unit.id
  hf.nemesis_id = -1
  hf.race = unit.race
  hf.caste = unit.caste
  hf.profession = unit.profession
  hf.sex = unit.sex
  hf.name:assign(unit.name)

  hf.appeared_year = df.global.cur_year
  hf.born_year = unit.birth_year
  hf.born_seconds = unit.birth_time
  hf.curse_year = unit.curse_year
  hf.curse_seconds = unit.curse_time
  hf.birth_year_bias = unit.birth_year_bias
  hf.birth_time_bias = unit.birth_time_bias
  hf.old_year = unit.old_year
  hf.old_seconds = unit.old_time
  hf.died_year = -1
  hf.died_seconds = -1

  hf.civ_id = unit.civ_id
  hf.population_id = unit.population_id
  hf.breed_id = -1
  hf.cultural_identity = unit.cultural_identity
  hf.family_head_id = -1

  df.global.world.history.figures:insert("#", hf)

  hf.info = df.historical_figure_info:new()
--  hf.info.whereabouts = df.historical_figure_info.T_whereabouts:new()
  hf.info.whereabouts = df.state_profilest:new()
 -- hf.info.whereabouts.death_condition_parameter_1 = -1
  hf.info.whereabouts.body_state_id = -1
 -- hf.info.whereabouts.death_condition_parameter_2 = -1
  hf.info.whereabouts.body_state_sub_id = -1
  -- set values that seem related to state and do event
  --change_state(hf, dfg.plotinfo.site_id, region_pos)


  --let's skip skills for now
  --local skills = df.historical_figure_info.T_skills:new() -- skills snap shot
  -- ...
  -- note that innate skills are automaticaly set by DF
  hf.info.skills = {new=true}

  if he then
    he.histfig_ids:insert('#', hf.id)
    he.hist_figures:insert('#', hf)
    hf.entity_links:insert("#",{new=df.histfig_entity_link_memberst,entity_id=unit.civ_id,link_strength=100})

    --add entity event
    local hf_event_id = df.global.hist_event_next_id
    df.global.hist_event_next_id = df.global.hist_event_next_id+1
    df.global.world.history.events:insert("#",{new=df.history_event_add_hf_entity_linkst,year=unit.birth_year,
    seconds=unit.birth_time,id=hf_event_id,civ=hf.civ_id,histfig=hf.id,link_type=0})
  end

  if he_group and he_group ~= he then
    he_group.histfig_ids:insert('#', hf.id)
    he_group.hist_figures:insert('#', hf)
    hf.entity_links:insert("#",{new=df.histfig_entity_link_memberst,entity_id=he_group.id,link_strength=100})
  end

  local soul = unit.status.current_soul
  if soul then
    hf.orientation_flags:assign(soul.orientation_flags)
  end

  unit.flags1.important_historical_figure = true
  unit.flags2.important_historical_figure = true
  unit.hist_figure_id = hf.id
  unit.hist_figure_id2 = hf.id

  return hf
end

function createNemesis(unit,civ_id,group_id)
  local id = df.global.nemesis_next_id
  local nem = df.nemesis_record:new()

  nem.id = id
  nem.unit_id = unit.id
  nem.unit = unit
  nem.flags:resize(31)
  nem.activeplotindex = -1
  nem.travel_link_nemid = -1
  nem.ideal_item_container_id = -1
  --nem.unk10 = -1
  --nem.unk11 = -1
  --nem.unk12 = -1
  df.global.world.nemesis.all:insert("#",nem)
  df.global.nemesis_next_id = id+1
  unit.general_refs:insert("#",{new = df.general_ref_is_nemesisst, nemesis_id = id})

  nem.save_file_id = -1

  local he
  if civ_id and civ_id ~= -1 then
    he = df.historical_entity.find(civ_id)
    he.nemesis_ids:insert("#",id)
    he.nemesis:insert("#",nem)
    allocateIds(nem,he)
  end
  local he_group
  if group_id and group_id ~= -1 then
    he_group = df.historical_entity.find(group_id)
  end
  if he_group then
    he_group.nemesis_ids:insert("#",id)
    he_group.nemesis:insert("#",nem)
  end
  nem.figure = unit.hist_figure_id ~= -1 and df.historical_figure.find(unit.hist_figure_id) or createFigure(unit,he,he_group) -- the histfig check is there just in case this function is called by another script to create nemesis data for a historical figure which somehow lacks it
  nem.figure.nemesis_id = id
  return nem
end
function sigh()
for k,v in pairs(df.global.world.units.active) do
local HF=df.global.world.history.figures
local HO=df.global.plotinfo.civ_id
local EN=df.global.world.entities.all[HO]
local HP=df.global.plotinfo.group_id
if v.hist_figure_id==-1 and v.civ_id==df.global.plotinfo.civ_id then
createNemesis(v,HO,HP)
--createFigure(v,EN,HP)
print(k)
end
end
end

for k,v in pairs(df.global.world.units.active) do
local HFN=df.global.world.history.figures
local HN=df.global.plotinfo.civ_id
sigh()
if v.hist_figure_id==-1 then break else
for c,q in pairs(HFN[v.hist_figure_id].entity_links) do
if q.entity_id==df.global.plotinfo.civ_id and v.population_id==-1 and q.entity_id~=df.global.plotinfo.group_id then
print(v.hist_figure_id)
v.flags1.tame=false
HFN[v.hist_figure_id].entity_links:insert("#",{new=df.histfig_entity_link_memberst})
HFN[v.hist_figure_id].entity_links[c].entity_id=df.global.plotinfo.group_id
HFN[v.hist_figure_id].entity_links[c].link_strength=100
end
end
end
end
and the script for filling out historical figures for non-hist figs of the fort this will catch the non histfigs and give them one but it's pretty experimental.
the next one is extremely experimental as it sets the map edge zlevel to align with where ever the hermit is position z level wise .

Code: ("mapedgeZhermit.lua") [Select]
function movewagon(curx,cury,curz)
for de,oe in pairs(df.global.world.units.active) do
if oe.custom_profession == 'Hermit' then

return oe.pos.z
end
end
end
local adv=movewagon()
for k3,Lay in pairs(df.global.plotinfo.map_edge.surface_z) do
local zeroedge=df.global.plotinfo.map_edge.surface_z[0]
local edge=df.global.plotinfo.map_edge.surface_z[k3]
local edge2=df.global.plotinfo.map_edge.surface_z[k3]
local adjust=adv-zeroedge
if Lay==0 then break else
Lay=edge2+adjust
print(Lay)
for k4,Lay2 in pairs(df.global.plotinfo.map_edge.surface_z) do
df.global.plotinfo.map_edge.surface_z[k4]=Lay2+adjust
end
end
end
Logged
I thought I would I had never hear my daughter's escapades from some boy...
DAMN YOU RUMRUSHER!!!!!!!!
"body swapping and YOU!"
Adventure in baby making!Adv Homes

myk

  • Bay Watcher
    • View Profile
Re: DFHack 50.15-r2
« Reply #3663 on: January 17, 2025, 11:58:00 am »

DFHack 50.15-r2 is now available!

Highlights: Stonesense reborn, Rescue lost squads, Rename things!

Get it from:

Manual installation instructions: https://docs.dfhack.org/en/stable/docs/Installing.html

On Steam, this release is available on the DFHack default None channel (for DF 50.15) and the adventure-beta channel (for DF 51.01-beta).
Logged

myk

  • Bay Watcher
    • View Profile
Re: DFHack 51.02-r1
« Reply #3664 on: January 23, 2025, 11:11:28 am »

DFHack 51.02-r1 is now available!

Highlights: Compatibility update, Stonesense progress

Get it from:

Manual installation instructions: https://docs.dfhack.org/en/stable/docs/Installing.html
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 51.02-r1
« Reply #3665 on: January 24, 2025, 11:56:54 am »

Code: ('adv-compass.lua') [Select]
local dlg=require("gui.dialogs")
--testing-for-map-charting-for-nomad
--ok so this script is made for the pile of nomad scripts to aid in finding 'realizations in the pre-gen sites'
-- so if one wants to visit a tavern, or the main keep or locate where in the 17x17 grid is the market stalls you could with this script.
-- for the 'realization' seeking to work you need to nomadically move into the site you're looking for which then the game will load in the realization data.
-- if you see no realization data if you click on or select any of the other sites in the first menu that means they don't have one or you're not in the site.
-- the coord numbers are based on the distance from the player site -x is west x is east and -y is north and y is south if you see a 0 then you're right on top of the edge of that site.
-- the player site will always show 0 0 0 0 as it subtracting it's coords with itself. 
--this script is also built off the structure of an old just summon script.
--2025: ok so this is a modification that now works in adv mode you need to be fast traveling for this to work

function justsummoning()
local center = df.global.plotinfo.main.fortress_site
local center3 = df.global.plotinfo.main.fortress_site
local Ark={}
local Radar= 32
for ko,vo in pairs(df.global.world.armies.all) do
if vo.flags[0]== true  then
local convert3= math.floor(vo.pos.x/3)
local convert4= math.floor(vo.pos.y/3)

for k,v in pairs(df.global.world.world_data.sites) do
if convert3 - v.global_min_x < Radar and  convert3 - v.global_min_x > -Radar and convert3 - v.global_max_x < Radar and convert3 - v.global_max_x > -Radar and convert4 - v.global_min_y < Radar and convert4 - v.global_min_y > -Radar and  convert4 - v.global_max_y < Radar and convert4 - v.global_max_y > - Radar then
local mapnotes1 = v.global_min_x - convert3
local mapnotes2 = v.global_max_x - convert3
local mapnotes3 = v.global_min_y - convert4
local mapnotes4 = v.global_max_y - convert4
local Sitetype={"Player Fort","Dark Fort","Cave","MountainHall","ForestRetreat","Town","Important Location","Lair/Shrine","MercFort","Camp","Monument"}
BoaName=dfhack.translation.translateName(v.name)
table.insert (Ark,{dfhack.translation.translateName(v.name).." "..Sitetype[v.type+1].." site id:"..v.resource_pile_id.." "..mapnotes1.." "..mapnotes2.." "..mapnotes3.." "..mapnotes4,nil,v,search_key = dfhack.translation.translateName(v.name):lower()})
end
end
end
end
local f=function(Name,C,center,convert3,convert4)
 justsummoning2(C[3],center,convert3,convert4)
end
dlg.showListPrompt("Compass ","here a list of local sites around a 32 embark tile radius: min x max x , min y max y",COLOR_WHITE,Ark,f,nil,nil,true)
end
function justsummoning2(v,center,convert3,convert4)
local center = df.global.plotinfo.main.fortress_site
local Sitetype={"cottage plot","castle wall","castle tower","castle_courtyard","house","Temple","tomb","shop house","warehouse","market square","pasture","waste","courtyard","well","vault","great tower","trenches","tree house","hillock house","mead hall","fortress entrance","library","tavern","counting house","guild hall","city tower","shrine","shrugs","dormitory","dinging hall","Necro Tower"," barrow"}
local Ark2={}
if v.type==1 or v.type==3 or v.type==4 or v.type==5 or v.type==10 then
if v.realization==nil then else
for ok,oe in pairs(v.realization.buildings) do
local regionx=math.floor(oe.min_x/47)
local regionx2=math.floor(oe.max_x/47)
local regiony=math.floor(oe.min_y/47)
local regiony2=math.floor(oe.max_y/47)
local regionmath1=math.floor((v.global_min_x+regionx)/16)
local regionmath2=math.floor((v.global_max_x+regionx2)/16)
local regionmath3=math.floor((v.global_min_y+regiony)/16)
local regionmath4=math.floor((v.global_max_y+regiony2)/16)
local regionmath1a=math.floor((v.global_min_x+regionx))
local regionmath2a=math.floor((v.global_max_x+regionx2))
local regionmath3a=math.floor((v.global_min_y+regiony))
local regionmath4a=math.floor((v.global_max_y+regiony2))
local globalmath1=math.floor((v.global_min_x+regionx)-(regionmath1*16))
local globalmath2=math.floor((v.global_max_x+regionx2)-(regionmath2*16))
local globalmath3=math.floor((v.global_min_y+regiony)-(regionmath3*16))
local globalmath4=math.floor((v.global_max_y+regiony2)-(regionmath4*16))
for ko2,vo2 in pairs(df.global.world.armies.all) do
if vo2.flags[0]== true  then
local convert3= math.floor(vo2.pos.x/3)
local convert4= math.floor(vo2.pos.y/3)
local mapnotes1a = regionmath1a - convert3
local mapnotes2a = regionmath2a - convert3
local mapnotes3a = regionmath3a - convert4
local mapnotes4a = regionmath4a - convert4
if oe.building_info==nil then
table.insert (Ark2,{"no name".." "..Sitetype[oe.type+1].." "..mapnotes1a.." "..mapnotes2a.." "..mapnotes3a.." "..mapnotes4a,nil,v,search_key = dfhack.translation.translateName(v.name):lower()})
else
if df.site_realization_building_info_hillock_housest:is_instance(oe.building_info) then
local Sitetype2={"shrugs","Civic Mound","Castle Mound","Drinking Mound"}
table.insert (Ark2,{" "..Sitetype2[oe.building_info.type+1].."/"..Sitetype[oe.type+1].." "..mapnotes1a.." "..mapnotes2a.." "..mapnotes3a.." "..mapnotes4a,nil,v,search_key = dfhack.translation.translateName(v.name):lower()})
else if df.site_realization_building_info_tree_housest:is_instance(oe.building_info) then
local Sitetype2={"Treehouse","Home Tree","Shaping Tree","Market Tree","shrugs","Shrugs 2"}
table.insert (Ark2,{dfhack.translation.translateName(oe.building_info.name).." "..Sitetype2[oe.building_info.type+1].."/"..Sitetype[oe.type+1].." "..mapnotes1a.." "..mapnotes2a.." "..mapnotes3a.." "..mapnotes4a,nil,v,search_key = dfhack.translation.translateName(v.name):lower()})
else if df.site_realization_building_info_castle_towerst:is_instance(oe.building_info) then
local Sitetype2={"castle tower"}
table.insert (Ark2,{"no name".." "..Sitetype[oe.type+1].." "..mapnotes1a.." "..mapnotes2a.." "..mapnotes3a.." "..mapnotes4a,nil,v,search_key = dfhack.translation.translateName(v.name):lower()})
else if oe.building_info~=nil then
table.insert (Ark2,{"no name".." "..Sitetype[oe.type+1].." "..mapnotes1a.." "..mapnotes2a.." "..mapnotes3a.." "..mapnotes4a,nil,v,search_key = dfhack.translation.translateName(v.name):lower()})
end
end
end
end
end
end
end
end
end
local f=function(Name,C)
end
dlg.showListPrompt("Compass zoomed","here a list of local site realization around a 32 embark tile radius: min x max x , min y max y",COLOR_WHITE,Ark2,f,nil,nil,true)
end
end
justsummoning()
Code: ('adv-compass-army.lua') [Select]
local dlg=require("gui.dialogs")
--testing-for-map-charting-for-nomad
--ok so this script is made for the pile of nomad scripts to aid in finding 'realizations in the pre-gen sites'
-- so if one wants to visit a tavern, or the main keep or locate where in the 17x17 grid is the market stalls you could with this script.
-- for the 'realization' seeking to work you need to nomadically move into the site you're looking for which then the game will load in the realization data.
-- if you see no realization data if you click on or select any of the other sites in the first menu that means they don't have one or you're not in the site.
-- the coord numbers are based on the distance from the player site -x is west x is east and -y is north and y is south if you see a 0 then you're right on top of the edge of that site.
-- the player site will always show 0 0 0 0 as it subtracting it's coords with itself. 
--this script is also built off the structure of an old just summon script.
--2025: ok so this is a modification that now works in adv mode you need to be fast traveling for this to work

function nemcheck(v)
for k2,v2 in pairs(df.global.world.nemesis.all) do
if v.members[0].nemesis_id==v2.id then
return
v2
end
end
end
function justsummoning()
local center = df.global.plotinfo.main.fortress_site
local Ark={}
local Radar= 32
for ko,vo in pairs(df.global.world.armies.all) do
if vo.flags[0]== true  then
for k,v in pairs(df.global.world.armies.all) do
local convert3= math.floor(vo.pos.x/3)
local convert4= math.floor(vo.pos.y/3)
local convert1= math.floor(v.pos.x/3)
local convert2= math.floor(v.pos.y/3)
if convert3 - convert1 < Radar and  convert3 - convert1 > -Radar and  convert3 - convert1 < Radar and  convert3 - convert1 > -Radar and convert4 - convert2 < Radar and  convert4 - convert2 > -Radar and  convert4 - convert2 < Radar and convert4 - convert2 > -Radar then
local mapnotes1 = convert1 - convert3
local mapnotes2 = convert1 - convert3
local mapnotes3 = convert2 - convert4
local mapnotes4 = convert2 - convert4
local Sitetype={"Player Fort","Dark Fort","Cave","MountainHall","ForestRetreat","Town","Important Location","Lair/Shrine","MercFort","Camp","Monument"}
if #v.members==0 then else
table.insert (Ark,{dfhack.translation.translateName(nemcheck(v).figure.name).." number:".. (#v.members) .."index:"..(k) .." Creature type:".. df.global.world.raws.creatures.all[nemcheck(v).figure.race].creature_id .." "..mapnotes1.." "..mapnotes2.." "..mapnotes3.." "..mapnotes4,nil,v,search_key = dfhack.translation.translateName(nemcheck(v).figure.name):lower()})
end
end
end
end
end
local f=function(Name,C,center)
end
dlg.showListPrompt("Compass ","here a list of local armies around a 32 embark tile radius: min x max x , min y max y",COLOR_WHITE,Ark,f,nil,nil,true)
end
function justsummoning2(v,center)
local center = df.global.plotinfo.main.fortress_site
local Sitetype={"cottage plot","castle wall","castle tower","castle_courtyard","house","Temple","tomb","shop house","warehouse","market square","pasture","waste","courtyard","well","vault","great tower","trenches","tree house","hillock house","mead hall","fortress entrance","library","tavern","counting house","guild hall","city tower","shrine","shrugs","dormitory","dinging hall","Necro Tower"," barrow"}
local Ark2={}
if v.type==1 or v.type==3 or v.type==4 or v.type==5 or v.type==10 then
if v.realization==nil then else
for ok,oe in pairs(v.realization.buildings) do
local regionx=math.floor(oe.min_x/47)
local regionx2=math.floor(oe.max_x/47)
local regiony=math.floor(oe.min_y/47)
local regiony2=math.floor(oe.max_y/47)
local regionmath1=math.floor((v.global_min_x+regionx)/16)
local regionmath2=math.floor((v.global_max_x+regionx2)/16)
local regionmath3=math.floor((v.global_min_y+regiony)/16)
local regionmath4=math.floor((v.global_max_y+regiony2)/16)
local regionmath1a=math.floor((v.global_min_x+regionx))
local regionmath2a=math.floor((v.global_max_x+regionx2))
local regionmath3a=math.floor((v.global_min_y+regiony))
local regionmath4a=math.floor((v.global_max_y+regiony2))
local globalmath1=math.floor((v.global_min_x+regionx)-(regionmath1*16))
local globalmath2=math.floor((v.global_max_x+regionx2)-(regionmath2*16))
local globalmath3=math.floor((v.global_min_y+regiony)-(regionmath3*16))
local globalmath4=math.floor((v.global_max_y+regiony2)-(regionmath4*16))
local mapnotes1a = regionmath1a - convert3
local mapnotes2a = regionmath2a - convert3
local mapnotes3a = regionmath3a - convert4
local mapnotes4a = regionmath4a - convert4
if oe.building_info==nil then
table.insert (Ark2,{"no name".." "..Sitetype[oe.type+1].." "..mapnotes1a.." "..mapnotes2a.." "..mapnotes3a.." "..mapnotes4a,nil,v,search_key = dfhack.translation.translateName(v.name):lower()})else
local Sitetype2={"Treehouse","Home Tree","Shaping Tree","Market Tree","shrugs","Shrugs 2"}
table.insert (Ark2,{dfhack.translation.translateName(oe.building_info.name).." "..Sitetype2[oe.building_info.type+1].."/"..Sitetype[oe.type+1].." "..mapnotes1a.." "..mapnotes2a.." "..mapnotes3a.." "..mapnotes4a,nil,v,search_key = dfhack.translation.translateName(v.name):lower()})
end
end
end
local f=function(Name,C)
end
dlg.showListPrompt("Compass zoomed","here a list of local site realization around a 32 embark tile radius: min x max x , min y max y",COLOR_WHITE,Ark2,f,nil,nil,true)
end
end
justsummoning()
ok given how adv ascii travel screen is like the questlog map with no sense of a marker I figured I could whip up a modified landmark and roaming party tracker for folks to navigate around,
it only works in fast travel and for the site option you could click on some of the sites you're currently fast travel into and maybe see the list of realization structures and probably inner parts of the place like a town tavern location or a treetop's main home tree or a hill top civil hall.
I hope this helps.
Logged
I thought I would I had never hear my daughter's escapades from some boy...
DAMN YOU RUMRUSHER!!!!!!!!
"body swapping and YOU!"
Adventure in baby making!Adv Homes

myk

  • Bay Watcher
    • View Profile
Re: DFHack 51.03-r1.1
« Reply #3666 on: January 25, 2025, 04:58:48 pm »

DFHack 51.03-r1.1 is now available!

Highlights: Compatibility update

Get it from:

Manual installation instructions: https://docs.dfhack.org/en/stable/docs/Installing.html

Note that DF 51.03 contains only sound fixes, so there is no DF 51.03 Classic. The latest DFHack release is still compatible with DF 51.02 Classic.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 51.03-r1.1
« Reply #3667 on: January 28, 2025, 12:21:03 am »

DFHack 51.04-r1 was also released today, but is only available on Steam because DF 51.04 was also only released on Steam.

There are no changes since 51.02-r1 other than compatibility with the new DF versions.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 51.03-r1.1
« Reply #3668 on: January 31, 2025, 11:50:17 am »

Code: [Select]
-- changes from advmode to fort safely and back (hopefully)
--[[Now to warn you about saving and loading in either game mode might lead
    to some side issues, for saving in fort mode switching to adv mode needs the adv to be `bodyswap`
    back in again. for Saving in Adv to switch to Fort mode you probably be safe-ish if the site.
    isn't a nano fort or a site that isn't 3x3 small. otherwise the game will try to resize the map.
    oh and switching to fort mode on any pre-gen site larger than 4x4 might implode one pc if
    you don't have like 20 gigs of memory for the 16x16 embark size.

ok so this version of this script has be updated again so that caravans and visitors and migrants
could show up at any edge of the map... and maybe leave from any spot... of the z level you assign the site too.
should be warned while I mostly iron out the Caravan crash which ties into entities than anything that messes with plotinfo.
there still some unknowns left in the game
so uhh I probably should get to figuring out how to map the surface (properly) at some point...
should be said This is a modified copy of Warmist's Tofort script and this one is made for messing around the world.
there's a more Fort mode focus one called TopFort which dives into switching into player forts... and sometimes lord claimed campsites.

5/15/2024: rework the script to align to 50 new df structures and changed one designation clear function so it functions with out a cursor.
this wouldn't really work in 50 but maybe, there's potential chance of it working in the beta 51 build that has adv mode.
6/9/2024: unit.active[0] doesn't work so time to update this once again AGAIN
1/31/2025: updated this mess again again now having access to 51 proper going from fort mode to adv mode is risky and prone to crash,
but going from adv mode to fort mode should work and back.
probably don't use this on any saves you care about out of lingering fort mode plotinfo data and adventure mode data in the save that won't get cleared until you exit or play that game mode
]]--

if df.global.gamemode==df.game_mode.ADVENTURE then
local adv= df.global.world.units.adv_unit
local comp={}
local plotinfo=df.global.plotinfo

function advGlobalPos()
    local wd=df.global.world.world_data.midmap_data
    return wd.adv_region_x*16+wd.adv_emb_x,wd.adv_region_y*16+wd.adv_emb_y
end
function inSite()
    local tx,ty=advGlobalPos()
    for k,v in pairs(df.global.world.world_data.sites) do
        local tp2={v.global_min_x, v.global_min_y, v.global_max_x, v.global_max_y}
        if tx>=tp2[1] and tx<=tp2[3] and
            ty>=tp2[2] and ty<=tp2[4] then
            return v
        end
    end
end
local site=inSite()
if site==nil then
    qerror("No site you are in found.")
end
local nomad={}
local h_ent
--local test= tonumber(...)
if plotinfo.main.fortress_entity~=nil or plotinfo.main.fortress_site~=nil then
plotinfo.main.fortress_entity=nil
plotinfo.main.fortress_site=nil
end
--nomad=df.global.world.entities.all[test]
for k,v in pairs(df.global.world.history.figures[adv.hist_figure_id].entity_links) do
if v~=histfig_entity_link_memberst and not v==nil then
nomad=df.global.world.entities.all[v.entity_id]

print(test)
else if v==histfig_entity_link_memberst then
nomad=df.global.world.history.figures[adv.hist_figure_id].entity_links[0]
end
end
end

if plotinfo.main.fortress_entity==nil then
    for k,v in pairs(df.global.world.entities.all) do
        --if v.type==df.historical_entity_type.SiteGovernment and v.id==nomad.id then --maybe match race too?
        if v.id==nomad.id then --maybe match race too?
            if nomad.positions.own==nil then
break else
h_ent=v
            break
        end
        end
if v.id~=nomad.id then
if v.type==df.historical_entity_type.SiteGovernment then

h_ent=v
end
end
    end
    if h_ent==nil then
        qerror("Valid historical entity not found. sorry...")
    end
    plotinfo.main.fortress_entity=h_ent
else
    h_ent=plotinfo.main.fortress_entity
end

function cleardesignate(adv)
local scorch=df.global.world.map.map_blocks
    for k,v in pairs(scorch) do
if v.flags.designated==true then
v.flags.designated=false
end
    for k2,v2 in pairs(v.designation) do
    for k3,v3 in pairs(v2) do
if v3.dig>0 or v3.smooth>0 then
v3.dig=0
v3.smooth=0
end
end
end
end
dfhack.run_command('revflood')

end


function cleardesignateold(adv)
--local adv=df.global.world.units.active[0]
local adv= df.global.world.units.adv_unit
df.global.plotinfo.main.mode=10
df.global.selection_rect.start_x=0
df.global.selection_rect.start_y=0
df.global.selection_rect.start_z=610
df.global.selection_rect.end_x=-14300
df.global.selection_rect.end_y=9000
df.global.selection_rect.end_z=0
df.global.cursor.x=400
df.global.cursor.y=400
df.global.cursor.z=0
dfhack.gui.getCurViewscreen():feed_key(1)
df.global.cursor.x=adv.pos.x
df.global.cursor.y=adv.pos.y
df.global.cursor.z=adv.pos.z
dfhack.gui.getCurViewscreen():feed_key(1)
dfhack.run_command('revflood')

end
local carter={}
function addToEntity(entity,unit,addtoLead)
    local nem=dfhack.units.getNemesis(unit)
    local hfig=nem.figure
        for k,v in pairs(hfig.entity_links) do
if v.entity_id==entity.id then break else
carter=true
end
end
if carter==true then
hfig.entity_links:insert("#",{new=df.histfig_entity_link_memberst,entity_id=entity.id,link_strength=100})
    entity.nemesis_ids:insert("#",nem.id)
    entity.nemesis:insert("#",nem)
    entity.histfig_ids:insert("#",hfig.id)
    entity.hist_figures:insert("#",hfig)
end
    if addtoLead then
        local lead_id
        for k,v in pairs(entity.positions.own) do
            if v.flags.IS_LEADER==true then
                lead_id=v.id
                break
            end
        end
        if lead_id~=nil then
            for k,v in pairs(entity.positions.assignments) do
                if v.position_id==lead_id  then
                        v.histfig=hfig.id
                    break
                end
            end
        end
    end
end

plotinfo.civ_id=adv.civ_id
plotinfo.race_id=adv.race
df.global.pause_state=true


plotinfo.usable_stockpile_race:insert("#",adv.race)
plotinfo.site_id=site.id
if plotinfo.main.fortress_site==nil then plotinfo.main.fortress_site=site end
if site.entity_links==nil then site.entity_links:insert("#", {new=true, df.entity_site_link, target=site.id, entity_id=plotinfo.fortress_entity.id,entity_site_link_flags.residence, entity_site_link_flags.trade_partner }) end
plotinfo.group_id=h_ent.id
plotinfo.game_state=2


if #plotinfo.tasks.discovered_plants==0 then
df.global.plotinfo.tasks.discovered_creature_foods:insert("#",0)
df.global.plotinfo.tasks.discovered_creatures:insert("#",0)
df.global.plotinfo.tasks.discovered_plants:insert("#",0)
df.global.plotinfo.tasks.discovered_plant_foods:insert("#",0)
end
if #plotinfo.alerts.list==0 then
    plotinfo.alerts.list:insert("#",{new=true,name="Dummy alert"})
    plotinfo.alerts.next_id=1
end


    local nem2=dfhack.units.getNemesis(adv)
    local hfig2=nem2.figure
    local nomad2=hfig2.entity_links[0]
    local nomad3=hfig2.entity_links
    local Test={}
    for co2,mp2 in pairs(nomad3) do
--print(mp2.entity_id,h_ent.id)
        if mp2.entity_id~=h_ent.id then Test=true else
            Test=false
            end
        end   
        if Test==true then
            addToEntity(h_ent,adv,true)
        end
    for co,mp in pairs(df.global.world.units.active) do
if mp.population_id==h_ent.id then
mp.flags2.resident=false
end
if mp.civ_id==h_ent.id or adv.civ_id==mp.civ_id then
mp.flags2.resident=false
end
        if mp.relationship_ids.GroupLeader==adv.id then
            local comp=mp
        if Test==true then
            addToEntity(h_ent,comp,false)
        end
    end
end
function filleco(tbl,low,high)
  for v =low, high do
    tbl.general_items:insert("#",2)
  end
     tbl.weapons:insert("#",2)
    tbl.armor:insert("#",2)
    tbl.handwear:insert("#",2)
    tbl.footwear:insert("#",2)
    tbl.legwear:insert("#",2)
    tbl.headwear:insert("#",2)
    tbl.prepared_food:insert("#",2)
    tbl.wood:insert("#",2)
    tbl.thread_cloth:insert("#",2)
    tbl.paper:insert("#",2)
    tbl.parchment:insert("#",2)
    tbl.bone:insert("#",2)
    tbl.tooth:insert("#",2)
    tbl.horn:insert("#",2)
    tbl.pearl:insert("#",2)
    tbl.shell:insert("#",2)
    tbl.leather:insert("#",2)
    tbl.silk:insert("#",2)
    tbl.yarn:insert("#",2)
    tbl.inorganic:insert("#",2)
    tbl.meat:insert("#",2)
    tbl.fish:insert("#",2)
    tbl.plants:insert("#",2)
    tbl.drinks:insert("#",2)
    tbl.extract_animal:insert("#",2)
    tbl.mill_animal:insert("#",2)
    tbl.cheese_animal:insert("#",2)
    tbl.extract_plant:insert("#",2)
    tbl.mill_plant:insert("#",2)
    tbl.cheese_plant:insert("#",2)
    tbl.pets:insert("#",2)

end
function filleco2(tbl,low,high)
  for v =low, high do
    --tbl[v].unk1=site.pos.x
    --tbl.unk1:insert("#",site.pos.x)
    --tbl.unk2:insert("#",site.pos.y)
    tbl.general_items:insert("#",nil)
     --tbl[v].unk2=site.pos.y
  end
 
     tbl.weapons:insert("#",nil)
    tbl.armor:insert("#",nil)
    tbl.handwear:insert("#",nil)
    tbl.footwear:insert("#",nil)
    tbl.legwear:insert("#",nil)
    tbl.headwear:insert("#",nil)
    tbl.prepared_food:insert("#",nil)
    tbl.wood:insert("#",nil)
    tbl.thread_cloth:insert("#",nil)
    tbl.paper:insert("#",nil)
    tbl.parchment:insert("#",nil)
    tbl.bone:insert("#",nil)
    tbl.tooth:insert("#",nil)
    tbl.horn:insert("#",nil)
    tbl.pearl:insert("#",nil)
    tbl.shell:insert("#",nil)
    tbl.leather:insert("#",nil)
    tbl.silk:insert("#",nil)
    tbl.yarn:insert("#",nil)
    tbl.inorganic:insert("#",nil)
    tbl.meat:insert("#",nil)
    tbl.fish:insert("#",nil)
    tbl.plants:insert("#",nil)
    tbl.drinks:insert("#",nil)
    tbl.extract_animal:insert("#",nil)
    tbl.mill_animal:insert("#",nil)
    tbl.cheese_animal:insert("#",nil)
    tbl.extract_plant:insert("#",nil)
    tbl.mill_plant:insert("#",nil)
    tbl.cheese_plant:insert("#",nil)
    tbl.pets:insert("#",nil)

end

function fill(tbl,low,high)
  for v =low, high do
    tbl:insert("#",0)
    tbl:insert("#",v)
    tbl:insert("#",143)
    tbl:insert("#",v)
  end
end
function fill2(tbl,low,high)
  for v =low, high do
    tbl:insert("#",v)
    tbl:insert("#",143)
    tbl:insert("#",v)
    tbl:insert("#",0)
  end
end
function fillz(tbl,low,high)
  for v =low, high do
    tbl:insert("#",adv.pos.z)
    tbl:insert("#",adv.pos.z)
    tbl:insert("#",adv.pos.z)
    tbl:insert("#",adv.pos.z)
  end
end
function fillunk(tbl,low,high)
  for v =low, high do
    tbl[v].x=site.pos.x
    tbl[v].y=site.pos.y
  end
end
function fillanimal(tbl,low,high)
  for v =low, high do
    tbl:insert("#",1)
  end
end
function fillstone(tbl,low,high)
  for v =low, high do
    tbl:insert("#",0)
  end
end

function fillTrain(tbl,tbl2,low,high)
  for v =low, high do
    tbl2:insert("#",0)
tbl:insert("#",5)
  end
end


function mapcheck2()

fill(df.global.plotinfo.wilderpop_enter.x,0,143)
fill2(df.global.plotinfo.wilderpop_enter.y,0,143)
fillz(df.global.plotinfo.wilderpop_enter.z,0,143)

fill(df.global.plotinfo.map_edge.surface_x,0,143)
fill2(df.global.plotinfo.map_edge.surface_y,0,143)
fillz(df.global.plotinfo.map_edge.surface_z,0,143)

for _,Lay in pairs(df.global.plotinfo.map_edge.layer_x) do

fill(Lay,0,143)
end
for _,Lay in pairs(df.global.plotinfo.map_edge.layer_y) do
fill2(Lay,0,143)
end
for _,Lay in pairs(df.global.plotinfo.map_edge.layer_z) do
fillz(Lay,0,143)
end
end
function sigh()
 mapcheck()
 mapcheck2()
for k,v in pairs(df.global.plotinfo.wilderpop_enter.x) do

end
for k,v in pairs(df.global.plotinfo.map_edge.surface_z) do
df.global.plotinfo.map_edge.surface_z[k]=adv.pos.z
--v=152
end
end
function mapcheck()
fillunk(df.global.plotinfo.border[0],0,143)
fillunk(df.global.plotinfo.border[1],0,143)
fillunk(df.global.plotinfo.border[2],0,143)
fillunk(df.global.plotinfo.border[3],0,143)

end
Tab={}
Tab2={}
for k,Lay2 in pairs(df.global.plotinfo.map_edge.layer_z) do
for k2,Lay3 in pairs(df.global.plotinfo.border[0]) do
if k then break else
Tab:insert("#",k)
end
Tab2:insert("#",k2)
return Tab,Tab2
end
end
if #df.global.plotinfo.map_edge.layer_z[0] == 0 then
print("map edge empty proceed to fill")
sigh()
 else
print("welp map edge currently full")
 end

 if plotinfo.main.fortress_entity.squads==0 then
for Sqa,Ds in pairs (df.global.world.squads.all) do
if Ds.entity_id==plotinfo.main.fortress_entity.id then
plotinfo.main.fortress_entity.squads:insert("#",{new=true,Ds})
end
end
end
if #plotinfo.tasks.discovered_plants==0 then

--for k,Lay2 in ipairs(df.global.world.raws.creatures.all) do
--return k
--end
local Anim=#df.global.world.raws.creatures.all
local Plan=#df.global.world.raws.plants.all
fillanimal(df.global.plotinfo.tasks.discovered_creatures,0,Anim)
fillanimal(df.global.plotinfo.tasks.discovered_creature_foods,0,Anim)

fillanimal(df.global.plotinfo.tasks.discovered_plants,0,Plan)
fillanimal(df.global.plotinfo.tasks.discovered_plant_foods,0,Plan)
--for k,Lay2 in ipairs(df.global.world.raws.plants.all) do
--return k
--end
--end
end
function fillTrain(tbl,tbl2,low,high)
  for v =low, high do
    tbl2:insert("#",0)
tbl:insert("#",5)
  end
end


 
if #plotinfo.kitchen.item_types==0 then
plotinfo.kitchen.item_types:insert("#",0)
plotinfo.kitchen.item_subtypes:insert("#",0)
plotinfo.kitchen.mat_types:insert("#",0)
plotinfo.kitchen.mat_indices:insert("#",0)
--plotinfo.kitchen.exc_types:insert("#",df.kitchen_exc_typest)
end
if #plotinfo.infiltrator_histfigs==0 then
plotinfo.infiltrator_histfigs:insert("#",0)
plotinfo.infiltrator_histfigs:insert("#",0)
plotinfo.infiltrator_years:insert("#",0)
plotinfo.infiltrator_years:insert("#",0)
plotinfo.infiltrator_year_ticks:insert("#",0)
plotinfo.infiltrator_year_ticks:insert("#",0)
end
if #plotinfo.economic_stone==0 then
for k,Lay2 in ipairs(df.global.world.raws.inorganics) do
fillstone(df.global.plotinfo.economic_stone,0,k)
--return k
end
end


if #plotinfo.economy_prices.price_adjustment.general_items==0 then

filleco(df.global.plotinfo.economy_prices.price_adjustment,0,114)
filleco2(df.global.plotinfo.economy_prices.price_setter,0,114)

end
--fix training info
if h_ent.training_knowledge == nil then
    h_ent.training_knowledge={new=true}
end
if #plotinfo.main.fortress_entity.training_knowledge.level==0  then
local Anim=#df.global.world.raws.creatures.all
fillTrain(plotinfo.main.fortress_entity.training_knowledge.level,plotinfo.main.fortress_entity.training_knowledge.skill_points,0,Anim-1)
end

df.global.gamemode=df.game_mode.DWARF
df.global.gametype=df.game_type.DWARF_MAIN
if df.global.gview.view.child.child==nil then df.global.gview.view.child=df.viewscreen_dwarfmodest:new()
df.global.gview.view.child.parent=df.global.gview.view
 end
 cleardesignate()
    print("Mode change complete.")
else
    local adv2=dfhack.gui.getSelectedUnit(true)
    local adv=df.global.world.units.adv_unit
    if not adv then
        --swap units...
local swap=df.global.adventure
swap.player_id=df.global.world.history.figures[adv2.hist_figure_id].nemesis_id
if swap.dungeon_screen==nil then
df.global.gview.view.child=df.viewscreen_dungeonmodest:new()
df.global.gview.view.child.parent=df.global.gview.view
swap.dungeon_screen=df.global.gview.view.child
    end
    end
df.global.gamemode=df.game_mode.ADVENTURE
    df.global.gametype=df.game_type.ADVENTURE_MAIN
df.global.gview.view.child=df.viewscreen_dungeonmodest:new()
df.global.gview.view.child.parent=df.global.gview.view
    print("Mode change complete.")
end
--end
Spoiler: 'showcase' (click to show/hide)
ok updated tofort to work in df51
well then this does lead to a weird moment of nomad scripts exist along with tofort and voidforts so one wanting to explore the world and dig they can do so.
big warning uhh probably don't go fort mode to adv mode with this one probably make a fort retire it then move to your player fort in adv mode and use this script or 'starting with adv mode works but starting with fort mode doesn't'.
Logged
I thought I would I had never hear my daughter's escapades from some boy...
DAMN YOU RUMRUSHER!!!!!!!!
"body swapping and YOU!"
Adventure in baby making!Adv Homes

myk

  • Bay Watcher
    • View Profile
Re: DFHack 51.04-r1.1
« Reply #3669 on: February 02, 2025, 09:59:26 pm »

DFHack 51.04-r1.1 is now available!

Highlights: Bugfixes, stonesense improvements

Get it from:

Manual installation instructions: https://docs.dfhack.org/en/stable/docs/Installing.html

Note that DF has lots of "current" versions right now. This version of DFHack is compatible with 51.04 on Steam, 51.03 on Itch, and 51.02 Classic.
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 51.03-r1.1
« Reply #3670 on: February 04, 2025, 12:49:33 pm »

Code: (snatcherase.lua) [Select]
for de,oe in pairs(df.global.world.army_controllers.all) do
if oe.mission_report == nil then else
print ( de,oe.mission_report.title)
for si,te in pairs(df.global.world.world_data.sites) do
local Sito=te.id
if oe.site_id== Sito then
local SitePool=df.global.world.world_data.sites[si].populace.nemesis
for e,o in pairs(df.global.world.armies.all) do
if oe.id == o.controller_id then
print (e)
local forv=df.global.world.armies.all[e].members[0]
df.global.world.armies.all[e].members:insert("#",{new=true,nemesis_id=SitePool[dfhack.random.new():random(#SitePool)],
stored_fat = forv.stored_fat,
tracking_rating= forv.tracking_rating,
sneak_rating= forv.sneak_rating,
smell_trigger= forv.smell_trigger,
low_light_vision= forv.low_light_vision,
odor_level= forv.odor_level})

for Del,ete in pairs(df.global.world.armies.all[e].members) do
for De,ee in pairs(SitePool) do
if ete.nemesis_id== ee then
SitePool:erase(De)  else break
end
end
end
end
end
end
end
end
end
Code: (recruitorder.lua) [Select]
--this is a script that is a modified version of the recruit script as this doesn't randomly select a historical figure but choose one out of a list.
--for this to work you need to send someone off on a mission probably a safe one like exploring ruins and in the middle of the mission run this script.
-- it might take a few tries to see if it works but if you see two printed out messages showcasing the army id and the mission report info then it might have worked.
--oh it also reuses the campboat script for list gui functions   
local dlg=require("gui.dialogs")
function teleportboatnames2()
local Ark={}
for k,v in pairs(df.global.world.nemesis.all) do
BoaName=dfhack.translation.translateName(v.figure.name)
table.insert (Ark,{dfhack.translation.translateName(v.figure.name).." "..v.figure.name.nickname,nil,v,search_key = BoaName:lower()})
end
local f=function(Name,C)
  OrderRecruit(C[3])
end
dlg.showListPrompt("list of Nemesis havers","Select Being(s) to settle here",COLOR_WHITE,Ark,f,nil,nil,true)
end

function OrderRecruit(Nemes)
for de,oe in pairs(df.global.world.army_controllers.all) do
if oe.mission_report == nil then else
print ( de,oe.mission_report.title)
for e,o in pairs(df.global.world.armies.all) do
if oe.id == o.controller_id then
print (e)
local forv=df.global.world.armies.all[e].members[0]
df.global.world.armies.all[e].members:insert("#",{new=true,nemesis_id=Nemes.id,
stored_fat = forv.stored_fat})
end
end
end
end
end

teleportboatnames2()
ok here's the updated scripts for snatch and recruit that I kinda forgot to post on the forums. do need to see if these still work in df51 probably go back and edit this post for confirmation

edit: ok been testing site-swap and I think I got most of it fixed but it's probably still a bit unstable. probably best to have revflood handy for jumping into player sites again.

Code: ('site-swap13.lua') [Select]
local nomad={}
local dlg=require("gui.dialogs")
local h_ent=nil
function teleportboatnames3()
local Ark={}
for k,v in pairs(df.global.world.world_data.sites) do
BoaName=dfhack.translation.translateName(v.name, true)
table.insert (Ark,{dfhack.translation.translateName(v.name, true).." "..v.name.nickname,nil,v,search_key = BoaName:lower()})
end
local f=function(Name,C)
  WarpEntityNames(C[3])
end
dlg.showListPrompt("list of stations","Select Station(s) to settle here",COLOR_WHITE,Ark,f,nil,nil,true)
end
function WarpEntityNames(Siteid)
local entity=Siteid.entity_links
local Ark1={}
for k1,v1 in pairs(entity) do
local BoaName1=dfhack.translation.translateName(df.global.world.entities.all[v1.entity_id].name, true)
table.insert (Ark1,{dfhack.translation.translateName(df.global.world.entities.all[v1.entity_id].name, true).." "..df.global.world.entities.all[v1.entity_id].name.nickname,nil,v1.entity_id,search_key = BoaName1:lower()})
end
local f=function(Name,C)
  unretire_all(C[3],Siteid)
end
dlg.showListPrompt("list of groups","Select group(s) to switch here",COLOR_WHITE,Ark1,f,nil,nil,true)
end
function stationmove()
if df.global.gview.view.child.child==nil then
print("this script requires you to be in the raid menu to work")
else
teleportboatnames3()
end
end
function MouseSeek3(siteID)
for x,y in pairs(df.global.world.entities.all) do
for x2,y2 in pairs(siteID) do
if y.name.first_name=="CREW" and y.id==y2.entity_id then
local EntMouse2=y2.entity_id
if y2.former_flag.residence==true then
y2.former_flag.residence=false
y2.flags.residence=true
end
return EntMouse2
end
end
end
end
function MouseSeek4(siteID)
for x,y in pairs(siteID) do
if y.flags.land_for_holding==true then
local EntMouse3=y.entity_id
print(EntMouse3)
return EntMouse3
end
if y.former_flag.land_for_holding==true then
y.former_flag.land_for_holding=false
y.flags.land_for_holding=true
end
end
end
function unretire_all(enti,siteID)
local Selectpark=df.global.world.entities.all[enti]
if df.global.plotinfo.main.fortress_entity~=nil or df.global.plotinfo.main.fortress_site~=nil then
df.global.plotinfo.main.fortress_entity=nil
df.global.plotinfo.main.fortress_site=nil
end
df.global.plotinfo.main.fortress_site=siteID
df.global.plotinfo.main.fortress_entity=Selectpark
df.global.plotinfo.site_id=siteID.id
df.global.plotinfo.group_id=enti
if MouseSeek4(siteID.entity_links)==nil then
df.global.plotinfo.civ_id=enti else
df.global.plotinfo.civ_id=MouseSeek4(siteID.entity_links)
end
aftermath()
end

function residentAll(unit,trgunit)
for k,v in pairs(df.global.world.units.active) do
if v== nil then
error("Invalid creature")
end

if v.civ_id~=df.global.plotinfo.civ_id then
v.flags2.resident=false
end
end
return true
end
function DeresidentAll(unit,trgunit)
for k,v in pairs(df.global.world.units.active) do
if v== nil then
error("Invalid creature")
end
v.flags2.resident=false
end
return true
end
function clearpopups()
df.global.world.status.popups:resize(0)
df.global.game.main_interface.options.open=false
df.global.game.main_interface.options.context=0
df.global.plotinfo.game_over=false
end
teleportboatnames3()
function aftermath()
df.global.cur_season_tick=3998
dfhack.gui.getCurViewscreen():feed_key(2)
 df.global.pause_state=false
print("unpaused", df.global.enabler.frame_last)
df.global.pause_state=false
if df.global.pause_state==true then
df.global.pause_state=false
end
residentAll()
dfhack.timeout(20,"frames",function() df.global.pause_state=false  end)
dfhack.timeout(33,"frames",function() df.global.pause_state=true DeresidentAll() print("unpaused") end)
dfhack.timeout(40,"frames",function() df.global.pause_state=true DeresidentAll()  clearpopups() print("unpaused") end)
dfhack.timeout(100,"frames",function() df.global.pause_state=true DeresidentAll()  clearpopups() print("unpaused") end)
dfhack.timeout(500,"frames",function() df.global.pause_state=true DeresidentAll()  clearpopups() print("unpaused") end)
dfhack.timeout(1,"ticks",function() dfhack.gui.getCurViewscreen():feed_key(278)
 DeresidentAll()
print("paused",  df.global.enabler.frame_last) end)
end
Code: ('messenger-recall.lua') [Select]

--this script requires the player site to have a holding, which to recall workers from.
-- it doesn't actually recall them but uses the army data the messenger goes out with to latch on the missing folks from the squad
-- and brings them back with out having to cause an international incident or spark a war.
-- this script is a modification of my old return travelers script where it still requires the player to name the squad DFHACK to work
-- but one doesn't have to toss out the leader of the squad to bring back the rest so it's an total improvement.
-- best works with the site create scripts to get a holding and just recall that person normally,
-- oh and having a noble position with messenger responsibilities modded entities with modded nobles probably going to have harder time here.
function squadselect()
for k,v in pairs(df.global.world.squads.all) do
if v.alias == 'DFHACK' then
print(df.global.world.squads.all[k].alias)
for ki,vi in pairs(df.global.world.squads.all[k].positions) do
if df.global.world.squads.all[k].positions[ki].occupant ~= -1 then
local occup=vi.occupant
local nemoccup=df.global.world.history.figures[occup].nemesis_id
local nemoccup2=df.global.world.history.figures[occup]

insertreport(nemoccup)
end
end
end
end
end
function entitypick()
for k,v in pairs(df.global.plotinfo.main.fortress_site.entity_links) do
if v.flags.local_market==true then
local pickentity=df.global.world.entities.all[v.entity_id]
return pickentity
end
end
end
function migrate(occup,nemoccup,nemoccup2,pickent)

local si2=df.global.gview.view.child.child.army_controller
local si3=df.global.gview.view.child.child.request_nem
local optioNem=df.global.world.nemesis.all[nemoccup]
for fo,rm in pairs (si2) do
if rm.goal==19 then
local messenge= rm.data.goal_make_request
messenge.requested_hfid:insert("#",occup)
si3:insert("#",optioNem)
pickent.hist_figures:insert("#",nemoccup2)
pickent.nemesis:insert("#",optioNem)
end
end
end

function insertreport(nemoccup)
for de,oe in pairs(df.global.world.army_controllers.all) do
if oe.mission_report == nil  then else
if oe.goal == 19 then
print ( de,oe.mission_report.title)
for e,o in pairs(df.global.world.armies.all) do
if oe.id == o.controller_id then
print (e)
local forv=df.global.world.armies.all[e].members[0]
df.global.world.armies.all[e].members:insert("#",{new=true,nemesis_id=nemoccup,
stored_fat = forv.stored_fat,
tracking_rating= forv.tracking_rating,
sneak_rating= forv.sneak_rating,
smell_trigger= forv.smell_trigger,
low_light_vision= forv.low_light_vision,
odor_level= forv.odor_level})
end
end
end
end
end
end
squadselect()
edit : added messenger recall for grabbing folks lost on a mission since I kinda forgot I didn't post this here.
« Last Edit: February 15, 2025, 11:44:30 am by Rumrusher »
Logged
I thought I would I had never hear my daughter's escapades from some boy...
DAMN YOU RUMRUSHER!!!!!!!!
"body swapping and YOU!"
Adventure in baby making!Adv Homes

myk

  • Bay Watcher
    • View Profile
Re: DFHack 51.05-r1
« Reply #3671 on: February 12, 2025, 08:58:46 pm »

DFHack 51.05-r1 is now available!

Highlights: Compatibility update

Get it from:

Manual installation instructions: https://docs.dfhack.org/en/stable/docs/Installing.html
Logged

mross

  • Bay Watcher
    • View Profile
Re: DFHack 51.05-r1
« Reply #3672 on: February 13, 2025, 04:05:31 pm »

47.05, dwarfs do not build stills or kitchens with planning mode. They build other workshops without issues.
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 51.05-r1
« Reply #3673 on: February 16, 2025, 09:00:50 am »

Code: ('invfilter.lua') [Select]
-- ok script made to filter items for folks who need to sift through stuff in their inventory
--requires the inventory to be open to work.
--probably unstable given my coding work is.
local dlg=require("gui.dialogs")
local advmenu= df.global.game.main_interface.adventure
 
function TraderContent(v)
local Ark={}

  for de,oe in pairs(advmenu.inventory.option_current) do

table.insert (Ark,{oe.item.id .." "..df.item_type[oe.item:getType()],nil,oe.item,search_key = df.item_type[oe.item:getType()]:lower()})
end

local f=function(Name,C)
  crabinabucket(C[3])
end
dlg.showListPrompt("list of items","Select items to store in target here",COLOR_WHITE,Ark,f,nil,nil,true)
end
 
  function crabinabucket(Can)

  for inv2,tory2 in pairs(advmenu.inventory.option.MAIN) do
 
  if tory2.item==Can then
  advmenu.inventory.option_current:resize(0)

  advmenu.inventory.option_current:insert("#",tory2)
end
end
end
TraderContent()

ok someone on the kitfox discord was wishing to filter the inventory and I figured well here's how the process would be if I had to write it all by scratch then I realize oh wait I did all this already with my nomad script writing on top of messing with the df51 ui before so I whip this script up, it works only when the adventurers inventory is open.
Logged
I thought I would I had never hear my daughter's escapades from some boy...
DAMN YOU RUMRUSHER!!!!!!!!
"body swapping and YOU!"
Adventure in baby making!Adv Homes

Maloy

  • Bay Watcher
    • View Profile
Re: DFHack 51.05-r1
« Reply #3674 on: February 18, 2025, 06:40:13 am »

I have an adventurer killed in a site battle while I was away. They impaled his body so it disappeared and no longer physically exists


how would I revive him? I wanted to use full-heal -r on him, but don't have a body

I attempted to use that script and use the unit ID I had from before he died, but the code told me it was an invalid ID
Looking for ideas or to see if I just did it wrong and need to be told so lol
Pages: 1 ... 243 244 [245] 246