oh boy you probably want Dfhack... or Resurrection on your adventurer next to the person you want to swap to and hope you jump into the body you wanted.
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 change_adv2(unit,nemesis)
if nemesis==nil then
nemesis=true --default value is nemesis switch too.
end
if unit==nil then
unit=getCreatureAtPos(getxyz()) --getCreatureAtPointer()--getSelectedUnit()
end
if unit==nil then
error("Invalid unit!")
end
local other=df.global.world.units.active
local unit_indx
for k,v in pairs(other) do
if v==unit then
unit_indx=k
break
end
end
if unit_indx==nil then
error("Unit not found in array?!") --should not happen
end
other[unit_indx]=other[0]
other[0]=unit
if nemesis then --basicly copied from advtools plugin...
local nem=dfhack.units.getNemesis(unit)
local other_nem=dfhack.units.getNemesis(other[unit_indx])
if other_nem then
other_nem.flags[0]=false
other_nem.flags[1]=true
end
if nem then
nem.flags[0]=true
nem.flags[2]=true
for k,v in pairs(df.global.world.nemesis.all) do
if v.id==nem.id then
df.global.ui_advmode.player_id=k
end
end
else
qerror("Current unit does not have nemesis record, further working not guaranteed")
end
end
end
here this is the remains of the bodyswap/ change adv script I use based from warmist's Dfusion copy, it works on cursor alignment so you need to be looking at your target you want to swap to.
switching back probably takes using Reveal if you happen to say swap to someone Miles away.
switching with this has the side effect of being able to play the character and any one you swap to before again if you retire them they get added to the playable adv pool.
you could swap between Fort mode and advmode through saving the game and selecting an adventurer with this though you probably have to go through loads of Gm-editor loops to get them Fort workable if they were not apart of the civ.