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
--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.
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
--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.