so here is the code used for dfhack dfusion to get conversions working
this goes in the folder Onfunction in the plugin.lua folder
function keeperchange()
RaceTable=RaceTable or BuildNameTable() --slow.If loaded don't load again
--repeat
local trgs=selectkeeper()
for k,v in pairs(trgs) do
--indx=GetCreatureAtPos(v)
--indx=engine.peek(v,ptr_creature.ID)
--local trgs=selectwolf()
--for t,z in pairs(trgs) do
r2=engine.peek(v,ptr_Creature.hurt1)
--ra2=RaceTable["FRAWD"]
id2=RaceTable["I_HUMAN"] -- find race id
engine.poke(v,ptr_Creature.race,id2)
print("Enhanced:"..k)
v2=engine.peek(v,ptr_Creature.hurt1)
for i=0,v2:size()-1 do
v2:setval(i,0)
end
v2=engine.peek(v,ptr_Creature.hurt2)
v2.type=DWORD
for i=0,v2:size()-1 do
v2:setval(i,0)
end
engine.peek(v,ptr_Creature.civ)
engine.poke(v,ptr_Creature.civ,-1)
engine.poke(v,ptr_Creature.bloodlvl,60000) --give blood
engine.poke(v,ptr_Creature.bleedlvl,24) --stop some bleeding...
--[[local flags=engine.peek(v,ptr_Creature.flags)
flags:set(1,false) -- alive!
flags:set(12,false) --zombie
flags:set(17,true)
flags:set(19,true)]]--
--end
end
--[[local trgs=selectdwarf()
for k,v in pairs(trgs) do
--indx=GetCreatureAtPos(v)
--indx=engine.peek(v,ptr_creature.ID)
--local trgs=selectwolf()
--for t,z in pairs(trgs) do
r2=engine.peek(v,ptr_Creature.hurt1)
--ra2=RaceTable["FRAWD"]
id2=RaceTable["FRAWD"] -- find race id
engine.poke(v,ptr_Creature.race,id2)
print("Infected:"..k)
v2=engine.peek(v,ptr_Creature.hurt1)
for i=0,v2:size()-1 do
v2:setval(i,0)
end
v2=engine.peek(v,ptr_Creature.hurt2)
v2.type=DWORD
for i=0,v2:size()-1 do
v2:setval(i,0)
end
engine.poke(v,ptr_Creature.bloodlvl,60000) --give blood
engine.poke(v,ptr_Creature.bleedlvl,24) --stop some bleeding...
local flags=engine.peek(v,ptr_Creature.flags)
flags:set(1,false) -- alive!
flags:set(12,false) --zombie
flags:set(17,true)
flags:set(19,true)
--end
end]]--
--until k==2
end
function selectkeeper()
local retvec={} --return vector (or a list)
myoff=offsets.getEx("AdvCreatureVec")
RaceTable=RaceTable or BuildNameTable()
vector=engine.peek(myoff,ptr_vector) --standart start
for i=0,vector:size()-1 do --check all creatures
local off
off=vector:getval(i)
local id=engine.peek(off,ptr_Creature.race)
local v2=engine.peek(off,ptr_Creature.hurt1)
ra=RaceTable["I_HUMAN"] --the infected race
ra2=RaceTable["HUMAN"] --normal Corrosion pavilion
--ra3=RaceTable["NORD"]
if id==ra2 and v2:getval(8*4)>=1 or id==ra and v2:getval(8*4)>=1 then
table.insert(retvec,off)--... add it to return vector
end
end
return retvec --return the "return vector" :)
end
stick this in the "install" section of the plugin.lua
onfunction.SetCallback("Move",keeperchange)
all you have to do next is copy and paste the human raw then change the raw name to I_human and maybe change the tile to something more easier to tell it's infected, then run the command and you are done!