ok so kinda been working on a script that lets one swap sites, so far it seem mostly useful for switching on to pre-gen sites,

local nomad={}
local dlg=require("gui.dialogs")
local h_ent=nil
--local test= tonumber(...)
function teleportboatnames3()
local Ark={}
for k,v in pairs(df.global.world.world_data.sites) do
BoaName=dfhack.TranslateName(v.name, true)
table.insert (Ark,{dfhack.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.TranslateName(df.global.world.entities.all[v1.entity_id].name, true)
table.insert (Ark1,{dfhack.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 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
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
so you might also need these
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
clearpopups()
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
dfhack.gui.getCurViewscreen():feed_key(278)
print("unpaused")
df.global.pause_state=false
dfhack.timeout(1,"ticks",function() end)
DeresidentAll()
print("paused")
these two are already in the main script but I spent a bit too long trying to bypass the game over screen and the process on how I did that was toggling the entire site to have the resident unit flag off and clearing the prompt off the screen which these two scripts will do... the one for clearing the screen is the clearpopups one and the hopefully working toggle off residence unit flag so you can get citizens again is the second one.
will note this is extremely unstable in that expect repercussions of bypassing the game over screen every time you jump to a new site, swapping to a player fort might require using revflood and moving the camera to the game field.
oh yeah be careful with loading in a 17x17 size sites(towns, hamlets, hilltops, forest retreats, dark fortresses, dark pits, mountain halls) you might eat all your ram and memory trying to load those sites.
it best to have a pc with like 30 gigs of ram or something beefy to handle like 8 gigs being used on the spot for memory.
if you got like a reveal all sites script you could gain access to reading the names of camps and have a chance at loading into those also.
oh and another thing if you're playing a vanilla raw expect none of the noble stuff to work or partially working if you jump into any non dwarf entity group and expect it to mostly to not work if you land on a dwarven one.
in comparison to the nomad and void fort scripts this one a bit more sandbox-like given complete control over the civs you generated than just your dwarves/modded in civilizations.
so learn how it feels to control a necro tower then realize you got no pick or axe or anvil.
any way here's body swap but for sites.