Bay 12 Games Forum
Dwarf Fortress => DF Modding => Utilities and 3rd Party Applications => Topic started by: FranchuFranchu on May 03, 2018, 03:56:18 pm
-
Finally, a way to do it
function index(ls,arg)
for i,j in ipairs(ls) do
if j == arg then return i end
end
qerror('Oops, something internal went wrong')
end
if dfhack.gui.getSelectedUnit() then
unit = dfhack.gui.getSelectedUnit()
active = df.global.world.units.active
ni = index(active,unit)
newadv = active[ni]
adv = active[0]
active[0] = newadv
active[ni] = adv
print('Correctly bodyswapped!')
endCopy-paste it in a .lua file, put it on hack/scripts and enjoy