Bay 12 Games Forum
Dwarf Fortress => DF Adventure Mode Discussion => Topic started by: Bauta on March 27, 2017, 08:20:02 am
-
I want to start an adventure with one of my fortressdwarfs
I retired the fortress, went there with another character, found the guy i am looking for but i dont know how to bodyswap because adv_bodyswap says its not a recognised comman :'(
-
I want to start an adventure with one of my fortressdwarfs
I retired the fortress, went there with another character, found the guy i am looking for but i dont know how to bodyswap because adv_bodyswap says its not a recognised comman :'(
Try the Mod forum? Dfhack forum? Someplace like that.
-
I can change to a desired character? How????
-
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.
-
I wanted one of these I could hotkey actually, I remembered why I went through the hoops instead of just using the advtools or whatnot methods.
local utils = require 'gui'
function assumeControl(new,old)
local actold
for i,j in ipairs(df.global.world.units.all) do
if j.id==df.global.world.units.active[0].id then
actold=j.id
break
end
end
local old
old=df.unit.find(actold)
local new
new=dfhack.gui.getSelectedUnit(true)
if new==nil then
qerror("Unable to Assume Control!")
end
local active=df.global.world.units.active
local actnew
for k,v in pairs(active) do
if v==new then
actnew=k
break
end
end
if actnew==nil then
qerror("Attempt to Assume Control has failed?")
end
active[actnew]=active[0]
active[0]=new
local target = dfhack.units.getNemesis(new)
if target then
local nwnem=dfhack.units.getNemesis(new)
local olnem=dfhack.units.getNemesis(old)
if olnem then
olnem.flags.ACTIVE_ADVENTURER=false
olnem.flags.RETIRED_ADVENTURER=true
olnem.unit.status.current_soul.personality.flags[1]=false
end
if nwem then
nwem.flags.ACTIVE_ADVENTURER=true
nwem.flags.RETIRED_ADVENTURER=false
nwnem.flags.ADVENTURER=true
nwnem.unit.status.current_soul.personality.flags[1]=true
for k,v in pairs(df.global.world.nemesis.all) do
if v.id==nwnem.id then
df.global.ui_advmode.player_id=k
end
end
end
else
qerror("Assuming Direct Control! Current target may not last long!")
end
end
assumeControl(new,old)
-
I tried figuring it out myself, but i simply dont know how to make the commands work in DF hack, can anyone help me ?
-
Do i need to install a different programm apart from DFHack ?
Is there an easy manual on how to use the adv tools ?