with the rise of Dfmode having a adventure transfer code would help those who don't want to fiddle around in Runesmith or the off chance runesmith is out dated again.
function selectcomp()
local retvec={} --return vector (or a list)
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff,ptr_vector) --standart start
for i=0,vector:size()-1 do --check all creatures
local off
off=vector:getval(i)
lfollow=engine.peek(off,ptr_Creature.followID) -- get target creatures "now following ID"
if lfollow ~=0xFFFFFFFF then --if its set
table.insert(retvec,off)--... add it to return vector
end
end
return retvec --return the "return vector" :)
end
function rum_tools.fortcomps()
local trgs=selectcomp()
for k,v in pairs(trgs) do
--indx=GetCreatureAtPos(v)
--indx=engine.peek(v,ptr_creature.ID)
print("Companion:"..k)
local flags=engine.peek(v,ptr_Creature.flags)
flags:set(1,false) -- alive!
flags:set(51,false) -- remove the is resident flag on companions
flags:set(47,false) -- something todo with wounds- lets you walk again.
engine.poke(v,ptr_Creature.flags,flags)
end
end
function rum_tools.fortdy()
--first three lines same as before (because we will need an offset of creature at location x,y,z)
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff,ptr_vector)
indx=GetCreatureAtPos(getxyz())
--indx=0
--print(string.format("%x",vector:getval(indx)))
flg=engine.peek(vector:getval(indx),ptr_Creature.flags) --get flags
flg:set(51,false) -- 76 is ghostliness flag.
--flg:set(1,0) -- alive
--flg:set(13,1) -- skeleton
engine.poke(vector:getval(indx),ptr_Creature.flags,flg) --save flags
end
I have a modified hostile function to make different Civ Adventurers match up with the current site civ number
function rum_tools.Fortilate()
vector=engine.peek(offsets.getEx("CreatureVec"),ptr_vector)
id=engine.peekd(offsets.getEx("CreaturePtr"))
print(string.format("Vec:%d cr:%d",vector:size(),id))
off=vector:getval(id)
crciv=engine.peek(off,ptr_Creature.civ)
curciv=engine.peekd(offsets.getEx("CurrentRace")-12)
if curciv==crciv then
print("Friendly")
--engine.poke(off,ptr_Creature.civ,curciv)
flg=engine.peek(off,ptr_Creature.flags)
flg:set(17,false)
engine.poke(off,ptr_Creature.flags,flg)
else
print("Enemy or Adventurer- making friendly")
engine.poke(off,ptr_Creature.civ,curciv)
flg=engine.peek(off,ptr_Creature.flags)
flg:set(17,false)
flg:set(19,false)
engine.poke(off,ptr_Creature.flags,flg)
end
end
.