ok so went and worked on a script that lets one force petitions to your fort.
kind of an alternative version to Makeown that forces the game to go through the citizenship process.
function petition()
local Shell=dfhack.gui.getSelectedUnit(true)
--local Shell=getCreatureAtPos(getxyz())
local Agree=df.global.world.agreements.all
Agree:insert("#",{new=true,id='-10',next_party_id=2,next_details_id=1})
local dd=Agree[#Agree - 1]
--for d,dd in ipairs(Agree) do
--if dd.id==(-10) then
--print('oh no')
dd.id = df.global.agreement_next_id
df.global.agreement_next_id = df.global.agreement_next_id + 1
dd.details:insert("#",{new=true,type=3})
dd.parties:insert("#",{new=true})
dd.parties:insert("#",{new=true})
dd.details[0].data.Citizenship=df.agreement_details_data_citizenship:new()
dd.details[0].data.Citizenship.applicant=0
dd.details[0].data.Citizenship.government=1
dd.details[0].data.Citizenship.site=df.global.ui.site_id
dd.parties[0].histfig_ids:insert("#",0)
dd.parties[0].histfig_ids[0]=Shell.hist_figure_id
dd.parties[1].id=1
dd.parties[1].entity_ids:insert("#",0)
dd.parties[1].entity_ids[0]=df.global.ui.group_id
df.global.ui.petitions:insert("#",dd.id)
end
function petition2()
local Shell=dfhack.gui.getSelectedUnit(true)
--local Shell=getCreatureAtPos(getxyz())
local Agree=df.global.world.agreements.all
Agree:insert("#",{new=true,id='-10',next_party_id=2,next_details_id=1})
local dd=Agree[#Agree - 1]
--for d,dd in ipairs(Agree) do
--if dd.id==(-10) then
--print('oh no')
dd.id = df.global.agreement_next_id
df.global.agreement_next_id = df.global.agreement_next_id + 1
dd.details:insert("#",{new=true,type=2})
dd.parties:insert("#",{new=true})
dd.parties:insert("#",{new=true})
dd.details[0].data.Residency=df.agreement_details_data_residency:new()
dd.details[0].data.Residency.reason=3
--dd.details[0].data.Residency.reason=48
dd.details[0].data.Residency.applicant=0
dd.details[0].data.Residency.government=1
dd.details[0].data.Residency.site=df.global.ui.site_id
dd.parties[0].histfig_ids:insert("#",0)
dd.parties[0].histfig_ids[0]=Shell.hist_figure_id
dd.parties[1].id=1
dd.parties[1].entity_ids:insert("#",0)
dd.parties[1].entity_ids[0]=df.global.ui.group_id
df.global.ui.petitions:insert("#",dd.id)
end
petition2()
petition()
just use the cursor and run the script, and unpause the game as it takes awhile for the petition option to show up.
now the original script had one(three) functions but with help of lethosor it was cut down to two(the other function is for residency after realizing granting citizenship might not always work)
probably should give out a warning as this script probably has some unseen bugs but so far pretty stable the most part of my tests.
you probably should not use this if you don't have a noble who can receive petitions as the game will prevent you from accepting/denying them.
this script opens the door to other agreement related mechanics you want to mess with.
edit: ok so here's an artifact spawner script that plops any artifact item into anyone's inventory... the kicker is you probably don't wanna drop this.
local dlg=require("gui.dialogs")
-- ok so this script is made for summoning gods into DF, to make this work you need to nickname someone historical that would form an army.
-- so the best choice would be either another adventurer or adv follower if you want the god to show up after fast traveling or assign the DFCAT nickname on some random peasant you talk to once.
-- going to give a warning about how this script messes with nemesis and probably unstable.
-- so BEST not use this on any important saves you care about and just test this out on an disposable save.
-- oh and the gods you summon won't really talk back if you reply to them.
-- this script uses coding from spawn unit and gui scripting to make it work, don't think this works in fort mode as this was made and tested in adv mode.
-- hopefully you have a better time getting gods to fight each other better than I did.
--that been edited to spawn items so it less likely to crash and corrupt saves hopefully
function deitysummoning()
local Ark={}
for k,v in pairs(df.global.world.artifacts.all) do
if v.item.flags.artifact==true or v.flags.artifact_mood==true then
BoaName=dfhack.TranslateName(v.name)
table.insert (Ark,{dfhack.TranslateName(v.name).." "..v.name.nickname,nil,v})
end
end
local f=function(Name,C)
deitysummoning2(C[3])
end
dlg.showListPrompt("artifact list","Select your item for summoning",COLOR_RED,Ark,f)
end
function getxyz() -- this will return pointers x,y and z coordinates.
local x=df.global.cursor.x
local y=df.global.cursor.y
local z=df.global.cursor.z
return x,y,z -- return the coords
end
function getxyz() -- this will return pointers x,y and z coordinates.
local x=df.global.cursor.x
local y=df.global.cursor.y
local z=df.global.cursor.z
return x,y,z -- return the coords
end
function getItemAtKPos(x,y,z) -- gets the item index @ x,y,z coord
--local x,y,z=getxyz() --get 'X' coords
local vector=df.global.world.item.all -- load all items
local kickpos=df.global.world.units.active[0].pos
for i = 0, #vector-1 do -- look into all items offsets
local curpos=vector[i].pos --get its coordinates
local cx=curpos.x
local cy=curpos.y
local cz=curpos.z
if cx==kickpos.x and cy==kickpos.y and cz==kickpos.z then --compare them
return vector[i] --return index
end
end
--print("item not found!")
return nil
end
function getCreatureAtPos(x,y,z) -- gets the creature index @ x,y,z coord
--local x,y,z=getxyz() --get 'X' coords
local vector=df.global.world.units.all -- load all creatures
for i = 0, #vector-1 do -- look into all creatures offsets
local curpos=vector[i].pos --get its coordinates
local cx=curpos.x
local cy=curpos.y
local cz=curpos.z
if cx==x and cy==y and cz==z then --compare them
return vector[i] --return index
end
end
--print("Creature not found!")
return nil
end
function deitysummoning2(HistfigID)
Divineslot=HistfigID
local horse=getCreatureAtPos(getxyz())
print('God Nem ID',Divineslot.id)
print('God Nem.figure ID',horse.id)
horse.inventory:insert("#",{new=true,item=HistfigID.item,mode=2,body_part_id=0})
end
deitysummoning()
probably useful for getting a slab or a book or random trinkets from the world with out needing to search for it hard you do need to know the name of the artifact you're looking for.
also probably unstable I haven't tested how this works with saving yet.