Bay 12 Games Forum

Dwarf Fortress => DF Modding => Topic started by: darius on November 03, 2010, 10:44:00 am

Title: DFusion - a lua based plugin system (integrated into DFHack)
Post by: darius on November 03, 2010, 10:44:00 am
This is a hijacked thread to dfusion integrated into DFhack (http://www.bay12forums.com/smf/index.php?topic=91166.0).

A wip wiki: here (http://df.magmawiki.com/index.php?title=Utility:DFusion)
Repository: here (https://github.com/warmist/dfhack)
Download here: DFhack, built by peterix including stonesense and other neat things (https://github.com/downloads/peterix/dfhack/dfhack-0.31.25-r8-Windows.zip)

Title: Re: DFusion - a lua based plugin system v1
Post by: darius on November 04, 2010, 10:50:50 am
Lua syntax:
Spoiler (click to show/hide)
Script example:
Spoiler (click to show/hide)
Guide for friendship plugin by Hugo_The_Dwarf here (http://www.bay12forums.com/smf/index.php?topic=69682.msg1706891#msg1706891)
Title: Re: DFusion - a lua based plugin system v1
Post by: Hugo_The_Dwarf on November 04, 2010, 10:57:53 am
I'd like to ask how to use this? any special things I need on my PC? (.NET, Java...)
Title: Re: DFusion - a lua based plugin system v1
Post by: darius on November 04, 2010, 10:59:04 am
Should work right of the box, if not please tell me. now should work right out of the box! why no one told me that it says DLL missing :/
Edit: found a little bug - first entry in friendship is not parsed... so dwarves suddenly turn into "tame" :D
Title: Re: DFusion - a lua based plugin system v1.2
Post by: Hugo_The_Dwarf on November 05, 2010, 08:06:20 am
so sorry that I didn't just say the .dll file was missing, funny too cuz im a pc tech haha, so I believe that out of the box means you do'nt need "FE" just this? right on, I shall begin testing

EDIT: after reading the change log I'll get "FE" just in case
Title: Re: DFusion - a lua based plugin system v1.2
Post by: Askot Bokbondeler on November 05, 2010, 08:23:48 am
followin
Title: Re: DFusion - a lua based plugin system v1.2
Post by: Rumrusher on November 07, 2010, 01:24:33 am
going to use this post as means of dumping my add-ons so people don't have to surf this thread for all of them.
installing new is as simple open up notepad and copy paste the code in then save the file as plugin.lua then make a folder called Rum_tools and place the file in there.
next you need to do is place the folder rum_tools in the plugin folder of Dfhack.

Code: [Select]
rum_tools={} --> first lets make a menu table
rum_tools.menu=MakeMenu()
function rum_tools.changeadv() -- this function will do almost all the work
myoff=offsets.getEx("AdvCreatureVec") -- first find out where "Adventurer creature vector" is
vector=engine.peek(myoff,ptr_vector) -- +16 is a little fix...
indx=GetCreatureAtPos(getxyz()) -- a little helper, gets index in the vector with current id. And getxyz() is a function that gets x y and z of that "X" pointer. These functions are in common.lua
print("Swaping, press enter when done.")
-- next three lines is a common switch two things pattern
tval=vector:getval(0) -- get offset of player
vector:setval(0,vector:getval(indx)) -- set first offset to be the target's
vector:setval(indx,tval) -- set targets offset to the players
r=io.stdin:read() -- pause
-- again switch them around
tval=vector:getval(0)
vector:setval(0,vector:getval(indx))
vector:setval(indx,tval)
end
function rum_tools.MakeFollow()
--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())

print(string.format("current creature:%x",vector:getval(indx)))
trgid=engine.peek(vector:getval(0),ptr_Creature.ID) --get players ID
lfollow=engine.peek(vector:getval(indx),ptr_Creature.followID) -- get target creatures "now following ID"
if lfollow ~=0xFFFFFFFF then --if its set
print("Already following, unfollow? y/N") -- ask confirmation
r=io.stdin:read()
if r== "y" then
engine.poke(vector:getval(indx),ptr_Creature.followID,0)
end
else
engine.poke(vector:getval(indx),ptr_Creature.followID,trgid) -- if not just write the players ID.
end
end
function rum_tools.racechange()
--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())
RaceTable=RaceTable or BuildNameTable() --slow.If loaded don't load again
print("Enter race name ALL CAPS!:")
repeat
entry=io.stdin:read() --get entry
id=RaceTable[entry] -- find race id
until id~=nil -- if not found repeat
engine.poke(vector:getval(indx),ptr_Creature.race,id)
end
function rum_tools.makeghost()
--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:flip(76) -- 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
function rum_tools.maketest()
--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)))
test=engine.peek(vector:getval(indx),ptr_Creature.wutlvl) --get random hex memory between bleed and blood
--flg:flip(76) -- 76 is ghostliness flag.
--flg:set(1,0) -- alive
--flg:set(13,1) -- skeleton

engine.poke(vector:getval(indx),ptr_Creature.wutlvl,-1) --testing for anything to happen
end
function rum_tools.getitems()
--first three lines same as before (because we will need an offset of creature at location x,y,z)
x,y,z=getxyz()
vector=engine.peek(myoff+16,ptr_vector)
indx=GetCreatureAtPos(getxyz())
indx=0
flg=engine.peek(vector:getval(indx),ptr_Creature.flags) --get flags
flg:flip(76) -- 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
function rum_tools.hostilate()
vector=engine.peek(offsets.getEx("AdvCreatureVec"),ptr_vector)
id=GetCreatureAtPos(getxyz())
print(string.format("Vec:%d cr:%d",vector:size(),id))
off=vector:getval(id)
crciv=engine.peek(vector:getval(id),ptr_Creature.civ)
curciv=engine.peek(vector:getval(0),ptr_Creature.civ)

if curciv==crciv then
print("Friendly-making enemy")
engine.poke(off,ptr_Creature.civ,-1)
flg=engine.peek(off,ptr_Creature.flags)
flg:set(17,true)
engine.poke(off,ptr_Creature.flags,flg)
else
print("Enemy- 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
function rum_tools.nociv() --removes Civ number will become hostile
vector=engine.peek(offsets.getEx("AdvCreatureVec"),ptr_vector)
id=GetCreatureAtPos(getxyz())
print(string.format("Vec:%d cr:%d",vector:size(),id))
off=vector:getval(id)
crciv=engine.peek(vector:getval(id),ptr_Creature.civ)
engine.poke(off,ptr_Creature.civ,-1)
--[[curciv=engine.peek(vector:getval(0),ptr_Creature.civ)

if curciv==crciv then
print("Friendly-making enemy")
engine.poke(off,ptr_Creature.civ,-1)
flg=engine.peek(off,ptr_Creature.flags)
flg:set(17,true)
engine.poke(off,ptr_Creature.flags,flg)
else
print("Enemy- 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
function rum_tools.tamingcompanions() --woop wopp does not work
vector=engine.peek(offsets.getEx("AdvCreatureVec"),ptr_vector)
id=GetCreatureAtPos(getxyz())
print(string.format("Vec:%d cr:%d",vector:size(),id))
off=vector:getval(id)
crciv=engine.peek(vector:getval(id),ptr_Creature.civ)
curciv=engine.peek(vector:getval(0),ptr_Creature.civ)

if curciv==crciv then
print("Friendly-making friendly")
engine.poke(off,ptr_Creature.civ,crciv)
flg=engine.peek(off,ptr_Creature.flags)
flg:set(17,0)
flg:set(19,0)
engine.poke(off,ptr_Creature.flags,flg)
else
print("Enemy- making friendly")
engine.poke(0,ptr_Creature.civ,crciv)
flg=engine.peek(off,ptr_Creature.flags)
flg:set(17,0)
flg:set(19,0)
engine.poke(off,ptr_Creature.flags,flg)
end
end
function rum_tools.getlegendsid(croff)
local vec=engine.peek(croff,ptr_Creature.legends)
if vec:size()~=0 then
return engine.peekd(vec:getval(0)+4)
else
return 0
end
end
function rum_tools.follow2()
myoff=offsets.getEx("AdvCreatureVec")
leg=offsets.getEx("Legends")
vector=engine.peek(myoff,ptr_vector)
legvec=engine.peek(leg,ptr_vector)
indx=GetCreatureAtPos(getxyz())
print(string.format("current creature:%x",vector:getval(indx)))
trgid=engine.peek(vector:getval(0),ptr_Creature.ID) --get players ID
--[[playerlegid=engine.peek(vector:getval(0),ptr_Creature.legends)
playerlegid=engine.peekd(playerlegid:getval(0)+4)
lfollow=engine.peek(vector:getval(indx),ptr_Creature.followID) -- get target creatures "now following ID"
trglegid=engine.peek(vector:getval(indx),ptr_Creature.legends)
trglegid=engine.peekd(trglegid:getval(0)+4)--]]
playerlegid=rum_tools.getlegendsid(vector:getval(0))
trglegid=rum_tools.getlegendsid(vector:getval(indx))
print(string.format("Player legends id:%d and offset:%x",playerlegid,legvec:getval(playerlegid)))
print(string.format("Target legends id:%d and offset:%x",trglegid,legvec:getval(trglegid)))

if lfollow ~=0xFFFFFFFF then --if its set
print("Already following, unfollow? y/N") -- ask confirmation
r=io.stdin:read()
if r== "y" then
engine.poke(vector:getval(indx),ptr_Creature.followID,-1)
engine.poke(legvec:getval(trglegid),ptr_legends2.follow,-1)
end
else
engine.poke(vector:getval(indx),ptr_Creature.followID,trgid) -- if not just write the players ID.
engine.poke(legvec:getval(trglegid),ptr_legends2.follow,playerlegid)
end
end
function rum_tools.changeadv2()
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff,ptr_vector)
indx=GetCreatureAtPos(getxyz())
print("Swaping")

tval=vector:getval(0)
vector:setval(0,vector:getval(indx))
vector:setval(indx,tval)
local legid=rum_tools.getlegendsid(vector:getval(0))
print("Legends id found:"..legid)
if legid~=0 then
engine.poked(offsets.getEx("PlayerLegend"),legid)
else
print("Warning target does not have a valid legends id!")
end
end
function rum_tools.changeflag() --by rumrusher
   myoff=offsets.getEx("AdvCreatureVec")
   vector=engine.peek(myoff,ptr_vector)
   indx=GetCreatureAtPos(getxyz())
   flg=engine.peek(vector:getval(indx),ptr_Creature.flags)
   print("Type flags number to flip:")
   entry=io.stdin:read()
   print("Was:"..flg:get(entry))
   flg:flip(entry)
   print("Now:"..flg:get(entry))
   engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
end
function rum_tools.wagonmode() --by rumrusher
   --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(1,false)
   flg:set(74,false)
   engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
   print("To stay normal press y, else hit Enter turn Wagon mode on.")
   r=io.stdin:read() -- repeat for it too work... also creature will be dead.
   if r== "y" then
      flg=engine.peek(vector:getval(indx),ptr_Creature.flags)
      flg:set(1,false)
      engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
   else
      flg=engine.peek(vector:getval(indx),ptr_Creature.flags)
      flg:set(1,false)
      flg:flip(74)
      engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
   end
end
continue on the other post
Spoiler: "old post" (click to show/hide)
Title: Re: DFusion - a lua based plugin system v1.2
Post by: darius on November 07, 2010, 06:46:13 am
race changer!?
does this mean we can change the race of any selected the creature
or change the civ controller?

some how it doesn't work with .10. even when I try the -f
change race - changes the controling race, not race of one creature. As for version, try running df in arena mode and then use the "-f" if it still does not work i suspect that .10 could be too old although i tried to make algorithms universal.
Title: Re: DFusion - a lua based plugin system v1.2
Post by: Rumrusher on November 07, 2010, 08:59:28 am
Code: [Select]
function rum_tools.ressurect()
    --repeat
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff,ptr_vector)
indx=0 --GetCreatureAtPos(getxyz())
if indx<0 then return end
--print(string.format("%x",vector:getval(indx)))
v2=engine.peek(vector:getval(indx),ptr_Creature.hurt1)
for i=0,v2:size()-1 do
v2:setval(i,0)
end
v2=engine.peek(vector:getval(indx),ptr_Creature.hurt2)
v2.type=DWORD
for i=0,v2:size()-1 do
v2:setval(i,0)
end
engine.poke(vector:getval(indx),ptr_Creature.bloodlvl,60000) --give blood
engine.poke(vector:getval(indx),ptr_Creature.bleedlvl,0) --stop some bleeding...
local flg=engine.peek(vector:getval(indx),ptr_Creature.flags)
    flg:set(1,false) --ALIVE
    flg:set(39,false) -- leave body yet again
    flg:set(37,false)
    flg:set(57,true)
    flg:set(60,true) -- something todo with wounds- lets you walk again.
    engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
    --until r==7
end
function rum_tools.Hurt() --instant hurt of a body part
    --repeat
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff,ptr_vector)
indx=GetCreatureAtPos(getxyz())
if indx<0 then return end
--print(string.format("%x",vector:getval(indx)))
v2=engine.peek(vector:getval(indx),ptr_Creature.hurt1)
for i=0,v2:size()-1 do
v2:setval(i,7)
end
v2=engine.peek(vector:getval(indx),ptr_Creature.hurt2)
v2.type=DWORD
for i=0,v2:size()-1 do
v2:setval(i,8)
end
engine.poke(vector:getval(indx),ptr_Creature.bloodlvl,60000) --give blood
engine.poke(vector:getval(indx),ptr_Creature.bleedlvl,1) --stop some bleeding...
local flg=engine.peek(vector:getval(indx),ptr_Creature.flags)
    flg:set(1,false) --ALIVE
    flg:set(39,false) -- leave body yet again
    flg:set(37,false) -- something todo with wounds- lets you walk again.
    engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
    --until r==7
end

function rum_tools.Hurtselected() --found out that this does not really hurt creature but will give the user ability to disarm them if you remove(15) a limb from their bodies this will cause their clothes to fall off so find the hand and poof away gear.
    --repeat
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff,ptr_vector)
indx=GetCreatureAtPos(getxyz())
if indx<0 then return end
--print(string.format("%x",vector:getval(indx)))
v2=engine.peek(vector:getval(indx),ptr_Creature.hurt1)
v3=engine.peek(vector:getval(indx),ptr_Creature.hurt2)
v3.type=DWORD
print("select body part 0=upperbody,1=lowerbody,2=head,3=right front leg,4=left front leg,5=")
r=io.stdin:read()
t=r*4
print("select infliction")
d=io.stdin:read()
v2:setval(t,d)
v3:setval(r,d) --remove zero-th limb or something... same with hurt2
end
function rum_tools.ressurectall()
local trgs=selectall()
for k,v in pairs(trgs) do
--indx=GetCreatureAtPos(v)
--indx=engine.peek(v,ptr_creature.ID)
print("Zombie:"..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,0) --stop some bleeding...
local flags=engine.peek(v,ptr_Creature.flags)
flags:set(1,false) -- alive!
flags:set(39,false) -- leave body yet again
flags:set(37,false) -- something todo with wounds- lets you walk again.
engine.poke(v,ptr_Creature.flags,flags)
end
end
function rum_tools.ressurectcomp() --heal all your friends for a small chance to die again
local trgs=selectcomp()
for k,v in pairs(trgs) do
--indx=GetCreatureAtPos(v)
--indx=engine.peek(v,ptr_creature.ID)
print("Companion:"..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,0) --stop some bleeding...
local flags=engine.peek(v,ptr_Creature.flags)
flags:set(1,false) -- alive!
flags:set(39,false) -- leave body yet again
flags:set(37,false) -- something todo with wounds- lets you walk again.
engine.poke(v,ptr_Creature.flags,flags)
end
end
function rum_tools.fortcomps() --removes the is resident tag off companions
local trgs=selectcomp()
for k,v in pairs(trgs) do
--indx=GetCreatureAtPos(v)
--indx=engine.peek(v,ptr_creature.ID)
print("Companion:"..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,0)]]-- --stop some bleeding...
local flags=engine.peek(v,ptr_Creature.flags)
flags:set(1,false) -- alive!
flags:set(51,false) -- leave body yet again
flags:set(47,false) -- something todo with wounds- lets you walk again.
engine.poke(v,ptr_Creature.flags,flags)
end
end
function rum_tools.Zombieressurectandcontrol() -- BE THE NECROMANCER... end up watching a bunch of zombie fight each other like savages and not get any raiding done use a teleport or carry command to order them around.
local trgs=selectall()
for k,v in pairs(trgs) do
--indx=GetCreatureAtPos(v)
--indx=engine.peek(v,ptr_creature.ID)
print("Zombie:"..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(creatureptr,ptr_Creature.legends,-1)
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff+16,ptr_vector)
local trgs=selectall()
for k,v in pairs(trgs) do
trgid=engine.peek(vector:getval(0),ptr_Creature.ID) --get players ID
engine.peek(v,ptr_Creature.followID) -- get target creatures "now following ID"
engine.poke(v,ptr_Creature.followID,trgid) -- if not just write the players ID.
end
engine.poke(v,ptr_Creature.bloodlvl,60000) --give blood
engine.poke(v,ptr_Creature.bleedlvl,0) --stop some bleeding...
local flags=engine.peek(v,ptr_Creature.flags)
flags:set(1,false) -- alive!
flags:set(12,true) --zombie
engine.poke(v,ptr_Creature.flags,flags)
end
end

function rum_tools.Zombieressurect() -- turn dead into undead and undead into dead for good.
repeat
local trgs=selectall()
for k,v in pairs(trgs) do
--indx=GetCreatureAtPos(v)
--indx=engine.peek(v,ptr_creature.ID)
print("Zombie:"..k)
v2=engine.peek(v,ptr_Creature.hurt1)
for i=0,v2:size()-1 do
v2:setval(i,1)
end
v2=engine.peek(v,ptr_Creature.hurt2)
v2.type=DWORD
for i=0,v2:size()-1 do
v2:setval(i,1)
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,true) --zombie
flags:set(17,true)
flags:set(19,true)
engine.poke(v,ptr_Creature.flags,flags)
--engine.poke(v,ptr_Creature.legends,-1)
end
until r==7
end

function rum_tools.lycanressurect() -- turns any one hurt a curtain way into a different race but be warn hitting them will cause the game to crash.
--repeat
local trgs=selectwolf()
for k,v in pairs(trgs) do
--indx=GetCreatureAtPos(v)
--indx=engine.peek(v,ptr_creature.ID)
engine.poke(v,ptr_Creature.race,151)
print("Werewolf:"..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)
engine.poke(v,ptr_Creature.flags,flags)
end
--until r==7
end

function rum_tools.ghostin() --necromancer controls of turning zombies into ghosts for easier manipulation of the dead
local trgs=selectskeleton()
for k,v in pairs(trgs) do
print("Zombie:"..k)
local flags=engine.peek(v,ptr_Creature.flags)
flags:set(1,false) -- alive!
flags:flip(76) --passive ghost following
engine.poke(v,ptr_Creature.flags,flags)
end
end
function rum_tools.skeltozombie() --add the rot to the pile of bones
local trgs=selectskeleton()
for k,v in pairs(trgs) do
print("Zombie:"..k)
local flags=engine.peek(v,ptr_Creature.flags)
flags:set(1,false) -- alive!
flags:set(12,true) --zombie
flags:set(13,false) --no skel
engine.poke(v,ptr_Creature.flags,flags)
end
end


function rum_tools.nosneak() --unreveal a hidden companion attack or an siege.
local trgs=selectalive()
for k,v in pairs(trgs) do
print("hidden:"..k)
local flags=engine.peek(v,ptr_Creature.flags)
flags:set(1,false) -- alive!
flags:set(18,false) --unreveal ambushers
engine.poke(v,ptr_Creature.flags,flags)
end
end
function rum_tools.compsneak()  -- stealth tactics for against archers
local trgs=selectcomp()
for k,v in pairs(trgs) do
print("hidden:"..k)
local flags=engine.peek(v,ptr_Creature.flags)
--flags:set(1,false) -- alive!
flags:set(18,true) --ambushers
engine.poke(v,ptr_Creature.flags,flags)
end
end
function rum_tools.zombietoskel() -- strip the rotten meat from the bones.
local trgs=selectzombie()
for k,v in pairs(trgs) do
print("Skeleton:"..k)
local flags=engine.peek(v,ptr_Creature.flags)
flags:set(1,false) -- alive!
flags:set(13,true)
flags:set(12,false) --no zombie
engine.poke(v,ptr_Creature.flags,flags)
end
end
function selectalive()
  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)
     local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(1)==false then  --if dead ...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end
function rum_tools.ControlZombie() -- get temp control over the dead will revert if you travel
--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)
local trgs=selectzombie()
for k,v in pairs(trgs) do
trgid=engine.peek(vector:getval(0),ptr_Creature.ID) --get players ID
engine.poke(v,ptr_Creature.civ,-1)
engine.peek(v,ptr_Creature.followID) -- get target creatures "now following ID"
engine.poke(v,ptr_Creature.followID,trgid) -- if not just write the players ID.
end
end
function selectskeleton()
  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)
     local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(13)==true then  --if undead in anyway...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end

function selectzombie()
  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)
     local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(12)==true then  --if undead in anyway...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end
function selectall()
  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)
     local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(1)==true and flags:get(12)==false then  --if dead ...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end
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.butcher() --flips slaughter flag on a creature causes any member of the fort to drag the poor sucker to the butcher shop and kill them for meat. yum
--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:flip(49) -- 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

function rum_tools.butcherdead() --search for dead creatures and flip on the butcher tag so that you can still serve a dead dwarf to feed millions.
local trgs=selectall()
for k,v in pairs(trgs) do
print("kattle:"..k)
local flags=engine.peek(v,ptr_Creature.flags)
flags:set(49,true) -- butch!
--flags:set(13,true)
--flags:set(12,false) no zombie
engine.poke(v,ptr_Creature.flags,flags)
end
end
function rum_tools.fortdy() --use the pointer on the creature flip off the is resident flag.
--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
function selectindcomp(names) -- this function will allow you to change to a companion for a small period does not work
myoff=offsets.getEx("AdvCreatureVec") -- first find out where "Adventurer creature vector" is
vector=engine.peek(myoff,ptr_vector) -- +16 is a little fix...
--indx=GetCreatureAtPos(getxyz()) -- a little helper, gets index in the vector with current id. And getxyz() is a function that gets x y and z of that "X" pointer. These functions are in common.lua
local trgs=selectcomp()
for k,v in pairs(trgs) do
tnames={}
rnames={}
local name=engine.peek(v,ptt_dfstring):getval()
local lid= tools.getlegendsid(v)
if lid ~=0 then
print(i..")*Creature Name:"..name.." race="..engine.peekw(v+ptr_Creature.race.off).." legendid="..lid)
else
print(i..") Creature Name:"..name.." race="..engine.peekw(v+ptr_Creature.race.off))
end
if name ~="" and name~=nil then
tnames[v]=name
rnames[name]=v
end
end
print("=====================================")
print("type in name or number:")
r=io.stdin:read()
if tonumber(r) ==nil then
indx=rnames[r]
if indx==nil then return end
else
r=tonumber(r)
if r<vector:size() then indx=r else return end
end
return indx
end

function selectwolf()
  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)
     local v2=engine.peek(off,ptr_Creature.hurt1)
     if v2:getval(12)==15 and v2:getval(8)==0 then
     --[[local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(1)==0 then]]--  --if dead ...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end
function rum_tools.change_adv2comp() --woop woop does not work
myoff=offsets.getEx("AdvCreatureVec") -- first find out where "Adventurer creature vector" is
vector=engine.peek(myoff,ptr_vector) -- +16 is a little fix...
indx=selectindcomp(names) -- a little helper, gets index in the vector with current id. And getxyz() is a function that gets x y and z of that "X" pointer. These functions are in common.lua
print("Swaping, press enter when done.")
-- next three lines is a common switch two things pattern
tval=vector:getval(0) -- get offset of player
vector:setval(0,vector:getval(indx)) -- set first offset to be the target's
vector:setval(indx,tval) -- set targets offset to the players
r=io.stdin:read() -- pause
-- again switch them around
tval=vector:getval(0)
vector:setval(0,vector:getval(indx))
vector:setval(indx,tval)
end
function rum_tools.comprace()
--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())
local trgs=selectcomp()
for k,v in pairs(trgs) do
--RaceTable=RaceTable or BuildNameTable() --slow.If loaded don't load again
--print("Enter race name ALL CAPS!:")
--repeat
entry=io.stdin:read() --get entry
--id=RaceTable[entry] -- find race id
--until id~=nil -- if not found repeat
engine.poke(v,ptr_Creature.race,entry)
end

end
function rum_tools.compraceez()
--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())
local trgs=selectcomp()
for k,v in pairs(trgs) do
RaceTable=RaceTable or BuildNameTable() --slow.If loaded don't load again
print("Enter race name ALL CAPS!:")
repeat
entry=io.stdin:read() --get entry
id=RaceTable[entry] -- find race id
until id~=nil -- if not found repeat
engine.poke(v,ptr_Creature.race,id)
end
end
function rum_tools.compiggybackride() --for people who want every one to cross the river or get every one in one spot so you can retreat/attack one person
--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())
local trgs=selectcomp()
for k,v in pairs(trgs) do
--RaceTable=RaceTable or BuildNameTable() --slow.If loaded don't load again
--print("Enter race name ALL CAPS!:")
repeat
flg=engine.peek(vector:getval(0),ptr_Creature.flags)
      flg2=engine.peek(v,ptr_Creature.flags)
      enty=engine.peek(vector:getval(0),ptr_Creature.y)
      entx=engine.peek(vector:getval(0),ptr_Creature.x)
      move=engine.peek(vector:getval(0),ptr_Creature.z)
      engine.poke(v,ptr_Creature.z,move)
      engine.poke(v,ptr_Creature.x,entx)
      engine.poke(v,ptr_Creature.y,enty)
      until flg:get(15) ==true or flg2:get(1) ==true
--entry=io.stdin:read() --get entry
--id=RaceTable[entry] -- find race id
--until id~=nil -- if not found repeat
--engine.poke(v,ptr_Creature.race,id)
end
end
function rum_tools.warptowag() --for those with wagons
--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())
local trgs=selectcomp()
for k,v in pairs(trgs) do
print("warpin' to Wagon")
local trgs=selectwagon()
for w,d in pairs(trgs) do
      wary=engine.peek(d,ptr_Creature.y)
      warx=engine.peek(d,ptr_Creature.x)
      warz=engine.peek(d,ptr_Creature.z)
      engine.poke(v,ptr_Creature.z,warz)
      engine.poke(v,ptr_Creature.x,warx)
      engine.poke(v,ptr_Creature.y,wary)
      engine.poke(vector:getval(0),ptr_Creature.y,wary)
      engine.poke(vector:getval(0),ptr_Creature.x,warx)
      engine.poke(vector:getval(0),ptr_Creature.z,warz)
end
print("WARP COMPLETE! preparing getaway.")
--[[repeat
flg=engine.peek(vector:getval(0),ptr_Creature.flags)
      flg2=engine.peek(d,ptr_Creature.flags)
      enty=engine.peek(vector:getval(0),ptr_Creature.y)
      entx=engine.peek(vector:getval(0),ptr_Creature.x)
      move=engine.peek(vector:getval(0),ptr_Creature.z)
      engine.poke(v,ptr_Creature.z,move)
      engine.poke(v,ptr_Creature.x,entx)
      engine.poke(v,ptr_Creature.y,enty)
      until flg:get(15) ==true
print("Parking.")--]]
--entry=io.stdin:read() --get entry
--id=RaceTable[entry] -- find race id
--until id~=nil -- if not found repeat
--engine.poke(v,ptr_Creature.race,id)
end
end
function selectwagon()
  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)
     local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(74)==true then  --if undead in anyway...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end
function rum_tools.warp() --made before darius version really primitive
   myoff=offsets.getEx("AdvCreatureVec")
   vector=engine.peek(myoff,ptr_vector)
   --indx=GetCreatureAtPos(getxyz())
   print("how high?")
   entry=io.stdin:read()
   move=engine.peek(vector:getval(0),ptr_Creature.z)+entry
   print("W and E")
   entry=io.stdin:read()
   move2=engine.peek(vector:getval(0),ptr_Creature.x)+entry
   print("N and S")
   entry=io.stdin:read()
   move3=engine.peek(vector:getval(0),ptr_Creature.y)+entry
   engine.poke(vector:getval(0),ptr_Creature.z,move)
   engine.poke(vector:getval(0),ptr_Creature.x,move2)
   engine.poke(vector:getval(0),ptr_Creature.y,move3)
end

function rum_tools.carry() --first crack at the carry command
   myoff=offsets.getEx("AdvCreatureVec")
   vector=engine.peek(myoff,ptr_vector)
   indx=GetCreatureAtPos(getxyz())
   --[[print("grab person how? N S E W")
   --repeat
   r=io.stdin:read()
   if r=="N" then
      enty=(engine.peek(vector:getval(0),ptr_Creature.y)+1)
   elseif r=="S" then
      enty=(engine.peek(vector:getval(0),ptr_Creature.y)-1)
   elseif r=="W" then
      entx=(engine.peek(vector:getval(0),ptr_Creature.x)-1)
   elseif r=="E" then
      entx=(engine.peek(vector:getval(0),ptr_Creature.x)+1)
   end]]--
   repeat
   flg=engine.peek(vector:getval(0),ptr_Creature.flags)
   flg2=engine.peek(vector:getval(indx),ptr_Creature.flags)
   --print("how high?")
   --entry=io.stdin:read()
   Crepos=engine.peek(vector:getval(0),ptr_Creature.x)-1 --+entx
   move=engine.peek(vector:getval(0),ptr_Creature.z)
   --print("W and E")
   --entry=io.stdin:read()
   --move2=engine.peek(vector:getval(0),ptr_Creature.x)
   --print("N and S")
   --entry=io.stdin:read()
   move3=engine.peek(vector:getval(0),ptr_Creature.y) --+enty
   engine.poke(vector:getval(indx),ptr_Creature.z,move)
   engine.poke(vector:getval(indx),ptr_Creature.x,Crepos)
   engine.poke(vector:getval(indx),ptr_Creature.y,move3)
   until flg:get(15) ==1 or flg2:get(1) ==1
end
function rum_tools.carryEX() --better version of the said carry command to use this have the pointer on top of the creature you want to hold and insert a letter may lead to invisible blocks so user beware.
   myoff=offsets.getEx("AdvCreatureVec")
   vector=engine.peek(myoff,ptr_vector)
   indx=GetCreatureAtPos(getxyz())
   print("grab person how? N S E W")
   --repeat
   r=io.stdin:read()
   if r=="N" then
      repeat 
      flg=engine.peek(vector:getval(0),ptr_Creature.flags)
      flg2=engine.peek(vector:getval(indx),ptr_Creature.flags)
      enty=engine.peek(vector:getval(0),ptr_Creature.y)+1
      entx=engine.peek(vector:getval(0),ptr_Creature.x)
      move=engine.peek(vector:getval(0),ptr_Creature.z)
      engine.poke(vector:getval(indx),ptr_Creature.z,move)
      engine.poke(vector:getval(indx),ptr_Creature.x,entx)
      engine.poke(vector:getval(indx),ptr_Creature.y,enty)
      until flg:get(15) ==true or flg2:get(1) ==true
   elseif r=="S" then
      repeat
      flg=engine.peek(vector:getval(0),ptr_Creature.flags)
      flg2=engine.peek(vector:getval(indx),ptr_Creature.flags)
      enty=engine.peek(vector:getval(0),ptr_Creature.y)-1
      entx=engine.peek(vector:getval(0),ptr_Creature.x)
      move=engine.peek(vector:getval(0),ptr_Creature.z)
      engine.poke(vector:getval(indx),ptr_Creature.z,move)
      engine.poke(vector:getval(indx),ptr_Creature.x,entx)
      engine.poke(vector:getval(indx),ptr_Creature.y,enty)
      until flg:get(15) ==true or flg2:get(1) ==true
   elseif r=="W" then
      repeat
      flg=engine.peek(vector:getval(0),ptr_Creature.flags)
      flg2=engine.peek(vector:getval(indx),ptr_Creature.flags)
      entx=engine.peek(vector:getval(0),ptr_Creature.x)-1
      enty=engine.peek(vector:getval(0),ptr_Creature.y)
      move=engine.peek(vector:getval(0),ptr_Creature.z)
      engine.poke(vector:getval(indx),ptr_Creature.z,move)
      engine.poke(vector:getval(indx),ptr_Creature.x,entx)
      engine.poke(vector:getval(indx),ptr_Creature.y,enty)
      until flg:get(15) ==true or flg2:get(1) ==true
   elseif r=="E" then
      repeat
      flg=engine.peek(vector:getval(0),ptr_Creature.flags)
      flg2=engine.peek(vector:getval(indx),ptr_Creature.flags)
      entx=engine.peek(vector:getval(0),ptr_Creature.x)+1
      enty=engine.peek(vector:getval(0),ptr_Creature.y)
      move=engine.peek(vector:getval(0),ptr_Creature.z)
      engine.poke(vector:getval(indx),ptr_Creature.z,move)
      engine.poke(vector:getval(indx),ptr_Creature.x,entx)
      engine.poke(vector:getval(indx),ptr_Creature.y,enty)
      until flg:get(15) ==true or flg2:get(1) ==true
   end
   --[[flg=engine.peek(vector:getval(0),ptr_Creature.flags)
   flg2=engine.peek(vector:getval(indx),ptr_Creature.flags)
   --print("how high?")
   --entry=io.stdin:read()
   --Crepos=engine.peek(vector:getval(0),ptr_Creature.x)+entx
   move=engine.peek(vector:getval(0),ptr_Creature.z)
   --print("W and E")
   --entry=io.stdin:read()
   move2=engine.peek(vector:getval(0),ptr_Creature.x)
   --print("N and S")
   --entry=io.stdin:read()
   move3=engine.peek(vector:getval(0),ptr_Creature.y)
   repeat
   engine.poke(vector:getval(indx),ptr_Creature.z,move)
   engine.poke(vector:getval(indx),ptr_Creature.x,entx)
   engine.poke(vector:getval(indx),ptr_Creature.y,enty)
   until flg:get(15) ==1 or flg2:get(1) ==1]]--
end
function rum_tools.Fortilate() -- make creature same civ as the area their in great for converting adventurers to citizens of a fort.
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
function selectciv()
  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)
     local crciv=engine.peek(off,ptr_Creature.civ)
     local curciv=engine.peek(vector:getval(0),ptr_Creature.civ)
     if curciv==crciv then
     --[[local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(1)==false then]]--  --if dead ...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end
function selectciv1() -- this grabs any who is apart of the first civ aka Civ number "1"
  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)
     local crciv=engine.peek(off,ptr_Creature.civ)
     --local curciv=engine.peek(vector:getval(0),ptr_Creature.civ)
     if crciv==1  then
     --[[local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(1)==false then]]--  --if dead ...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end
function rum_tools.returnfort() -- goes through all who are apart of your civ and flips off the is resident tag also has left over code form previous testing.
local trgs=selectciv()
for k,v in pairs(trgs) do
print("members:"..k)
local flags=engine.peek(v,ptr_Creature.flags)
flags:set(51,false) -- alive!
--flags:set(13,true)
--flags:set(12,false) no zombie
engine.poke(v,ptr_Creature.flags,flags)
end
local trgs=selectciv1()
for w,q in pairs(trgs) do
print("pets:"..w)
local flags=engine.peek(q,ptr_Creature.flags)
flags:set(26,true) -- alive!
--flags:set(13,true)
--flags:set(12,false) no zombie
engine.poke(q,ptr_Creature.flags,flags)
end
end

function rum_tools.ControlCiv() -- mass assemble of every one in your fort though they will be non companions if you fast travel
--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)
local trgs=selectciv()
for k,v in pairs(trgs) do
print("members:"..k)
trgid=engine.peek(vector:getval(0),ptr_Creature.ID) --get players ID
engine.peek(v,ptr_Creature.followID) -- get target creatures "now following ID"
engine.poke(v,ptr_Creature.followID,trgid) -- if not just write the players ID.
end
end

function rum_tools.ControlCiv2() -- this fixes the Fast travel issue and will make them permanently a member of your companions best for military heavy groups and armies.
--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)
leg=offsets.getEx("Legends")
legvec=engine.peek(leg,ptr_vector)
local trgs=selectciv()
for k,v in pairs(trgs) do
print("members:"..k)
trgid=engine.peek(vector:getval(0),ptr_Creature.ID) --get players ID
playerlegid=rum_tools.getlegendsid(vector:getval(0))
trglegid=rum_tools.getlegendsid(v)
trgid=engine.peek(vector:getval(0),ptr_Creature.ID) --get players ID
engine.poke(v,ptr_Creature.followID,trgid) -- if not just write the players ID.
engine.poke(legvec:getval(trglegid),ptr_legends2.follow,playerlegid)
end
end
function selecttame()
  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)
     local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(26)==true then  --if tame in anyway...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end

function rum_tools.tamilate() -- this function causes any tame critter to be turn into civ one or apart of your civ number I need to change this so that it just does the latter.
vector=engine.peek(offsets.getEx("AdvCreatureVec"),ptr_vector)
--id=GetCreatureAtPos(getxyz())
local trgs=selecttame()
for k,v in pairs(trgs) do
--print(string.format("Vec:%d cr:%d",vector:size(),id))
print("tamed" ..k)
--off=vector:getval(id)
crciv=engine.peek(v,ptr_Creature.civ)
curciv=engine.peek(vector:getval(0),ptr_Creature.civ)

if curciv==crciv then
print("unlocked-making locked")
engine.poke(v,ptr_Creature.civ,1)
flg=engine.peek(v,ptr_Creature.flags)
flg:set(51,false)
flg:set(26,false)
engine.poke(v,ptr_Creature.flags,flg)
else
print("locked- making unlocked")
engine.poke(v,ptr_Creature.civ,curciv)
flg=engine.peek(v,ptr_Creature.flags)
flg:set(51,false)
flg:set(19,false)
engine.poke(v,ptr_Creature.flags,flg)
end
end
end

function rum_tools.Convert() -- for changing the civ number of the companion to match the adventurer.
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff,ptr_vector)
--id=engine.peekd(offsets.getEx("CreaturePtr"))
--print(string.format("Vec:%d cr:%d",vector:size(),id))
local trgs=selectcomp()
for k,v in pairs(trgs) do
print("members:"..k)
off=v
crciv=engine.peek(off,ptr_Creature.civ)
curciv=engine.peek(vector:getval(0),ptr_Creature.civ)
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
end

function rum_tools.deadwarp()
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff,ptr_vector)
local tx,ty,tz
local trgs=selectdead()
for k,v in pairs(trgs) do
tx,ty,tz=getxyz()
print("Warp to coords:"..tx.." "..ty.." "..tz)
engine.poke(v,ptr_Creature.x,tx)
engine.poke(v,ptr_Creature.y,ty)
engine.poke(v,ptr_Creature.z,tz)
end
end

function rum_tools.zomwarp()
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff,ptr_vector)
local tx,ty,tz
local trgs=selectzombie()
for k,v in pairs(trgs) do
tx,ty,tz=getxyz()
print("Warp to coords:"..tx.." "..ty.." "..tz)
engine.poke(v,ptr_Creature.x,tx)
engine.poke(v,ptr_Creature.y,ty)
engine.poke(v,ptr_Creature.z,tz)
end
end
if not(FILE) then -- if not in script mode
rum_tools.menu:add("Toggle wutest",rum_tools.maketest)
rum_tools.menu:add("Change flag",rum_tools.changeflag)
rum_tools.menu:add("Ressurection Fix",rum_tools.ressurect)
--rum_tools.menu:add("?Toggle hostile?",rum_tools.hostilate)
rum_tools.menu:add("?control undead?",rum_tools.ControlZombie)
rum_tools.menu:add("control civ",rum_tools.ControlCiv)
rum_tools.menu:add("?control civ?",rum_tools.ControlCiv2)
rum_tools.menu:add("healer",rum_tools.ressurectcomp)
rum_tools.menu:add("Mass Ressurection",rum_tools.ressurectall)
rum_tools.menu:add("?Reveal ambush?",rum_tools.nosneak)
rum_tools.menu:add("?passive ghost time?",rum_tools.ghostin)
rum_tools.menu:add("?SkeltoZombies?",rum_tools.skeltozombie)
rum_tools.menu:add("?Zombiestoskel?",rum_tools.zombietoskel)
rum_tools.menu:add("Zombies fix",rum_tools.Zombieressurect)
rum_tools.menu:add("?necromancer?",rum_tools.Zombieressurectandcontrol)
rum_tools.menu:add("?harm?",rum_tools.Hurt)
rum_tools.menu:add("?returntofort?",rum_tools.returnfort)
rum_tools.menu:add("?carry?",rum_tools.carry)
rum_tools.menu:add("?carryex?",rum_tools.carryEX)
rum_tools.menu:add("?warp?",rum_tools.warp)
rum_tools.menu:add("?warp2wagon?",rum_tools.warptowag)
rum_tools.menu:add("?piggy backin?",rum_tools.compiggybackride)
rum_tools.menu:add("?group sneak?",rum_tools.compsneak)
rum_tools.menu:add("?bye civ?",rum_tools.nociv)
rum_tools.menu:add("change make member of civ",rum_tools.Fortilate)
rum_tools.menu:add("?make companions fortplayable?",rum_tools.fortcomps)
rum_tools.menu:add("?makefort playable?",rum_tools.fortdy)
rum_tools.menu:add("gut a friendly",rum_tools.butcher)
rum_tools.menu:add("gut a dead",rum_tools.butcherdead)
rum_tools.menu:add("?harm part?",rum_tools.Hurtselected)
rum_tools.menu:add("?werebronze?",rum_tools.lycanressurect)
rum_tools.menu:add("?Companionsracechange?",rum_tools.comprace)
rum_tools.menu:add("?Companionsracechange easier?",rum_tools.compraceez)
rum_tools.menu:add("lock up pets",rum_tools.tamilate)
rum_tools.menu:add("cleanupfloors",rum_tools.fixwarp)
rum_tools.menu:add("move zed",rum_tools.zomwarp)
rum_tools.menu:add("move souls",rum_tools.deadwarp)
rum_tools.menu:add("convert companions",rum_tools.Convert)
--rum_tools.menu:add("Swap to companion",rum_tools.change_adv2comp)
--rum_tools.menu:add("beastmaster",rum_tools.tamingcompanions)
rum_tools.menu:display()
--[[
choices={,{adv_tools.makeghost,"Toggle ghostliness"},{adv_tools.hostilate,"Toggle hostile"},{function () return end,"Quit"}} --make a table of function+string pairs
print("Select choice:")
for p,c in pairs(choices) do
print(p..")."..c[2]) -- print choices names
end
repeat
ans=tonumber(io.stdin:read())
if ans==nil or not(ans<=table.maxn(choices) and ans>0) then
print("incorrect choice")
end
until ans~=nil and (ans<=table.maxn(tdir) and ans>0)
choices[ans][1]() --run the choice
--]]
end
Spoiler: "old post" (click to show/hide)
Title: Re: DFusion - a lua based plugin system v1.2
Post by: darius on November 07, 2010, 09:31:47 am
<..> Though I Ponder the miss chance of communicating to animals using this,<..>
what do you mean? Talking to animals?
<..> that and finally seeing if one can have babies with adventurers in 31.xx.
Should not be so hard. (If Runesmith does not give that ability i could look into it.) AFAIK: you need ability to change a few flags for the retired adventurer and maybe his civ?
Edit: one problem though: you cannot embark on any city/village in 31.16
Title: Re: DFusion - a lua based plugin system v1.2
Post by: Kiktamo on November 07, 2010, 01:34:48 pm
True but there's an embark anywhere hex edit that can be done

http://www.bay12forums.com/smf/index.php?topic=21351.msg1655462#msg1655462
Title: Re: DFusion - a lua based plugin system v1.2
Post by: darius on November 07, 2010, 01:55:27 pm
Did not work (at least for me) in .16
Title: Re: DFusion - a lua based plugin system v1.2
Post by: Rumrusher on November 07, 2010, 02:35:48 pm
Code: [Select]
function rum_tools.fixwarp()
local mapoffset=offsets.getEx("WorldData")--0x131C128+offsets.base()
local x=engine.peek(mapoffset+24,DWORD)
local y=engine.peek(mapoffset+28,DWORD)
local z=engine.peek(mapoffset+32,DWORD)
--vec=engine.peek(mapoffset,ptr_vector)

print("Blocks loaded:"..x.." "..y.." "..z)
print("Select type:")
print("1. All (SLOW)")
print("2. range (x0 x1 y0 y1 z0 z1)")
print("3. One block around pointer")
print("anything else- quit")
q=io.stdin:read()
n2=tonumber(q)
if n2==nil then return end
if n2>3 or n2<1 then return end
local xs,xe,ys,ye,zs,ze
if n2==1 then
xs=0
xe=x-1
ys=0
ye=y-1
zs=0
ze=z-1
elseif n2==2 then
print("enter x0:")
xs=tonumber(io.stdin:read())
print("enter x1:")
xe=tonumber(io.stdin:read())
print("enter y0:")
ys=tonumber(io.stdin:read())
print("enter y1:")
ye=tonumber(io.stdin:read())
print("enter z0:")
zs=tonumber(io.stdin:read())
print("enter z1:")
ze=tonumber(io.stdin:read())
function clamp(t,vmin,vmax)
if t> vmax then return vmax end
if t< vmin then return vmin end
return t
end
xs=clamp(xs,0,x-1)
ys=clamp(ys,0,y-1)
zs=clamp(zs,0,z-1)
xe=clamp(xe,xs,x-1)
ye=clamp(ye,ys,y-1)
ze=clamp(ze,zs,z-1)
else
xs,ys,zs=getxyz()
xs=math.floor(xs/16)
ys=math.floor(ys/16)
xe=xs
ye=ys
ze=zs
end
local xblocks=engine.peek(mapoffset,DWORD)
local flg=bit.bnot(bit.lshift(1,3))
for xx=xs,xe do
local yblocks=engine.peek(xblocks+xx*4,DWORD)
for yy=ys,ye do
local zblocks=engine.peek(yblocks+yy*4,DWORD)
for zz=zs,ze do



local myblock=engine.peek(zblocks+zz*4,DWORD)
if myblock~=0 then
for i=0,255 do
local ff=engine.peek(myblock+0x67c+i*4,DWORD)
ff=bit.band(ff,flg) --set 14 flag to 1
engine.poke(myblock+0x67c+i*4,DWORD,ff)
end
end
end
print("Blocks done:"..xx.." "..yy)
end
end
end

Spoiler: old post (click to show/hide)
Title: Re: DFusion - a lua based plugin system v1.2
Post by: darius on November 07, 2010, 02:40:38 pm
As for companions: sometimes they are left behind if you travel(in local mode) very fast in one direction and they are fighting or sth... don't remember but it happened to me at least twice.
Edit: yay found an how to fix embark anywhere.
Edit2: but the map gen is busted and cities are non existant (including units)
Title: Re: DFusion - a lua based plugin system v1.2
Post by: Kiktamo on November 07, 2010, 10:29:23 pm
Yeah seems that an adventurer has to enter a town before it exists or whatever I don't know If the town continues to exist after the adventurer leaves though.
Title: Re: DFusion - a lua based plugin system v1.2
Post by: Hugo_The_Dwarf on November 08, 2010, 09:00:53 am
did some play testing with this program over the weekend, works very nice. I thought it would be like your old "FE" but I was surpised to see that using the Embark option seems to make the selected races that have [INTELLIGENT] allow you to change their labors and do normal hauling tasks until you use Friendship, very very nice. But Is there anyway to assign creatures other then dwarves to noble postions or military?
Title: Re: DFusion - a lua based plugin system v1.2
Post by: Rumrusher on November 08, 2010, 10:50:33 am
wait I remember people saying there no towns for dwarfs and goblins and the game pretty barren.
Is this true?
Title: Re: DFusion - a lua based plugin system v1.2
Post by: darius on November 08, 2010, 11:10:07 am
did some play testing with this program over the weekend, works very nice. I thought it would be like your old "FE" but I was surpised to see that using the Embark option seems to make the selected races that have [INTELLIGENT] allow you to change their labors and do normal hauling tasks until you use Friendship, very very nice. But Is there anyway to assign creatures other then dwarves to noble postions or military?
I suspect its the same as FE. You need to activate tools->give sentience before that creature comes to map (i.e. before embarking or before migrants come) that way they are added to some super secret vector that allows them to be picked for positions and military (also growing up could also trigger this)
Title: Re: DFusion - a lua based plugin system v1.2
Post by: Rumrusher on November 08, 2010, 01:49:56 pm
hmm so one could slap this on before embarking into a human town on humans and they will be able to apply to said noble ranks?

also I wonder why the offset in the new one isn't a set of numbers like the last projects you had.

The last -f check seem to fail on CreatureGloss.
Title: Re: DFusion - a lua based plugin system v1.2
Post by: darius on November 09, 2010, 03:39:45 am
hmm so one could slap this on before embarking into a human town on humans and they will be able to apply to said noble ranks?

also I wonder why the offset in the new one isn't a set of numbers like the last projects you had.

The last -f check seem to fail on CreatureGloss.

Offsets now are in hex (it was in base 10 before) and also now it's possible to add script to find new offsets.
And i really need to add some sort of way to get DF version :/. Also is the site down? or is it just me?

EDIT: try new version with "-c" flag Rumrusher.
Title: Re: DFusion - a lua based plugin system v1.2
Post by: Rumrusher on November 09, 2010, 08:37:14 am
hmm so one could slap this on before embarking into a human town on humans and they will be able to apply to said noble ranks?

also I wonder why the offset in the new one isn't a set of numbers like the last projects you had.

The last -f check seem to fail on CreatureGloss.

Offsets now are in hex (it was in base 10 before) and also now it's possible to add script to find new offsets.
And i really need to add some sort of way to get DF version :/. Also is the site down? or is it just me?

EDIT: try new version with "-c" flag Rumrusher.
sweet thanks will try also could you add a profession changer? so that I can bypass the noble and children canceling the ability to join you.
oh good news I finally got a child to be brought in 31.xx the lass name is Rush Covensports and was born from normal human parents using the pet tag only. Sadly this lead to the father still not to be named.
Title: Re: DFusion - a lua based plugin system v1.3
Post by: Hugo_The_Dwarf on November 09, 2010, 08:45:09 am
getting version 1.3, so I will need to use "Give senientance to creature" in the tool menu then use the embark function? and then utimatly embark, to have them to be assigned to milita and noble? and would this also include them getting married and reproducing?
Title: Re: DFusion - a lua based plugin system v1.3
Post by: Rumrusher on November 09, 2010, 09:14:36 am
getting version 1.3, so I will need to use "Give senientance to creature" in the tool menu then use the embark function? and then utimatly embark, to have them to be assigned to milita and noble? and would this also include them getting married and reproducing?
from my progress all you need is the Pet tag on the creature for them to start breeding but expect no father's listed. though on the subject of the no towns.
I think the reason is that the protagonist from final fantasy 8 covers the whole town in his Emo gunbladeness so finding like finding a needle in a hay stack. I think using adventurers to map out the area would be a great idea if not the gunbladeness also blocking out land marks... yeah sucks but I do notice how stupid fast this (.13) version is compared to 10. it's like all wild life got wipe out for Cpu space.
Title: Re: DFusion - a lua based plugin system v1.3
Post by: Hugo_The_Dwarf on November 09, 2010, 09:28:58 am
At least I know how to breed my elves but I'd like them to be goblin fodder when they seige, and im still having trouble getting them set into the milita
Title: Re: DFusion - a lua based plugin system v1.3
Post by: Hugo_The_Dwarf on November 09, 2010, 12:09:24 pm
had some trouble with v1.3 the "Friendship" option seems to be broken unless it does not like it when a given creature has been given Sentiant, so I reverted back to 1.2 to see if I get the same problem. Still no luck with assigning noble status or milita but then again its probally a end-user fault (me that is)
Title: Re: DFusion - a lua based plugin system v1.3
Post by: darius on November 09, 2010, 01:21:10 pm
had some trouble with v1.3 the "Friendship" option seems to be broken unless it does not like it when a given creature has been given Sentiant, so I reverted back to 1.2 to see if I get the same problem. Still no luck with assigning noble status or milita but then again its probally a end-user fault (me that is)
Hmm can you say what happens exactly  in v1.3? And about nobles and militia seems i'm still missing something...

Oh and finally retired, embarked and found my adventurer. Now towns are way larger and its hard to say where exactly to embark.

Edit: oh i found a bug in friendship v1.3 :/
Edit2: and fixed it:
(http://imgur.com/L97Qq.jpg)

Miniguide to achieve this: start DF, select start new game, select dwarf fortress, Run DFusion in there: Embark+friendship+tools->Give sentience:TROLL (not sure if last one is needed) and embark where you want.
Title: Re: DFusion - a lua based plugin system v1.35
Post by: Hugo_The_Dwarf on November 10, 2010, 09:03:56 am
just downloaded 1.35 hopefully I don't mess up these simple steps of getting "friendship" to work as well as assigning milita and nobles

EDIT: Works very nicely I like this alot now I can play my multi cultural fortress
Title: Re: DFusion - a lua based plugin system v1.35
Post by: Hugo_The_Dwarf on November 11, 2010, 09:01:57 am
To use a race(s) (other then Dwarves) make sure you do not have the [PET] tag, as this will stop you from assigning labours (but not stop hauling) due to the "This creature is ready for slaughter (Y/N)" but you are still able to set them as soldiers and nobles, steps to follow:

Getting Started
--------------------------------------------------------------------------------------------
-Create New World (if you have one made already good)

-Start a new game in "Fortress Mode"

-Run DFusion
--Use "Embark" function (make sure you have edited the "races.txt" to your desire)
--Run DFusion again and use the "Friendship" function (the "races.txt" have to be edited as well)

-Now pick you place to embark and either use "Play Now" or "Custom" and enjoy.

---Optional (if a creature you have selected to come along is unintelligent use the "Tools" function in DFusion and in there use "Give Sentience" and type the creatures tag Ex. "TROLL")
--------------------------------------------------------------------------------------------

Now if you have no Idea on how Editing the "races.txt" files (there are three, one for "Embark", one for "Friendship", and one for "Migrants") in the DFusion folder open the "Plugins" folder there you should see a group of Folders three will be "Embark", "Friendship", and "Migrants". Inside these folders are the seperate "races.txt" but all three must be edited differently
 
Editing the Plugins (races.txt)
 --------------------------------------------------------------------------------------------
Embark (races.txt)
-for every creature tag you will get one of those creatures with you (ex. from original "races.txt")
 
DWARF
DWARF
DWARF
ELF
HUMAN
GOBLIN
TROLL
 
this will have you start with [3x DWARFs] [1x Elf] [1x HUMAN] [1xGOBLIN] and [1x TROLL] but you can have as many as you want, just make sure the creature tags have their own line (just to look nice and avoid confusion and probally errors). Now I copied the creature I wanted in the raws and added a "D" to the end of its tag due to "Friendship" covering this later.

********************************
Friendship (races.txt)
-You only need one of each creature tag that you want within your team of controlable creatures (ex. from original "races.txt")
 
DWARF
HUMAN
ELF
GOBLIN
TROLL
GREMLIN
ELEMENTMAN_IRON
 
Now these allow DFusion to find all creatures within the game and make them playable (in a sense, hostile creatures will still attack and act as normal, but due to them being "considered" your RACE they will demand burial. So not only when Goblins come to attack and you kill them all, but they will also be put in your coffins)
 
********************************
Migrants (races.txt)
-This file goes by a random pick so if you have only two creature tags (DWARF and HUMAN) it will be a coin toss to see what race a migrant will be. So adding a large amount of one creature tag makes it more common (as it has a higher chance of being picked randomly) here is a example from the original (races.txt)
 
HUMAN
DWARF
ELF
ELF
DWARF
DWARF
DWARF
GOBLIN
HUMAN
DWARF
ELF
ELF
DWARF
DWARF
DWARF
GOBLIN
TROLL
 
So imagin a huge wheel with 17 segments with a tag in each segment, when "Migrants Arive" this spins, and when it lands on DWARF you get a dwarf, then it spins again landing on what ever fate demands until all migrants have come.
  --------------------------------------------------------------------------------------------

Now to fully explain my above statement of copy-ing a creature is so that there is no way that creature is acually in the "World" and that you would never encounter it (thus allowing me to kills Elves but not bury them [because my elves are a different creature altho exacly the same.])
 
My Embark (races.txt)
 
GOLEM_IRON
GOLEM_IRON
GOLEM_IRON
GOLEM_IRON
GOLEM_IRON
GOLEM_IRON
GOLEM_IRON
GOLEM_IRON
GOLEM_STEEL
GOLEM_STEEL
DWARF
DWARF
DWARF
DWARF
DWARF
DWARF
DWARF
DWARF
DWARF
DWARF


My Friendship (races.txt)
 
DWARF
GOLEM_IRON
GOLEM_STEEL
HUMAN
 
My Migrants (races.txt)
 
DWARF
DWARF
DWARF
GOLEM_STEEL
DWARF
HUMAN
HUMAN
DWARF
DWARF
GOLEM_IRON
GOLEM_IRON
GOLEM_IRON
DWARF
DWARF
DWARF
HUMAN
DWARF
GOLEM_IRON
GOLEM_IRON
DWARF
GOLEM_STEEL
DWARF
DWARF
GOLEM_IRON
GOLEM_IRON
GOLEM_IRON
GOLEM_IRON
HUMAN
HUMAN
HUMAN
GOLEM_STEEL
 
and thats all I need
 
EDIT: if these instructions are a little hard to follow let me know and I will remedy this, and if you want I can add sections. I.E. TOOLS and CHANGE RACE
 
EDIT 2: proof-reading, added MIGRANTS, and  updated my (races.txt)
Title: Re: DFusion - a lua based plugin system v1.5
Post by: darius on November 13, 2010, 10:09:37 pm
Bumping because added adventurer swapper. Usage: tools->Change Adventurer, type in number you want to change in, do stuff, press enter to get back. Used for: stealing items from unsuspecting npc, starting chaos (attack npc with npc) and most importantly arming your friends.
Title: Re: DFusion - a lua based plugin system v1.5
Post by: Tarran on November 14, 2010, 12:06:57 am
Oooh, niiiceee. Thanks for making this.
Title: Re: DFusion - a lua based plugin system v1.5
Post by: Grax on November 14, 2010, 03:27:29 am
Do other races fall in strange moods?
Title: Re: DFusion - a lua based plugin system v1.5
Post by: Rumrusher on November 14, 2010, 03:31:46 am
Bumping because added adventurer swapper. Usage: tools->Change Adventurer, type in number you want to change in, do stuff, press enter to get back. Used for: stealing items from unsuspecting npc, starting chaos (attack npc with npc) and most importantly arming your friends.
No more Cage traps!
NO more Cage Traps!
oh god wait number? meh time to EXPLOIT!
dang I found out that walking a good mile away from the main character could lead to a crash.
good news is now we can control our companions, and equip them properly which means community adventure mode can be done with out killing or retiring a adventurer.


edit: there a proven way to stay the character you swap to when you travel. you have to boot up fusion again and type the name of the character again.

edit: oh don't sleep if you want to keep your character... unless you want to hike back to the last area and swap back.
Title: Re: DFusion - a lua based plugin system v1.5
Post by: darius on November 14, 2010, 07:51:14 am
Do other races fall in strange moods?

They do. Had a few troll artifacts.

Also would be very cool to change adventurer "permanently" (i.e. with travelling and quests...) but i think it depends on history entries and thats an uncharted territory.

Edit 3: also caves make a very good houses, till some demon comes and kicks you out. Killed 3 adventurers (+6 henchmen) already.
Title: Re: DFusion - a lua based plugin system v1.5
Post by: Rumrusher on November 14, 2010, 09:30:24 am
Do other races fall in strange moods?

They do. Had a few troll artifacts.

Also would be very cool to change adventurer "permanently" (i.e. with travelling and quests...) but i think it depends on history entries and thats an uncharted territory.

Edit 3: also caves make a very good houses, till some demon comes and kicks you out. Killed 3 adventurers (+6 henchmen) already.
darn thanks for the info on that I notice that you can input any number and become a unknown creature which save me from death during a bogeyman rush... sadly I was a child and a buzzard and both pretty got wrecked during the attacks.
oh I wonder is there a away to get a Travel anywhere? I'm getting sick of walking thirty miles away from a non-hostile fort I got a quest from.

that and it seems missing a aim attack doesn't provoke folks or punching them... or was this lady just have a enough tolerance for stupid people.

edit: oh snap I just got an idea! you can use companions as pack mules now!

edit: if your companions have companions those second tier companions will follow you as well.
I don't know if they will 'T'ravel yet but one could move entire town doing this.
Title: Re: DFusion - a lua based plugin system v1.5
Post by: Halconnen on November 15, 2010, 05:48:25 pm
Is there any chance that embark can be modified to let you select the specific caste of a creature you want along?
Title: Re: DFusion - a lua based plugin system v1.5
Post by: darius on November 15, 2010, 09:20:48 pm
Is there any chance that embark can be modified to let you select the specific caste of a creature you want along?
Will look into it, but no promises.

Also new version: now you can randomise migrants. Although i don't trust the rnd gen that i cooked up in assembly but it should be distributed nicely. So if you want to have a rare goblin just type a lot of "DWARF" and one "GOBLIN" into the races.txt. Have fun :)
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Ramiel. on November 15, 2010, 11:34:08 pm
This looks great, I can't wait to try it all out.  Just a few things, to make sure I have this correctly.
I personally don't care about mixed-race embarks / migrants - not opposed, just not too worried about it.  What I really want to do is take Elf/Goblin prisoners and make them citizens (slaves) of my fort - I can do that with tools->race changer, right?  (Actually, can't Runesmith do something like that?  Have it, but haven't used it yet).
If I do that, then I can use friendship to make them work, right?
Second, Tigermen.  If I read this right, I'll have to remove the [PET] tag to give them labors, but they can still be in the military without it?  I believe removing the tag means the Elves will stop bringing them tamed.  I assume I can wait for them to bring a breeding pair (or three), remove the [PET] tag from the save raws, then use friendship?
Even if not, still a great set of tools I plan to make good use of.
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Eagleon on November 16, 2010, 03:08:24 am
Not working for me in 17. I get
Code: [Select]
Invalid peek type
plugins/common.lua:101: attempt to index local 'vec' (a nil value)
for embark,
Code: [Select]
race num:0
Invalid peek type
plugins/common.lua:91: attempt to index local 'vec' (a nil value)
for friendship, and
Code: [Select]
Invalid peek type
plugins/common.lua:101: attempt to index local 'vec' (a nil value)
for migrants. Strangely, simple embark and embark anywhere work fine. I haven't tried change race or adventurer yet.

Trying -f, I get
Code: [Select]
Searching offsets:
Offset "CreatureGloss" Invalid peek type
terminate called after throwing an instance of 'lua::runtime_error'
  what():  offsets.lua:37: attempt to index local 'vec' (a nil value)
which I assume is the same thing Rumrusher had, but -c does nothing for me.

Am I missing something? :P
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Rumrusher on November 16, 2010, 05:03:49 am
oh I got it to work perfectly for me in .17
just that I had the Windows version.
the -c is for versions before .13
which makes it playable for 10 which I was using before I found out how to breed adventurers and sentient folk using the pet tag.
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Eagleon on November 16, 2010, 05:07:46 am
This is the windows version I'm having issues with. Thinking about it, maybe it has issues with the SDL version. Will try that now.
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Rumrusher on November 16, 2010, 05:10:32 am
This is the windows version I'm having issues with. Thinking about it, maybe it has issues with the SDL version. Will try that now.
have you try going to CMD and getting the file there using the -F function?
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Eagleon on November 16, 2010, 05:16:40 am
Yes, of course. Which version are you using, SDL or Legacy? And which version of DFusion? The newest? Trying to track down where the difference is.
Title: Re: DFusion - a lua based plugin system v1.6
Post by: darius on November 16, 2010, 06:32:51 am
Yes, of course. Which version are you using, SDL or Legacy? And which version of DFusion? The newest? Trying to track down where the difference is.
can you paste what is printed in the beginning when you run it with "-f". And the dfusion is designed to work best with newest DF SDL version.

This looks great, I can't wait to try it all out.  Just a few things, to make sure I have this correctly.
I personally don't care about mixed-race embarks / migrants - not opposed, just not too worried about it.  What I really want to do is take Elf/Goblin prisoners and make them citizens (slaves) of my fort - I can do that with tools->race changer, right?  (Actually, can't Runesmith do something like that?  Have it, but haven't used it yet).
If I do that, then I can use friendship to make them work, right?
Second, Tigermen.  If I read this right, I'll have to remove the [PET] tag to give them labors, but they can still be in the military without it?  I believe removing the tag means the Elves will stop bringing them tamed.  I assume I can wait for them to bring a breeding pair (or three), remove the [PET] tag from the save raws, then use friendship?
Even if not, still a great set of tools I plan to make good use of.
Hmm not sure about slaves. The runesmith does have the ability to change creatures civ (though its not hard to make a tool or small lua script for dfusion) and idk if it has the ability to change flags (from invader to friendly) but the part that i have no idea is military and nobles. Oh and usually you don't need to remove [PET] tag for it to work. If you have a large running fort i suggest backing up and just experimenting.

EDIT:I and also i heard traps were bugged with 31.17?
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Rumrusher on November 16, 2010, 08:22:43 am
Speaking on jobs I should see if my hunch "that designations would work out side of fort mode."
would really work.
The materials I would need is a auto designator like auto fort and a bunch of adventurer mode reactions that on teach new skills.
If I prove successful this may be the next breakthrough than lighting your self on fire to become immune to magma.

edit:wait someone updated Tweak for .17 so now I can simply carve a hole in the ground... and properly install buildings like cages or statues.
sadly I can't figure out cage traps...
maybe it's a mix of mechanism or a type of tile that needs a cage.


Title: Re: DFusion - a lua based plugin system v1.6
Post by: Ramiel. on November 16, 2010, 02:06:05 pm
Well, I started a new fort in a Savage Tropical biome, and by mid-summer had caught and tamed a few Tigermen.  I removed the PET tag from the raws (think I'll try putting it back in later) and used friendship - they can be assigned labors now, but as far as I can tell they won't actually do any of them.  Tried to get them to mine - nothing.  Tried to smooth stone - nothing.  Tried to get them to just haul stuff around - still nothing.  I used Runesmith and changed their Civilization value to the same as my dwarves, then later removed the tame tag.  No luck.  I'm not much of a modder or programmer (yet), so I don't know what I should try next; just though I'd report on my actions.
I also tried using the Give Sentience tool at one point, but I think it crashed or something.  Not too sure what happened there.  Later: I just tried again, and after typing the token name, the program just sits there doing nothing.  Have to ctrl-c to get out of it.

Now I need to wait for goblins to attack, and see what I can do with them.

Also, I'm running 31.16 for now.  I wait for most/all of the utilities to update before changing versions.
Title: Re: DFusion - a lua based plugin system v1.6
Post by: darius on November 16, 2010, 02:49:50 pm
Well, I started a new fort in a Savage Tropical biome, and by mid-summer had caught and tamed a few Tigermen.  I removed the PET tag from the raws (think I'll try putting it back in later) and used friendship - they can be assigned labors now, but as far as I can tell they won't actually do any of them.  Tried to get them to mine - nothing.  Tried to smooth stone - nothing.  Tried to get them to just haul stuff around - still nothing.  I used Runesmith and changed their Civilization value to the same as my dwarves, then later removed the tame tag.  No luck.  I'm not much of a modder or programmer (yet), so I don't know what I should try next; just though I'd report on my actions.
I also tried using the Give Sentience tool at one point, but I think it crashed or something.  Not too sure what happened there.  Later: I just tried again, and after typing the token name, the program just sits there doing nothing.  Have to ctrl-c to get out of it.

Now I need to wait for goblins to attack, and see what I can do with them.

Also, I'm running 31.16 for now.  I wait for most/all of the utilities to update before changing versions.
Did you add tigerman to the races.txt in plugins\friendship ?


Also new offsets if you are afraid or sth to run with "-f" for 31.18:
Code: [Select]
CreatureGloss : 0x12e5370
CreaturePtr : 0xacf848
CreatureVec : 0x12df5a0
CurrentRace : 0x10cdaf0
StartDwarfs : 0x4f87e2
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Ramiel. on November 16, 2010, 04:50:41 pm
Yes, I did that before anything else.  Don't think they would have had labors enabled otherwise.
And in case anyone asks, yes, I spelled it Tigerman like in the raws, not Tigermen.
Title: Re: DFusion - a lua based plugin system v1.6
Post by: darius on November 16, 2010, 06:36:50 pm
Yes, I did that before anything else.  Don't think they would have had labors enabled otherwise.
And in case anyone asks, yes, I spelled it Tigerman like in the raws, not Tigermen.
Can you upload a save? I happened to me before with dragon (thought maybe megabeastness made him lazy) but maybe there is something else.
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Eagleon on November 16, 2010, 06:59:44 pm
Code: [Select]
H:\df_31_17_win>dffusion -f
lua working ok!
Running lua file:common.lua
Searching offsets:
Offset "CreatureGloss" Invalid peek type
terminate called after throwing an instance of 'lua::runtime_error'
  what():  offsets.lua:37: attempt to index local 'vec' (a nil value)

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
I don't suppose you're using .net? I've had issues with .net on my install since forever. Not always, but enough for it to be a possibility, and that termination message looks awfully familiar...

Trying it with the new version soon, just have to generate a world.
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Ramiel. on November 16, 2010, 07:30:11 pm
Sure, no problem.  Never done that before - just upload the region folder from the save folder, right?
http://www.mediafire.com/?6yr2waje2jmm9sx

I added the [PET] tag back onto them, and they lost the ability to work again, replaced by the 'cant work; slaughter Y/N' stuff.  Ran friendship again just to be sure, and it gave an error.  Closed up, re-deleted the [PET] tag, and when I reloaded labors were enabled again.
Maybe it has something to do with the fact they don't have names?  I heard Tame Tigerman cubs are born named, going to wait for a few to be born and see what I can do with them.  On an unrelated note, what tag in the raws says how long it takes a species kids to grow up?  I can't find it, and that'd make testing quite a bit easier.

For the record, the only utilities I've used on this save/world are DFusion, Runesmith, and DT.  Only mods/additions are the display case, NoExotics, and an extra descriptor (Cacame).
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Eagleon on November 16, 2010, 09:05:47 pm
Getting the same issue with new version, even with the new offsets you posted :( Really want to try the migrant changer, oh well
Title: Re: DFusion - a lua based plugin system v1.6
Post by: darius on November 17, 2010, 03:12:02 am
Getting the same issue with new version, even with the new offsets you posted :( Really want to try the migrant changer, oh well

Oh damn. -.- seems that my there was a real big misunderstandment between me and your OS. All other os'es load patterns.lua first and then common.lua yours skips patterns.lua? or loads it too late?
Oh and there is no net even close to my programs ( bad memories)
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Rumrusher on November 17, 2010, 03:36:41 am
some how sleeping as a body swap character in the same tile makes your player character stats Jump around.
first time I done that my bronze had 230 when he woke up but when I done it the second time it jump up to 1626 from the normal ~400 speed range. oh and some how flooded the lower levels of my lair/fort.
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Eagleon on November 17, 2010, 03:37:18 am
Speaking of patterns.lua...
Quote
H:\deons genesis 3.18 ASCII\deons genesis 3.18 ASCII>dffusion
lua working ok!
Running lua file:common.lua
Found plugins:
1).patterns.lua
2).tools
3).simple_embark
4).migrants
5).friendship
6).embark
1
launching patterns.lua...
cannot open plugins/patterns.lua/plugin.lua: No such file or directory
H:\deons genesis 3.18 ASCII\deons genesis 3.18 ASCII>
Looking at this more closely... H:\ is an ext3 volume, managed through ext2 volume manager. Apparently it's not liking how directories can be stored on such, because it's seeing patterns.lua as one, which is crazy. I don't even know what's going on here - I'd have to look at the methods you're using for file retrieval. In any case, copying it to my windows partition makes everything peachy.

Patching in a different file retrieval method might work to solve this, but then it might break things completely, so I wouldn't bother unless you're curious about what's going on (I know I am, especially because it might indicate buggy implementation for ext2 volume manager) - this is going to be a rare problem for most users. I use the ext3 partition because it has just under a terabyte more space than my windows partition, and because of a dumb mistake when I first built the filesystem for Ubuntu, I can't resize it without losing data, and I can't back things up because I don't have another drive.

TLDR: I'll just move something off of C:\ to make room for DF :)
Title: Re: DFusion - a lua based plugin system v1.6
Post by: darius on November 17, 2010, 03:43:10 am
<...>
TLDR: I'll just move something off of C:\ to make room for DF :)

I think that something invisible could be in the ending of patterns.lua, cause if you look into init.lua you'll see that it matches the end of files (or directories) with ".lua" and runs them and then removes from the table. (as ext3 supports more letters then ntfs e.g. i had a folder created from ubuntu that was not accessible from win just because it had "?" :D )

Sure, no problem.  Never done that before - just upload the region folder from the save folder, right?
http://www.mediafire.com/?6yr2waje2jmm9sx
<...>

I just tested the save. Just as run friendship the tigermen run to engrave. Maybe that error is to blame?
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Kaelem Gaen on November 21, 2010, 01:03:56 pm
I'm running this with .18 but I can't seem to get the  adventurer changer to work,  how do I do that exactly I get no number and typing in a name doesn't effect anything.
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Rumrusher on November 21, 2010, 03:54:44 pm
I'm running this with .18 but I can't seem to get the  adventurer changer to work,  how do I do that exactly I get no number and typing in a name doesn't effect anything.
well if you type any number you could swap you to someone unless you try that and nothing happens.
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Darkdwarf14 on November 21, 2010, 04:56:10 pm
Where do you put "-f" to update the offset?
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Kaelem Gaen on November 21, 2010, 05:29:33 pm
well if you type any number you could swap you to someone unless you try that and nothing happens.

That's what I meant, I typed a number hit enter, and nothing happened, and I can't get -f to work either (It fails on Creature Gloss)  I assume the adventure changing issue was because of the Offset labeld "Adv" something or other... anyone have that offset for .18?
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Rumrusher on November 21, 2010, 06:18:09 pm
well if you type any number you could swap you to someone unless you try that and nothing happens.

That's what I meant, I typed a number hit enter, and nothing happened, and I can't get -f to work either (It fails on Creature Gloss)  I assume the adventure changing issue was because of the Offset labeld "Adv" something or other... anyone have that offset for .18?
just checked the .18 version and OH my same problem. looks like DFusion needs a .18 update.
shame to
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Tarran on November 21, 2010, 06:32:31 pm
and I can't get -f to work either (It fails on Creature Gloss)  I assume the adventure changing issue was because of the Offset labeld "Adv" something or other... anyone have that offset for .18?
The reason it's failing at Creature Gloss is because you're running -f at the title screen. That won't work, you're supposed to do it in-game in either adventure mode or fortress mode. Anyway, try the offsets darius provided.

Code: [Select]
CreatureGloss : 0x12e5370
CreaturePtr : 0xacf848
CreatureVec : 0x12df5a0
CurrentRace : 0x10cdaf0
StartDwarfs : 0x4f87e2

just checked the .18 version and OH my same problem. looks like DFusion needs a .18 update.
shame to
That's strange, it works for me.

Title: Re: DFusion - a lua based plugin system v1.6
Post by: Kaelem Gaen on November 21, 2010, 06:44:30 pm
I have those already,  but like I said I still can't get adventurer offset (Which I assume is required for the Body-swap to arm companions)
Title: Re: DFusion - a lua based plugin system v1.6
Post by: darius on November 21, 2010, 06:57:43 pm
It had a .18 update...
First "-f" goes into commandline (win+r, cmd, cd to path, dfusion -f) second this needs to be done when df is in game (or at least in choose embark location).
Third the adv mode change is bugged. (Gets the wrong address just noticed it myself) Have it fixed but need to fix few other things...
Quick fix would be:
Spoiler (click to show/hide)
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Kaelem Gaen on November 21, 2010, 06:59:47 pm
So -f doesn't work when playing Adventure Mode?  (I was getting the creature gloss failure while running DfFusion -f with an adventurer loaded up.)

Okay time to go add those lines, thank you Darius

edit: Add the entire line? or just add the "break" after the line?
Title: Re: DFusion - a lua based plugin system v1.6
Post by: darius on November 21, 2010, 07:05:56 pm
So -f doesn't work when playing Adventure Mode?  (I was getting the creature gloss failure while running DfFusion -f with an adventurer loaded up.)

Okay time to go add those lines, thank you Darius

edit: Add the entire line? or just add the "break" after the line?
just break
Oh and i am not sure about "-f" in adv mode.
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Tarran on November 21, 2010, 07:11:26 pm
Oh and i am not sure about "-f" in adv mode.
It does work. Just tested it.
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Kaelem Gaen on November 21, 2010, 07:24:36 pm
It does work. Just tested it.

You playing modded or vanilla?

Also, probably something that I should also have asked prior, does DfFusion still work if it's in a different directory than DF itself? or do I need to toss it in with DF.exe being in the folder one-up from DfFusion (like how SoundSense worked/works)
Title: Re: DFusion - a lua based plugin system v1.6
Post by: darius on November 21, 2010, 07:30:37 pm
Hmm theoretically modded could ruin the "-f" to be precise creature_gloss lookup. It depends that first creature is TOAD.
Just paste this into offsets.txt in case of modded .18 (SDL)
Code: [Select]
CreatureGloss : 0x12e5370
CreaturePtr : 0xacf848
CreatureVec : 0x12df5a0
CurrentRace : 0x10cdaf0
StartDwarfs : 0x4f87e2
and do not run the "-f" as it will fail and delete good values.
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Tarran on November 21, 2010, 07:47:21 pm
It was modded, Deon's Genesis mod. I got the values without any problems.

I just tested vanilla now as a human and, huh, it doesn't get Creature Gloss in Adventure mode. Then I tried it again as a dwarf and it worked. That's odd.
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Rumrusher on November 21, 2010, 08:27:24 pm
I after looking at the code for swapping I wonder in a "non-coder layman's" term way how adventurer swapping worked.
Does it boot out the original character and insert the name and number the creature playing?(if so then that would explain why traveling out{with a different body} would lead to a random character... the game must have a extra piece of code that searches for either the number/name of either the last character or the adventurer the game started with, but seems to fail at that so it goes and selects the closest one.).
 
also I only modded in Bronze Colossi and some reactions and all seem fine except for the adventurer Reactions. which seems to fail.
bummer.
Title: Re: DFusion - a lua based plugin system v1.6
Post by: darius on November 21, 2010, 09:05:22 pm
I after looking at the code for swapping I wonder in a "non-coder layman's" term way how adventurer swapping worked.
Does it boot out the original character and insert the name and number the creature playing?(if so then that would explain why traveling out{with a different body} would lead to a random character... the game must have a extra piece of code that searches for either the number/name of either the last character or the adventurer the game started with, but seems to fail at that so it goes and selects the closest one.).
 
also I only modded in Bronze Colossi and some reactions and all seem fine except for the adventurer Reactions. which seems to fail.
bummer.
"non-coder layman's" first do you know pointers if yes skip this:
Spoiler (click to show/hide)
My program just loads all the creatures vector (an array of creatures, or just list) but df keeps only pointers of them. I switch the first one with selected and voila: you have a different body, switch back and you have your own body again. I guess what happens if you leave with other creature is that df tries saving you, but your body has no "adventurer data" or "legends info" or something like that (todo try to posses a historical figure and leave) and then fails. Why it jumps around when you leave is a mystery to me...
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Rumrusher on November 22, 2010, 07:38:42 am
well that explains it.
the characters don't have historical/adventure data on them when traveled will cause the game to search for the nearest one who close to it, like a crundle or a demon underground.

also the time spent not as your adventurer would count that as him/her as retired and the days spent away would start the adventurer dodads and crafting addons to stuff which if one wants to go into crafting biz that's a sure fire way to do it.
sucks that all my utilities I think except for tweak don't work on .18

edit:oh and some how your companions will leave you if you stay to far gone in a different body weird too as the body swap list is all I had for finding folks in towns and that's not saying much when many tend to have same names.
 
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Kaelem Gaen on November 22, 2010, 12:08:31 pm
I saw someone mentioning -f only worked when used on a dwarven adventurer, that might also explain the problem I have with being unable to swap/equip my companions, the character I'm playing as is an Elf, and currently all my companions for them are the "Marsh Dwarf" Trader civ I modded in.
Title: Re: DFusion - a lua based plugin system v1.6
Post by: Rumrusher on November 23, 2010, 10:00:56 am
nah doesn't work.
I even updated the version from 1.5 to 1.6 and still doesn't work, and played as a dwarf.
edit: some how testing this in fort mode lead to access to adventure mode swapping.
but does it have to ask for a Race of char?
Title: Re: DFusion - a lua based plugin system v1.6
Post by: darius on November 24, 2010, 06:41:17 am
nah doesn't work.
I even updated the version from 1.5 to 1.6 and still doesn't work, and played as a dwarf.
edit: some how testing this in fort mode lead to access to adventure mode swapping.
but does it have to ask for a Race of char?
It should ask it only once (for every time it does not detect offset in offsets.txt) but due to a logical bug (program never really quits) it never saves the file. That's why you need to ask for race every time.

There. Should be fixed+ scripts (although i forgot to document how to use them :/ )
Title: Re: DFusion - a lua based plugin system v1.8
Post by: addictgamer on November 24, 2010, 04:28:27 pm
I tried running DFusion on both .17 and .18 (SDL).
Embark anywhere works fine on both.
But when I try to run Embark, I get this:
Quote
plugins/embark/plugin.lua:9: bad argument #1 to 'pairs' (table expected, got function)
So...How do I get it working?

Thanks in advance!
Title: Re: DFusion - a lua based plugin system v1.9
Post by: darius on November 24, 2010, 04:47:28 pm
My bad. Should be fixed now.
Title: Re: DFusion - a lua based plugin system v1.9
Post by: Hugo_The_Dwarf on November 24, 2010, 10:20:16 pm
anyway to make a plugin or tool that will allow you to replace missing bodyparts (or ones still there) for a certain creature with the orginal tissue or something else (like a milita commmander with a clear diamond eye and a steel arm and leg), and a plugin or tool to add special tags to a certain creature (not race) so say you have the only flying fire breathing cat in the world. Also I updated my guide

EDIT: or a HEAL ALL tool
Title: Re: DFusion - a lua based plugin system v1.9
Post by: Rumrusher on November 25, 2010, 01:22:34 am
I wonder do scripts work with adventurer swap?
If so then maybe there a way to write a script that plays everytime I travel.
Title: Re: DFusion - a lua based plugin system v1.9
Post by: darius on November 25, 2010, 02:38:27 am
no, currently scripts have no way to trigger. This is only usefull when you need more then one command.

anyway to make a plugin or tool that will allow you to replace missing bodyparts (or ones still there) for a certain creature with the orginal tissue or something else (like a milita commmander with a clear diamond eye and a steel arm and leg), and a plugin or tool to add special tags to a certain creature (not race) so say you have the only flying fire breathing cat in the world. Also I updated my guide

EDIT: or a HEAL ALL tool
Damn that sounds dwarven. Although not sure how the first part could work (are there any similar already in game workings?) but the second part could be doable.
Title: Re: DFusion - a lua based plugin system v1.9
Post by: Hugo_The_Dwarf on November 25, 2010, 09:17:12 pm
no, currently scripts have no way to trigger. This is only usefull when you need more then one command.

anyway to make a plugin or tool that will allow you to replace missing bodyparts (or ones still there) for a certain creature with the orginal tissue or something else (like a milita commmander with a clear diamond eye and a steel arm and leg), and a plugin or tool to add special tags to a certain creature (not race) so say you have the only flying fire breathing cat in the world. Also I updated my guide

EDIT: or a HEAL ALL tool
Damn that sounds dwarven. Although not sure how the first part could work (are there any similar already in game workings?) but the second part could be doable.


I like this "doable" heal all (that is a part of your civ don't need maimed elves getting healed)
Title: Re: DFusion - a lua based plugin system v1.9
Post by: Shinziril on November 25, 2010, 10:04:10 pm
Excuse me, but how do you get the adventurer swap tool to work?  It asks me for my character's race, and refuses to believe that "human" is a valid answer (instead giving me the line "incorrect race" over and over again, with absolutely no indication of what is the correct answer).  My adventurer is human, of course.

Okay, it had to be in all caps.  Unfortunately, swapping now causes the game to crash as soon as I attempt to move.  The entire view screen goes black as well, although the rest of the interface does not.  Any suggestions?
Title: Re: DFusion - a lua based plugin system v1.9
Post by: Rumrusher on November 26, 2010, 12:19:04 am
Excuse me, but how do you get the adventurer swap tool to work?  It asks me for my character's race, and refuses to believe that "human" is a valid answer (instead giving me the line "incorrect race" over and over again, with absolutely no indication of what is the correct answer).  My adventurer is human, of course.

Okay, it had to be in all caps.  Unfortunately, swapping now causes the game to crash as soon as I attempt to move.  The entire view screen goes black as well, although the rest of the interface does not.  Any suggestions?
let me guess you try to travel using a companion? oh and if the screen goes black(with no sudden close on DF then) try mashing the space bar and movement keys awhile the game needs to search and zoom over to the creature you swap.
Title: Re: DFusion - a lua based plugin system v1.9
Post by: Kaelem Gaen on November 26, 2010, 12:42:52 am
Swapping works  (besides the crash when it jumps to a creature not revealed), though it doesn't seem to pick up custom races,  anyone get this to work with a swap with alternate character races, (Like Genesis with all it's non-van creatures)   I can't seem to get it to switch to a Marsh Dwarf (City-based trader dwarves I made.)

It's kinda weird, it shows the name of said dwarf , in this case cilub, but when I jump to that name it puts me to the nearest human companion (Again the dwarf is from the Marsh dwarf entity I added)
Title: Re: DFusion - a lua based plugin system v1.9
Post by: HermitDwarf on November 26, 2010, 02:32:57 am
The listing for which body you're switching is off. It won't show animals or anything, but you can type in more numbers than the ones listed and it'll move you. Sometimes with unexpected results (crash).
Title: Re: DFusion - a lua based plugin system v1.9
Post by: Rumrusher on November 26, 2010, 02:49:07 pm
Swapping works  (besides the crash when it jumps to a creature not revealed), though it doesn't seem to pick up custom races,  anyone get this to work with a swap with alternate character races, (Like Genesis with all it's non-van creatures)   I can't seem to get it to switch to a Marsh Dwarf (City-based trader dwarves I made.)

It's kinda weird, it shows the name of said dwarf , in this case cilub, but when I jump to that name it puts me to the nearest human companion (Again the dwarf is from the Marsh dwarf entity I added)
man I just notice the crashes too.
shame how the older version doesn't even have that.(only crashes where caused by doing something in DF than DFusion)
Title: Re: DFusion - a lua based plugin system v1.9
Post by: Shinziril on November 26, 2010, 03:19:06 pm
let me guess you try to travel using a companion? oh and if the screen goes black(with no sudden close on DF then) try mashing the space bar and movement keys awhile the game needs to search and zoom over to the creature you swap.

I did NOT attempt to [T]ravel while swapped, as I had read the notifications that that could cause "bad things".  The other reason is that attempting to [T]ravel while swapped would require the game to not crash instantly. 

Hitting the space bar or the period key or any of the movement keys while the screen is black ALSO caused the game to crash instantly.  The crash seems highly reminiscent of the crash caused when swapping to an unrevealed creature (as typing a number that did not appear on the list of available swap-names caused it to swap to a character with a different speed value than the first swap, the screen went black in the same manner, and the game promptly crashed instantly). 
Title: Re: DFusion - a lua based plugin system v1.9
Post by: darius on November 26, 2010, 03:31:56 pm
damn it... I know its because i change two vectors. But not sure which one is the right one. I it would be great help if some one would test it with first and second vector. I have no time for it now. (see plugins\tools\plugin.lua in function "tools.change_adv")
Title: Re: DFusion - a lua based plugin system v1.9
Post by: Shinziril on November 26, 2010, 04:12:51 pm
I GOT IT TO WORK!

The creature I wanted to switch to (my companion) was listed as "1" on the list of available creatures (the character I was currently playing as was listed as "0").  Typing in "9" caused it to switch to my companion properly. 

EDIT: Ehehehehe . . .  this can be a little erratic.  Trying to swap to various numbers (including the number of my companion, and the number of my companion+8) while on the site of a lair did *not* result in crashes, impressively, but instead transplanted my soul into random creatures inhabiting the cave systems below me. 

DOUBLE EDIT: Okay, it seems the problem is that the name of the creature you are supposedly are going to swap to and the creature the program actually swaps you to are not properly correlated with one another.  At the site of the lair, the list of swap targets is 1:bemta (me), 2:sapa (my companion), and 0:zakosp (the night creature we just killed).  Typing in "0" or "zakosp" swaps me to myself (no visible effect; this is consistent with what I had observed earlier- 0 is "yourself").  Typing in "1" or "bemta" swaps me to the deceased night creature.  Typing in "2" or "sapa" swaps me to a monitor lizard fiend in Hell.  Note that these are all reproducible; I can swap back without causing a crash, and repeating the input swaps me to the same target as previously.  The fact that it is noticing the night creature as a listed swap target is also a little odd, as the selected race is "human", but I suppose it is technically a transformed human?  I don't know. 

Typing in "3" swapped me to a draltha in the caves, however, swapping back failed to work properly.  When I savescummed and tried it again, it swapped me to a monitor lizard fiend in Hell (not the same one as when swapping to 2, but it was standing right next to it).  4 and 5 swapped me to further demons in that same cluster.  I think distance might factor into this somehow. 

TRIPLE EDIT: Aaaaand "9" swaps me to my companion properly, despite the fact that his displayed target number in the program is different than the last time that worked.  What the hell.
Title: Re: DFusion - a lua based plugin system v1.9
Post by: Rumrusher on November 26, 2010, 06:22:03 pm
yeah.. 1.8 and up seems to have a wonky list.
I'm using 1.6-7 or before the scripts where added. and those on  df.18 doesn't randomly toss you into a different body.

Also I found out that you can find where a demon fort is with this if you find your list of humans/dwarf/you past the 4 hundreds.
Title: Re: DFusion - a lua based plugin system v1.95
Post by: darius on November 26, 2010, 07:24:30 pm
K tried fixing it... now it also prints ALL creatures (formating sux but <some very important excuse>) and their race number (that gives general idea about what are they). I'm not sure if the fix works for ALL df version now but it does on 31.18.
Title: Re: DFusion - a lua based plugin system v1.95
Post by: Shinziril on November 28, 2010, 05:27:01 pm
New version works, although in certain areas it can print several hundred creatures, resulting in the relevant ones running off the top of the list (presumably due to catching a larger-than-average portion of cavern critters or demons or some such).  Not really a huge problem; you just need to move somewhere else where this doesn't happen. 

The armor I've outfitted my single NPC companion has allowed him to last long enough to become a Legendary Spearman.  He's pretty damn badass at this point; he has seventy-odd personal kills at this point, and is perfectly capable of holding his own against several lesser-skilled bandits and murdering them all without any help.  He's even started to one-shot people, "BOOM headshot!" style.  Plus, he has a lovely collection of scars from back before I got him armor (amazingly none of which caused major disability). 

Adventurer Swap definitely makes NPC allies vastly more viable (particularly if they drop an item due to an injury that heals, like when he dropped his spear due to a broken wrist).  Now I just need to find a beach somewhere that doesn't freeze (this entire continent seems pretty cold, unhelpfully) and get him to at least Adequate Swimmer so he won't die if he randomly falls in a murky pool again . . . had to savescum twice due to that so far >_>
Title: Re: DFusion - a lua based plugin system v1.95
Post by: Rumrusher on November 29, 2010, 03:36:31 pm
New version works, although in certain areas it can print several hundred creatures, resulting in the relevant ones running off the top of the list (presumably due to catching a larger-than-average portion of cavern critters or demons or some such).  Not really a huge problem; you just need to move somewhere else where this doesn't happen. 

The armor I've outfitted my single NPC companion has allowed him to last long enough to become a Legendary Spearman.  He's pretty damn badass at this point; he has seventy-odd personal kills at this point, and is perfectly capable of holding his own against several lesser-skilled bandits and murdering them all without any help.  He's even started to one-shot people, "BOOM headshot!" style.  Plus, he has a lovely collection of scars from back before I got him armor (amazingly none of which caused major disability). 

Adventurer Swap definitely makes NPC allies vastly more viable (particularly if they drop an item due to an injury that heals, like when he dropped his spear due to a broken wrist).  Now I just need to find a beach somewhere that doesn't freeze (this entire continent seems pretty cold, unhelpfully) and get him to at least Adequate Swimmer so he won't die if he randomly falls in a murky pool again . . . had to savescum twice due to that so far >_>
well with the swapping you could just make a reaction that trains swimming.
though I'm wonder is there a way DFusion can 'tame'/calm down/ befriend creatures? so that I could test if people can play as a Dungeon Master/ Demon Trainer and maintain a lair filled with monsters they can swap around and train and bring with?
Title: Re: DFusion - a lua based plugin system v2.0
Post by: darius on November 29, 2010, 07:34:46 pm
Just tried rumrusher's idea. Results are in: can make them follow temporarily that is till you finish traveling/sleep or e.g. save/load. Also it does not make them friendly. But its fun to make demon follow you and then travel to a castle where he kills puny humans. Updated program. Oh and also they hang around if you leave them somewhere.
Title: Re: DFusion - a lua based plugin system v2.0
Post by: Rumrusher on November 29, 2010, 09:15:15 pm
So before I test this, this means any friendly but won't agree to join characters will perma-join with you using this or will they revert? (either way this makes moving second tier companions possible).
I wonder if I could get a no ties adventurer to keep a fresh form hell demon by his/her side.
well this seems like a great test on bogeymen. Wait how many times one has to kill something before the game gives the creature a name, because seeing how fusion doesn't pick up profession/nick names this makes finding the one demon you control out of the 100 that live underground a pain.
Still will enjoy walking night creatures back to towns for massive slaughter or seeing if I can rent a stay in their homes.

edit:well I prove that swapping to said character will lead to your adventurer to zerk and kill it on sight.
sucks to be the zerba demon. now to test if normal folk can be effected as well... and next see if temp control of 2nd tier companions still follow 1st tier companions?

edit: found out if a companion(or I guess any one) recruits a companion it removes that companion from the adventurer's list of companions. so yeah I just learn how to dump companions in hovels now.
by having a high fame companion recruit another then swap to that one and recruit those I want to retire. Now all I need to do is find a place where I can dump these guys in with out coming back and finding them all dead from a demon attack or. lairs are death traps waiting to happen and hovels can lead to confusion.

fake edit: also having the creature follow the companion doesn't make it friends with other companions, case in point the poor pond grabber got shank by acharged and chewed on by one of my lady consort after I re-friend it it was shanked by a lord consort later.
the poor thing didn't even counterstrike or hit back.

edit: so to make terms for this
1st tier companions are ones you(the adventurer) can recruit
nth tier companions are the companions' companions who can't travel unlike 1st tier but will follow the their tier leader(2nd tiers are known to follow 1st tiers but 3rd tiers are after 2nd for following someone(2nd) who following a 1st tier)
___'s companions are 1st/nth tier companions that follow a non-companion (ei some body swapped creature who isn't apart of the adventurer's group.)
and finally Interns who are companions formed from the "make creature follow" command, who can travel with you but only once, and if a demon or wild creature will be attacked by other tier companions.
Also with the creature follow command one can make nth tier companions able to travel... I don't know the effects of removing someone from someone's group would do yet but this can lead to less painful long walks with large groups.

wait normal friendly folks seem to be fine when you save and load.
but I'm in the middle of testing tweak on a demon fort right now.
Title: Re: DFusion - a lua based plugin system v2.0
Post by: darius on November 30, 2010, 06:14:11 am
Um... interesting thing happened: the creature i left in a cave (human fisherman) "attacked" me when i was travelling (had a message you feel uneasy and he appeared standing next to me...)
Title: Re: DFusion - a lua based plugin system v2.0
Post by: Rumrusher on November 30, 2010, 01:52:48 pm
Um... interesting thing happened: the creature i left in a cave (human fisherman) "attacked" me when i was travelling (had a message you feel uneasy and he appeared standing next to me...)
yeah really weird too, you think you just mod the trait to have the "loves adventuring" and removes all blocks so you can ask them your self.
oh while moving some men (after dumping 2 children in the cave I went back and pick up a lady, a cook, and a consort) then some how from swapping back to my old body kogan teleported through the floor and the old spot the bronze was, weird.
Title: Re: DFusion - a lua based plugin system v2.0
Post by: latogato on December 01, 2010, 06:54:38 pm
DFusion does not works for me. My human adventurer with 4 party members standing on a road. DFusion is running but almost all the options gives an application error. The simple_embark does nothing, waiting until control-c.

DF version: 0.31.18 Legacy and SDL

The offsets.txt:
AdvCreatureVec : 0x12a12c4
CreatureGloss : 0x12e5370
CreaturePtr : 0xacf848
CreatureVec : 0x12df5a0
CurrentRace : 0x10cdaf0
StartDwarfs : 0x4f87e2

I wrote some extra lines at the end of the offsets.lua:
--print ("Base",offsets.base())
print ("StartDwarfs",offsets.get("StartDwarfs"))
print ("CreatureVec",offsets.get("CreatureVec"))
print ("CreaturePtr",offsets.get("CreaturePtr"))
print ("CreatureGloss",offsets.get("CreatureGloss"))
print ("CurrentRace",offsets.get("CurrentRace"))

It seems all the offsets are nil. The offsets.base() also give an application error, so i commented it out.

StartDwarfs     nil
CreatureVec     nil
CreaturePtr     nil
CreatureGloss   nil
CurrentRace     nil
lua working ok!
Running lua file:common.lua
Running lua file:patterns.lua
Found plugins:
1).embark
2).friendship
3).migrants
4).research
5).simple_embark
6).tools

I'm completely clueless, why the offsets are nil. :(
Title: Re: DFusion - a lua based plugin system v2.0
Post by: Rumrusher on December 01, 2010, 08:24:52 pm
yeah the new version as mention before won't work well with others except for .18 sdl

so have you tried -f?
Title: Re: DFusion - a lua based plugin system v2.0
Post by: darius on December 01, 2010, 09:22:52 pm
Hmm it does not seem to be as simple as running with "-f" maybe your Os is doing something bad? Have you tried running as an admin? offsets.base() should never fail (the most simplest function ever). Maybe something is corrupted? Rumrusher did you try v2.0?

Edit:And offsets are nil if they are not loaded yet. Offsets.lua defines how to find offsets because of that it still does not have offsets loaded. To see real addresses try pasting in init.lua just in the beginning.
Title: Re: DFusion - a lua based plugin system v2.0
Post by: latogato on December 02, 2010, 10:02:53 am
I looked again the error message and it's said exception C000001D happened.
Google said it's means an illegal instruction.
After that i started debugging the dfusion.exe
It's turned out the dfusion.exe using SSE2 instructions and my old cpu doesn't understand them. SSE2 was introduced with the Pentium 4.

Part of the code:
4298CE   MOV DWORD PTR [EBP-14],EAX
4298D1   MOVD XMM0,DWORD PTR [EBP-14]
4298D6   BYTE 66    <--- Oops, unknown instruction. Google said SSE2 instructions begin with 0x66.
4298D7   BYTE 0F    <--- 0F D6 means movq which is a SSE2 instruction.
4298D8   BYTE D6

It is a shock to me. :D I know my computer is old but until now i never had a problem with it... except some video card related problems.
Is there a hope for a non-SSE2 compiled dfusion.exe?
Some arguments for it:
- I'm sure i'm not the only one with that problem. Others just not persistent enough.
- DF seems not using SSE2, i have no problem with it.
- I want this mod! :)
Title: Re: DFusion - a lua based plugin system v2.0
Post by: darius on December 02, 2010, 11:57:00 am
Try one from this file (http://www.box.net/shared/66405v63ki). And write if any of them works. I hope that this is from my code not from lua lib or something... Oh and if it works pls tell which one. And i did not know that compiler puts SSE code into the exe i did not give it the flags to do it.
Title: Re: DFusion - a lua based plugin system v2.0
Post by: latogato on December 02, 2010, 01:57:14 pm
I think Lua binaries doesn't use SSE2 because they try to make them portable.

I tried the Dfusion.exes and all of them work fine! 8)
That's awesome, thank you! :D
Title: Re: DFusion - a lua based plugin system v2.0
Post by: darius on December 02, 2010, 02:12:52 pm
Great. It means that GCC implies that computers are not that old when compiling (it also implied that everyone is using 64bit at first :) )
Title: Re: DFusion - a lua based plugin system v2.0
Post by: Rumrusher on December 02, 2010, 08:07:02 pm
so darius did you ever try dumping minions into a abandon fort?
Title: Re: DFusion - a lua based plugin system v2.0
Post by: darius on December 02, 2010, 08:12:54 pm
No. I don't like abandoned forts because they litter items. I think if you embark on a lair it still litters them.
Title: Re: DFusion - a lua based plugin system v2.0
Post by: Rumrusher on December 02, 2010, 11:15:25 pm
though lairs do scatter your men around making a mess when creatures come and kill them.
oh I just remember that way back when using runesmith for companioning demons, I had to first get them to be the same(a) civ which removes the wild civ they keep. though I think it is better to slap the prisoner profession( and your civ) on them just to be sure.
maybe call it "the turn creature into slave" and have it next to the "make creature follow" for testing.
Title: Re: DFusion - a lua based plugin system v2.0
Post by: darius on December 03, 2010, 07:15:38 am
Well changing civ to mine on GCS did not work (it ate my companions). The main problem now is that not everything is saved when traveling (i think civ is not saved).
Title: Re: DFusion - a lua based plugin system v2.0
Post by: Rumrusher on December 03, 2010, 10:41:27 pm
oh darius for self modding Dfusion how would someone like me go through and make swapping/taming creatures just by using the cursor?
Title: Re: DFusion - a lua based plugin system v2.0
Post by: darius on December 04, 2010, 12:36:24 pm
oh darius for self modding Dfusion how would someone like me go through and make swapping/taming creatures just by using the cursor?
In adventure mode?
First you need to find pointer for x,y,z location of the pointer. It should be in one place (that is xxyyzz where one letter is one byte) after you know that load those coordinates (with engine.peekw(offset)) and compare to each creature's coordinates. I could write a tutorial/tool for that but maybe tomorrow because now i'm exhausted. Oh and usually you need some kind of memory hacking tool to find new offsets. (or just steal them from DFHack :) )
Title: Re: DFusion - a lua based plugin system v2.0
Post by: Rumrusher on December 09, 2010, 03:12:34 am
Here a suggestion I don't really need but would be fun to play around.
What if you could change the race of the character(though traveling might lead to wolves with human title turning into humans and humans with cat titles turning into cats and vice versa)?
Title: Re: DFusion - a lua based plugin system v2.1
Post by: darius on December 09, 2010, 08:01:45 am
Okay updated! Now adventurer tools have pointer based (that pointer that you get by looking or talking) targeting AND its heavily commented (thats closest i could get to tutorial...).
Here a suggestion I don't really need but would be fun to play around.
What if you could change the race of the character(though traveling might lead to wolves with human title turning into humans and humans with cat titles turning into cats and vice versa)?
I will try that. Although it might be possible to make a more permanent solution if ill find where DF keeps creatures while they are traveling ( i hope not in files...)
Edit: it worked... but very crashy. Changed before traveling and when landed it still was a dragon, but crashed soon after starting to fight (although it breathed fire)
Title: Re: DFusion - a lua based plugin system v2.1
Post by: Rumrusher on December 09, 2010, 09:22:04 am
Okay updated! Now adventurer tools have pointer based (that pointer that you get by looking or talking) targeting AND its heavily commented (thats closest i could get to tutorial...).
Here a suggestion I don't really need but would be fun to play around.
What if you could change the race of the character(though traveling might lead to wolves with human title turning into humans and humans with cat titles turning into cats and vice versa)?
I will try that. Although it might be possible to make a more permanent solution if ill find where DF keeps creatures while they are traveling ( i hope not in files...)
Edit: it worked... but very crashy. Changed before traveling and when landed it still was a dragon, but crashed soon after starting to fight (although it breathed fire)
I expect something on par of needing to save the game first before having the changes are permanent. I guess you help pave a small way to playing as proper night creatures and stealing folks for converting purposes. that and for roleplaying experiences.
Title: Re: DFusion - a lua based plugin system v2.1
Post by: darius on December 09, 2010, 11:07:44 am
If you want to try race changing:
Code: [Select]
function adv_tools.racechange()
--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+16,ptr_vector)
indx=GetCreatureAtPos(getxyz())
RaceTable=RaceTable or BuildNameTable() --slow.If loaded don't load again
print("Enter race name ALL CAPS!:")
repeat
entry=io.stdin:read() --get entry
id=RaceTable[entry] -- find race id
until id~=nil -- if not found repeat
engine.poke(vector:getval(indx),ptr_Creature.race,id)
end
insert this into adv_tools/plugin.lua (in the second line)
and replace
Code: [Select]
choices={{adv_tools.changeadv,"Change adventurer"},{adv_tools.MakeFollow,"Make creature follow"},{function () return end,"Quit"}} --make a table of function+string pairs
with
Code: [Select]
choices={{adv_tools.changeadv,"Change adventurer"},{adv_tools.MakeFollow,"Make creature follow"},{adv_tools.racechange,"Change race"},{function () return end,"Quit"}} --make a table of function+string pairs
But be warned: its quite buggy and will crash DF.
Title: Re: DFusion - a lua based plugin system v2.1
Post by: Rumrusher on December 09, 2010, 08:47:58 pm
well learn one thing you should not do with a changed creature...
don't look at their description.
also don't attack with them until body is fully changed... which I think is from saving the game... well time to see if this is true! it's true I got a human female turn salt banshee to use salt based attacks and kill a human spearman before dying from the mob rush. so I guess one could perma change into another race... but doing so kills any chance of seeing your descriptions.
Title: Re: DFusion - a lua based plugin system v2.1
Post by: Askot Bokbondeler on December 09, 2010, 09:33:36 pm
don't look at their description.

a creature so horrendous the mere description of it's aspect is enough to drive men insane!
Title: Re: DFusion - a lua based plugin system v2.1
Post by: darius on December 09, 2010, 09:45:59 pm
don't look at their description.

a creature so horrendous the mere description of it's aspect is enough to drive men insane!
also don't stand in the line of fire of friendly dragons (does not crash but melts ;) )
Title: Re: DFusion - a lua based plugin system v2.1
Post by: Rumrusher on December 09, 2010, 10:07:48 pm
don't look at their description.

a creature so horrendous the mere description of it's aspect is enough to drive men insane!
also don't stand in the line of fire of friendly dragons (does not crash but melts ;) )
STILL don't look into the description of a changed character... even if you saved and travel with them.
makes me wonder how Dwarf companion pull that one off as well.
Title: Re: DFusion - a lua based plugin system v2.1
Post by: Kobold Troubadour on December 10, 2010, 08:04:08 am
STILL don't look into the description of a changed character... even if you saved and travel with them.
So you can change your companion to a Colossus or Fiend but you're forbidden to look at them directly ever again? Medusa effect huh? So the Caravan arc will also give new hurdles to jump over...interesting...
Title: Re: DFusion - a lua based plugin system v2.1
Post by: Rumrusher on December 10, 2010, 07:05:14 pm
STILL don't look into the description of a changed character... even if you saved and travel with them.
So you can change your companion to a Colossus or Fiend but you're forbidden to look at them directly ever again? Medusa effect huh? So the Caravan arc will also give new hurdles to jump over...interesting...
well the game will turn to stone and crumble.
so far you should not travel as adventurer's companion(being someone's companion won't lead to this),
don't fight the creature who race has been changed unless you save the game after the change is done, don't 'L'ook 'D'irectly into the swap creature 'D'etails (don't know if this works in fort mode),
also build a abandon fort a small click from a lair (but not on top of it) for companion storage,
lairs are for items not people... until darius could find away to seal creatures in cages or figure out how to turn forts into lairs and towns this would be a good option.



edit: I figure out why we can't look at descriptions. the hack only changes the race and not the personal descriptions each race has. so if a blue eye human with blond hair gets turn into a rabbit then the human data can't cross over to the rabbit data due to the game searching for that type of description under the rabbit race leading to a crash. It could be fixed if someone adds in a Faux-detail in order to bypass the game need of a certain type of detail. now while I'm on it if changing race changes the creatures limbs if you save and reload what happens if said creature is wounded would this means we can heal team mates if we change them to their race?



edit: IT WORKS, that salt demon I had human limbs are still fine compared to her losing her left foot.
so one can heal companions/self if you change your race.
the thing is I don't know as of now if the demon form get's patch up or would that still lead to a missing leg.
here's to reviving dead folks and Zombism!

edit: Yes the limb grows back the limb grows back! All you have to do is to change creature race to something else travel change back then travel again! said human salt demon was fix of her missing foot problem.
Title: Re: DFusion - a lua based plugin system v2.1
Post by: darius on December 12, 2010, 08:03:15 am
Site research:
Found sitelist. Found site type (thus can change type of any and all sites). Unfortunately just changing the type of site is not enough to prevent item scatter.
Edit: Found flags... one for hidden three for caves n stuff one for hamlet ticks... none for "do not scatter shit around" :/
Title: Re: DFusion - a lua based plugin system v2.1
Post by: Rumrusher on December 14, 2010, 02:30:43 am
So these will make any land mass sleep friendly? Having a custom non town-hot spot I could park my men with out worry of them dying from a cave creature is awesome that and to retire there and start up another character is a nice bonus. I mean if I can figure out all the kinks from race changing healing then I could set up a hospital/ base of operation near a lair and go with that.
Hey does the fort tile spawn knights?

edit: jump on to working on a revive/zombify/ghost adv_tool so far I just copied and pasted the make creature follow tool(learn how to add in functions to the list with proper names) just that now I can't seem to get the peek to work. From checking the patterns file there a 'flag' command and a following ID but do I have to add in a "Ghost ID/flag" to the pattern's file or should the peek do that for me?
Title: Re: DFusion - a lua based plugin system v2.1
Post by: darius on December 14, 2010, 12:53:20 pm
well the flags are a bit special case. Creature flags take up 4 (or more) bytes and indvidual bits are flags
Code: [Select]
in memory:
here starts the flags
   v
xxxyyyy...
so getting a byte with peek will only get you a sum of flags. Getting individual flag is a bit different. I'll write the code for that soon.
Edit:
add this in patterns.lua at the top. This is a universal (changeable size) pattern for  flag manipulation.
Code: [Select]
ptt_dfflag={}
function ptt_dfflag.flip(self,num) --flip one bit in flags
local of=math.floor (num/8);

self[of]=bit.bxor(self[of],bit.lshift(1,num%8))
end

function ptt_dfflag.get(self,num) -- get one bit in flags
local of=math.floor (num/8);

if bit.band(self[of],bit.lshift(1,num%8))~=0 then
return 1
else
return 0
end
end
function ptt_dfflag.set(self,num,val) --set to on or off one bit in flags
if (self:get(num)~=val) then
self:flip(num)
end
end
function ptt_dfflag.new(size) -- create new flag pattern of size
local ret={}
for i=0,size-1 do
ret[i]={off=i,rtype=BYTE};
end
ret.flip=ptt_dfflag.flip
ret.get=ptt_dfflag.get
ret.set=ptt_dfflag.set
return ret;
end
then somewhere after "ptr_Creature={}" add
Code: [Select]
ptr_Creature.flags={off=224,rtype=ptt_dfflag.new(10)}-- not sure if its 10 or more...
Using this now becomes very simple if you have creature offset (with get creature at pos or similar):
Code: [Select]
myoff=offsets.getEx("AdvCreatureVec") -- first find out where "Adventurer creature vector" is
vector=engine.peek(myoff+16,ptr_vector) -- +16 is a little fix...
tval=vector:getval(0) -- get offset of player
flg=engine.peek(tval,ptr_Creature.flags) --get flags
flg:flip(76) -- 76 is ghostliness flag. Other flags (from older versions :1-> dead, 2->insane,3->artifact made,4->merchant and so on...)
engine.poke(tval,ptr_Creature.flags,flg) --save flags
Title: Re: DFusion - a lua based plugin system v2.1
Post by: Rumrusher on December 14, 2010, 01:41:05 pm
well the flags are a bit special case. Creature flags take up 4 (or more) bytes and indvidual bits are flags
Code: [Select]
in memory:
here starts the flags
   v
xxxyyyy...
so getting a byte with peek will only get you a sum of flags. Getting individual flag is a bit different. I'll write the code for that soon.
also I Almost understand what you did in the adv_tools from staring hard enough what I don't get is from realizing all of it goes back to pattens.lua and the creature section (which has a list of numbers and some with "(D Word)" next to it) from what I got from digging round common state these might mean 1 byte 2 byte and 3 byte, which leads to the biggest puzzle with this. Could I swap only the flags of a creature? That and could I find some way to force a pointer(or auto select the next body in line) in DF and allow the user to change to the nearest body around. the latter major hurdle is from not knowing if adding a number(with title to it so the program can connect) between the creature section in the pattern.lua will work and I can test to see which number has the right flag.

I also want to thank you for all of this I wouldn't be getting my hands slightly dirty if it wasn't for this.
Title: Re: DFusion - a lua based plugin system v2.1
Post by: darius on December 14, 2010, 02:12:03 pm
Yeah my on todo list is resume tutorial in patterns.lua and other undocumented stuff. Later still release all source code (maybe when engine does not change much...). As for patterns they are quite simple:

This system makes it possible to load anything without disturbing things you don't want to mess with. Simple example:
Code: [Select]
z=engine.peek(someoffset, ptt_vector)
--what this means is read data from someoffset using pattern ptt_vector. That in turn means:
--read someoffset+0 with size DWORD (4bytes) and save it to z.st (because ptt_vector.st={off=0,rtype=DWORD})
--and read someoffset+4 with size DWORD and save it to z.en (ptt_vector.en={off=4,rtype=DWORD})
Patterns can also have functions, those are left unchanged (and copied to end object).
Code: [Select]
function ptr_vector:size() -- the ':' means ptr_vector.size(self)
return (self.en-self.st)/engine.sizeof(self.type)
end
-- so this in turn makes z(loaded before) have function z:size()
-- if you make a lua helper function
function print_all(t)
for k,v in pairs(t) do
 print(tostring(k).."=>"..tostring(v))
end
end
--and use it:
print_all(z)
-- you should get everything what is in that object.
Also all code that does that sits in common.lua. See engine.peekpattern/pokepattern.
Edit: and why does hacking DF go so smooth when programing my own game is so slow...
Title: Re: DFusion - a lua based plugin system v2.1
Post by: Rumrusher on December 14, 2010, 03:01:59 pm
Maybe writing a sentence when you first learn it is harder than deciphering it.
76 ghostliness = noclip excuse me as I foam in the mouth over the adventure mode discovery...
Title: Re: DFusion - a lua based plugin system v2.2
Post by: darius on December 14, 2010, 03:17:01 pm
Maybe writing a sentence when you first learn it is harder than deciphering it.

Maybe true. I have another hypothesis: less interaction/encouragement and a goal to make something more impressive than DF (that is near impossible).

Also updated Dfusion. Now we have site type changer (very... ugly... unwieldy... and so on...) and adv. tools has ghostifier (thx Rumrusher for the idea).
Edit: funfact- if you change the site type to 0 (your embark point) you can try to reclaim it. But it crashed when i tried that. Also changing into hamlet makes buildings when you visit next time.
Title: Re: DFusion - a lua based plugin system v2.2
Post by: Rumrusher on December 14, 2010, 04:22:58 pm
I was figuring out how to bring back the spirit of a dead person (just got the tracking fix but fail to chain more than one flag switch) then the entire adv_tools got lock out.
well at least now I can test out creating undead companions who may or may not kill you and the ability to noclip through walls in the new version.

edit: I found out that 8 will kill things dead and removes them from the field(which means no way to bring back), and 50 puts them to sleep literally, so it's a nice feature for wanting to have either a power nap in game or curing your companions of their drowsiness. so far from what I know re-dying in arena mode won't cause a crash. that and trying to convert it into a hovel also.
hey do you know what flag is zombie/skeleton?

here's a close code for revival... sadly this is for talking to the dead buddies who kick it too soon.
Code: [Select]
function adv_tools.notdead()
--this will revive a dead soul from the grave... chances of it following you not so much
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff+16,ptr_vector)
indx=GetCreatureAtPos(getxyz())
flg=engine.peek(vector:getval(indx),ptr_Creature.flags) --get flags
flg:flip(1,76) -- this will turn off the dead flag while turning on Ghostliness
engine.poke(vector:getval(indx),ptr_Creature.flags,flg) --save flags
end
if my idea correct one could swap the body with a demon model and swap back, or if I'm wrong should swap back to the human model as a dead demon and swap back.
 
Title: Re: DFusion - a lua based plugin system v2.2
Post by: darius on December 15, 2010, 06:12:16 am
Damn i need program in more error messages.
Code: [Select]
flg:flip(1,76)
does not work as you think it would
Code: [Select]
flg:flip(1)
flg:flip(76)
would work
but i think this would be better yet:
Code: [Select]
flg:set(1,0) --not dead
flg:set(76,1) -- is ghost
Title: Re: DFusion - a lua based plugin system v2.2
Post by: Rumrusher on December 15, 2010, 07:10:46 am
hey I got a silly idea if you create a fort, then use turn the site into a hamlet, then dump a companion there will the companion become the inn keeper of the place making it save for sleeping or do we have to add the "is resident" flag on(I still couldn't find the Zombie/skeleton flags but found the 'wagon' 74 flag)?
70
also thanks for the quick fix.

edit:new discovery today
if a creature that was classed as a pet dies from abandonment when revived they will have all limbs non damaged.
so this might mean there is hope for a full revival with out the harsh effects of death.

edit: well after checking the wiki it's 12 and 13 which are the zombie and skeleton flags.
Hmm I got a working zombie revival but the kicker is that In adventurer mode harming the same creature twice will lead to a crash as found out again from having my awesome BogeyHuman go nuts after the zombie orc who body was turn into a bag little while after his death (made by his killer the bogeyhuman)
Code: [Select]
function adv_tools.undead()
--this will revive a dead soul from the grave as a somewhat zombie... chances of it following you not so much
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff+16,ptr_vector)
indx=GetCreatureAtPos(getxyz())
flg=engine.peek(vector:getval(indx),ptr_Creature.flags) --get flags
flg:set(1,0)
flg:set(12,1) --note this person is now part live mostly part dead to fully rez further test on bringing back body parts will be needed.
engine.poke(vector:getval(indx),ptr_Creature.flags,flg) --save flags
end


been testing something I wonder would this code scan all creatures in the area then select them?
it's for a zombie mod I'm pitching in for.
Code: [Select]
function tools.selectall(vector)

tnames={}
rnames={}
--[[print("vector1 size:"..vector:size())
print("vector2 size:"..vector2:size())]]--
for i=0,vector:size() do
--print(string.format("%x",vector:getval(i)))

local name=engine.peek(vector:getval(i),ptt_dfstring):getval()
tnames[i]=name
rnames[name]=i
end
end
indx=rnames[r]
if indx==nil then return
end
end
return indx
end
function tools.zombiemode()
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff+16,ptr_vector)
indx=tools.selectall(vector)
lzombie=engine.peek(vector:getval(indx))
flg=engine.peek(vector:getval(indx),ptr_Creature.flags)
if ~=flg:(1,1) then
flg:set(1,0)
flg:set(12,1)
flg:set(17,1)
end
end
engine.poke(vector:getval(indx),ptr_Creature.flags,flg) --save flags
end
end
I kinda got a little 'End' happy here.
Title: Re: DFusion - a lua based plugin system v2.2
Post by: darius on December 21, 2010, 06:58:05 pm
What do you mean scan them and select them? Do you mean scan them (check if they have some flag) and then select them (form a list of them?) if so this should do the trick:
Code: [Select]
function selectall()
  local retvec={} --return vector (or a list)
  myoff=offsets.getEx("AdvCreatureVec")
  vector=engine.peek(myoff+16,ptr_vector) --standart start
  for i=0,vector:size()-1 do --check all creatures
     local off
     off=vector:getval(i)
     local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(1) then  --if dead ...
        tables.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end
and then using it:
Code: [Select]
deadthings=selectall()
for _,v in pairs(deadthings) do
  flg=engine.peek(v,ptr_Creature.flags)
  flg:set(1,0)
  flg:set(12,1)
  engine.poke(v,ptr_Creature.flags)
end
things like these make me wish that it would be possible to trigger lua scripts from DF (e.g. drop an idol-> a slave zombie army, throw a coin-> summon a golem, eat some creature flesh-> turn into a ghost :) )
Title: Re: DFusion - a lua based plugin system v2.2
Post by: Rumrusher on December 21, 2010, 08:47:43 pm
sweet thanks.

wait so do you have "dead things" separate or do I have to shove it into a function.
because I just added these two and it didn't work.
Title: Re: DFusion - a lua based plugin system v2.2
Post by: darius on December 22, 2010, 08:12:42 am
deadthins is a list thats returned by selectall() (weell maybe a better name would be more informative e.g. selectdead() )
you could try (full function now) :
Code: [Select]
function tools.zombiemode()
 
for _,v in pairs(selectall()) do
  flg=engine.peek(v,ptr_Creature.flags)
  flg:set(1,0)
  flg:set(12,1)
  engine.poke(v,ptr_Creature.flags)
end
 
end
Oh and sorry that it did not work (i am not in university and can't test it)
Title: Re: DFusion - a lua based plugin system v2.2
Post by: Rumrusher on December 26, 2010, 04:19:00 pm
I was testing the Site changer and found that you best not over lap a hamlet over a abandon fort or you will end up with the game returning the land to before you embark on it and lose the ability to rest and retire let alone travel out. So pretty much with that in mind it's pretty easy to set up a Hamlet near a lair for saving/retiring and proper roof over your head. That and picking a house with out a owner(s) means you can sleep with out fear of being kick out when you wake up.
so any research on sites recently?
Title: Re: DFusion - a lua based plugin system v2.3
Post by: darius on December 27, 2010, 07:56:23 pm
No not really. I could make site flag editing easier, but as far as i tried it does nothing good (although fun things like setting shops happens sometimes...)

Edit: here. Updated. Using it is simple, select site (just as awkwardly as site changer) and then you can flip the flags by typing its number. Maybe some flag could change if items are scattered or not, but i think i tried them all.
Title: Re: DFusion - a lua based plugin system v2.3
Post by: Rumrusher on December 28, 2010, 04:14:23 am
oh wait about that death thing.
if you die retiring ends up removing your character from the game... or was that retiring in a nonexistent place (dark fort)lead to the adventurer removal.
this makes me wonder about the hostilities tag?
is it there for the sake of converting wild animals and friendlies to savage beasts and tame pets.
Title: Re: DFusion - a lua based plugin system v2.3
Post by: darius on December 28, 2010, 05:04:24 am
oh wait about that death thing.
if you die retiring ends up removing your character from the game... or was that retiring in a nonexistent place (dark fort)lead to the adventurer removal.
this makes me wonder about the hostilities tag?
is it there for the sake of converting wild animals and friendlies to savage beasts and tame pets.
Df removes units only if: you abandon fort or you move out of non-important location. If you move out of important location (i think dark fort included) it saves all creatures (prob non-dead though...) into that site.
Hostilities toggle (which i forgot i added) makes creature either friendly to you civ or invader so its more usefull in fort mode to make gladiator fights between your units.
Oh and there is creature flags from older version of DFHACK:
Spoiler (click to show/hide)
Title: Re: DFusion - a lua based plugin system v2.3
Post by: Rumrusher on December 28, 2010, 07:18:00 am
oh wait about that death thing.
if you die retiring ends up removing your character from the game... or was that retiring in a nonexistent place (dark fort)lead to the adventurer removal.
this makes me wonder about the hostilities tag?
is it there for the sake of converting wild animals and friendlies to savage beasts and tame pets.
Df removes units only if: you abandon fort or you move out of non-important location. If you move out of important location (i think dark fort included) it saves all creatures (prob non-dead though...) into that site.
Hostilities toggle (which i forgot i added) makes creature either friendly to you civ or invader so its more usefull in fort mode to make gladiator fights between your units.
Oh and there is creature flags from older version of DFHACK:
Spoiler (click to show/hide)
found out that if you didn't strike your demons or your demons didn't strike you.
you can calm them down by swapping to them and apply hostilities on your character.
it made the "Don't talk to me types more understanding" though I also some how traveled as my companion recruiting my adventurer also.

*tested with Atu and JohnnyGhost* sadly this means poking every one in the group to accept the new character and swapping to them and making sure that accept it too.
so having over say 5 bow men and having them accept that Atu summon a Demon form hell for assisting them would be some tedious work, that could fall apart if you accidentally exit out.
Also I found out that JohnnyGhost Snake berry will recruit Atu "Insticktick" and she will lovely agree.
I bet it's from the high base stats from being a boegyman and the few kills Johnny has that cause this. oh well at least now he won't run away any more.
Title: Re: DFusion - a lua based plugin system v2.4
Post by: darius on December 28, 2010, 07:40:40 am
Good news: found a way to make creatures stick (i.e. travel with you) bad news: needs function calling and thats always a pain...

Quote
you can calm them down by swapping to them and apply hostilities on your character.
how do you do this? It supposed to work only in fort mode.
Edit2: ok made following stick even without function calling. Drawback- target needs to be a historical important figure.
Edit3: also found how to change bodies (permanently) with historically important target
Edit4: updated program
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Rumrusher on December 28, 2010, 03:45:57 pm
Good news: found a way to make creatures stick (i.e. travel with you) bad news: needs function calling and thats always a pain...

Quote
you can calm them down by swapping to them and apply hostilities on your character.
how do you do this? It supposed to work only in fort mode.
Edit2: ok made following stick even without function calling. Drawback- target needs to be a historical important figure.
Edit3: also found how to change bodies (permanently) with historically important target
Edit4: updated program
well it's the same look at creature function as in the adv_tools stuff and I guess this is close to changing the civ of the creature to yours so if I just swap to the creature and have it's civ copied over to the adventurer then the adventurer would be apart of that (civ while keeping ties to other places)?
I guess so if one has a wild dog which are apart of the -1 wild group you can swap to the said dog and use that civ (-1) and copy it over to yours and seeing how you are apart of the same civ they won't hurt you. Though I couldn't recreate this when I revived a dead creature I killed so best not too attack the creature or have companions do so.

edit: wow this works great... weird thing is about the wild class is that the entire forest is their home... so they will drop info on capitals and surroundings to many sites... though due to playing Deon's mod with this I can't seem to find a Ent anywhere.
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Kobold Troubadour on December 28, 2010, 09:01:48 pm
found how to change bodies (permanently) with historically important target
Sweet, gonna' try this later and make a certain Emperor be more "proactive" in his kingdoms troubles...THROUGH VIOLENCE!
Title: Re: DFusion - a lua based plugin system v2.4
Post by: darius on December 29, 2010, 06:56:43 am
I tried that with the "lady". Her combat skills sucked and she died very quickly. Now the castle stands without any lord or lady :D
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Rumrusher on December 29, 2010, 07:23:44 am
well at least now folks can play a monster trainer adventurer.
if they place a Pfort and name it Personalcomputer or something close to it change it to a Hamlet/fort also good and use it for dumping companions then yeah.
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Kobold Troubadour on December 29, 2010, 07:26:36 pm
I tried that with the "lady". Her combat skills sucked and she died very quickly. Now the castle stands without any lord or lady :D
Oh I know...better check Legends 1st to see a Leader that actually lasted throughout World-Gen's harshness. I know of a certain Empress who kept on losing her newly born children to monsters attacking their fort, as if her child is monster magnet/trigger and the youngest only surviving because gen already stopped...she's itching for vengeance.

Extra info: You can actually employ people of power who are willing without Dfusion if you remove the [DUTYBOUND] tag in their raws.

Oh, just for confirmation: With the current Dfusion, can I use World leaders AND Historically recognized children, save then and play as them without any "after effects"?
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Deviled on December 29, 2010, 09:42:35 pm
Is there an way I could get this in a zip file
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Rumrusher on December 30, 2010, 08:56:53 am
well it work for some characters but when you swap to a random NPC with no history then it's back to jumping and you can't escape from this by finding a warlord and swapping to them either.
I take it I have to slap a history recorded flag on the person first before swapping or just swap to companions and travel.
edit: well if you die in game you can never come back by retiring. Just found this out from losing Em un-retiring. Unless there a way to remove the Dead/killed flag in legends then there still perma death.
Title: Re: DFusion - a lua based plugin system v2.4
Post by: darius on December 30, 2010, 05:20:54 pm
Is there an way I could get this in a zip file
Changed the file to zip. But i would suggest getting 7zip (homesite (http://www.7-zip.org/)) clearly whatever program you are using for archives is not powerfull enough (plus 7zip is free).

well it work for some characters but when you swap to a random NPC with no history then it's back to jumping and you can't escape from this by finding a warlord and swapping to them either.
I take it I have to slap a history recorded flag on the person first before swapping or just swap to companions and travel.
edit: well if you die in game you can never come back by retiring. Just found this out from losing Em un-retiring. Unless there a way to remove the Dead/killed flag in legends then there still perma death.

Just slapping a flag could be not enough. The reason is that when `DF` recruits a person it checks if it is historically important person, if not makes him important (creates an entry in legends list) and only then flips that flag.
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Rumrusher on December 30, 2010, 07:42:04 pm
Is there an way I could get this in a zip file
Changed the file to zip. But i would suggest getting 7zip (homesite (http://www.7-zip.org/)) clearly whatever program you are using for archives is not powerfull enough (plus 7zip is free).

well it work for some characters but when you swap to a random NPC with no history then it's back to jumping and you can't escape from this by finding a warlord and swapping to them either.
I take it I have to slap a history recorded flag on the person first before swapping or just swap to companions and travel.
edit: well if you die in game you can never come back by retiring. Just found this out from losing Em un-retiring. Unless there a way to remove the Dead/killed flag in legends then there still perma death.

Just slapping a flag could be not enough. The reason is that when `DF` recruits a person it checks if it is historically important person, if not makes him important (creates an entry in legends list) and only then flips that flag.
darn should have quick recruit then perma recruit then unperma then perma swap then.
also another way to piss off your companions is to friendly a creature then attack it.
some how this piss every one in your group off and they will turn on you one by one.
I guess this also goes when you have a companion attacking a friendly creature and thus makes said companion a enemy of your civ.

I wonder if we be able to punch Gods and forces in the face.
if they are in the legend and that people can talk to them I wonder if one could Summon one and punch them in the face and maybe finally slap a death year.
from non coding planning means we need to know how to spawn creatures or put said god on the list of creatures that will spawn in a fort/hamlet/area which means we need to know where toady places these gods at...
well better place this under wishful thinking.
Title: Re: DFusion - a lua based plugin system v2.4
Post by: MaximumZero on January 01, 2011, 04:55:23 pm
This is pretty well awesome. Gonna play around with this a bit and see what I can do with it.
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Rumrusher on January 02, 2011, 11:10:19 am
do not I mean DO NOT make a fort(not Pfort a fort) over an ocean then take an adventurer and retire him there and try to place another fort on top of the original one.
you will not only crash dwarf fortress but Blue screen your PC as well.

Title: Re: DFusion - a lua based plugin system v2.4
Post by: Bharani on January 02, 2011, 03:10:00 pm
Hey. Just got Dfusion and started playing with to heal a dwarf. I posted this in the runesmith thread, but thought I'd try here, too, since the question is about Dfusion.

I'm trying to heal a dwarf with a yellow lower leg who is being ignored by the others and is starving to death.
Using DFusion while in fort mode. Do I use adv_tools? If so, this is what I get when I try to change adventurer, I get this (it IS fort mode):
plugins/patterns.lua:33: attempt to perform arithmetic on local 'num' (a nil value)
If I use change race, it asks me to enter a race in all caps, and then gives me the above error message no matter what I enter.
Any way to heal a dwarf in fort mode using Dfusion?
I've also done dfusion -r to update the offsets.txt.
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Rumrusher on January 02, 2011, 05:08:33 pm
Hey. Just got Dfusion and started playing with to heal a dwarf. I posted this in the runesmith thread, but thought I'd try here, too, since the question is about Dfusion.

I'm trying to heal a dwarf with a yellow lower leg who is being ignored by the others and is starving to death.
Using DFusion while in fort mode. Do I use adv_tools? If so, this is what I get when I try to change adventurer, I get this (it IS fort mode):
plugins/patterns.lua:33: attempt to perform arithmetic on local 'num' (a nil value)
If I use change race, it asks me to enter a race in all caps, and then gives me the above error message no matter what I enter.
Any way to heal a dwarf in fort mode using Dfusion?
I've also done dfusion -r to update the offsets.txt.
what version of dwarf fortress do you have... if it's 17 then sorry this only works for 18.
if you have 18 then did you select your dwarf first by using the Look command If not then next time have the pointer on top of the wounded dwarf the program need to know the exact direction the creature is.
If you did that and it's 18 then it must been you hitting the swap adventure function when your in fort mode.
and isn't it -f not -r for getting offsets for dfusion?

edit: I was wondering does the perma adventure swap also grant access to retiring as that character or do I need to swap back to the adventurer after I'm done.
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Bharani on January 02, 2011, 10:34:28 pm
Hey. Just got Dfusion and started playing with to heal a dwarf. I posted this in the runesmith thread, but thought I'd try here, too, since the question is about Dfusion.

I'm trying to heal a dwarf with a yellow lower leg who is being ignored by the others and is starving to death.
Using DFusion while in fort mode. Do I use adv_tools? If so, this is what I get when I try to change adventurer, I get this (it IS fort mode):
plugins/patterns.lua:33: attempt to perform arithmetic on local 'num' (a nil value)
If I use change race, it asks me to enter a race in all caps, and then gives me the above error message no matter what I enter.
Any way to heal a dwarf in fort mode using Dfusion?
I've also done dfusion -r to update the offsets.txt.
what version of dwarf fortress do you have... if it's 17 then sorry this only works for 18.
if you have 18 then did you select your dwarf first by using the Look command If not then next time have the pointer on top of the wounded dwarf the program need to know the exact direction the creature is.
If you did that and it's 18 then it must been you hitting the swap adventure function when your in fort mode.
and isn't it -f not -r for getting offsets for dfusion?

edit: I was wondering does the perma adventure swap also grant access to retiring as that character or do I need to swap back to the adventurer after I'm done.
Ah, didn't realize that I needed to use the "look" mode to select the dwarf. Thank you! It's crashing after I changerace-save-reload, but at least it's doing something now!
And yes, it's -f. My mistake.

EDIT: Yes! By changing him to an elf, and then back to a dwarf, I avoided a crash and although it didn't heal him, it made the other dwarves recognize he needed help. Fun and useful tool. Thanks for your help!
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Rumrusher on January 03, 2011, 12:17:27 am
to heal you need to swap out the body type of the creature.
which is why I mention DEMON_1 or BRONZE_COLOSSUS(not really for swapping body parts but for a indestructible powerhouse that never needs sleep.) so that the game will dump the info on the old parts for new ones and if you swap back the game should replace those parts with new ones.
Though best to wait awhile before healing or the wounds will reopen and you might get blood all over your floor.
if you want to play around with flags runesmith had then poke though this thread for some tips on doing so.
(but for the new version just fill in this "adv_tools.menu:add("[insert what it should say here]",adv_tools.[the function name goes here]) also always back up plugins before digging around and adding for the off chance of breaking the code don't know how.
edit: oh and daruis I forgot to bring this up but that zombie mode and select all doesn't work.

edit:shock about editing this again but I'm working on a caravan mode function that will make those who want to RP as wandering settlers or a makeshift Oregon Trail mod.
so far all I have for code is this
Code: [Select]
function adv_tools.wagonmode()
--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+16,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(1,0)
flg:set(74,0)
engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
r=io.stdin:read() -- repeat for it too work... also creature will be dead.
flg:set(1,0) -- brings back to life
flg:flip(74) -- will scuttle if not repeat.
engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
end
Code: [Select]
adv_tools.menu:add("caravan mode",adv_tools.wagonmode)
so far all is fine for looking like a wagon but storing items may lead to some troubles, if you care about the person that being turn into a wagon then they will never come back when you retire or the case having a wild animal might lead to your entire group betrayal or if seeing how it's dead the lost of all it's items from the first scuttle making you have to use the get item code and force the creature to pick up all those items.

adding items should be easy(after getting it to work) as dropping the stuff in the middle wagon tile remove the caravan mode from the creature (by going over it again which will remove it for you and pausing the utility the other steps where done by booting up another version of Dfusion), swap to them pick up the item and swap back, then unpause the utility that had caravan mode running.
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Fwoosh on January 16, 2011, 07:17:07 pm
Not being a programmer, I don't completely understand how to use this so I could really use some help. I have a pet that keeps getting an infection and dying so I want to prevent this by healing it. From what I've understood from this thread you can heal a creature by changing it to another kind of creature and then changing it back. I've tried messing with this but can't understand how to use it. Can anyone help me figure this out?
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Rumrusher on January 16, 2011, 07:31:56 pm
Not being a programmer, I don't completely understand how to use this so I could really use some help. I have a pet that keeps getting an infection and dying so I want to prevent this by healing it. From what I've understood from this thread you can heal a creature by changing it to another kind of creature (save/travel) and then changing it back (save/travel). I've tried messing with this but can't understand how to use it. Can anyone help me figure this out?
Well this cures missing limbs and damaged nerves though I hadn't gone and fix infections with this.
Though if it's a syndrome based infection then you're best bet is to change into a creature who won't be effected by this Syndrome and wait it out. unless it was a cut that was left unchecked then try changing to DEMON_1 and play with your pet in that state for awhile before swapping back.
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Fwoosh on January 16, 2011, 08:36:50 pm
Thanks, that sounds like that could help. Its an infected wound so I guess the demon would be the option to go with. However, my main problem is that I really just can't figure out how to make the program actually do that. I just can't seem to understand how to give the program commands. It just keeps crashing whenever I do anything. An example of what to type in with fill in the blanks or something would be great. Please help a poor non-programmer that is completely lost.  :(
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Rumrusher on January 16, 2011, 08:52:29 pm
Thanks, that sounds like that could help. Its an infected wound so I guess the demon would be the option to go with. However, my main problem is that I really just can't figure out how to make the program actually do that. I just can't seem to understand how to give the program commands. It just keeps crashing whenever I do anything. An example of what to type in with fill in the blanks or something would be great. Please help a poor non-programmer that is completely lost.  :(
well sadly you have to use the pointer on top of the creature for it to work. the code for Adv_tools all are on the getting the 'xyz' for finding the creature id to do any work on it.
so hitting either the look, talk, throw, fire, commands to bring up the pointer and aim it at the creature then activate the command. no programming needed. hope this makes this clear to understand.
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Fwoosh on January 16, 2011, 09:16:27 pm
Ok, so if I am getting this right what I have to do is put the cursor over the pet using look and then go to the Adv_tools. Would I then use the change adventurer tool? Where does the demon part come in? Thanks for all the help you are giving me one this.
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Rumrusher on January 16, 2011, 09:39:52 pm
Ok, so if I am getting this right what I have to do is put the cursor over the pet using look and then go to the Adv_tools. Would I then use the change adventurer tool? Where does the demon part come in? Thanks for all the help you are giving me one this.
the demon part comes from using race changer the different random body parts replaces all the ones the creature had including the infected one.
swapping back will lead to the game inputting the specific body parts for that race and stick new ones than remembering the old body. So swapping to an elf won't work due to sharing the same anatomy with a dwarf where swapping to a 1 legged elephant will.

though I want to know what animal/creature your pet is?
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Fwoosh on January 16, 2011, 11:34:09 pm
Its a Blightscale Dragon from Legendary Lands. I embarked on the spot just so I could capture the stupid thing and so I can't have it dying from a stupid broken leg infection. If it dies I'll never have my dragon army of doom! Also, my problem is that I don't know what to actually type in. So far I get that I put the cursor over the dragon and then type in the instructions, which I know are part of the Adv_tools section. I just don't know what specifically to type in. Step by step instructions might be necessary.
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Rumrusher on January 17, 2011, 03:10:09 am
Its a Blightscale Dragon from Legendary Lands. I embarked on the spot just so I could capture the stupid thing and so I can't have it dying from a stupid broken leg infection. If it dies I'll never have my dragon army of doom! Also, my problem is that I don't know what to actually type in. So far I get that I put the cursor over the dragon and then type in the instructions, which I know are part of the Adv_tools section. I just don't know what specifically to type in. Step by step instructions might be necessary.
wait fort mode then you best brush up on Deon's creatures Raw name or you might end up not getting back that Blightscale Dragon. oh now I can understand and give a proper step by step.

best back up the save incase anything goes horribly wrong(I didn't go through all this with out save scumming)
hover over your dragon using the look command then go into race changer then change into a Human/Dwarf/Demon since it's body parts are so not humanoid or random gen.
save seeing you can't travel or sleep on it then reload the game and check up on the dragon hopefully you save while pause and not unpause due to the case of the game thinking it has human/dwarf/Demon parts but has dragon wounds still active which to me means the game can't find the parts
now your half dragon half random animal let's say Cat will walk around with no rot on their limbs... unless cat share the same limb parts then you have a rot limb kitty swap to a different creature... like a Demon.
now after a few ticks clear out the bad body it had you can swap back to your dragon.
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Fwoosh on January 17, 2011, 06:44:05 am
Thank you so much for helping me all this time. I think I almost have it now. I just don't know what to literally type in. When I just type in the number for change race the whole thing crashes. I've tried typing the 3 with DEMON_1 after it in different ways but it just says incorrect choice. One example of what exactly to type and I think I have this figured out. Thanks again for all the help you are giving me.
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Rumrusher on January 17, 2011, 02:39:18 pm
Thank you so much for helping me all this time. I think I almost have it now. I just don't know what to literally type in. When I just type in the number for change race the whole thing crashes. I've tried typing the 3 with DEMON_1 after it in different ways but it just says incorrect choice. One example of what exactly to type and I think I have this figured out. Thanks again for all the help you are giving me.
well is it on top of the creature, and did you type in all caps CAT then save?
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Fwoosh on January 17, 2011, 03:02:26 pm
The cursor is on top of the creature. When I type the 3 for the change race option the program just closes. If I type CAT and the 3 on the same line then it just gives an incorrect choice message.
Title: Re: DFusion - a lua based plugin system v2.4
Post by: darius on January 17, 2011, 06:03:23 pm
Could be that you are using the wrong tool. Adv-tools are for adventure mode only. AFAIR there should be same tools for fort mode but it has been some time since i touched anything related to DF/DFusion (few more weeks and i'll be done with uni ^^ (for now...) )
add this into plugins\tools\plugin.lua
Not tested for now...
Code: [Select]
function tools.racechange()

myoff=offsets.getEx("CreatureVec")
vector=engine.peek(myoff,ptr_vector)
local offset=0
tx,ty,tz=getxyz()
for i=0,vector:size() do
x=engine.peek(vector:getval(i),ptr_Creature.x)
y=engine.peek(vector:getval(i),ptr_Creature.y)
z=engine.peek(vector:getval(i),ptr_Creature.z)
if x==tx and y==ty and z==tz then
offset=vector:getval(i)
break;
end
end
if offset==0 then
print("Failed to find creature!")
return
end

RaceTable=RaceTable or BuildNameTable() --slow.If loaded don't load again
print("Enter race name ALL CAPS!:")
repeat
entry=io.stdin:read() --get entry
id=RaceTable[entry] -- find race id
until id~=nil -- if not found repeat
engine.poke(offset,ptr_Creature.race,id)
end
tools.menu:add("Change creature race",tools.racechange)
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Rumrusher on January 23, 2011, 04:09:25 am
edit: Darius ADv_tools do work in fort mode.
oh I just smooth out more of the wagon mode code for adventurers.
Code: [Select]
function adv_tools.wagonmode()
--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+16,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(1,0)
flg:set(74,0)
engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
print("To stay normal press y, else hit Enter turn Wagon mode on.")
r=io.stdin:read() -- repeat for it too work... also creature will be dead.
if r== "y" then
flg=engine.peek(vector:getval(indx),ptr_Creature.flags)
flg:set(1,0)
engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
else
flg=engine.peek(vector:getval(indx),ptr_Creature.flags)
flg:set(1,0)
flg:flip(74)
engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
end
end
sadly I wonder why does it only work when the creature is dead. guess it from the fact it only meant to be use only for caravans in fort mode and those where pulled by some type of animal, oh well makes me wonder oh well still wonder why that zombie mod doesn't work.
edit: made a easier to play with flags command for adventure mode.
Code: [Select]
function adv_tools.insertflag()
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff+16,ptr_vector)
indx=GetCreatureAtPos(getxyz())
flg=engine.peek(vector:getval(indx),ptr_Creature.flags)
print("insert flag:")
entry=io.stdin:read()
flg:flip(entry)
engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
end
Title: Re: DFusion - a lua based plugin system v2.4
Post by: darius on January 26, 2011, 03:26:20 pm
Okay i'm back. Just tried zombies and the problem is (i think) with the resurrected creatures that they have no body so next action involving body (attack defense or sth) will crash DF.

EDIT: added two plugins by rumrusher, ALSO: RESSURECTION!!!!11ONE with limb healing!!!!
Title: Re: DFusion - a lua based plugin system v2.4
Post by: Rumrusher on January 26, 2011, 09:06:52 pm
Okay i'm back. Just tried zombies and the problem is (i think) with the resurrected creatures that they have no body so next action involving body (attack defense or sth) will crash DF.

EDIT: added two plugins by rumrusher, ALSO: RESSURECTION!!!!11ONE with limb healing!!!!
also if you slap on Resurrection limb healing with Zombie you could fix that crashing issue since they revive with no limbs.
Title: Re: DFusion - a lua based plugin system v2.5
Post by: darius on January 26, 2011, 09:33:06 pm
Yeah had that idea after releasing... But now I just found out that i must do another homework for university :(
Title: Re: DFusion - a lua based plugin system v2.5
Post by: Rumrusher on January 26, 2011, 09:43:40 pm
Yeah had that idea after releasing... But now I just found out that i must do another homework for university :(
no big though I might have to find a way to get "v" in the zombie command to fit into the "Indx" in the resurrection code and I don't think placing indx=v would work.
Title: Re: DFusion - a lua based plugin system v2.5
Post by: darius on January 26, 2011, 09:53:01 pm
something like this, but have not time to test:
Code: [Select]
function adv_tools.zombie()
local trgs=selectall()
for k,v in pairs(trgs) do
print("Zombie:"..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,0) --stop some bleeding...
local flg=engine.peek(v,ptr_Creature.flags)
local flags=engine.peek(v,ptr_Creature.flags)
    flg:set(1,0) --ALIVE
flags:set(12,1) --zombie
    flg:set(39,0) -- leave body yet again
    flg:set(37,0) -- something todo with wounds- lets you walk again.
engine.poke(v,ptr_Creature.flags,flags)
end
end
Title: Re: DFusion - a lua based plugin system v2.5
Post by: Rumrusher on January 26, 2011, 10:05:55 pm
something like this, but have not time to test:
Code: [Select]
function adv_tools.zombie()
local trgs=selectall()
for k,v in pairs(trgs) do
print("Zombie:"..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,0) --stop some bleeding...
local flg=engine.peek(v,ptr_Creature.flags)
local flags=engine.peek(v,ptr_Creature.flags)
    flg:set(1,0) --ALIVE
flags:set(12,1) --zombie
    flg:set(39,0) -- leave body yet again
    flg:set(37,0) -- something todo with wounds- lets you walk again.
engine.poke(v,ptr_Creature.flags,flags)
end
end
oh shoot that's what I got...
Code: [Select]
function adv_tools.Zombieressurect()
local trgs=selectall()
for k,v in pairs(trgs) do
--indx=GetCreatureAtPos(v)
--indx=engine.peek(v,ptr_creature.ID)
print("Zombie:"..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,0) --stop some bleeding...
local flags=engine.peek(v,ptr_Creature.flags)
flags:set(1,0) -- alive!
flags:set(12,1) --zombie
engine.poke(v,ptr_Creature.flags,flags)
end
end
it was puzzling but I figured out that the problem was the vector getting value so I remove all of it and replace it with v.
oh well still my alligators seem to be just pushing stuff around than attacking. well at least now the folks at zombie mod can have their rising dead again.
edit: I just tested your code(added the two flags from yours 37 and 39) and it seems it just kills the zombie again.
removing those two seems to fix it. 
So now in adventure mode we can walk on water, come back from the dead in less than 3 days, turn water in to wine and turn folks into wooden caravans I mean really go at carpentry oh revive millions.

edit:
here some adventurer mode only zombie codes for any one with a necro twitch
Code: [Select]
function adv_tools.Zombieressurectandcontrol()
local trgs=selectall()
for k,v in pairs(trgs) do
--indx=GetCreatureAtPos(v)
--indx=engine.peek(v,ptr_creature.ID)
print("Zombie:"..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
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff+16,ptr_vector)
local trgs=selectall()
for k,v in pairs(trgs) do
trgid=engine.peek(vector:getval(0),ptr_Creature.ID) --get players ID
engine.peek(v,ptr_Creature.followID) -- get target creatures "now following ID"
engine.poke(v,ptr_Creature.followID,trgid) -- if not just write the players ID.
end
engine.poke(v,ptr_Creature.bloodlvl,60000) --give blood
engine.poke(v,ptr_Creature.bleedlvl,0) --stop some bleeding...
local flags=engine.peek(v,ptr_Creature.flags)
flags:set(1,0) -- alive!
flags:set(12,1) --zombie
engine.poke(v,ptr_Creature.flags,flags)
end
end

function adv_tools.ressurectall()
local trgs=selectall()
for k,v in pairs(trgs) do
--indx=GetCreatureAtPos(v)
--indx=engine.peek(v,ptr_creature.ID)
print("Zombie:"..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,0) --stop some bleeding...
local flags=engine.peek(v,ptr_Creature.flags)
flags:set(1,0) -- alive!
flags:set(39,0) -- leave body yet again
flags:set(37,0) -- something todo with wounds- lets you walk again.
engine.poke(v,ptr_Creature.flags,flags)
end
end

function adv_tools.ControlZombie()
--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+16,ptr_vector)
local trgs=selectzombie()
for k,v in pairs(trgs) do
trgid=engine.peek(vector:getval(0),ptr_Creature.ID) --get players ID
engine.peek(v,ptr_Creature.followID) -- get target creatures "now following ID"
engine.poke(v,ptr_Creature.followID,trgid) -- if not just write the players ID.
end
end

function selectalive()
  local retvec={} --return vector (or a list)
  myoff=offsets.getEx("AdvCreatureVec")
  vector=engine.peek(myoff+16,ptr_vector) --standart start
  for i=0,vector:size()-1 do --check all creatures
     local off
     off=vector:getval(i)
     local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(1)==0 then  --if dead ...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end

function selectzombie()
  local retvec={} --return vector (or a list)
  myoff=offsets.getEx("AdvCreatureVec")
  vector=engine.peek(myoff+16,ptr_vector) --standart start
  for i=0,vector:size()-1 do --check all creatures
     local off
     off=vector:getval(i)
     local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(12)==1 then  --if dead ...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end
I was going to add in a perma zombie res control but then it was to much code to cut and paste into right... that and having horrible zombies who will attack you unless you're a ghost isn't what I had in mind. oh well with this it would make the process of making them follow much easier.
wait danging now I need to test if I can add a "non hostile to other companions" code.
hmm maybe later when I can build up over 100 zombie minions.
Title: Re: DFusion - a lua based plugin system v2.5
Post by: Dragonchampion on February 07, 2011, 12:56:00 am
Sorry for the noobishness, but is there any way to get this to work with Dwarf Therapist? It will not see any races but dwarves.  :'(
Title: Re: DFusion - a lua based plugin system v2.5
Post by: darius on February 07, 2011, 11:52:18 am
not without manually editing dwarf therapist's source code. Maybe somebody could do that from DT thread? (atleast remove the check altogether)
Title: Re: DFusion - a lua based plugin system v2.5
Post by: Deon on February 07, 2011, 12:11:24 pm
Hey, did YOU make that awesome tool which allowed magical gem? If so, is there any chance to get it for the current version? :)
Title: Re: DFusion - a lua based plugin system v2.5
Post by: darius on February 07, 2011, 12:43:43 pm
You mean that enchanting with detailing mod for old DF? Unfortunately not yet. Don't have the patients to find all the offsets (and calling conventions) for functions just to find them different next version (and new DF is really not far away). Maybe i'll make some automated tool later.
Title: Re: DFusion - a lua based plugin system v2.5
Post by: Deon on February 07, 2011, 12:57:02 pm
Yeah, if you ever make it again, it would be grand :). I miss firebreathing statues.
Title: Re: DFusion - a lua based plugin system v2.5
Post by: Rumrusher on February 07, 2011, 02:43:08 pm
Yeah, if you ever make it again, it would be grand :). I miss firebreathing statues.
I missed making fire breathing weapons for adventure mode. man those where the days in fact I think making spells was the thing that cause me to stumble into adventurer breeding.
oh well now this makes me want to crack open Spellcraft.exe see how it ticks and use that as a starting point once I go search for those offsets.

Sadly I don't know how to crack open my old Spellcraft nor know how to search for offsets(I think someone posted a guide on how.).
Title: Re: DFusion - a lua based plugin system v2.5
Post by: Alkhemia on February 07, 2011, 03:02:55 pm
lol I was changing adventures and i set the cursor in the wrong spot now I'm in HFS and a Clown  :o
 Edit: every time i sleep and travel i end up as a diffrent creature now i'm a plump helmet man...
Title: Re: DFusion - a lua based plugin system v2.5
Post by: Rumrusher on February 07, 2011, 04:58:19 pm
lol I was changing adventures and i set the cursor in the wrong spot now I'm in HFS and a Clown  :o
 Edit: every time i sleep and travel i end up as a diffrent creature now i'm a plump helmet man...
yeah best way out of that jam is to find some one that is historic like a lady or a townsmen and perma adv change into them or kill thing to make what ever body your in added to the legends and you won't jump around when you Travel.

okay time to dump.
rez companions, lycan rez, a repeating zombie function so players don't need to select it over again, and Companion race changer so one can mass convert a bunch of humans into Cave spiders.
Code: [Select]
function selectcomp()
  local retvec={} --return vector (or a list)
  myoff=offsets.getEx("AdvCreatureVec")
  vector=engine.peek(myoff+16,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 adv_tools.comprace()
--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+16,ptr_vector)
--indx=GetCreatureAtPos(getxyz())
local trgs=selectcomp()
for k,v in pairs(trgs) do
--RaceTable=RaceTable or BuildNameTable() --slow.If loaded don't load again
--print("Enter race name ALL CAPS!:")
--repeat
entry=io.stdin:read() --get entry
--id=RaceTable[entry] -- find race id
--until id~=nil -- if not found repeat
engine.poke(v,ptr_Creature.race,entry)
end

end

function adv_tools.lycanressurect()
repeat
local trgs=selectall()
for k,v in pairs(trgs) do
--indx=GetCreatureAtPos(v)
--indx=engine.peek(v,ptr_creature.ID)
print("Werewolf:"..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,0) -- alive!
flags:set(12,0) --zombie
flags:set(17,1)
flags:set(19,1)
engine.poke(v,ptr_Creature.flags,flags)
engine.poke(v,ptr_Creature.race,151)
end
until r==7
end

function adv_tools.ressurectcomp()
local trgs=selectcomp()
for k,v in pairs(trgs) do
--indx=GetCreatureAtPos(v)
--indx=engine.peek(v,ptr_creature.ID)
print("Companion:"..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,0) --stop some bleeding...
local flags=engine.peek(v,ptr_Creature.flags)
flags:set(1,0) -- alive!
flags:set(39,0) -- leave body yet again
flags:set(37,0) -- something todo with wounds- lets you walk again.
engine.poke(v,ptr_Creature.flags,flags)
end
end

so far killing a creature twice will cause the killer's legend data to be buggy and will cause a crash if unless you don't have them as a companion and or didn't rekill something. so I wonder if one could remove the creature from legend mode?

Title: Re: DFusion - a lua based plugin system v2.5
Post by: darius on February 12, 2011, 05:42:18 pm
You could try editing its legend id (e.g. setting it to 0 or -1 or something like that) then killing then restoring.
Title: Re: DFusion - a lua based plugin system v2.5
Post by: Rumrusher on February 12, 2011, 09:59:18 pm
You could try editing its legend id (e.g. setting it to 0 or -1 or something like that) then killing then restoring.
hmm so I have to code in the revival to have this legend remove first before killing, I might go test that oh one thing about the hurt pattern in creature is there a way one could select different parts of the body to be affected? I ask so that I could see to making a death requirement function where if someone dies/wounded a certain way (which will be able to be trigger by syndromes) they will be turn.
I figure if Deon gave his vampiress, werewolves, lost adventurers, face huggers syndromes that will effect a creature body part(or parts) this will trigger the coded "if requirement" to add the victim to the list of that infected and convert the poor fellow into one of the beast(or burst from their chest). The only set back to this is that whole Race changed creatures end up crashing the game if they are wounded.
Title: Re: DFusion - a lua based plugin system v2.5
Post by: Deviled on February 12, 2011, 10:21:27 pm
I can't get this to run.
Title: Re: DFusion - a lua based plugin system v2.5
Post by: darius on February 13, 2011, 06:56:35 am
I can't get this to run.
what did you try?
Title: Re: DFusion - a lua based plugin system v2.5
Post by: Deviled on February 13, 2011, 10:25:34 am
I can't get this to run.
what did you try?
I mean when I open it it basecly closes imedetly.
Title: Re: DFusion - a lua based plugin system v2.5
Post by: darius on February 13, 2011, 10:32:29 am
Create a new file called whatever.bat and paste this:
Code: [Select]
DFfusion.exe
pause
then save, run and type what is reported.
Title: Re: DFusion - a lua based plugin system v2.5
Post by: Rumrusher on February 13, 2011, 11:15:05 am
do you have do you have Dwarf fortress running? it automatically closes when that happens.
Title: Re: DFusion - a lua based plugin system v2.5
Post by: Deviled on February 13, 2011, 12:56:31 pm
do you have do you have Dwarf fortress running? it automatically closes when that happens.
Yes
Create a new file called whatever.bat and paste this:
Code: [Select]
DFfusion.exe
pause
then save, run and type what is reported.
I just tryed this and the same thing happens, it opens the immediately closes.
Title: Re: DFusion - a lua based plugin system v2.5
Post by: darius on February 13, 2011, 02:02:56 pm
hmm... try this then:
Code: [Select]
DFfusion.exe>log.txt
inside test.bat. Run test.bat and then paste log.txt
Title: Re: DFusion - a lua based plugin system v2.5
Post by: Deviled on February 13, 2011, 03:09:19 pm
hmm... try this then:
Code: [Select]
DFfusion.exe>log.txt
inside test.bat. Run test.bat and then paste log.txt
Wheres test.bat
Title: Re: DFusion - a lua based plugin system v2.5
Post by: darius on February 13, 2011, 04:13:05 pm
eh...
here (http://www.box.net/shared/2bylsq8t6s). put it in the same folder as DFfusion.exe. Run, paste what log.txt contains.
Title: Re: DFusion - a lua based plugin system v2.5
Post by: Deviled on February 13, 2011, 05:48:00 pm
Same thing, Should I have DfFusion.exe and dwarf fortress in the same folder?
Title: Re: DFusion - a lua based plugin system v2.5
Post by: darius on February 14, 2011, 11:35:08 am
Hmm... this is puzzling. No you don't need to put in the same directory. Try running with admin rights if on windows 7 or vista.
Title: Re: DFusion - a lua based plugin system v2.5
Post by: Rumrusher on February 16, 2011, 08:51:44 am
oh Darius about the removing legend information I really don't know how to do that... or target different body parts so that creatures with syndrome can cause a conversion.
Title: Re: DFusion - a lua based plugin system v2.5
Post by: darius on February 16, 2011, 09:00:15 am
oh Darius about the removing legend information I really don't know how to do that... or target different body parts so that creatures with syndrome can cause a conversion.

For legends:
Code: [Select]
engine.poke(creatureptr,ptr_Creature.legends,-1)
should work. As for second part, I don't quite understand what you mean...

It does not remove legends information per se, but it does remove the pointer to it. So for game it should look that creature has no legends info.
Title: Re: DFusion - a lua based plugin system v2.5
Post by: Rumrusher on February 16, 2011, 03:24:21 pm
darn it I tried to update the latest version of Dfusion for 31.19 and none of the commands work.
Title: Re: DFusion - a lua based plugin system v2.5
Post by: Viken on February 16, 2011, 04:55:52 pm
The .19 update of DF is so big that all of the memory addresses and whatnot have probably been shunted to different memory areas.  Toady has added hundreds of new items, animals, jobs, workshops and changed how the game is even played in some cases.  Everyone will need time to work on making their mods and the like work properly.

That said, I have greatly enjoyed DFusion myself, and I hope that I'll be able to use it again with the new releases.
Title: Re: DFusion - a lua based plugin system v2.5
Post by: Rumrusher on February 17, 2011, 02:19:49 am
oops I was too quick to say that all commands don't work.
I mean All Adv_tool commands don't work due to the code not finding the offset for AdvCreatureVec
every thing else from Embark any where to even Nano fort works. So I guess My theory on Toady does not change all his code and just adds on and alter the stuff that contradicts is true.
also I have good news the Hostility code in tools folder still works so if I could jerry wig the code for adventure mode I could make a temp replacement until the AdvCreatureVec code gets a update.
Title: Re: DFusion - a lua based plugin system v2.5
Post by: darius on February 17, 2011, 01:52:18 pm
Awesome not everything is broken :D now just to try to fix everything else...
Title: Re: DFusion - a lua based plugin system v2.5
Post by: Rumrusher on February 17, 2011, 02:32:15 pm
Awesome not everything is broken :D now just to try to fix everything else...
oh man let me say
Title: Re: DFusion - a lua based plugin system v2.5
Post by: darius on February 17, 2011, 02:45:06 pm
Need to make a test script that does all the testing in case of new version. That way at least i would know whats broken... Or invent an AI that does all the work instead of me. :D
Title: Re: DFusion - a lua based plugin system v2.5
Post by: Rumrusher on February 17, 2011, 03:43:03 pm
so far I had an idea of using Hostility coding as a temp fix until AdvCreatureVec offset is working.
but tampering with the code for adventure swapping caused a crash in Dwarf fortress.
Title: Re: DFusion - a lua based plugin system v2.6
Post by: darius on February 17, 2011, 06:21:51 pm
Ok. Tried to fix few(most) of errors. Good thing that they looked like easy fixes (except for legend id... it seems that the same vector is now used for lots of things and lots of creatures have stuff in it.)
Title: Re: DFusion - a lua based plugin system v2.6
Post by: Rumrusher on February 18, 2011, 06:28:08 pm
hmm looks like 2.6 doesn't have the updated zombie revival code where the creatures limbs come back and won't crash the game. oh and Darius thanks for updating this for 31.19 I can at least continue testing properties, like making a hurt function where one could target a part of a creature body(hopefully I can rig this to the lycan revival from .18 so night creatures can have their own personal conversion) but I don't know how to target certain limbs the code for revival seem to be selecting all limbs and you kinda left no indication on how to select a creature limb?
Title: Re: DFusion - a lua based plugin system v2.6
Post by: darius on February 18, 2011, 07:35:28 pm
To target specific limb you need to change only one value in vectors (hurt1,hurt2 and/or wounds). Which corresponds to which limb i don't know. E.g:
Code: [Select]
v2=engine.peek(vector:getval(indx),ptr_Creature.hurt1)
v2:setval(0,7) --remove zero-th limb or something... same with hurt2
Now i'm not really sure, i dont know what wounds vector does...
Title: Re: DFusion - a lua based plugin system v2.6
Post by: Rumrusher on February 18, 2011, 11:43:35 pm
To target specific limb you need to change only one value in vectors (hurt1,hurt2 and/or wounds). Which corresponds to which limb i don't know. E.g:
Code: [Select]
v2=engine.peek(vector:getval(indx),ptr_Creature.hurt1)
v2:setval(0,7) --remove zero-th limb or something... same with hurt2
Now i'm not really sure, i dont know what wounds vector does...
sweet atleast now I can throw in an if to the Select functions
--some time before writing all that above
work in a hurt separate part into the code that uses user input from what I got the creatures body parts are counted +4 to the next body type... or that what I guess from testing on a horse.
though losing a head and a leg the thing still alive... must be the lack of blood and bleed codes.
Code: [Select]
function rum_tools.Hurtselected()
    --repeat
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff,ptr_vector)
indx=GetCreatureAtPos(getxyz())
if indx<0 then return end
--print(string.format("%x",vector:getval(indx)))
v2=engine.peek(vector:getval(indx),ptr_Creature.hurt1)
v3=engine.peek(vector:getval(indx),ptr_Creature.hurt2)
v3.type=DWORD
print("select body part 0=upperbody,4=lowerbody,8=head,12=right front leg,16=left front leg,20=")
r=io.stdin:read()
print("select infliction")
d=io.stdin:read()
v2:setval(r,d)
v3:setval(r,d) --remove zero-th limb or something... same with hurt2
end
Title: Re: DFusion - a lua based plugin system v2.6
Post by: Brandon816 on February 26, 2011, 04:48:20 am
This isn't a really important bug, but there is a redundancy in your code. In the file "common.lua", the method "GetCreatureAtPos(x,y,z)" isn't really using the "x,y,z" parameters. The first line of the method is "x,y,z=getxyz()". You should either remove that line, or have the method not take any parameters, so that "getxyz()" isn't being called twice for one use.
Title: Re: DFusion - a lua based plugin system v2.7
Post by: darius on February 26, 2011, 06:12:25 am
This isn't a really important bug, but there is a redundancy in your code. In the file "common.lua", the method "GetCreatureAtPos(x,y,z)" isn't really using the "x,y,z" parameters. The first line of the method is "x,y,z=getxyz()". You should either remove that line, or have the method not take any parameters, so that "getxyz()" isn't being called twice for one use.
Good catch. Fixed it and updated.
Also added teleportation to adv_tools as requested by rumrusher.
Title: Re: DFusion - a lua based plugin system v2.7
Post by: Rumrusher on February 26, 2011, 01:48:23 pm
This isn't a really important bug, but there is a redundancy in your code. In the file "common.lua", the method "GetCreatureAtPos(x,y,z)" isn't really using the "x,y,z" parameters. The first line of the method is "x,y,z=getxyz()". You should either remove that line, or have the method not take any parameters, so that "getxyz()" isn't being called twice for one use.
Good catch. Fixed it and updated.
Also added teleportation to adv_tools as requested by rumrusher.
hmm so since the XYZ code is patch I might be able to get working on a Summon Teammates over to location.

[insert code for gotohell() and spawncomp() code here]
Code: [Select]
function rum_tools.butcher()
--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:flip(49) -- 49 is slaughter flag.
--flg:set(1,0) -- alive
--flg:set(13,1) -- skeleton

engine.poke(vector:getval(indx),ptr_Creature.flags,flg) --save flags
end
a butcher any creature code for those who want to snuff human caravans or nobles under the knife.
best make a slab for them so they won't go ghosting for revenge, but then removing the said ghost flag would work also.
Title: Re: DFusion - a lua based plugin system v2.7
Post by: darius on February 27, 2011, 11:55:02 am
Just noticed that give sentience does not work with new version, quick fix:
Code: [Select]
in plugins\tools\plugin.lua:
print("Caste name:"..engine.peekstr(off).."...")
off=engine.peekd(off+0x514)  -- <--change this to off=engine.peekd(off+0x524)
if(bit.band(engine.peekb(off+7),2)==2) then
will be updated next release.
Also quite cool to have a troll miner (with a kitty as a pet) which you can trim :D (and kobolds, they should lay eggs but started with three guys...)
Title: Re: DFusion - a lua based plugin system v2.7
Post by: Rumrusher on February 27, 2011, 04:32:52 pm
Just noticed that give sentience does not work with new version, quick fix:
Code: [Select]
in plugins\tools\plugin.lua:
print("Caste name:"..engine.peekstr(off).."...")
off=engine.peekd(off+0x514)  -- <--change this to off=engine.peekd(off+0x524)
if(bit.band(engine.peekb(off+7),2)==2) then
will be updated next release.
Also quite cool to have a troll miner (with a kitty as a pet) which you can trim :D (and kobolds, they should lay eggs but started with three guys...)
hmm also I was wondering do you find the address with a Hex editor like Cheat engine and write a code around it or do you do something different? I ask for the site changer been holding some outdated address and wonder how to fix it for getting a feel on how to add more plugins and maybe finding offsets for you.
edit. thanks for the guide.
Title: Re: DFusion - a lua based plugin system v2.7
Post by: darius on February 28, 2011, 05:53:01 pm
Warmist's illustrated guide to memory hacking.
(yup that is my 'real' name)
Part 1: static offset (site vector)
First of all I'm using a tool called "L'Spiros Memory hacking software" or MHS for short. You can find it by using google: like this (http://www.google.com/search?q=memory+hacking+software).
Usually the job to find some offset is:
But this is not the best way for things like vectors (they use pointers, which are slow to find and sometimes they act differently). But for that i made a helper function: offsets.getvectors(). Returns tables with most vectors (static i.e. global) and times it is used in code. Simplest way to use it would be like this:
Code: [Select]
for k,v in pairs(offsets.getvectors()) do -- for each entry (here k is address of vector, v is times used)
vec=engine.peek(k,ptr_vector) -- load vector
print("Looking into:"..string.format("%x used:%d size=%d",k,v,vec:size())) --print all info...
end
Pasted that into research\plugin.lua and ran when DF was in legends mode (excerpt):
Spoiler (click to show/hide)
Now seeing DF:
Spoiler (click to show/hide)
You probably can guess which one is the correct vector... (hint both are 55 in size). Now because memory tend to move in computers (in some not but better safe than sorry) lets modify research\plugin.lua a bit more:
Code: [Select]
for k,v in pairs(offsets.getvectors()) do
vec=engine.peek(k,ptr_vector)
if vec:size()==55 then -- look only for vector with 55 as size
print("Looking into:"..string.format("%x used:%d size=%d",k-offsets.base(),v,vec:size())) -- note the k-offsets.base()
end
end
Now there is only one hit and its:
Code: [Select]
Looking into:131de24 used:8 size=55
Lets test it. In tools\plugins.lua there is function "tools.getsite(names)". In that function update the offsites line:
Code: [Select]
local offsites=0x131DE24+offsets.base() --todo make normal offset
and test tools->change site.

Next time: maybe actually using the MHS... :D

Spoiler (click to show/hide)

Hope that this helps somebody and maybe makes something more clear...
Title: Re: DFusion - a lua based plugin system v2.7
Post by: Rumrusher on March 05, 2011, 04:22:58 am
well good news I discover how to store items... using Tweak. All I did was check on occupancy's 14-blood which cause any item on that tile to stay there when you leave so covering every tile with this you might get away with building an Adventure home in hell. Oh that and engrave/smooth stone accounts the tile to being apart of the site that on it so someone could get have much fun with out the need of lairs. Those getting the player forts to be save for retiring is my next step in custom adventure homes.
Title: Re: DFusion - a lua based plugin system v2.7
Post by: darius on March 05, 2011, 04:48:35 am
wow cool! Gonna play with it now... Actually it would not be that hard to implement this into DFusion (after all the offsets are known)
Edit: Tweak not working for me. Finds process and tile edit crashes when trying to read something.
Title: Re: DFusion - a lua based plugin system v2.7
Post by: Rumrusher on March 05, 2011, 08:10:33 pm
wow cool! Gonna play with it now... Actually it would not be that hard to implement this into DFusion (after all the offsets are known)
Edit: Tweak not working for me. Finds process and tile edit crashes when trying to read something.
tried using the pointer?
or getting the new version of it?
sleeping at the abandon site for a couple times leads to ambushes so it's best to make sure to prep traps for this sort of thing.
Title: Re: DFusion - a lua based plugin system v2.7
Post by: darius on March 06, 2011, 04:05:20 am
Using version from DFFD for 31.19_SDL, with pointer. I fear that it could be because of windows7 ASLR or just because my windows are 64bit.
EDIT: success, removing 0x40 flag from DLL_CHARACTERISTICS in pe header did the trick. Now it tweak works.
EDIT2: Made DFusion also work :) And built a first house for my adventurer

Edit3: here is code for that if somebody wants to test it.:
Code: [Select]
mapoffset=offsets.getEx("WorldData")
x=engine.peek(mapoffset+24,DWORD)
y=engine.peek(mapoffset+28,DWORD)
z=engine.peek(mapoffset+32,DWORD)
xblocks=engine.peek(mapoffset,DWORD)
for xx=0,x-1 do
for yy=0,y-1 do
for zz=0,z-1 do

yblocks=engine.peek(xblocks+xx*4,DWORD)
zblocks=engine.peek(yblocks+yy*4,DWORD)
myblock=engine.peek(zblocks+zz*4,DWORD)
if myblock~=0 then
for i=0,255 do
ff=engine.peek(myblock+0x67c+i*4,DWORD)
ff=bit.bor(ff,bit.lshift(1,14)) --set 14 flag to 1
engine.poke(myblock+0x67c+i*4,DWORD,ff)
end
end
end
end
end
and into offsets.lua:
Code: [Select]
function f_world()
local pos=offsets.base()
pos=offsets.find(pos+6,0xa1,ANYDWORD,0x8b,0x4c,0x88,0xFC,EOL)
print("offset:"..string.format("%x",pos))
if pos~=0 then
return engine.peekd(pos+1)-offsets.base()
end
return 0
end
offsets.new("WorldData",f_world)
and into offsets.txt (this is for 31.20):
Code: [Select]
WorldData : 0x1322128
Also not yet sure if all offsets work with 31.20 but it looks okay...
EDIT<somenumber>: the code above works but verryyy slowly...
Title: Re: DFusion - a lua based plugin system v2.7
Post by: Rumrusher on March 06, 2011, 03:59:10 pm
I would love to see your house you made.
Title: Re: DFusion - a lua based plugin system v2.7
Post by: darius on March 06, 2011, 04:34:40 pm
Hehe deleted with release of new version. It was 10x10 stone hut with cellar and a 20x10 crypt. One thing was annoying - it was a 4x4 embark so traveling into it and out took a lot of time. It's way easier to embar 2x2 and build something there. (almost) Did that on 31.20 but halfway through it got attacked by a titan :/
EDIT: OMG even reclaiming is so easy when everything does not scatter everywhere...
Title: Re: DFusion - a lua based plugin system v2.7
Post by: Rumrusher on March 07, 2011, 05:54:54 am
Hehe deleted with release of new version. It was 10x10 stone hut with cellar and a 20x10 crypt. One thing was annoying - it was a 4x4 embark so traveling into it and out took a lot of time. It's way easier to embar 2x2 and build something there. (almost) Did that on 31.20 but halfway through it got attacked by a titan :/
EDIT: OMG even reclaiming is so easy when everything does not scatter everywhere...
oh man I used Nano fort to make a 1x1 tile that way I won't have to walk 2 Embark tiles to my sites. also I wonder reclaim spam will build enough of a peasant army to protect the area at night.

the abandon site I have is a hole to the ground with a tweak path to the lair. the rooms to the left are pretty much experiments on optional death traps. one a vertex using a water wheel connected to two screw pumps with a treak hole that sucks victims into a chasm. next is a level attached to 4 wooden spikes and the room far to the right is filled with cage traps. which from past testing does not keep them cage if you leave the area. so pretty much any ideas of having a prison for bandits or a zoo of the crazy creatures that come in from the lair seem to be shut down until then.
also it seems that the site spawn loads of leather every where.
Title: Re: DFusion - a lua based plugin system v2.8
Post by: darius on March 07, 2011, 08:26:48 am
Updated DFusion to 2.8. Mostly offset fixes for 31.20/21 but also added marking of site as "cave". Although that could be slow but usually you don't need to run it more than once (basically it walks trough all tiles setting one flag- so more tiles more wait...)
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Rumrusher on March 09, 2011, 07:26:57 pm
Posting not on my main CPU but figured how to make a carry creature function using my old warp code. So far if any one uses the Xpointer on any living thing they will warp to the left side of them hold any one over open space will cause them to fall and take damage based on how deep the hole is but since the code repeats and corrects their Zlevels to the same the adventure is. The game will dribble their body until their dead(or the player go prone) which will end the carry code. Oh once my connection back I'll dump the code.
Title: Re: DFusion - a lua based plugin system v2.7
Post by: Thundercraft on March 10, 2011, 02:16:30 am
well good news I discover how to store items... using Tweak. All I did was check on occupancy's 14-blood which cause any item on that tile to stay there when you leave
...built a first house for my adventurer
It was 10x10 stone hut with cellar and a 20x10 crypt.
...
EDIT: OMG even reclaiming is so easy when everything does not scatter everywhere...

Holy crab apples! That's awesome! :o

Now all that's missing is a way to combine DFusion with DFMode (http://www.bay12forums.com/smf/index.php?topic=58809.0) in a way that allows swapping between Fortress Mode and Adventure Mode without all those unpleasant side effects (http://www.bay12forums.com/smf/index.php?topic=58809.msg2060966#msg2060966).

I don't suppose there is a way to prevent our pets and creatures from dying after Abandon fortress, is there? (Perhaps changing the ownership or friendship before Abandon?) Or maybe a way to prevent our dwarves from leaving the site area after Abandon? (Maybe by changing the parent civilization or something beforehand?)

I'm looking forward to the day when we can "Retire" a Fortress without actually Abandoning the site. And I'm not the only one:
'Retiring' forts is a crazy popular suggestion.  Just below gunpowder and steampunk in it's perennial nature.
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Rumrusher on March 10, 2011, 02:56:29 am
I remember from 40d is that when Abandoning Remove signs that they where Tamed(FLAG 26). usually that will save them from dying. hopefully I can figure out how to manually swap between Adventure mode and fort mode with out killing the fort .
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Askot Bokbondeler on March 10, 2011, 03:43:37 am
this is how it's done:

1 first, save your fortress as a lair using the dfusion "protect the site from item scattering" functionality
2 then run dfhack's reveal, leave it open
3 do the tricks required to swap to adventurer mode
4 fool around the world
5 return to your fortress
6 do the tricks required to swap to fortress mode
7 use runesmith to turn off the flag "is resident" on your friendly dwarves
8 before unpausing, unreveal your fortress tiles again using the reveal process you had already open


NOTE: it worked for me, but some dwarves were teleported into the unexplored depths, i haven't tried, but i suspect that if i use the fast mode of "protect the site from item scattering", only a few selected z levels are stored as a lair preventing the scattering of dwarves
also, always back up your save, it is extremely easy to screw up everything
Title: Re: DFusion - a lua based plugin system v2.8
Post by: darius on March 10, 2011, 04:55:37 am
Now another question: Can you play in two fortress this way :D (play in one-> adv mode-> travel -> fort mode in second-> adv mode->travel ->etc...)
Woah it worked... Unfortunately everyone killed each other (unpaused in arena mode) so horse traveled...
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Rumrusher on March 10, 2011, 06:41:58 am
Now another question: Can you play in two fortress this way :D (play in one-> adv mode-> travel -> fort mode in second-> adv mode->travel ->etc...)
Woah it worked... Unfortunately everyone killed each other (unpaused in arena mode) so horse traveled...
Mind Blown. wait so this will work if you took a Lair and convert it to a fort as well right? oh to remove/add "Is resident" from dwarves it's flag (51) so if I get as far as you guys in exploring Fort adv then running a code to search and remove add is key.
Title: Re: DFusion - a lua based plugin system v2.8
Post by: darius on March 10, 2011, 08:53:59 am
Found an interesting thing... If you go to other fort with adventurer it no longer is same size as it was. I suspect that made me lose last fort (my only adventurer moved too far...)

Edit: nope that does not work... It just quits after a while... :/
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Rumrusher on March 10, 2011, 05:51:05 pm
Found an interesting thing... If you go to other fort with adventurer it no longer is same size as it was. I suspect that made me lose last fort (my only adventurer moved too far...)

Edit: nope that does not work... It just quits after a while... :/
so is there a way to save in fort mode once you get there in adventure mode?
also due to bad internet connections I couldn't grab the new non .21-20 update for Dfusion and couldn't test out the lair building. but here's the carry code.
Code: [Select]
function rum_tools.carry()
   myoff=offsets.getEx("AdvCreatureVec")
   vector=engine.peek(myoff,ptr_vector)
   indx=GetCreatureAtPos(getxyz())
   --[[print("grab person how? N S E W") -- this was supposed to make it possible to grab the person in any direction other than West but if you could get it to work be I'm okay with it.
   --repeat
   r=io.stdin:read()
   if r=="N" then
      enty=(engine.peek(vector:getval(0),ptr_Creature.y)+1)
      end
   elseif r=="S" then
      enty=(engine.peek(vector:getval(0),ptr_Creature.y)-1)
      end
   elseif r=="W" then
      entx=(engine.peek(vector:getval(0),ptr_Creature.x)-1)
      end
   elseif r=="E" then
      entx=(engine.peek(vector:getval(0),ptr_Creature.x)+1)
      end]]--
   repeat
   flg=engine.peek(vector:getval(0),ptr_Creature.flags)
   flg2=engine.peek(vector:getval(0),ptr_Creature.flags)
   --print("how high?")
   --entry=io.stdin:read()
   Crepos=engine.peek(vector:getval(0),ptr_Creature.x)-1 --+entx
   move=engine.peek(vector:getval(0),ptr_Creature.z)+1 --this was for stunning enemies who would just use their new position to attack you for friendlies best remove this
   --print("W and E")
   --entry=io.stdin:read()
   --move2=engine.peek(vector:getval(0),ptr_Creature.x)
   --print("N and S") old code I had before you release your version
   --entry=io.stdin:read()
   move3=engine.peek(vector:getval(0),ptr_Creature.y) --+enty
   engine.poke(vector:getval(indx),ptr_Creature.z,move)
   engine.poke(vector:getval(indx),ptr_Creature.x,Crepos)
   engine.poke(vector:getval(indx),ptr_Creature.y,move3)
   until flg:get(15) ==1 or flg2:get(1) ==1
end

Title: Re: DFusion - a lua based plugin system v2.8
Post by: darius on March 11, 2011, 05:30:16 pm
*advertisement paid by Dragon hunters inc*
How are you boning your pray? Everybody knows that it needs extreeeemly sharp blades! Now guild of dragon hunters present newest creation:
(http://i.imgur.com/XTFLS.png)
Made by top mages in top towers! Buy yours today.
Price one(1) adamantinium coin
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Thundercraft on March 12, 2011, 11:48:09 am
Question:
The DFFD download page (http://dffd.wimbli.com/file.php?id=3354) says that the DFusion download is:
Quote
For DF version:   0.31.21

So, is only guaranteed compatible with 0.31.21? Or is backwards compatible as well?
If it is the latter, then perhaps the download page should say this instead?:
Quote
For DF version:   Multiple
Or, at least the description should mention backwards compatibility...?
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Rumrusher on March 12, 2011, 05:18:42 pm
Question:
The DFFD download page (http://dffd.wimbli.com/file.php?id=3354) says that the DFusion download is:
Quote
For DF version:   0.31.21

So, is only guaranteed compatible with 0.31.21? Or is backwards compatible as well?
If it is the latter, then perhaps the download page should say this instead?:
Quote
For DF version:   Multiple
Or, at least the description should mention backwards compatibility...?
I tried it's only for 31.21 you could attempt to get the offsets (-f)for any of the older versions but yeah you might end up not getting all features.
Title: Re: DFusion - a lua based plugin system v2.8
Post by: darius on March 12, 2011, 05:43:06 pm
It's kind of backwards/forward compatible. But when a new version comes some fixes change the static offsets or something in patters.lua that may brake backwards compatibility. I know that DFHack approach is superior (supporting versions from long ago) but I tend to do things a bit more chaotically and another reason is that this way i support Toady One and his patches no mater what (so nobody would get stuck in version X and say that we don't update because program Y does not have support for X version yet.)
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Thundercraft on March 13, 2011, 12:50:08 am
Well, that's a problem for me.  :(

Recently, I was excited about the new features of the latest DFusion and so I downloaded the new version, while deleting the old version. Now I find out that DFusion is version specific (unlike DFHack). I had already decided to stick with .18 and my old fort for a while longer. (Also, I'm waiting for a few more bug fixes and for more mods to catch up.)

So now I'm really wishing I had not deleted the old version...

I was not expecting the same level of backwards compatibility as DFHack, with support for versions from long ago. But I was expecting support of at least a few recent versions. (I think the way DFHack does this is by keeping all the old offsets and some of the old code and it checks the version of DF you have installed, automatically matching the offsets and code with the correct version.)

I can appreciate that you support Toady and his new releases. But there were major changes and lots of bugs with the recent versions. And not everyone is willing to just abandon their well established forts and/or their megaprojects every time a new release comes out.

Perhaps you would consider uploading a couple of the most recent DFusion versions on a free file host such as mediafire (http://www.mediafire.com/) or dropbox (http://www.dropbox.com/)? At least, some of the more popular mods and tools do this, such as the Lazy Newb Pack (http://www.bay12forums.com/smf/index.php?topic=59026.0), Phoebus' Graphic Set (http://www.bay12forums.com/smf/index.php?topic=57557.0), and Ironhand's Graphics Set (http://www.bay12forums.com/smf/index.php?topic=53180.0). For that matter, I doubt the Dwarf Fortress File Depot (http://dffd.wimbli.com/) would mind if you kept a few of the old versions around a while.
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Rumrusher on March 13, 2011, 01:43:03 am
Well, that's a problem for me.  :(

Recently, I was excited about the new features of the latest DFusion and so I downloaded the new version, while deleting the old version. Now I find out that DFusion is version specific (unlike DFHack). I had already decided to stick with .18 and my old fort for a while longer. (Also, I'm waiting for a few more bug fixes and for more mods to catch up.)

So now I'm really wishing I had not deleted the old version...

I was not expecting the same level of backwards compatibility as DFHack, with support for versions from long ago. But I was expecting support of at least a few recent versions. (I think the way DFHack does this is by keeping all the old offsets and some of the old code and it checks the version of DF you have installed, automatically matching the offsets and code with the correct version.)

I can appreciate that you support Toady and his new releases. But there were major changes and lots of bugs with the recent versions. And not everyone is willing to just abandon their well established forts and/or their megaprojects every time a new release comes out.

Perhaps you would consider uploading a couple of the most recent DFusion versions on a free file host such as mediafire (http://www.mediafire.com/) or dropbox (http://www.dropbox.com/)? At least, some of the more popular mods and tools do this, such as the Lazy Newb Pack (http://www.bay12forums.com/smf/index.php?topic=59026.0), Phoebus' Graphic Set (http://www.bay12forums.com/smf/index.php?topic=57557.0), and Ironhand's Graphics Set (http://www.bay12forums.com/smf/index.php?topic=53180.0). For that matter, I doubt the Dwarf Fortress File Depot (http://dffd.wimbli.com/) would mind if you kept a few of the old versions around a while.
really one of my problems with Dfusion or any Warmist work is that removal of the old versions.
I miss out on getting the latest 19 patch before he updated it for 21. though you could copy and paste your old save over I did so with a .17 save up to .19 and a 31.10 to a 31.18 though this may be a costumer fix than a producer fix and being able to go download a older version should be there in DffD.
Title: Re: DFusion - a lua based plugin system v2.8
Post by: darius on March 13, 2011, 04:54:42 am
Thundercraft try running DFusion with -f if that does not work. Try pasting into offsets.txt (its from 2.5 AFAIK its last version to work with 31.18):
Code: [Select]
AdvCreatureVec : 0x12a12c4
CreatureGloss : 0x12e5370
CreaturePtr : 0xacf848
CreatureVec : 0x12a12d4
CurrentRace : 0x10cdaf0
Legends : 0x12a1344
PlayerLegend : 0x1438bb4
StartDwarfs : 0x4f87e2
WordVec : 0x12e5520
Xpointer : 0x7127f0

If that does not work then i'll upload old versions somewhere...
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Rumrusher on March 13, 2011, 07:12:44 am
did anyone ever complied the list of things you can do with DFMODE that was found out?
because between your double fort plan and Askot's really hard to pull off method of swapping. have any one else discover any thing new during the release of the new function?
Though now I'm wondering would a lair turn players fort would as a alternative to a site if retiring their adventure is out of the question?
edit: good news DFusion users I just work out the kinks of my carry code now you can carry any one north south east or west.
Code: [Select]
function rum_tools.carryEX()
   myoff=offsets.getEx("AdvCreatureVec")
   vector=engine.peek(myoff,ptr_vector)
   indx=GetCreatureAtPos(getxyz())
   print("grab person how? N S E W")
   --repeat
   r=io.stdin:read()
   if r=="N" then
      repeat 
      flg=engine.peek(vector:getval(0),ptr_Creature.flags)
      flg2=engine.peek(vector:getval(indx),ptr_Creature.flags)
      enty=engine.peek(vector:getval(0),ptr_Creature.y)+1
      entx=engine.peek(vector:getval(0),ptr_Creature.x)
      move=engine.peek(vector:getval(0),ptr_Creature.z)
      engine.poke(vector:getval(indx),ptr_Creature.z,move)
      engine.poke(vector:getval(indx),ptr_Creature.x,entx)
      engine.poke(vector:getval(indx),ptr_Creature.y,enty)
      until flg:get(15) ==1 or flg2:get(1) ==1
   elseif r=="S" then
      repeat
      flg=engine.peek(vector:getval(0),ptr_Creature.flags)
      flg2=engine.peek(vector:getval(indx),ptr_Creature.flags)
      enty=engine.peek(vector:getval(0),ptr_Creature.y)-1
      entx=engine.peek(vector:getval(0),ptr_Creature.x)
      move=engine.peek(vector:getval(0),ptr_Creature.z)
      engine.poke(vector:getval(indx),ptr_Creature.z,move)
      engine.poke(vector:getval(indx),ptr_Creature.x,entx)
      engine.poke(vector:getval(indx),ptr_Creature.y,enty)
      until flg:get(15) ==1 or flg2:get(1) ==1
   elseif r=="W" then
      repeat
      flg=engine.peek(vector:getval(0),ptr_Creature.flags)
      flg2=engine.peek(vector:getval(indx),ptr_Creature.flags)
      entx=engine.peek(vector:getval(0),ptr_Creature.x)-1
      enty=engine.peek(vector:getval(0),ptr_Creature.y)
      move=engine.peek(vector:getval(0),ptr_Creature.z)
      engine.poke(vector:getval(indx),ptr_Creature.z,move)
      engine.poke(vector:getval(indx),ptr_Creature.x,entx)
      engine.poke(vector:getval(indx),ptr_Creature.y,enty)
      until flg:get(15) ==1 or flg2:get(1) ==1
   elseif r=="E" then
      repeat
      flg=engine.peek(vector:getval(0),ptr_Creature.flags)
      flg2=engine.peek(vector:getval(indx),ptr_Creature.flags)
      entx=engine.peek(vector:getval(0),ptr_Creature.x)+1
      enty=engine.peek(vector:getval(0),ptr_Creature.y)
      move=engine.peek(vector:getval(0),ptr_Creature.z)
      engine.poke(vector:getval(indx),ptr_Creature.z,move)
      engine.poke(vector:getval(indx),ptr_Creature.x,entx)
      engine.poke(vector:getval(indx),ptr_Creature.y,enty)
      until flg:get(15) ==1 or flg2:get(1) ==1
   end
end
also I'm going to work on combining both the carryEX with my wagon mode so that one could push the companion along their journey which means companion storage and if I'm lucky quick warp to the wagon if their wounded.
Title: Re: DFusion - a lua based plugin system v2.8
Post by: darius on March 14, 2011, 04:25:55 pm
I'm not sure but ptt_dfflag pattern changed a bit and might have broken some stuff... Maybe this would help:
Code: [Select]
function ptt_dfflag.set(self,num,val) --set to on or off one bit in flags
if(val==0) then val=false end --hehe c++ like fix...
if (self:get(num)~=val) then
self:flip(num)
end
end
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Rumrusher on March 15, 2011, 03:14:43 am
**
From Rumtech comes the wagonwarp for dumping items with time to spare or getting out of a lair with your hair. Call now and we throw in a free the Piggyback.The Piggyback has a mobile wagon attachment so anyone(on your friend list) could ride in 3x3 style. Yours now for easy 3 payments of 4 Slade coins.
Spoiler: "1-800-RUM-TECH" (click to show/hide)
Title: Re: DFusion - a lua based plugin system v2.8
Post by: addictgamer on March 15, 2011, 12:08:04 pm
*Takes out 10 Slade coins*
Thank you kind sir. Keep the change ^_^

Edit:
Running SDL .21 in windows:
Quote
F:\df_linux_31_21\df_31_21_win\df_fusion>DfFusion.exe
lua working ok!
Running lua file:common.lua
Found plugins:
1).patterns.lua
2).embark
3).friendship
4).migrants
5).simple_embark
6).research
7).adv_tools
8).tools
3
launching friendship...
race num:226
Invalid peek type
plugins/common.lua:99: attempt to index local 'vec' (a nil value)
F:\df_linux_31_21\df_31_21_win\df_fusion>echo Kay, hit enter.
Kay, hit enter.

F:\df_linux_31_21\df_31_21_win\df_fusion>pause
Press any key to continue . . .
Races.txt:
Quote
DWARF
HUMAN
Am I doing something wrong? Or is there an offset problem?
Title: Re: DFusion - a lua based plugin system v2.7
Post by: Langdon on March 22, 2011, 10:31:04 pm
well good news I discover how to store items... using Tweak. All I did was check on occupancy's 14-blood which cause any item on that tile to stay there when you leave
...built a first house for my adventurer
It was 10x10 stone hut with cellar and a 20x10 crypt.
...
EDIT: OMG even reclaiming is so easy when everything does not scatter everywhere...

Holy crab apples! That's awesome! :o

Now all that's missing is a way to combine DFusion with DFMode (http://www.bay12forums.com/smf/index.php?topic=58809.0) in a way that allows swapping between Fortress Mode and Adventure Mode without all those unpleasant side effects (http://www.bay12forums.com/smf/index.php?topic=58809.msg2060966#msg2060966).

I don't suppose there is a way to prevent our pets and creatures from dying after Abandon fortress, is there? (Perhaps changing the ownership or friendship before Abandon?) Or maybe a way to prevent our dwarves from leaving the site area after Abandon? (Maybe by changing the parent civilization or something beforehand?)

I'm looking forward to the day when we can "Retire" a Fortress without actually Abandoning the site. And I'm not the only one:
'Retiring' forts is a crazy popular suggestion.  Just below gunpowder and steampunk in it's perennial nature.


Ok, from various notes from Askot and Rumrusher, I have successfully "retired" my fortress - and it doesn't seem to have any bugs so far:

What I did:

1) used DFusion tools->"prevent items from scattering" function to "fix" parts of my fortress (basically moved the cursor over every floor, using "protect block around cursor" because I couldn't find a way to find the x y coordinates).

2) ran DFHack's dfmode, selected Adventure Mode, Direct Control

The screen will go black at this point, hiding most of the map.

3) used DFusion tools->Change Adventurer, selected a dead goblin (one of the hundreds in my refuse pile). I selected a goblin because my dwarves had scrolled off the top of my cmd window, but any dead entity will do.

4) without closing DFusion (i.e. pressing enter) go back to the fortress, ESC and save game.

5) Quit DF, restart it and reload. You will now be in adventure mode, possessing a dead goblin. It will now say "You are deceased."

6) Finish out to the main menu

7) Start a new adventurer, visit your old fortress to verify

The old fortress still has its old dwarves, and they act like normal townspeople (answer correctly to "Surroundings", which means they consider the fortress their home). I couldn't recruit my old militia, I guess due to insufficient fame, but was able to recruit a weaponsmith and a bowyer.

What's more, the fortress acts like normal game Mountain Hall, and I can retire my adventurer there.

Still have to test a bunch of stuff (reclaming, etc) but so far it looks like it's working correctly for adventure mode.

Edit: pets seem to be dead (can't find any alive) although the merchant caravan's animals are still alive and wandering about. I guess I have to stuff them in cages and use Runesmith to remove the tame flag before switching over.
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Rumrusher on March 22, 2011, 11:43:59 pm
Oh I should try that so you found out how to get Merchants or migrants with 'withering' if you Move into a mountain home as a adventurer and swap over to fort mode?
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Langdon on March 23, 2011, 12:09:51 am
Oh I should try that so you found out how to get Merchants or migrants with 'withering' if you Move into a mountain home as a adventurer and swap over to fort mode?

I've only really tried fortress->adventure yet, in truth I'm just looking for a way to gracefully "retire" a fort so I can go on to build a new one.

I'll try adventure->fortress tomorrow (I don't have a working version of Tweak, though, so I don't know how to go about building stuff if fortress mode doesn't work properly).

I believe you mentioned something about automatic abandon after some time when you build an adventurer fort? Is that what you meant by "withering"?
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Rumrusher on March 23, 2011, 12:41:53 am
Oh I should try that so you found out how to get Merchants or migrants with 'withering' if you Move into a mountain home as a adventurer and swap over to fort mode?

I've only really tried fortress->adventure yet, in truth I'm just looking for a way to gracefully "retire" a fort so I can go on to build a new one.

I'll try adventure->fortress tomorrow (I don't have a working version of Tweak, though, so I don't know how to go about building stuff if fortress mode doesn't work properly).

I believe you mentioned something about automatic abandon after some time when you build an adventurer fort? Is that what you meant by "withering"?
yeah withering what shows up on the header when it happens. from what I found if your on the embark site and swap over to fort mode then save you will be able to play it out but from my test of moving entire group of settlers over to a embark site 2 tiles away that the game after I think 2 weeks causes a force abandon. though I haven't tested the possibility of moving them back to the previous site to see if it still Force abandon or not. what I do know is you can just swap over to adventure mode and sleep past the day it strikes making the fort playable again.(The problem with this solution is that I think I'm missing out on either getting merchants, sieges, and more Dwarves.)
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Langdon on March 23, 2011, 02:17:30 am
yeah withering what shows up on the header when it happens. from what I found if your on the embark site and swap over to fort mode then save you will be able to play it out but from my test of moving entire group of settlers over to a embark site 2 tiles away that the game after I think 2 weeks causes a force abandon. though I haven't tested the possibility of moving them back to the previous site to see if it still Force abandon or not. what I do know is you can just swap over to adventure mode and sleep past the day it strikes making the fort playable again.(The problem with this solution is that I think I'm missing out on either getting merchants, sieges, and more Dwarves.)

It seems that's because there's still a missing flag on units that indicates they are a member of the fortress. No units on map that have the "member of fortress" flag turned on = withering away at the next check.

If you find that flag and switch it on for at least one unit that might prevent the withering. Maybe it's civ membership? Maybe you need to create a civ subgroup that "owns" that fortress, and move over civ membership to that group?

or maybe just hijack an existing civ subgroup (perhaps from a previous player fortress).

As to getting merchants/migrants, there's something in the fort data that isn't initialized properly (again maybe parent civ/civ subgroup relations?).

For now I just plan to schlep adventurers to a site then embark/reclaim there if I want to put my adventurers in a fort. I'm going to think of it as needing to hire a dwarven construction crew if I want to build something.
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Rumrusher on March 23, 2011, 03:17:27 am
yeah withering what shows up on the header when it happens. from what I found if your on the embark site and swap over to fort mode then save you will be able to play it out but from my test of moving entire group of settlers over to a embark site 2 tiles away that the game after I think 2 weeks causes a force abandon. though I haven't tested the possibility of moving them back to the previous site to see if it still Force abandon or not. what I do know is you can just swap over to adventure mode and sleep past the day it strikes making the fort playable again.(The problem with this solution is that I think I'm missing out on either getting merchants, sieges, and more Dwarves.)

It seems that's because there's still a missing flag on units that indicates they are a member of the fortress. No units on map that have the "member of fortress" flag turned on = withering away at the next check.

If you find that flag and switch it on for at least one unit that might prevent the withering. Maybe it's civ membership? Maybe you need to create a civ subgroup that "owns" that fortress, and move over civ membership to that group?

or maybe just hijack an existing civ subgroup (perhaps from a previous player fortress).

As to getting merchants/migrants, there's something in the fort data that isn't initialized properly (again maybe parent civ/civ subgroup relations?).

For now I just plan to schlep adventurers to a site then embark/reclaim there if I want to put my adventurers in a fort. I'm going to think of it as needing to hire a dwarven construction crew if I want to build something.
Oh I found out that using the flag changer 51 or if that doesn't work use runesmith and remove the 'is resident tag' make the the nonplayable dwarfs that are on site playable. so that you could get your adventurer to build on the site though slapping on tame(number 26 if using Dfusion flag changer) tag also work too just remember to remove it.
if your case on caging wild animals prevents them from dying works then maybe I can use Adventure traps and my Carry code to cage humans and bandits and make a prison system.
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Viken on March 27, 2011, 06:22:13 pm
Any way to get DFusion updated to the new releases? I'm missing my good features!  :'(
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Rumrusher on March 27, 2011, 07:51:39 pm
Any way to get DFusion updated to the new releases? I'm missing my good features!  :'(
-f in the CMD command.
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Viken on March 27, 2011, 07:58:52 pm
The -f compiles the new offsets, but none of them match for the 31.24 Phoebus.   >:(  Gah! I want more embarkment dwarves.
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Rumrusher on March 28, 2011, 12:30:24 pm
The -f compiles the new offsets, but none of them match for the 31.24 Phoebus.   >:(  Gah! I want more embarkment dwarves.
dang it .25 just came out. I think Darius is in hiding until the update wave calms down sorry best think now is to either help find the offsets or settle down with the reasonable Dfusion version and wait out the update storm. I'd stop at 21 or 19 at best.
Title: Re: DFusion - a lua based plugin system v2.8
Post by: darius on March 28, 2011, 01:41:34 pm
The -f compiles the new offsets, but none of them match for the 31.24 Phoebus.   >:(  Gah! I want more embarkment dwarves.
dang it .25 just came out. I think Darius is in hiding until the update wave calms down sorry best think now is to either help find the offsets or settle down with the reasonable Dfusion version and wait out the update storm. I'd stop at 21 or 19 at best.
Hehe i almost came out when 24 was out :D
Now i'll wait for a day or something (new version will be out on weekend for sure maybe earlier)
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Rumrusher on March 28, 2011, 01:52:46 pm
The -f compiles the new offsets, but none of them match for the 31.24 Phoebus.   >:(  Gah! I want more embarkment dwarves.
dang it .25 just came out. I think Darius is in hiding until the update wave calms down sorry best think now is to either help find the offsets or settle down with the reasonable Dfusion version and wait out the update storm. I'd stop at 21 or 19 at best.
Hehe i almost came out when 24 was out :D
Now i'll wait for a day or something (new version will be out on weekend for sure maybe earlier)
oh yeah I found out that teleport waste can be clean up by removing the creature tag on the tile the creature was on before teleporting. so coding a previous tile flag removal might free up space.
Darius how's your Adventure forts? because I learn that recent embark forts are safer than old embarks which I should have figured that when you tested out the double fort thing.
Title: Re: DFusion - a lua based plugin system v2.8
Post by: darius on March 28, 2011, 03:33:44 pm
The -f compiles the new offsets, but none of them match for the 31.24 Phoebus.   >:(  Gah! I want more embarkment dwarves.
dang it .25 just came out. I think Darius is in hiding until the update wave calms down sorry best think now is to either help find the offsets or settle down with the reasonable Dfusion version and wait out the update storm. I'd stop at 21 or 19 at best.
Hehe i almost came out when 24 was out :D
Now i'll wait for a day or something (new version will be out on weekend for sure maybe earlier)
oh yeah I found out that teleport waste can be clean up by removing the creature tag on the tile the creature was on before teleporting. so coding a previous tile flag removal might free up space.
Darius how's your Adventure forts? because I learn that recent embark forts are safer than old embarks which I should have figured that when you tested out the double fort thing.
Fort got killed by goblins. Later my adventurers killed two forgotten beasts (they were walled off in fort) but got killed by a goblin spearman. Now i'm too lazy to level up an adventurer to make it to that epic fort (although now it has a lot of epic stuff). Newest idea is to make a fort to make adamantine items+ some steel weapons, maybe adamantine clothes :D and then travel to my fort :)
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Rumrusher on March 28, 2011, 04:48:46 pm
The -f compiles the new offsets, but none of them match for the 31.24 Phoebus.   >:(  Gah! I want more embarkment dwarves.
dang it .25 just came out. I think Darius is in hiding until the update wave calms down sorry best think now is to either help find the offsets or settle down with the reasonable Dfusion version and wait out the update storm. I'd stop at 21 or 19 at best.
Hehe i almost came out when 24 was out :D
Now i'll wait for a day or something (new version will be out on weekend for sure maybe earlier)
oh yeah I found out that teleport waste can be clean up by removing the creature tag on the tile the creature was on before teleporting. so coding a previous tile flag removal might free up space.
Darius how's your Adventure forts? because I learn that recent embark forts are safer than old embarks which I should have figured that when you tested out the double fort thing.
Fort got killed by goblins. Later my adventurers killed two forgotten beasts (they were walled off in fort) but got killed by a goblin spearman. Now i'm too lazy to level up an adventurer to make it to that epic fort (although now it has a lot of epic stuff). Newest idea is to make a fort to make adamantine items+ some steel weapons, maybe adamantine clothes :D and then travel to my fort :)
oh from what I know you could go straight from Adventure mode to the fort and not have to deal with the weak abandoning issue if you do the retire thing. I could be wrong and it simpler than that.
oh I just got an idea of building a fort out of the bodies of enemies but I need two things
one for toady to fix the corpsepiece tag in adventure reaction so I can craft sentient bodies again.
two see if I can ADv.Craft blocks if I can then I could build MEAT blocks and form them into meat walls.
if those two are able then here's to (someone) making an organic model of MEAT BOY STEVE from minecraft. though I wonder if going out and Killing enough creatures to make a model a challenge or building it in fort mode?
Title: Re: DFusion - a lua based plugin system v2.8
Post by: meowmix on April 01, 2011, 11:14:55 am
which version of dwarf fortress is dfusion compatible for right now? cause i cannot get the resurrect option to work at all in the newest dwarf fort version, and previous ones either.
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Rumrusher on April 01, 2011, 12:58:37 pm
which version of dwarf fortress is dfusion compatible for right now? cause i cannot get the resurrect option to work at all in the newest dwarf fort version, and previous ones either.
I stop at .21 since after that was just bug fixes.
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Taricus on April 02, 2011, 05:19:55 pm
Is it possible to use this with .25?
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Langdon on April 02, 2011, 06:43:36 pm
Is it possible to use this with .25?

I tried it, couldn't find the correct offsets.

Hehe i almost came out when 24 was out :D
Now i'll wait for a day or something (new version will be out on weekend for sure maybe earlier)

Darius says this weekend, so I'm going to wait till Monday. Otherwise the last working version seems to be for .21.
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Rumrusher on April 02, 2011, 06:55:10 pm
Is it possible to use this with .25?

I tried it, couldn't find the correct offsets.

Hehe i almost came out when 24 was out :D
Now i'll wait for a day or something (new version will be out on weekend for sure maybe earlier)

Darius says this weekend, so I'm going to wait till Monday. Otherwise the last working version seems to be for .21.
well kinda found out that the site changer still bonked. so no ability to turn a players fort into a hamlet.
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Langdon on April 03, 2011, 12:19:03 am
Is it possible to use this with .25?

I tried it, couldn't find the correct offsets.

Hehe i almost came out when 24 was out :D
Now i'll wait for a day or something (new version will be out on weekend for sure maybe earlier)

Darius says this weekend, so I'm going to wait till Monday. Otherwise the last working version seems to be for .21.
well kinda found out that the site changer still bonked. so no ability to turn a players fort into a hamlet.

Oh. So that's why I could never get it to work. So the fully working version is .19?
Title: Re: DFusion - a lua based plugin system v2.8
Post by: devek on April 03, 2011, 12:22:41 am
Is it possible to use this with .25?

I tried it, couldn't find the correct offsets.

Hehe i almost came out when 24 was out :D
Now i'll wait for a day or something (new version will be out on weekend for sure maybe earlier)

Darius says this weekend, so I'm going to wait till Monday. Otherwise the last working version seems to be for .21.

Let him come out when he feels comfortable. :D
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Langdon on April 03, 2011, 01:08:48 am
Is it possible to use this with .25?

I tried it, couldn't find the correct offsets.

Hehe i almost came out when 24 was out :D
Now i'll wait for a day or something (new version will be out on weekend for sure maybe earlier)

Darius says this weekend, so I'm going to wait till Monday. Otherwise the last working version seems to be for .21.

Let him come out when he feels comfortable. :D

No rush, I'm actually still playing on .21.
Title: Re: DFusion - a lua based plugin system v2.8
Post by: devek on April 03, 2011, 03:29:08 am
It's ok, my lame joke was playing on .22
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Rumrusher on April 03, 2011, 09:58:36 am
well experimenting with Langdon's Retire fort and my Save swap leads to some interesting events
one you can build and retire in the fort if done successfully thus makes chances of Bay12 Cribs more reality and creating a new community game called Settlers/migrant succession(where people must take their dwarven adventurer/Settler/migrant and reach the embark site and build their own room in the place.)
two don't place nano forts next to other player forts because the the two forts will over lap thus causing the game to clean wipe everything in the fort your on. though this doesn't mean you can't have a nano forts with non site gaps between them.

oh man so who up for starting one of those migrant successions?
Title: Re: DFusion - a lua based plugin system v2.8
Post by: darius on April 03, 2011, 04:07:16 pm
Damn it's been a long time since I did this. Having trouble with world offset (this one is used to get tile data).
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Rumrusher on April 03, 2011, 05:34:21 pm
So Do I need to find the Attack offset first before getting Dfusion to throw out dragon breathe and webber?
Title: Re: DFusion - a lua based plugin system v2.8
Post by: Andux on April 03, 2011, 08:36:30 pm
Having trouble with world offset (this one is used to get tile data).

Tile data offsets (http://df.magmawiki.com/index.php/DF2010:Memory_hacking#Tile_data_offsets) changed between 0.31.21 and .22; could that be causing issues?
Title: Re: DFusion - a lua based plugin system v2.9
Post by: darius on April 04, 2011, 09:46:32 am
Having trouble with world offset (this one is used to get tile data).

Tile data offsets (http://df.magmawiki.com/index.php/DF2010:Memory_hacking#Tile_data_offsets) changed between 0.31.21 and .22; could that be causing issues?
That really helped.

Updated DFusion to v2.9. Due to time constrains couldn't test it fully but mostly it works. Also there is patterns2.lua that could be used to get RTTI (run time type information) which is useful to determine some things about polymorphic objects (like items, or some misc info each creature has in legends vector). See research folder for a bit more info...
Title: Re: DFusion - a lua based plugin system v2.9
Post by: ral on April 12, 2011, 01:32:40 am
posting to watch
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Brisk on April 14, 2011, 04:12:58 pm
I feel like I am missing some obvious step. How exactly do you run DFusion?

I have a fresh un-modded 31.25 version of DF
I click DfFusion and a box pops up

DfFusion.exe - Application Error
The application failed to initialize properly (0x0150002), Click on OK to terminate the application.
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Rumrusher on April 14, 2011, 09:39:44 pm
I feel like I am missing some obvious step. How exactly do you run DFusion?

I have a fresh un-modded 31.25 version of DF
I click DfFusion and a box pops up

DfFusion.exe - Application Error
The application failed to initialize properly (0x0150002), Click on OK to terminate the application.
do you have a xp x64? because that the same issue I have on my "new" PC.
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Brisk on April 14, 2011, 10:22:54 pm
I feel like I am missing some obvious step. How exactly do you run DFusion?

I have a fresh un-modded 31.25 version of DF
I click DfFusion and a box pops up

DfFusion.exe - Application Error
The application failed to initialize properly (0x0150002), Click on OK to terminate the application.
do you have a xp x64? because that the same issue I have on my "new" PC.

No. I do have Windows XP Professional but the 32 bit version.
Title: Re: DFusion - a lua based plugin system v2.9
Post by: darius on April 15, 2011, 12:10:10 am
 ??? quick googling showed me that its most probably some dll i'm not including. I'll try to find it when i get home. Till then you could try using http://www.dependencywalker.com/ and searching in the internet to find missing dlls.
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Rumrusher on April 15, 2011, 01:27:06 am
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.
Code: [Select]
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
Code: [Select]
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
.
Title: Re: DFusion - a lua based plugin system v2.9
Post by: darius on April 15, 2011, 04:54:14 pm
Ok probably it's MSVCR80.DLL that is neede by lua.dll (i hate this windows dependancy mess) i might try recompiling lua.dll or just integrating it. Till then either install microsoft visual c redistribute (not sure witch version) or just google for this file.
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Brisk on April 15, 2011, 05:31:37 pm
Ok probably it's MSVCR80.DLL that is neede by lua.dll (i hate this windows dependancy mess) i might try recompiling lua.dll or just integrating it. Till then either install microsoft visual c redistribute (not sure witch version) or just google for this file.

I used the dependency program to find and install the following .dll
msvcr80
ieshims
wer
mpr
ncrypt
bcrypt

then I tried installing microsoft visual c redistribute 2010

still no dice. just to check I downloaded DFusion onto an older machine. It is Windows XP home edition. worked like a charm no problem.

*sigh*
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Rumrusher on April 16, 2011, 12:36:29 am
man working on a make civ members follow function and boy it making my head thump. if I perfect this code users could be able to mass recruit their entire fort in adventure mode then raid other forts.
though doing so now would be for either striking human settlements or taking down megabeasts.
which I can't see right now.... well mostly due to the horrible fact that I still haven't got a single adventurer to tie the knot and push out babies.

edit: here is a untested Rough Draft of the Selecting Fort members and the turning Fort members into simple Companions that and the ability to remove Is resident to all members with the same civ number you have. reclaiming a fort may lead to some issues with the game changing the Civ number but at least we figured out how to make past members work now.
Code: [Select]

function selectciv()
  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)
     local crciv=engine.peek(off,ptr_Creature.civ)
     local curciv=engine.peek(vector:getval(0),ptr_Creature.civ)
     if curciv==crciv then
     --[[local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(1)==false then]]--  --if dead ...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end

function rum_tools.returnfort()
--this should select and remove is resident from fort
myoff=offsets.getEx("AdvCreatureVec")
local trgs=selectciv()
for k,v in pairs(trgs) do
--vector=engine.peek(myoff,ptr_vector)
--indx=GetCreatureAtPos(getxyz())
--indx=0
--print(string.format("%x",vector:getval(indx)))
flg=engine.peek(v,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(v,ptr_Creature.flags,flg) --save flags
end

function rum_tools.civFollow()
--first three lines same as before (because we will need an offset of creature at location x,y,z)
myoff=offsets.getEx("AdvCreatureVec")
local trgs=selectciv()
for k,v in pairs(trgs) do

print(string.format("current creature:%x",k))
trgid=engine.peek(vector:getval(0),ptr_Creature.ID)
engine.peek(v,ptr_Creature.followID) --get players ID
--[[lfollow=engine.peek(v,ptr_Creature.followID) -- get target creatures "now following ID"
if lfollow ~=0xFFFFFFFF then --if its set]]--
engine.poke(v,ptr_Creature.followID,trgid) -- if not just write the players ID.
end
end
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Cardinal on April 17, 2011, 09:29:48 pm
Tried to use this to change a site type but no matter what I type into the search parameter, I never get a site to change.  Am I supposed to do this while in Dwarf Mode, Adventure Mode, Embark??  I just want to make a player-controlled mountain hall into a not-player controlled (abandoned, though, I'm not trying to retire a fort, yet).  Can somebody walk me through this?  A very slow, very detailed, suitable for children kind of walkthrough would be the best kind.
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Rumrusher on April 18, 2011, 12:48:28 am
Tried to use this to change a site type but no matter what I type into the search parameter, I never get a site to change.  Am I supposed to do this while in Dwarf Mode, Adventure Mode, Embark??  I just want to make a player-controlled mountain hall into a not-player controlled (abandoned, though, I'm not trying to retire a fort, yet).  Can somebody walk me through this?  A very slow, very detailed, suitable for children kind of walkthrough would be the best kind.
one we need to know your pc specs and which DF version you have this could be a case of outdated site offset(oh and you can use Site changer in any mode even legends). I'm really confused in your suggestion as langdon retiring turns a players fort(what it's called in Site changer) into non playable Mountain halls. though I guess your in a fort now and want another player site converted. well I'll tell you this doing so will wipe all work on the fort and leave nothing but a empty flat plane.
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Cardinal on April 18, 2011, 10:39:10 am
I'm using DF .25 on Win7 with the latest DFusion.  I didn't realize changing the site type would wipe out the fortress.  I thought it would just change the way it was treated when you were looking at it from the map (that it couldn't be reclaimed).  I wanted to change a player fort into a mountain halls (so it couldn't be reclaimed) but I didn't want to wipe out the fort.

If there's another way to set up an abandoned player fort so that it is no longer available to be reclaimed, I'd be happy to do it that way.
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Rumrusher on April 18, 2011, 12:17:45 pm
I'm using DF .25 on Win7 with the latest DFusion.  I didn't realize changing the site type would wipe out the fortress.  I thought it would just change the way it was treated when you were looking at it from the map (that it couldn't be reclaimed).  I wanted to change a player fort into a mountain halls (so it couldn't be reclaimed) but I didn't want to wipe out the fort.

If there's another way to set up an abandoned player fort so that it is no longer available to be reclaimed, I'd be happy to do it that way.
simple you have to retire an adventurer/fort pull up a dummy one walk over to the site switch to fort mode then murder the adventurer using a utility then switch back into adventure mode. then end the game. you will then have to just remember not to REclaim the site next time but will be known as a mountain home.
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Cardinal on April 18, 2011, 02:13:55 pm
simple you have to retire an adventurer/fort pull up a dummy one walk over to the site switch to fort mode then murder the adventurer using a utility then switch back into adventure mode. then end the game. you will then have to just remember not to REclaim the site next time but will be known as a mountain home.

Could you be a little more detailed about this?  Specifically:

When you say I need to retire an adventurer/fort, what do you mean?  and "pull up a dummy one" does that mean a new fort or new adventurer?

When you say I walk over to the site, does that mean that I should run DFusion when I have an adventurer standing at the site which I want to change-type for?

How do I switch to fort mode from adventure mode?  DFHack?

Is the site still going to show up on the reclaim list?  That's one of the things I wanted to avoid.  If someone tries to reclaim it, does that mean it'll crash DF?

I appreciate all the effort you guys have put into this, but some decent tutorials would help immensely on using DFusion.

Title: Re: DFusion - a lua based plugin system v2.9
Post by: darius on April 18, 2011, 02:55:55 pm
Quote
I appreciate all the effort you guys have put into this, but some decent tutorials would help immensely on using DFusion.

Hehe... this was originally intended as a programmers tool to make something more user-friendly later. This however never moved on to the user-friendliness. I guess a gui would help a lot?..

Rumrusher: your signature link is broken.

Also what helps debuggin:
Code: [Select]
-- import debug -- not sure if needed
print(debug.traceback())

this shows a stack trace (in theory... would be more useful if called on error...)
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Rumrusher on April 18, 2011, 06:46:38 pm
Quote
I appreciate all the effort you guys have put into this, but some decent tutorials would help immensely on using DFusion.

Hehe... this was originally intended as a programmers tool to make something more user-friendly later. This however never moved on to the user-friendliness. I guess a gui would help a lot?..

Rumrusher: your signature link is broken.

Also what helps debuggin:
Code: [Select]
-- import debug -- not sure if needed
print(debug.traceback())

this shows a stack trace (in theory... would be more useful if called on error...)
programmer's tool it is. I made just about 30 different commands and functions for this thing from temp controlling zombies, companions, to making a makeshift grab command for dragging companions, friendlies, enemies across areas that they can't path through. I have to say thanks Darius for getting me into Df hacking.
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Cardinal on April 18, 2011, 08:23:26 pm
programmer's tool it is. I made just about 30 different commands and functions for this thing from temp controlling zombies, companions, to making a makeshift grab command for dragging companions, friendlies, enemies across areas that they can't path through. I have to say thanks Darius for getting me into Df hacking.

And it looks like a great tool!  Alright, let's start simply:

1.  Where should I be in the game when I open up DFusion and select option 7 (tools), sub-option 6 (site type).  Should I be in adventure mode?  Fortress mode?  Should I be in adventure mode at the site in question?  Assume I have just abandoned my fortress and I'd like to change its site type (or fix items or whatever else is available in option 7).

2.  When the tool prompts me with "Type words that are in the site name, FULLCAPS..." should I be typing in the a substring of the site name, the full name, its translated name or what?

I know if may seem tedious to explain this to a schlomo, but I promise I'll use it for good.
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Rumrusher on April 19, 2011, 01:34:18 am
programmer's tool it is. I made just about 30 different commands and functions for this thing from temp controlling zombies, companions, to making a makeshift grab command for dragging companions, friendlies, enemies across areas that they can't path through. I have to say thanks Darius for getting me into Df hacking.

And it looks like a great tool!  Alright, let's start simply:

1.  Where should I be in the game when I open up DFusion and select option 7 (tools), sub-option 6 (site type).  Should I be in adventure mode?  Fortress mode?  Should I be in adventure mode at the site in question?  Assume I have just abandoned my fortress and I'd like to change its site type (or fix items or whatever else is available in option 7).

2.  When the tool prompts me with "Type words that are in the site name, FULLCAPS..." should I be typing in the a substring of the site name, the full name, its translated name or what?

I know if may seem tedious to explain this to a schlomo, but I promise I'll use it for good.
I think Darius explain this when he added it but the first can be done any where it that you need the non plural word of the name like flowersgates has to be typed out as "FLOWER" "GATE"
I learn that to make my life simple to just name the forts simple to spell names that does not have different meanings of the word or to site change the recent player fort which is always the second to last number on the list. though experiments in site changing only lead to two things one premade forts and hamlets or a wipe out plane.
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Cardinal on April 19, 2011, 10:35:59 am
So is there a no-reclaim tag that can be changed somewhere, instead of changing the site?
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Rumrusher on May 04, 2011, 11:57:13 am
well I just posted all my functions on the first 2 posts of this thread so hopefully no one would get lost having to find the necromancer command.
Title: Re: DFusion - a lua based plugin system v2.9
Post by: darius on May 04, 2011, 12:08:14 pm
Also copy this into init.lua for easier lua code error debugging:
Code: [Select]
function err(msg) --function that intercepts error
print (msg) --print old message
print (debug.traceback()) -- print stack (the function call list)
end
function dofile(filename)
return xpcall(loadfile(filename),err)
end
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Rumrusher on May 04, 2011, 04:50:21 pm
well with the mix of Dfmode and getting every one to be a perma companion the DF community can now build LARGE armies and raid forts now.
all what I need to figure out is how to take turns swapping between forts with out having the player deal with the small time frame to play in.
I guess the person has to retire the adventurer then reclaim or build the fort. do Langdon's retire trick to regain access to the fort due to the fort been the recent active fort they could continue in fort mode as along as they want.
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Angel Of Death on May 07, 2011, 02:59:38 am
This is compatable with the latest version of DF, right?
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Selenite on May 07, 2011, 03:23:45 am
This is compatable with the latest version of DF, right?

Yep.
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Rumrusher on May 07, 2011, 12:21:57 pm
yep ish Darius kinda flipped the coding of Flags around before making changes to the rest leading to some old commands I made not working.
it's been fixed so you don't have to worry that much just make sure you check if the Wagon mode command say true and false in the If line and not 1 or 0, else you'll end up having the command flip the flag.
oh and darius zombie function still wonked just grab mine from the first post I made in this thread.

edit: okay just finish working on a way to build a mini army from using Runesmith to swap over to the hamlet's civ and run a function that auto joins the members of the civ.
so far I got up to 2 towns following me and up to 89270 orc companions. I also made a civ converter so I can use them for the fort as haulers or militia.

like to announce site changer still bonked.
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Angel Of Death on May 29, 2011, 04:46:45 am
How do I use this to swap to an adventurer while playing fort?
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Rumrusher on May 29, 2011, 06:29:35 am
How do I use this to swap to an adventurer while playing fort?
Adv_tools
"?change adv permanent?"
use the pointer on the creature you want to play as.
or
Tools
"change adventurer"
Select the creature from the list and choose "stay with legends " so that you don't end up playing as a crundle when you Fast travel.
Title: Re: DFusion - a lua based plugin system v2.9
Post by: The Scout on June 04, 2011, 02:58:45 pm
How does this work? I hit 6, for simple embark, type in 56, and I still have 7 dwarves. Can someone explain?
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Halconnen on June 04, 2011, 05:08:18 pm
Hmm, just tried this for the first time in a long while, on an unmodded 31.25, with the stock scripts. Apologies if this has been asked before, I paged through about ten pages of the thread, with no mention of it yet. Woop.

Used embark with the defaults, and correctly got a kobold, gremlin and elf as part of the initial seven.

Used friendship and they started doing their jobs.

However, I still can't appoint them as nobles. Is there anything else I have to do to make this work or is it not possible? Chief medical gremlin wants his work.
Title: Re: DFusion - a lua based plugin system v2.9
Post by: darius on June 04, 2011, 07:18:45 pm
Hmm, just tried this for the first time, on an unmodded 31.25, with the stock scripts. Apologies if this has been asked before, I paged through about ten pages of the thread, with no mention of it yet. Woop.

Used embark with the defaults, and correctly got a kobold, gremlin and elf as part of the initial seven.

Used friendship and they started doing their jobs.

However, I still can't appoint them as nobles. Is there anything else I have to do to make this work or is it not possible? Chief medical gremlin wants his work.
If you use friendship too late (when the map already is started) you can't appoint THOSE creatures to nobles/military but new waves (and children who grow up) will be allowed to be nobles and/or military. This is due to how DF makes lists and does not update them until it needs to. I forget but maybe even old creatures are added to those list later...
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Halconnen on June 05, 2011, 04:19:26 am
Ah, awesome, thank you. I somehow got the impression you had to use friendship after the map was loaded. Woops.

Is there any way to select caste, rather than just race, during embark? :o
Title: Re: DFusion - a lua based plugin system v2.9
Post by: darius on June 05, 2011, 05:05:21 am
Ah, awesome, thank you. I somehow got the impression you had to use friendship after the map was loaded. Woops.

Is there any way to select caste, rather than just race, during embark? :o
Unfortunately not yet. You need to run both friendship and embark setting when in map selecting where to embark for best effect.
Title: Re: DFusion - a lua based plugin system v2.9
Post by: Halconnen on June 05, 2011, 05:31:04 am
Heheh, thank you for the quick responses.

Alas, yeah, I just remembered I already asked about the caste thing back on page 3. Woopsie. Still probably my most wanted feature.
Title: Re: DFusion - a lua based plugin system v2.9
Post by: darius on June 05, 2011, 07:10:27 am
Heheh, thank you for the quick responses.

Alas, yeah, I just remembered I already asked about the caste thing back on page 3. Woopsie. Still probably my most wanted feature.
MUAHJAHAHA

added castes to embark thingy... And it even works :)

Format is e.g. "ANT_MAN:0" -> first caste woman worker, "ANT_MAN" -> random caste (same as ANT_MAN:-1).
Edit: hmm something is not right a bit...
Edit2: oh its okay. usually 0 will be female 1 will be male, some don't have castes and will crash DF if you enter bigger number than caste count
Title: Re: DFusion - a lua based plugin system v3.0
Post by: Halconnen on June 05, 2011, 07:40:44 am
Now that was fast. =D

Will be playing around with this a lot a bit later today~.

Edit: Works. This is perfect. I love you. Thank you. <3
Title: Re: DFusion - a lua based plugin system v3.0
Post by: Rumrusher on June 05, 2011, 11:51:20 am
so does this mean I can swap around castes with the race changer oh and is Site changer fixed?
oh and due to issues I can't get a hex memory editor due to some of my games are crazy over those programs.
Title: Re: DFusion - a lua based plugin system v3.0
Post by: darius on June 05, 2011, 12:08:14 pm
so does this mean I can swap around castes with the race changer oh and is Site changer fixed?
oh and due to issues I can't get a hex memory editor due to some of my games are crazy over those programs.

Hehe nope (not very hard but will probably crash DF just like race changing) and nope but will look into site changer. And yeah some games dont like these programs although MHS has some anti-detection built in.
Title: Re: DFusion - a lua based plugin system v3.0
Post by: Rumrusher on June 05, 2011, 12:26:32 pm
so does this mean I can swap around castes with the race changer oh and is Site changer fixed?
oh and due to issues I can't get a hex memory editor due to some of my games are crazy over those programs.

Hehe nope (not very hard but will probably crash DF just like race changing) and nope but will look into site changer. And yeah some games dont like these programs although MHS has some anti-detection built in.
darn I wonder if the utility could search for an custom attack and give it dragon fire or webber or a material breath attack?
Title: Re: DFusion - a lua based plugin system v3.0
Post by: darius on June 05, 2011, 12:46:08 pm
so does this mean I can swap around castes with the race changer oh and is Site changer fixed?
oh and due to issues I can't get a hex memory editor due to some of my games are crazy over those programs.

Hehe nope (not very hard but will probably crash DF just like race changing) and nope but will look into site changer. And yeah some games dont like these programs although MHS has some anti-detection built in.
darn I wonder if the utility could search for an custom attack and give it dragon fire or webber or a material breath attack?
You mean on attack do something. I plan to add some functionality for detecting if some function is called and then calling other functions. Last try failed because same approach as Spellcraft did not work (and it's not the best way).
Title: Re: DFusion - a lua based plugin system v3.0
Post by: Rumrusher on June 05, 2011, 03:51:10 pm
so does this mean I can swap around castes with the race changer oh and is Site changer fixed?
oh and due to issues I can't get a hex memory editor due to some of my games are crazy over those programs.

Hehe nope (not very hard but will probably crash DF just like race changing) and nope but will look into site changer. And yeah some games dont like these programs although MHS has some anti-detection built in.
darn I wonder if the utility could search for an custom attack and give it dragon fire or webber or a material breath attack?
You mean on attack do something. I plan to add some functionality for detecting if some function is called and then calling other functions. Last try failed because same approach as Spellcraft did not work (and it's not the best way).
darn well at-least we got telepathy and site clean up from telepathy down pack. I might pick up 3.0 once Site changer fixed and go on testing if one could convert a small lair or castle into a playable fortress in fort mode.

oh and to retire a fort faster you could just body swap a dead guy in Fort mode then hit the Esc key and in DFmode got to adventure mode and direct control then go to finish game.
oh and figure out how to make a makeshift wounded to zombie command, and a stop and start zombie control using the projectile flag so you can plan better zombie strikes.
Title: Re: DFusion - a lua based plugin system v3.0
Post by: Fredd on June 06, 2011, 10:27:26 am
On the prevent scattering tool, are the 2 x,  2 y, 2z  the position of the corners of a rectangle, whose interior is a no scatter zone?
Title: Re: DFusion - a lua based plugin system v3.0
Post by: darius on June 06, 2011, 02:58:15 pm
Rectangle x0 to x1 and y0 to y1 and z0 to z1. Although it is not "coordinates" but blocks. One block is 16x16x1 AFAIR.

EDIT: Updated to 3.1 fixing the site finding and editing.
Title: Re: DFusion - a lua based plugin system v3.1
Post by: Rumrusher on June 06, 2011, 05:07:51 pm
Well just finally tested the Retire on a site change players fort.
Two things one you can make the site retire access open.
Two the game doesn't like this and will crash, through in Genesis I got the ability to reload the game pause and access the escape menu and do the retire method.
So taking over sites can be done just that you be just razing the place and building would be either in tweak or embarking on top, though I done this to a bandit camp and didn't try this to a lair or any small premade sites.
Title: Re: DFusion - a lua based plugin system v3.1
Post by: Fredd on June 08, 2011, 10:32:21 am
 The block size being 16x16 sure sounds better than a 3x3 area surrounding your cursor with the other option to prevent scattering.
 So for example, you have two dwarves pulling levers. You record their xyz coordinates from runesmith, then enter these coordinates x0,y0,z0 for 1 dwarf, x1,y1,z1 for the second dwarf. End result are prevent scattering blocks between these 2 positions.
 The reason I am bothering you, is that on the technique to swap from adventure/fort mode, I think Dflair from Dfhack is causing withering with its lair designation for the area. Thanks again
Title: Re: DFusion - a lua based plugin system v3.1
Post by: DwarvenBuffet on June 13, 2011, 04:14:14 pm
how do i revert the changes i made with this?  ???
Title: Re: DFusion - a lua based plugin system v3.1
Post by: darius on June 13, 2011, 04:35:37 pm
how do i revert the changes i made with this?  ???
Ehehe... Which changes? If friendship/embark/immigrant hacks saving exiting and reloading should revert everything as for others it would be more... difficult (some impossible)
Title: Re: DFusion - a lua based plugin system v3.1
Post by: DwarvenBuffet on June 13, 2011, 04:39:52 pm
how do i revert the changes i made with this?  ???
Ehehe... Which changes? If friendship/embark/immigrant hacks saving exiting and reloading should revert everything as for others it would be more... difficult (some impossible)
things like change race(tools) which strangely after changing race destroys my fort.
Title: Re: DFusion - a lua based plugin system v3.1
Post by: Taricus on June 13, 2011, 04:46:19 pm
That happens if you change your race to anything that isn't at the fort at that moment.
Title: Re: DFusion - a lua based plugin system v3.1
Post by: DwarvenBuffet on June 13, 2011, 04:48:43 pm
any way to fix it because what happened was I changed it and afterwards it sets it to dwarf instead of the default (creature set up to be used for fortress mode)

EDIT:it also changes the default smily face icon to dwarf when reverting to dwarf
Title: Re: DFusion - a lua based plugin system v3.1
Post by: Rumrusher on June 13, 2011, 06:24:55 pm
Have you type the original creature used for fort mode then just type the name of the creature in CAPS?
Another thing you need to know is that the race also need to be apart of the civ if not then the game will just end so make sure to change the civ number of the creature your swapping to.
Title: Re: DFusion - a lua based plugin system v3.1
Post by: DwarvenBuffet on June 13, 2011, 08:40:59 pm
hm can you just tell me what files I need to change? ???
Title: Re: DFusion - a lua based plugin system v3.1
Post by: Eric Blank on June 13, 2011, 09:00:24 pm
I'm unable to run this at all. When I attempt to open dffusion.exe it gives me an application error stating it "failed to initialize properly (0xc0150002)."
Can only close it. This is the newest version run with df31.25 open, extracted from the .zip directly into an otherwise empty folder. I also don't see any sort of setup instructions...
What exactly is wrong here? Does it NOT simply work 'out of the box'?
Title: Re: DFusion - a lua based plugin system v3.1
Post by: DwarvenBuffet on June 13, 2011, 09:11:56 pm
what operating system are you using
Title: Re: DFusion - a lua based plugin system v3.1
Post by: Eric Blank on June 13, 2011, 09:21:09 pm
what operating system are you using

oh, yes. sorry. Windows xp professional 64x
Title: Re: DFusion - a lua based plugin system v3.1
Post by: DwarvenBuffet on June 14, 2011, 02:03:07 pm
what operating system are you using

oh, yes. sorry. Windows xp professional 64x
ok what about your dwarf fortress version (full vesion as in 31.25 not just 31) and what is the exact procedure you took to run it (from the point after downloading to running it
Title: Re: DFusion - a lua based plugin system v3.1
Post by: Eric Blank on June 14, 2011, 03:40:55 pm
Exactly as I already said. 31.25. df was already running with a game loaded. the newest version of dffusion was extracted to an empty folder outside that df directory, untouched. I double clicked/otherwise opened dffusion and get that error.
So how exactly should it be done?
Title: Re: DFusion - a lua based plugin system v3.1
Post by: DwarvenBuffet on June 14, 2011, 03:51:21 pm
i dont know how to help but one thing that you forgot to mention did you extract ALL of the folders contents and not just the exe
Title: Re: DFusion - a lua based plugin system v3.1
Post by: darius on June 14, 2011, 05:00:32 pm
Yeah this error came up earlier... Something with missing dlls. Unfortunately not sure what is missing. I'll try to recompile Lua with static linking (without any dlls) maybe that will help.

EDIT: there, try now.
Title: Re: DFusion - a lua based plugin system v3.1
Post by: Eric Blank on June 14, 2011, 08:40:57 pm
i dont know how to help but one thing that you forgot to mention did you extract ALL of the folders contents and not just the exe

Well of course I did. That would be ridiculous. :P

And thank you Darius, that actually fixed the problem.
Title: Re: DFusion - a lua based plugin system v3.3
Post by: darius on June 15, 2011, 06:31:06 am
New version!! with item manipulation (for now only destroy all items ( :D ) and hatch all nested eggs)
Title: Re: DFusion - a lua based plugin system v3.3
Post by: Rumrusher on June 16, 2011, 01:27:19 am
hey daruis I just found a weird recreatable situration when you use this .... wait item creation and egg hatching.
Code: [Select]
function rum_tools.zombiearmy()
local trgs=selectwoundead()
for k,v in pairs(trgs) do
--indx=GetCreatureAtPos(v)
--indx=engine.peek(v,ptr_creature.ID)
print("Zombie:"..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(creatureptr,ptr_Creature.legends,-1)
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff+16,ptr_vector)
local trgs=selectall()
for k,v in pairs(trgs) do
trgid=engine.peek(vector:getval(0),ptr_Creature.ID) --get players ID
engine.peek(v,ptr_Creature.followID) -- get target creatures "now following ID"
engine.poke(v,ptr_Creature.followID,trgid) -- if not just write the players ID.
end
engine.poke(v,ptr_Creature.bloodlvl,60000) --give blood
engine.poke(v,ptr_Creature.bleedlvl,0) --stop some bleeding...
local flags=engine.peek(v,ptr_Creature.flags)
flags:set(1,false) -- alive!
flags:set(12,true) --zombie
engine.poke(v,ptr_Creature.flags,flags)
local flags=engine.peek(vector:getval(0),ptr_Creature.flags)
flags:set(1,false) -- alive!
flags:set(12,false) --zombie
engine.poke(vector:getval(0),ptr_Creature.flags,flags)
end
end

function selectwoundead()
  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)
     local v2=engine.peek(off,ptr_Creature.hurt1)
     if v2:getval(12)>=1 then
        table.insert(retvec,off)--... add it to return vector
     end
     local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(1)==true then  --if dead ...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end

rum_tools.menu:add("zomarmy",rum_tools.zombiearmy)
wait never mind these are nested eggs not spawn in mid air ones shoot. If only there was a way to take adventure reaction eggs and hatch them instantly. oh well we are SOooo close to summons it's crazy,
so is this making natural birth eggs hatch and not the spawn kind.

edit: looks like the eggs has to be lay in the building and not just in the nest box that and item destroying seems to not work well.
Title: Re: DFusion - a lua based plugin system v3.3
Post by: Thundercraft on June 16, 2011, 04:12:06 am
...wait never mind these are nested eggs not spawn in mid air ones shoot. If only there was a way to take adventure reaction eggs and hatch them instantly. oh well we are SOooo close to summons it's crazy,
It's only a matter of time before enough new features are added to DF to allow a creative modder to figure out how to do summons.

Have you considered a reaction in Adventure Mode to produce a modded vermin creature? (See the Artificial bees and containment protocols (http://www.bay12forums.com/smf/index.php?topic=85521.0) thread.) That's sort of like summoning, even if it is limited to vermin. Vermin can still be nasty. Just give it a poison, flame or freeze attack. Or suck all blood.

Then, consider how werewolf and vampire-type curse syndromes will be coming out soon. It was mentioned (see the Future of the Fortress (http://www.bay12forums.com/smf/index.php?topic=84398.0) thread) that curse syndromes will probably be extended to be able to turn one creature into another creature. There was even talk of curses that change specific body parts. It was also said these would be done through the raws, so it will open up a lot of modding possibilities. I can imagine intentionally inflicting a modded curse syndrome on companions to change them into dragons or whatever giant killing machines strikes your fancy.
Title: Re: DFusion - a lua based plugin system v3.3
Post by: darius on June 16, 2011, 05:15:31 am
hey daruis I just found a weird recreatable situration when you use this
<...>

edit: looks like the eggs has to be lay in the building and not just in the nest box that and item destroying seems to not work well.

What do you mean weird?

Also do you mean you could place eggs in any building (e.g. workshop?) and it would work?!
Title: Re: DFusion - a lua based plugin system v3.3
Post by: Rumrusher on June 16, 2011, 05:21:40 am
by the time I said that I already found out what a few flags do,

17 poofs the item I guess this is how bogeymen go out.
18 don't know testing in arena
19 forbids items so rig this to a repeater and you can forbid eggs when they lay.
and good one
14 deals with if the item was made in the fort or not, so you can bump up fort value with goods far from the site.
oh and bees and vermin do count as Items so this command I had working on will run through those creatures as well.
Code: [Select]
function items.test3()
myoff=offsets.getEx("Items") -- first find out where "item vector" is
vector=engine.peek(myoff,ptr_vector) --  get list of items
for i=0,vector:size()-1 do --look at each item
flg=engine.peek(vector:getval(i),ptr_item.flags)
entry=io.stdin:read() -- 17 poofs items, 19 forbids and 14 removes item ties to the fort and can add if you have set on false.
print("Was:"..tostring(flg:get(entry)))
flg:flip(entry)
print("Now:"..tostring(flg:get(entry)))
engine.poke(vector:getval(i),ptr_item.flags,flg)
end
end

I thought I cross out that sentence as means of "Oops spoke too soon on that"
I found that most of the items only take effect in Fort mode so my Adventure loving behind can't have real use for this unless I switch over to the mode.
I just had a cat turn roc lay 'Roccats' and you can't even see these things detail with out breaking the game(nothing new someone did this the hard way on this months ago)


hey daruis I just found a weird recreatable situration when you use this
<...>

edit: looks like the eggs has to be lay in the building and not just in the nest box that and item destroying seems to not work well.

What do you mean weird?

Also do you mean you could place eggs in any building (e.g. workshop?) and it would work?!


by weird I mean when I use the zombie army on group of bandits with a -1 civ adventurer cause the bandits to drop hostilities and talk to me.
what I think caused this is when I hurt a creature more so a sentient with a wild(-1) adventurer in the spot that triggers the function (the upper right arm any damage to that spot causes the change or if the creature doesn't have that part will also change) which turns the creature into a zombie fully healed too. now I guess due to this the civ pulls 'a enemy of my enemy is my friend effect' due to the zombie is also aggro to every one thus the bandits will just attack their zombie buddy and lay off attacking you due to thinking " 'ey this bloke trin' to kill us hey adventure' we try kill' earlier let's team up and stop the Zomb' copolyse from befallin this area" might not work on wild life as those creatures treat zombies like elves.


edit: I didn't test if I could place eggs in any building(I should through) I just build 2 nest box one normal and the other not installed and had a dwarf place dwarf eggs made from a adventure reaction into them, so far didn't work , and didn't work once installed some how the box didn't count the items in the building but in the box made in the building so I need to stick the eggs in the nest.
which means I need to find a way to get the nest to take in a reaction that makes a dwarf put eggs into the nest or that having the item fall into the building on it's own if that doesn't work.

Other than that backward coding through the item menu and hoping for adding a pointer to this doesn't break it... through I wonder if there a possibility for a stack pointer so it gets all creatures/items in the spot and allows the developer to mess with, so one doesn't have to separate the creature, item from a stack to get at it.


E: fish this one out of Df-hack the second dash is the input for dfusion, I don't know if this works well but if creature flags work the same then so will this.
Code: [Select]
0x00000001 - on ground -0
0x00000002 - tasked -1
0x00000004 - ? -2
0x00000008 - in inventory/container -3
0x00000010 - lost (artifact) -4
0x00000020 - part of building -5
0x00000040 - ? -6
0x00000080 - ? -7
0x00000100 - rotten -8
0x00000200 - ? -9
0x00000400 - ? -10
0x00000800 - ? -11
0x00001000 - ? (previously flagged artifacts) -12
0x00002000 - ? -13
0x00004000 - imported/foreign (in parentheses) -14
0x00008000 - ? (previously marked trade goods) -15
0x00010000 - owned by dwarf -16
0x00020000 - poof -17
0x00040000 - ? -18
0x00080000 - forbidden -19
0x00100000 - ? -20
0x00200000 - dump -21
0x00400000 - on fire -22
0x00800000 - melt -23
0x01000000 - hidden -24
0x02000000 - ? -25
0x04000000 - ? -26
0x08000000 - ? -27
0x10000000 - ? -28
0x20000000 - ? -29
0x40000000 - ? -30
0x80000000 - ? -31


Title: Re: DFusion - a lua based plugin system v3.4
Post by: darius on June 16, 2011, 08:58:35 am
Not sure about stacks (although in DFhack thread i think i read that 16x16 map has it's own item list) but I updated DFusion with simple item editor. Lets you change material, flags (not very confortable) and if its covered in something it lets you change that (e.g. water into venom ;) ).

Fun fact DF supports named creature items (like Urist mcMiner bone dagger) but reactions don't make them for some reason. If you mess with materials enough you can change that and have named dragon pike (like i do now :P)
Title: Re: DFusion - a lua based plugin system v3.4
Post by: Rumrusher on June 16, 2011, 09:10:57 am
Not sure about stacks (although in DFhack thread i think i read that 16x16 map has it's own item list) but I updated DFusion with simple item editor. Lets you change material, flags (not very confortable) and if its covered in something it lets you change that (e.g. water into venom ;) ).

Fun fact DF supports named creature items (like Urist mcMiner bone dagger) but reactions don't make them for some reason. If you mess with materials enough you can change that and have named dragon pike (like i do now :P)
hmm between this and giving weapons names is what people on the Adventure forum been asking.
well time to see if I can roughly add a selectobject and make every ones pants ignite. Also from fiddling around with flag 0 you can have the item in a person hand and on the floor, 22 can ignite Vermin... though they won't stay on fire once you throw them. and I haven't tested out the ability to stick items in buildings in adventure mode can be done. oh well here to Dwarven clone factories.


edit: I just found out that taking spider thread by removing all flags but the on ground one and turning it into a statue net you about 1,000 or more statues all in your hand. also I'm postponing sticking items in buildings.
testing if a player can set up traps using webbing and thread seeing how removing the flags of thread turn it to it's normal state.
Title: Re: DFusion - a lua based plugin system v3.4
Post by: darius on June 16, 2011, 11:19:14 am
Hmm strange but armors use legends id as race index (for size) and submat2 as legends id.
Title: Re: DFusion - a lua based plugin system v3.4
Post by: Rumrusher on June 16, 2011, 06:46:59 pm
found how to turn spider webs into threads by removing the flag 9 from the webbing.
through I don't know how to turn anything else into webbing.

edit: oh okay I'm noticing a slight issue here, I can't test to see which item has the in building flag using the editor due to the editor can't pick up the item in the building or on a person.

edit: remember how cage trapping a creature and moving the cage and attempting to use a pointer on it won't work.
well the same goes with pick up items and items used in buildings,  they all leave a hidden spot they where last used or originally on the ground.
which answer why I can't see the eggs.
  at least now I have a sweet burn weapons/anything the person wearing command.
Code: [Select]

function selectitem()
  local retvec={} --return vector (or a list)
  myoff=offsets.getEx("Items")
  vector=engine.peek(myoff,ptr_vector)
  for i=0,vector:size()-1 do --check all creatures
     local off
     off=vector:getval(i)
     --local RTI=engine.peek(off,ptr_item.RTI)
     --local itmser=ptr_item.getname(nil,RTI)
     local flags=engine.peek(off,ptr_item.flags)
     if flags:get(3)==true then  --if a weapon in anyway...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end

function selectitem2()
  local retvec={} --return vector (or a list)
  myoff=offsets.getEx("Items")
  vector=engine.peek(myoff,ptr_vector)
  for i=0,vector:size()-1 do --check all creatures
     off=vector:getval(i)
     RTI=engine.peek(off,ptr_item.RTI)
     itmser=ptr_item.getname(nil,RTI)
     --local flags=engine.peek(off,ptr_item.flags)
     if itmser=="item_weaponst" then  --if a weapon in anyway...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end


function items.wepbrn()
  local trgs=selectitem2()
for _,v in pairs(trgs) do
flg=engine.peek(v,ptr_item.flags)
flg:set(22,1)
engine.poke(v,ptr_item.flags,flg)
end
end

function items.disarm()
  local trgs=selectitem2()
for _,v in pairs(trgs) do
flg=engine.peek(v,ptr_item.flags)
flg:set(0,1)
engine.poke(v,ptr_item.flags,flg)
end
end



edit: okay here the deal you can't hatch eggs in other buildings so no Cloning vat with cloning processing.
So the only way one can hatch eggs is to find ways to place the eggs into the NEST_BOX building.
Title: Re: DFusion - a lua based plugin system v3.4
Post by: Hugo_The_Dwarf on July 02, 2011, 09:45:33 pm
Following again. glad this is still going.
Title: Re: DFusion - a lua based plugin system v3.4
Post by: micha on July 06, 2011, 08:13:14 am
patterns2.lua seems to be missing from the zip at dffd making all the cool stuff unworkable. dang.
Title: Re: DFusion - a lua based plugin system v3.4
Post by: Iituem on July 06, 2011, 04:19:52 pm
Working on an old 40d fort.  Is there a version of DFusion that will work with 40d?
Title: Re: DFusion - a lua based plugin system v3.4
Post by: darius on July 06, 2011, 06:52:07 pm
patterns2.lua seems to be missing from the zip at dffd making all the cool stuff unworkable. dang.
sorry about that, ill fix it with next ver.

Working on an old 40d fort.  Is there a version of DFusion that will work with 40d?

Sorry but i could only redirect you to Spellcraft mod (not as stable but more impresive and only for 40d) because a LOT has changed since 40d and it's hard to support one version.here (http://www.bay12forums.com/smf/index.php?topic=43043.msg802980#msg802980) Been a looong time since I tried it but it should work AFAIR
Edit2: looking back i found that it's only for 40d16 so not sure if you are using d16 or d18 or some other.

Edit: ok updated it to 3.5 with patterns2.lua included
Title: Re: DFusion - a lua based plugin system v3.5
Post by: Rumrusher on July 06, 2011, 07:35:55 pm
darius I'm kinda stuck on few things,
first is getting an egg to be placed in a nest. so adventure made eggs can be hatched
second is to have a control over a creature possession of items.
so far the edit item only effect drop items.

third is with adventure decoration how would one get Dfusion to check if an item has a "raise dead" rune or a "sentry" rune?
Title: Re: DFusion - a lua based plugin system v3.5
Post by: darius on July 06, 2011, 07:53:32 pm
darius I'm kinda stuck on few things,
first is getting an egg to be placed in a nest. so adventure made eggs can be hatched
second is to have a control over a creature possession of items.
so far the edit item only effect drop items.

third is with adventure decoration how would one get Dfusion to check if an item has a "raise dead" rune or a "sentry" rune?

First is a tricky one. For item to be placed in building it must be marked with a flag, build must have it in it's ref list, and item must have building in it's ref list AFAIK. Those ref lists are the tricky part. Also it's not enough (i think) for egg to be in building, it also must be actively hatched (someone sitting on top with a job or sth)

Second is less tricky and i'll look into it. I think it's a vector somewhere in creature that has all the item pointers, so some hacking there should be possible.

As for third one it's relatively easy. I'll look into it tomorrow. It's 4am here already :/
Title: Re: DFusion - a lua based plugin system v3.5
Post by: Rumrusher on July 06, 2011, 08:03:25 pm
Sweet here comes setting up statues that spits corrosive acid and or breathes fire.
Title: Re: DFusion - a lua based plugin system v3.5
Post by: thatkid on July 06, 2011, 08:17:59 pm
Hey there
whenever I try to run this in wine, a command prompt opens and then promptly closes. DFWorld Tinker works fine in Wine even DF is running outside, so I know that's not it. I don't suppose anyone could tell me what needs to be done to get it working?
Title: Re: DFusion - a lua based plugin system v3.5
Post by: darius on July 07, 2011, 05:32:32 am
Hey there
whenever I try to run this in wine, a command prompt opens and then promptly closes. DFWorld Tinker works fine in Wine even DF is running outside, so I know that's not it. I don't suppose anyone could tell me what needs to be done to get it working?

Could you run it from commandline with console wine and post the output here.

Edit: Updated DFusion to 3.6. Added material list and offset for it, pattern(token name only for now), decorations patterns, and item access that creature is wearing.
Spoiler: code (click to show/hide)
Title: Re: DFusion - a lua based plugin system v3.6
Post by: Rumrusher on July 07, 2011, 04:49:42 pm
Sweet looks like I could get into a jump start on giving companions armor.
or work on a pack mule command.
Though I guess I need to have it select the creature with the special back pack and then store the item in said back pack.
wait this giving me an error
Code: [Select]
plugins/itempatterns.lua:lua79: '=' expected near '+'
plugins/itempatterns.lua:14: attempt to index global 'ptt_dfflag' (a nil value)
stack traceback:
       init.lua:6: in function <init.lua:4>
       plugins/itempatterns.lua:14: in main chunk
       [C]: in function 'xpcall'
       init.lua:11: in function 'dofile'
       plugins/common.lua:408: in main chunk
       [C]: in function 'xpcall'
       init.lua:11: in function 'dofile'
       init.lua:19: in main chuck
all the commands don't work.
Title: Re: DFusion - a lua based plugin system v3.6
Post by: thatkid on July 07, 2011, 10:15:52 pm
I can't seem to duplicate whatever was causing Dfusion to not work with wine the other day, as it's working fine now.
Title: Re: DFusion - a lua based plugin system v3.6
Post by: Rumrusher on July 08, 2011, 02:32:00 am
so you got 3.6 working or 3.5 or 3.4?
Title: Re: DFusion - a lua based plugin system v3.6
Post by: ribosom on July 08, 2011, 07:18:32 am
Sweet looks like I could get into a jump start on giving companions armor.
or work on a pack mule command.
Though I guess I need to have it select the creature with the special back pack and then store the item in said back pack.
wait this giving me an error
Code: [Select]
plugins/itempatterns.lua:lua79: '=' expected near '+'
plugins/itempatterns.lua:14: attempt to index global 'ptt_dfflag' (a nil value)
stack traceback:
       init.lua:6: in function <init.lua:4>
       plugins/itempatterns.lua:14: in main chunk
       [C]: in function 'xpcall'
       init.lua:11: in function 'dofile'
       plugins/common.lua:408: in main chunk
       [C]: in function 'xpcall'
       init.lua:11: in function 'dofile'
       init.lua:19: in main chuck
all the commands don't work.

I have the same problem with v3.6

DF_31_25_win

XP 32bit

edit: also -f doesn´t work.
I don´t have the error message right now because I´m not at home, but it stops at 'CreatureGloss' or something like that.
Title: Re: DFusion - a lua based plugin system v3.6
Post by: darius on July 08, 2011, 07:58:45 am
 :-[
i forgot to fix += somewhere in code before releasing.

Change self.en+=engine.sizeof(self.type) into self.en=self.en+engine.sizeof(self.type) in patterns.lua for now...
Title: Re: DFusion - a lua based plugin system v3.6
Post by: Rumrusher on July 08, 2011, 11:16:23 am
sweet it works, I have work up a simple edit companions items command, and learn I can just simply type the function and the utility would call to it with out any hassle.
Saves me need to stick the same commands in the file.
though now I wonder is it possible to give an item to someone(that and getting the pointer to select the creature which then find their items so I can set it on fire)?
Code: [Select]
function items.trade_adv() --only allows access to edit companions items no trading.
vec=engine.peek(offsets.getEx("CreatureVec"),ptr_vector)
local trgs=selectcomp()
for k,v in pairs(trgs) do
items.edit(items.select_creature(v))
end
end

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
Title: Re: DFusion - a lua based plugin system v3.6
Post by: darius on July 08, 2011, 01:11:48 pm
Updated to 3.7 fixing that bug, also added interactive console thingy... (basically a line by line lua interpreter)
Too lazy/tired/hot to update first page and answer questions...
Title: Re: DFusion - a lua based plugin system v3.6
Post by: Rumrusher on July 08, 2011, 07:09:46 pm
oh I just switch over to flash develop for understanding which line was broken.

here some 3.6 commands for lighting up enemies by just looking at them.
Code: [Select]
function items.wepbrn2(offset)
flg=engine.peek(offset,ptr_item.flags)
flg:set(22,1)
engine.poke(offset,ptr_item.flags,flg)
end
function items.point_adv()
vec=engine.peek(offsets.getEx("CreatureVec"),ptr_vector)
indx=GetCreatureAtPos(getxyz())
items.wepbrn2(items.select_creature(vec:getval(indx)))
end

okay this command doesn't work and will just crash the game.
Code: [Select]
function items.cross(offset)
Advitem=engine.peek(vec:getval(0),ptr_Creature.itemlist1)
Advitem2=engine.peek(vec:getval(0),ptr_Creature.itemlist2)
compitem=engine.peek(offset,ptr_Creature.itemlist2)
compitem2=engine.peek(offset,ptr_Creature.itemlist1)
engine.poke(vec:getval(0),ptr_Creature.itemlist2,compitem)
engine.poke(vec:getval(0),ptr_Creature.itemlist1,compitem2)
end
Title: Re: DFusion - a lua based plugin system v3.6
Post by: The Master on July 09, 2011, 07:47:22 pm
help? If I start Dwarf Fortress THEN DFusion, it gives me an unauthorized request error and crashes Dwarf Fortress simultaneously. It won't detect the game AT ALL if I start DFusion first then Dwarf Fortress.
Title: Re: DFusion - a lua based plugin system v3.6
Post by: Rumrusher on July 09, 2011, 07:49:32 pm
which version of Dwarf fortress and Dfusion are your currently using?
the new ones should just send an error and not crash.
Title: Re: DFusion - a lua based plugin system v3.6
Post by: darius on July 10, 2011, 02:25:35 am

okay this command doesn't work and will just crash the game.
Code: [Select]
function items.cross(offset)
Advitem=engine.peek(vec:getval(0),ptr_Creature.itemlist1)
Advitem2=engine.peek(vec:getval(0),ptr_Creature.itemlist2)
compitem=engine.peek(offset,ptr_Creature.itemlist2)
compitem2=engine.peek(offset,ptr_Creature.itemlist1)
engine.poke(vec:getval(0),ptr_Creature.itemlist2,compitem)
engine.poke(vec:getval(0),ptr_Creature.itemlist1,compitem2)
end
Actually i have no idea how itemlist1 is used :/ so try without it and also if you are doing anything with pointers (in this case you are :) ) crash sometimes could be avoided by adding:
Code: [Select]
debuger.suspend()
<... your code >
debuger.resume()
Debuger lib (in dfusion) is undocumented and mostly crashes DF but this should be relatively safe.
Title: Re: DFusion - a lua based plugin system v3.6
Post by: Rumrusher on July 10, 2011, 02:50:12 am

okay this command doesn't work and will just crash the game.
Code: [Select]
function items.cross(offset)
Advitem=engine.peek(vec:getval(0),ptr_Creature.itemlist1)
Advitem2=engine.peek(vec:getval(0),ptr_Creature.itemlist2)
compitem=engine.peek(offset,ptr_Creature.itemlist2)
compitem2=engine.peek(offset,ptr_Creature.itemlist1)
engine.poke(vec:getval(0),ptr_Creature.itemlist2,compitem)
engine.poke(vec:getval(0),ptr_Creature.itemlist1,compitem2)
end
Actually i have no idea how itemlist1 is used :/ so try without it and also if you are doing anything with pointers (in this case you are :) ) crash sometimes could be avoided by adding:
Code: [Select]
debuger.suspend()
<... your code >
debuger.resume()
Debuger lib (in dfusion) is undocumented and mostly crashes DF but this should be relatively safe.
using it causes all items your holding to disappear then the game crash. Having the command flip where tries to take the item from the creature does nothing.
now I guess I could try to recreate the crash using the companion command to see if it's a pointer issue but really I guess if I broke DF then I done something right in coding.
Or... give up on trading for it's way out of my reach and try recreating spells. given I need to make a select "Rune" command and have it check if one any item is made of this material and any of the flags on it was triggered.
Title: Re: DFusion - a lua based plugin system v3.6
Post by: darius on July 10, 2011, 02:56:15 am
You could try exchanging two items...

Code: [Select]
Advitem=engine.peek(vec:getval(0),ptr_Creature.itemlist2)
it=engine.peekd(Advitem:getval(0)) -- first item
compitem=engine.peek(offset,ptr_Creature.itemlist2)
it2=engine.peekd(compitem:getval(0))
engine.poked(compitem:getval(0),it)
engine.poked(Advitem:getval(0),it2)
Title: Re: DFusion - a lua based plugin system v3.6
Post by: Rumrusher on July 10, 2011, 03:12:35 am
nah didn't work.
looks like the game doesn't like the idea of someone taking an item from their pocket and giving it to someone else.
my other plan is to see if one could just drop the item on the ground and give it to someone.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: darius on July 10, 2011, 05:43:43 am
Glorious day everyone. After months (or year(s)) of development I finally finished triggers plugins (although now it kinda does not match its name). Run once to install and second time for a menu. It allow calling DF functions, currently there is only print but more to come later (e.g. create item or creature and so on...). Finding locations for functions is a pain but it gives us ultimate power - control over DF with its own functions :)

To use in code (after triggers got installed) use this:
Code: [Select]
if engine.getmod("triggers_main") then
loadTriggers()
FILE="A" --work around for now... will split functions and its menu later
dofile("plugins/triggers/functions.lua") -- this is where the magic lies
func.PrintMessage("Oh such a nice wheather here.",6,1) -- last two are color and intensity
FILE=nil
else
print("Error: triggers plugin must be installed to run this!")
end
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on July 10, 2011, 06:53:22 am
Great now the guys over at Dferm could use DFusion to chat in game!
Title: Re: DFusion - a lua based plugin system v3.8
Post by: peterix on July 10, 2011, 07:17:02 am
You know... with the current direction of DFHack, we could totally join forces and proceed towards world domination :)
I'm putting stuff into the DF binary through a shim library between DF and SDL. Works like a charm. Your LUA stuff could live inside DFHack as a plugin, possibly removing a lot of code and becoming cross-platform at the same time. It would be awesome.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on July 10, 2011, 07:58:30 am
You know... with the current direction of DFHack, we could totally join forces and proceed towards world domination :)
I'm putting stuff into the DF binary through a shim library between DF and SDL. Works like a charm. Your LUA stuff could live inside DFHack as a plugin, possibly removing a lot of code and becoming cross-platform at the same time. It would be awesome.
Does this mean all my work which goes into a plugin.lua for DFusion will be now stuck into a plugin of Dfusion which is a plugin for DFhack?

some kind of pluginception?
edit: oh well I'm off to write silly announcement quotes and attach them to the ends some of my commands.

Code: [Select]
function func.PrintMessage1_()
print("Type a message:")
msg="Rise from your grave, you save my daughter!"
func.PrintMessage(msg,2,1)
end
function func.PrintMessage2_()
print("Type a message:")
msg="Stand there!"
func.PrintMessage(msg,2,1)
end
function func.PrintMessage3_()
print("Type a message:")
msg="Channeling souls here!"
func.PrintMessage(msg,5,1)
end
to place these into the Trigger folder
and to use them in a normal Rum_mod function or any really
just stick this
func.PrintMessage3_(msg)
in either the beginning or end of the command.
though due to the fact adventure mode won't announce if you have the pointer out but will be shown in the announcements. happy flavor adding
Title: Re: DFusion - a lua based plugin system v3.8
Post by: darius on July 10, 2011, 01:06:29 pm
You know... with the current direction of DFHack, we could totally join forces and proceed towards world domination :)
I'm putting stuff into the DF binary through a shim library between DF and SDL. Works like a charm. Your LUA stuff could live inside DFHack as a plugin, possibly removing a lot of code and becoming cross-platform at the same time. It would be awesome.

Would love to, but DFHack is overwhelmingly big and not sure where i would need to start...
Title: Re: DFusion - a lua based plugin system v3.8
Post by: The Master on July 10, 2011, 03:17:57 pm
which version of Dwarf fortress and Dfusion are your currently using?
the new ones should just send an error and not crash.

i'm using the current version for both. i'll tell you the exact version in a sec.

EDIT: dwarf fortress 0.31.25            DFusion 3.8
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Gamerlord on July 10, 2011, 06:34:37 pm
AAAHHH WHAT THE HELL IS WITH THIS THING I RAN EMBARK BY ACCIDENT THEN SIMPLE EMBARK AND NOW DF WON"T GO INTO DWARF FORTRESS MODE HOW DO I FIX THIS????
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on July 10, 2011, 08:00:02 pm
AAAHHH WHAT THE HELL IS WITH THIS THING I RAN EMBARK BY ACCIDENT THEN SIMPLE EMBARK AND NOW DF WON"T GO INTO DWARF FORTRESS MODE HOW DO I FIX THIS????
uhh have you try to reset DF?
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Gamerlord on July 10, 2011, 08:30:48 pm
um... If I give sentience to a creature, do I have to go back into the raws to fix this?
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on July 10, 2011, 08:57:56 pm
no it's doesn't change the raw file... or touches it really just the game it self.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Gamerlord on July 10, 2011, 09:07:20 pm
k. and when should i use the embark and simple embark ?
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on July 10, 2011, 10:13:44 pm
it should say when to use them in the Read me file.
but if that confusing you should use them during the map section of embark screen.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: UltraValican on July 12, 2011, 01:11:30 pm
May i suggest a more user friendly/in depth "read me" file, because so far i can only use embark anywhere corectly, almost every thing else dosn't work.
Also can someone just tell me how I can make goblin migrants for a bit then swich back to dwarves.
This is a great tool, you just need to elaborate more on how its used.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on July 12, 2011, 04:15:08 pm
Spoiler (click to show/hide)
Rum's rough guide to Dfusion
if you can't do anything of these things then type out the first error you see and either Darius or I/me will answer.
if you excuse me I need to rest my wrist for writing up this "'non-developer' guide."
Title: Re: DFusion - a lua based plugin system v3.8
Post by: UltraValican on July 12, 2011, 04:23:13 pm
WOW, thanks for the guide, you really didn't have to type all that just to awswer my question, but I thank you all the same. :)
Title: Re: DFusion - a lua based plugin system v3.8
Post by: micha on July 13, 2011, 06:19:37 am
>>   V3.5   .. added missing patterns2.lua and moved it to plugins folder.

awesome! thanks you muchly!
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on July 13, 2011, 07:33:39 am
uhh darius you have a goof with the adventure tools
Code: [Select]
function adv_tools.ressurect()
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff,ptr_vector)
indx=GetCreatureAtPos(getxyz())
if indx<0 then indx=0 end
--print(string.format("%x",vector:getval(indx)))
v2=engine.peek(vector:getval(indx),ptr_Creature.hurt1)
for i=0,v2:size()-1 do
v2:setval(i,0)
end
v2=engine.peek(vector:getval(indx),ptr_Creature.hurt2)
v2.type=DWORD
for i=0,v2:size()-1 do
v2:setval(i,0)
end
engine.poke(vector:getval(indx),ptr_Creature.bloodlvl,60000) --give blood
engine.poke(vector:getval(indx),ptr_Creature.bleedlvl,0) --stop some bleeding...
local flg=engine.peek(vector:getval(indx),ptr_Creature.flags)
    flg:set(1,0) --ALIVE
    flg:set(39,0) -- leave body yet again
    flg:set(37,0) -- something todo with wounds- lets you walk again.
    engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
end

the flags are following the 1,0 coding where as the dfflag follows the true or false triggers.
what this leads to is the utility not knowing what to do and making all flag commands flip than set accordingly.
Code: [Select]
function ptt_dfflag.get(self,num) -- get one bit in flags
local of=math.floor (num/8);

if bit.band(self[of],bit.lshift(1,num%8))~=0 then
return true
else
return false
end
end
the fix here would be to go through adventure tools and rewrite all the 0 and 1 to true and false.

Code: [Select]
function adv_tools.ressurect()
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff,ptr_vector)
indx=GetCreatureAtPos(getxyz())
if indx<0 then indx=0 end
--print(string.format("%x",vector:getval(indx)))
v2=engine.peek(vector:getval(indx),ptr_Creature.hurt1)
for i=0,v2:size()-1 do
v2:setval(i,0)
end
v2=engine.peek(vector:getval(indx),ptr_Creature.hurt2)
v2.type=DWORD
for i=0,v2:size()-1 do
v2:setval(i,0)
end
engine.poke(vector:getval(indx),ptr_Creature.bloodlvl,60000) --give blood
engine.poke(vector:getval(indx),ptr_Creature.bleedlvl,0) --stop some bleeding...
local flg=engine.peek(vector:getval(indx),ptr_Creature.flags)
    flg:set(1,false) --ALIVE
    flg:set(39,false) -- leave body yet again
    flg:set(37,false) -- something todo with wounds- lets you walk again.
    engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
end

function adv_tools.wagonmode() --by rumrusher
   --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(1,false)
   flg:set(74,false)
   engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
   print("To stay normal press y, else hit Enter turn Wagon mode on.")
   r=io.stdin:read() -- repeat for it too work... also creature will be dead.
   if r== "y" then
      flg=engine.peek(vector:getval(indx),ptr_Creature.flags)
      flg:set(1,false)
      engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
   else
      flg=engine.peek(vector:getval(indx),ptr_Creature.flags)
      flg:set(1,false)
      flg:flip(74)
      engine.poke(vector:getval(indx),ptr_Creature.flags,flg)
   end
end
function selectall()
  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)
     local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(1)==true then  --if dead ...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end
function adv_tools.hostilate()
vector=engine.peek(offsets.getEx("AdvCreatureVec"),ptr_vector)
id=GetCreatureAtPos(getxyz())
print(string.format("Vec:%d cr:%d",vector:size(),id))
off=vector:getval(id)
crciv=engine.peek(vector:getval(id),ptr_Creature.civ)
curciv=engine.peek(vector:getval(0),ptr_Creature.civ)

if curciv==crciv then
print("Friendly-making enemy")
engine.poke(off,ptr_Creature.civ,-1)
flg=engine.peek(off,ptr_Creature.flags)
flg:set(17,true)
engine.poke(off,ptr_Creature.flags,flg)
else
print("Enemy- 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
which I did to save time in doing so.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: The Master on July 13, 2011, 04:36:13 pm
Spoiler (click to show/hide)
Rum's rough guide to Dfusion
if you can't do anything of these things then type out the first error you see and either Darius or I/me will answer.
if you excuse me I need to rest my wrist for writing up this "'non-developer' guide."
sorry, but what...? I barely understood ANY of that! try to fix your typos.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on July 13, 2011, 08:56:33 pm
you mean the typos in the readme sections or the grammar errors that I might have missed while typing?
Title: Re: DFusion - a lua based plugin system v3.8
Post by: darius on July 15, 2011, 04:29:58 am
This project is now officially open source (in github)
Title: Re: DFusion - a lua based plugin system v3.8
Post by: peterix on July 15, 2011, 04:46:08 am
This project is now officially open source (in github)
Now THAT is awesome. I'll see what could be done about putting this into the new dfhack as a plugin when I'm done with what I'm working on right now (adding a thread-safe console)

EDIT: hmm... I don't know where I'd start either. This will need some serious research :)

Hmm.. let me explain stuff better. The new dfhack basically lives inside DF. A dfhack plugin can stop DF and take complete control over it. This means full access to everything, as long as you can find it (have the offset) and describe its layout in C++ types (the actual layout of objects can be left to the compiler). All this is done in sync with DF and it's thread-safe, so you can be *SURE* you'll never, ever break things because of some timing problem. You can use malloc/free/new/delete on DF's memory, because it's also your memory.

This new dfhack has a few extra bits:
A (in the near future thread-safe) console you can type in commands exported by the plugins.
It listens for the zoom hotkeys of DF and can invoke commands by name when the player pushes those hotkeys - this is F1-F8 and Shift+F1 - Shift-F8. Commands can be assigned to them using the in-game hotkey menu.
The plugins can have a function that's run after DF completes every game step.

DFusion (or some kind of similar LUA thing) would be a DFHack plugin, exporting various commands, so they can be invoked by the console or from the hotkeys. Some parts of DFusion would need tweaking, some don't really make sense - this needs research. If you're OK with it though :)
Title: Re: DFusion - a lua based plugin system v3.8
Post by: darius on July 15, 2011, 07:35:11 am
This project is now officially open source (in github)
Now THAT is awesome. I'll see what could be done about putting this into the new dfhack as a plugin when I'm done with what I'm working on right now (adding a thread-safe console)

EDIT: hmm... I don't know where I'd start either. This will need some serious research :)

Hmm.. let me explain stuff better. The new dfhack basically lives inside DF. A dfhack plugin can stop DF and take complete control over it. This means full access to everything, as long as you can find it (have the offset) and describe its layout in C++ types (the actual layout of objects can be left to the compiler). All this is done in sync with DF and it's thread-safe, so you can be *SURE* you'll never, ever break things because of some timing problem. You can use malloc/free/new/delete on DF's memory, because it's also your memory.

This new dfhack has a few extra bits:
A (in the near future thread-safe) console you can type in commands exported by the plugins.
It listens for the zoom hotkeys of DF and can invoke commands by name when the player pushes those hotkeys - this is F1-F8 and Shift+F1 - Shift-F8. Commands can be assigned to them using the in-game hotkey menu.
The plugins can have a function that's run after DF completes every game step.

DFusion (or some kind of similar LUA thing) would be a DFHack plugin, exporting various commands, so they can be invoked by the console or from the hotkeys. Some parts of DFusion would need tweaking, some don't really make sense - this needs research. If you're OK with it though :)

I'll try to make it more tidy in few days to come. There is a lot of stuff that need to be rewriten (e.g. Lune- lua-cpp object inteface, functional - useless not working and depending on debuger, Debuger- could be removed mostly used for allocate (which is not needed in DFHack) and so on...)

Straight DFusion to DFhack plugin transformation would need some way to search memory. Been using 0x517A5D hexsearch.h (although writen in C it takes care of lot of stuff). Afaik DFHack already has memory modification tools. Also Offset manager could be discarded an DFHack's internal used and so on.

I could try to fork DFHack and implement some sort of Lua interface for some of functions, but I'm not sure which to fork (there are a lot of forks :) )
Title: Re: DFusion - a lua based plugin system v3.8
Post by: thatkid on July 16, 2011, 01:17:20 pm
Uh, hey.
When I run DFusion in Wine, the following comes up: http://img801.imageshack.us/img801/8826/dfusionwine1.png
I'm not running an adventurer at the moment, so I can't get another screenshot but I get a similar error message when I try to switch companions.
Title: Re: DFusion - a lua based plugin system v3.6
Post by: Rumrusher on July 16, 2011, 01:41:50 pm
:-[
i forgot to fix += somewhere in code before releasing.

Change self.en+=engine.sizeof(self.type) into self.en=self.en+engine.sizeof(self.type) in patterns.lua for now...
yeah that was address a couple of pages ago.
here's darius fix on it.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: thatkid on July 16, 2011, 03:47:38 pm
Thanks :D
It works now, though it can't find the thread. This is likely a problem with WINE and the fact that I'm running DF outside of WINE as opposed to an issue with DFusion.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on July 16, 2011, 04:01:35 pm
Thanks :D
It works now, though it can't find the thread. This is likely a problem with WINE and the fact that I'm running DF outside of WINE as opposed to an issue with DFusion.
nah this issue was a DFusion one given I had it too and I'm not running on a mac.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: thatkid on July 16, 2011, 04:02:40 pm
Thanks :D
It works now, though it can't find the thread. This is likely a problem with WINE and the fact that I'm running DF outside of WINE as opposed to an issue with DFusion.
nah this issue was a DFusion one given I had it too and I'm not running on a mac.
No, I meant the original issue is solved thanks to the info you provided. DFusion can't find DF now though, and that's probably a problem with wine
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on July 20, 2011, 03:18:01 pm
oh I just found out that pets can be brought back to life if they where abandon/retired killed and won't be killed again once you return to the same fortress in adventurer mode if you travel around.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: babies on July 29, 2011, 02:35:30 am
I just found this healing script in a much older thread by rumrusher.

Spoiler (click to show/hide)

In a way that even a simple idiot like me could follow, how do I implement this using DFusion?
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on July 29, 2011, 10:55:25 am
first take the function title,
copy it and scroll down to the part where it shows

if not(FILE) then -- if not in script mode

look at how the commands for the other functions are and try to recreate the same line for that function.



Take the line of code where it say "makes them breathe" and "gives them sight" 
paste that in the same spot in the original adv_tool resurrect
for all I did was take the original and added some missing flags due to people tend to suffocate or come out blind when I revive them.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: darius on August 04, 2011, 04:50:41 pm
DFusion is dead. Long live DFusion! :D

Just a quick note that currently i'm stopping development of dfusion and resuming it as DFHack plugin. Future holds very awesome things, currently it's only +- working port of dfusion. For those who can compile and know how to use CMAKE n friends: code is here (https://github.com/warmist/dfhack/).  For others i'll release it sometime later. Maybe when linux support is minimal because now only thing thats better is OnTick function that is called every <some> tick (each tick was too lagy).

Edit: oh and remembered another plus of moving into DFhack- now memory lookups are way faster but not safe (could crash program- before returned 0)
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Thundercraft on August 06, 2011, 08:20:49 am
...Take the line of code where it say "makes them breathe" and "gives them sight" 
paste that in the same spot in the original adv_tool resurrect
for all I did was take the original and added some missing flags due to people tend to suffocate or come out blind when I revive them.

Those sound like very useful additions to the Ressurection plugin. Will they eventually get added to the Resurrection portion of the new DFusion DFHack plugin?
Title: Re: DFusion - a lua based plugin system v3.8
Post by: darius on August 07, 2011, 07:24:56 am
...Take the line of code where it say "makes them breathe" and "gives them sight" 
paste that in the same spot in the original adv_tool resurrect
for all I did was take the original and added some missing flags due to people tend to suffocate or come out blind when I revive them.

Those sound like very useful additions to the Ressurection plugin. Will they eventually get added to the Resurrection portion of the new DFusion DFHack plugin?
Added.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on August 07, 2011, 06:57:29 pm
wait if your going to do that then add this as well.
Code: [Select]
function Adv_tools.Zombieressurect() --fix to zombism
repeat
local trgs=selectall()
for k,v in pairs(trgs) do
--indx=GetCreatureAtPos(v)
--indx=engine.peek(v,ptr_creature.ID)
print("Zombie:"..k)
v2=engine.peek(v,ptr_Creature.hurt1)
for i=0,v2:size()-1 do
v2:setval(i,1)
end
v2=engine.peek(v,ptr_Creature.hurt2)
v2.type=DWORD
for i=0,v2:size()-1 do
v2:setval(i,1)
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,true) --zombie
flags:set(17,true)
flags:set(19,true)
engine.poke(v,ptr_Creature.flags,flags)
--engine.poke(v,ptr_Creature.legends,-1)
end
until r==7
end

function Adv_tools.carryEX() --have the pointer on the creature you want to hold on to.
   myoff=offsets.getEx("AdvCreatureVec")
   vector=engine.peek(myoff,ptr_vector)
   indx=GetCreatureAtPos(getxyz())
   print("grab person how? N S E W")
   --repeat
   r=io.stdin:read()
   if r=="N" then
      repeat 
      flg=engine.peek(vector:getval(0),ptr_Creature.flags)
      flg2=engine.peek(vector:getval(indx),ptr_Creature.flags)
      enty=engine.peek(vector:getval(0),ptr_Creature.y)+1
      entx=engine.peek(vector:getval(0),ptr_Creature.x)
      move=engine.peek(vector:getval(0),ptr_Creature.z)
      engine.poke(vector:getval(indx),ptr_Creature.z,move)
      engine.poke(vector:getval(indx),ptr_Creature.x,entx)
      engine.poke(vector:getval(indx),ptr_Creature.y,enty)
      until flg:get(15) ==true or flg2:get(1) ==true
   elseif r=="S" then
      repeat
      flg=engine.peek(vector:getval(0),ptr_Creature.flags)
      flg2=engine.peek(vector:getval(indx),ptr_Creature.flags)
      enty=engine.peek(vector:getval(0),ptr_Creature.y)-1
      entx=engine.peek(vector:getval(0),ptr_Creature.x)
      move=engine.peek(vector:getval(0),ptr_Creature.z)
      engine.poke(vector:getval(indx),ptr_Creature.z,move)
      engine.poke(vector:getval(indx),ptr_Creature.x,entx)
      engine.poke(vector:getval(indx),ptr_Creature.y,enty)
      until flg:get(15) ==true or flg2:get(1) ==true
   elseif r=="W" then
      repeat
      flg=engine.peek(vector:getval(0),ptr_Creature.flags)
      flg2=engine.peek(vector:getval(indx),ptr_Creature.flags)
      entx=engine.peek(vector:getval(0),ptr_Creature.x)-1
      enty=engine.peek(vector:getval(0),ptr_Creature.y)
      move=engine.peek(vector:getval(0),ptr_Creature.z)
      engine.poke(vector:getval(indx),ptr_Creature.z,move)
      engine.poke(vector:getval(indx),ptr_Creature.x,entx)
      engine.poke(vector:getval(indx),ptr_Creature.y,enty)
      until flg:get(15) ==true or flg2:get(1) ==true
   elseif r=="E" then
      repeat
      flg=engine.peek(vector:getval(0),ptr_Creature.flags)
      flg2=engine.peek(vector:getval(indx),ptr_Creature.flags)
      entx=engine.peek(vector:getval(0),ptr_Creature.x)+1
      enty=engine.peek(vector:getval(0),ptr_Creature.y)
      move=engine.peek(vector:getval(0),ptr_Creature.z)
      engine.poke(vector:getval(indx),ptr_Creature.z,move)
      engine.poke(vector:getval(indx),ptr_Creature.x,entx)
      engine.poke(vector:getval(indx),ptr_Creature.y,enty)
      until flg:get(15) ==true or flg2:get(1) ==true
   end
   --[[flg=engine.peek(vector:getval(0),ptr_Creature.flags)
   flg2=engine.peek(vector:getval(indx),ptr_Creature.flags)
   --print("how high?")
   --entry=io.stdin:read()
   --Crepos=engine.peek(vector:getval(0),ptr_Creature.x)+entx
   move=engine.peek(vector:getval(0),ptr_Creature.z)
   --print("W and E")
   --entry=io.stdin:read()
   move2=engine.peek(vector:getval(0),ptr_Creature.x)
   --print("N and S")
   --entry=io.stdin:read()
   move3=engine.peek(vector:getval(0),ptr_Creature.y)
   repeat
   engine.poke(vector:getval(indx),ptr_Creature.z,move)
   engine.poke(vector:getval(indx),ptr_Creature.x,entx)
   engine.poke(vector:getval(indx),ptr_Creature.y,enty)
   until flg:get(15) ==1 or flg2:get(1) ==1]]--
end

function selectdead()
  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)
     local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(1)==true then  --if dead ...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end

function Adv_tools.deadwarp()
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff,ptr_vector)
local tx,ty,tz
local trgs=selectdead()
for k,v in pairs(trgs) do
tx,ty,tz=getxyz()
print("Warp to coords:"..tx.." "..ty.." "..tz)
engine.poke(v,ptr_Creature.x,tx)
engine.poke(v,ptr_Creature.y,ty)
engine.poke(v,ptr_Creature.z,tz)
end
func.PrintMessage3_(msg)
end

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 Adv_tools.compwarp() --teleport companions if you used Control Civ you might teleport your self aswell
func.PrintMessage2_(msg)
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff,ptr_vector)
local tx,ty,tz
local trgs=selectcomp()
for k,v in pairs(trgs) do
tx,ty,tz=getxyz()
print("Warp to coords:"..tx.." "..ty.." "..tz)
engine.poke(v,ptr_Creature.x,tx)
engine.poke(v,ptr_Creature.y,ty)
engine.poke(v,ptr_Creature.z,tz)
end
end

function selectzombie()
  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)
     local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(12)==true then  --if undead in anyway...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end

function Adv_tools.zomwarp() --teleport zombies
func.PrintMessage2_(msg)
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff,ptr_vector)
local tx,ty,tz
local trgs=selectzombie()
for k,v in pairs(trgs) do
tx,ty,tz=getxyz()
print("Warp to coords:"..tx.." "..ty.." "..tz)
engine.poke(v,ptr_Creature.x,tx)
engine.poke(v,ptr_Creature.y,ty)
engine.poke(v,ptr_Creature.z,tz)
end
end

function Adv_tools.fixwarp() --fixing the large invisible blocks that slows movement
local mapoffset=offsets.getEx("WorldData")--0x131C128+offsets.base()
local x=engine.peek(mapoffset+24,DWORD)
local y=engine.peek(mapoffset+28,DWORD)
local z=engine.peek(mapoffset+32,DWORD)
--vec=engine.peek(mapoffset,ptr_vector)

print("Blocks loaded:"..x.." "..y.." "..z)
print("Select type:")
print("1. All (SLOW)")
print("2. range (x0 x1 y0 y1 z0 z1)")
print("3. One block around pointer")
print("anything else- quit")
q=io.stdin:read()
n2=tonumber(q)
if n2==nil then return end
if n2>3 or n2<1 then return end
local xs,xe,ys,ye,zs,ze
if n2==1 then
xs=0
xe=x-1
ys=0
ye=y-1
zs=0
ze=z-1
elseif n2==2 then
print("enter x0:")
xs=tonumber(io.stdin:read())
print("enter x1:")
xe=tonumber(io.stdin:read())
print("enter y0:")
ys=tonumber(io.stdin:read())
print("enter y1:")
ye=tonumber(io.stdin:read())
print("enter z0:")
zs=tonumber(io.stdin:read())
print("enter z1:")
ze=tonumber(io.stdin:read())
function clamp(t,vmin,vmax)
if t> vmax then return vmax end
if t< vmin then return vmin end
return t
end
xs=clamp(xs,0,x-1)
ys=clamp(ys,0,y-1)
zs=clamp(zs,0,z-1)
xe=clamp(xe,xs,x-1)
ye=clamp(ye,ys,y-1)
ze=clamp(ze,zs,z-1)
else
xs,ys,zs=getxyz()
xs=math.floor(xs/16)
ys=math.floor(ys/16)
xe=xs
ye=ys
ze=zs
end
local xblocks=engine.peek(mapoffset,DWORD)
local flg=bit.bnot(bit.lshift(1,3))
for xx=xs,xe do
local yblocks=engine.peek(xblocks+xx*4,DWORD)
for yy=ys,ye do
local zblocks=engine.peek(yblocks+yy*4,DWORD)
for zz=zs,ze do



local myblock=engine.peek(zblocks+zz*4,DWORD)
if myblock~=0 then
for i=0,255 do
local ff=engine.peek(myblock+0x67c+i*4,DWORD)
ff=bit.band(ff,flg) --set 14 flag to 1
engine.poke(myblock+0x67c+i*4,DWORD,ff)
end
end
end
print("Blocks done:"..xx.." "..yy)
end
end
end

function selectciv()
  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)
     local crciv=engine.peek(off,ptr_Creature.civ)
     local curciv=engine.peek(vector:getval(0),ptr_Creature.civ)
     if curciv==crciv then
     --[[local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(1)==false then]]--  --if dead ...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end
function Adv_tools.ControlCiv2() --those who has the same civ number as the adventurer will become the adventurer's companion might need to run this again after you travel out for they stop being companions after you travel and need to reapply one more time.
--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)
leg=offsets.getEx("Legends")
legvec=engine.peek(leg,ptr_vector)
local trgs=selectciv()
for k,v in pairs(trgs) do
print("members:"..k)
trgid=engine.peek(vector:getval(0),ptr_Creature.ID) --get players ID
playerlegid=rum_tools.getlegendsid(vector:getval(0))
trglegid=rum_tools.getlegendsid(v)
trgid=engine.peek(vector:getval(0),ptr_Creature.ID) --get players ID
engine.poke(v,ptr_Creature.followID,trgid) -- if not just write the players ID.
engine.poke(legvec:getval(trglegid),ptr_legends2.follow,playerlegid)
end
end


function Adv_tools.Convert() --makes companions the same civ
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff,ptr_vector)
--id=engine.peekd(offsets.getEx("CreaturePtr"))
--print(string.format("Vec:%d cr:%d",vector:size(),id))
local trgs=selectcomp()
for k,v in pairs(trgs) do
print("members:"..k)
off=v
crciv=engine.peek(off,ptr_Creature.civ)
curciv=engine.peek(vector:getval(0),ptr_Creature.civ)
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
end
Adv_tools.menu:add("?control civ?",Adv_tools.ControlCiv2)
Adv_tools.menu:add("Zombies fix",Adv_tools.Zombieressurect)
Adv_tools.menu:add("?carryex?",Adv_tools.carryEX)
Adv_tools.menu:add("arrange companions",Adv_tools.compwarp)
Adv_tools.menu:add("move zed",Adv_tools.zomwarp)
Adv_tools.menu:add("move souls",Adv_tools.deadwarp)
Adv_tools.menu:add("convert companions",Adv_tools.Convert)

note: the original headers where change from Rum_tools to Adv_tools for easier adding.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Kaelem Gaen on August 07, 2011, 10:16:11 pm
So how exactly do you add a plug in to DFhack?
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on August 08, 2011, 06:54:24 am
you mean how would a LUA plugin to Dfusion work for Dfhack's list of application?
beats me, I ask that same question I hope the same as before now I get access to dump silly functions to lighting pants on fire in the DFhack Chat.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Deviled on August 08, 2011, 12:35:17 pm
When I try to use any of the adv tools it says creature not found.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Warmist on August 08, 2011, 01:21:58 pm
When I try to use any of the adv tools it says creature not found.

More info pls (is version latest/SDL and are you in adventure mode?)

Also i found my old account pass :)

So how exactly do you add a plug in to DFhack?

Not as simple as dfusion :) but almost as simple. You need to know some C++ to do that if you are still interested- i will try to explain in more detail.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on August 08, 2011, 04:27:11 pm
more so for Deviled have you try using the pointer on a creature who is alive?
ADv_tools greatest hurdle is just the teaching folks you need to use the pointer on top of the creature you want to affect.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Warmist on August 08, 2011, 06:03:26 pm
more so for Deviled have you try using the pointer on a creature who is alive?
ADv_tools greatest hurdle is just the teaching folks you need to use the pointer on top of the creature you want to affect.
hehe tottaly forgot how it works :D

Btw linux version working but not doing anything yet :)
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on August 08, 2011, 07:13:36 pm
Well for Adventure fort news You can enlist any thing to military just not as a captain if you use the change fort race over in the Military screen and have the creature you want to apply have resident off(if there not sentient just flip them to the same race the fort runs enlist then flip back).
The other news is that if you add back the is resident flag on a military unit they will still be able to order around and have the added bonus of never need to feed them or give them a room.
Which means you can have squads of friendly minotaurs at the front gate or a group of Cave spiders appointed for archery with the Forbidden beasts.

For any home owners best pick up Runesmith and causally clean out the rising Demon population using the extinct button for these forts will accumulate demons who for some reason won't leave and will slow down the cpu. Animal men are to small an issue (and won't spill syndromes every where killing your citizens unless you got a mod that allows them to do so) and if you find any on the list better change their civ to yours and pull them out of the ground and enlist them as the military backbone of the site.

Oh and one thing INTERNS should never be place in the same group or squad as every one else in fact better keep them away from every one else or send them in first.
I learn this the hard way and now I got rotting living men who I guess caused my intern adventurer to go insane.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Kaelem Gaen on August 08, 2011, 09:13:37 pm
Actually no I was asking how I use the DFusion Plugin for DF Hack, I just see CPP or something for all the files on the git, my question is how do you use DFusion AS a plugin for DFhack....
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on August 08, 2011, 11:19:39 pm
Warmist you didn't add the perma adventurer swap and perma follow for the Dfhack version of DFusion?
I guess there removed until dfhack version works properly.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Warmist on August 09, 2011, 05:08:35 am
Warmist you didn't add the perma adventurer swap and perma follow for the Dfhack version of DFusion?
I guess there removed until dfhack version works properly.

Yeah could have missed them. Currently it's a bit messy, trying to port embark.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Deviled on August 09, 2011, 05:22:38 pm
more so for Deviled have you try using the pointer on a creature who is alive?
ADv_tools greatest hurdle is just the teaching folks you need to use the pointer on top of the creature you want to affect.

Wait what. Hold on let me try that.

Edit: yeah that was the problem
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on August 09, 2011, 05:29:59 pm
Oh warmist I got a question I'm having trouble with getting a site to be change due to the dfusion doesn't recognize SCALE as a word and Dfusion can't search for sites by one word.
The issue here is from attempting to change a elven resort over to a hamlet so I can steal their princess for my fort.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Kaelem Gaen on August 11, 2011, 02:01:03 am
So has he not released the official Plugin-version for DF Hack,  I'm honestly stumped as to how I use DFusion as a plugin for DFhack.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on August 11, 2011, 05:47:08 am
Beats me looks like they originally was talking about doing so and progress on it was only mention during a pm I got from asking a question.
I guess Warmist will make an official announcement later.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Warmist on August 11, 2011, 11:02:56 am
Oh warmist I got a question I'm having trouble with getting a site to be change due to the dfusion doesn't recognize SCALE as a word and Dfusion can't search for sites by one word.
The issue here is from attempting to change a elven resort over to a hamlet so I can steal their princess for my fort.

Strange- maybe DF has no word SCALE? As not searching by one word: there is no reason why it should not work with one word (i.e. i used it a few times with only one word)

So has he not released the official Plugin-version for DF Hack,  I'm honestly stumped as to how I use DFusion as a plugin for DFhack.

You need to build DFHack from github. That needs Microsoft Visual C (i use 2010 maybe older would work too) and CMAKE. For more exact instructions see build instructions in www.github.com/peterix/dfhack or www.github.com/warmist/dfhack . Also you need minimal experience with version control. OR you could wait till peterix (or me) makes a some sort of release (i heard him talking about it, dfhack will include a lot of usefull tool, including stonesense)
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on August 11, 2011, 11:22:35 am
or fish I guess from looking back at the ".18 version" of Dfusion I notice that the line where the offset was was moved to a function that might not pull all the words or maybe doesn't search for any part of the word and just looks if the person matches the name fully. this causes an issue with words like FISH in Chapelfish or SCALE in Dellscaly. Getting the one word searches to work might save me issues on the second word not registering as a word in Dfusion.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: darius on August 15, 2011, 02:16:51 am
Just a heads up: peterix released new (age) DFHack here (http://www.bay12forums.com/smf/index.php?topic=91166.0) with integrated dfusion.

I think i will start a new thread for that. Note that that version will be preferred to this in future development. Main reasons: cross-platform, faster (lookups in same program are way faster), multiple versions supported (depends on Memory.xml included with dfhack, e.g. friendship already uses memory.xml so theoretically it should work both with older versions and linux (although linux build failed for some reason) ). Access to memory.xml means that we can edit anything (and everything ;) ) that dfhack people could.

Changes that need to be noted:
Everything*- means that some things (very very rare) could make do something bad.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on August 15, 2011, 03:54:20 am
Dfusion Freezing the game going to have some issues with my Carry command where it needs the game running to work.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: darius on August 15, 2011, 03:56:30 am
Yeah that is one thing i forgot to note... You could try writing it in OnTick e.g.:
Code: [Select]
function OnTick()
  DoCarry()
end

Although ticks are rare (as not to lag too much) but it should work. I'm also thinking about making some sort of unsafe mode that it would not freeze DF (although that probably would result in crash)
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on August 15, 2011, 04:55:24 am
wait a minute why is it that the list shows only "g"s?
that the first time seeing OnTick before. Does this replace the "repeat until commands" or do I have to insert the function as a call to like so?
Code: [Select]
Docarry(rum_tools.carry)
Title: Re: DFusion - a lua based plugin system v3.8
Post by: darius on August 15, 2011, 05:27:59 am
wait a minute why is it that the list shows only "g"s?
that the first time seeing OnTick before. Does this replace the "repeat until commands" or do I have to insert the function as a call to like so?
Code: [Select]
Docarry(rum_tools.carry)
"g" is a bug (currently have no idea why... could be something with lua lib)
And OnTick does replace in some sense the repeat until commands, that is OnTick is called every N milllisecs. So you would write:
Code: [Select]
function rum_tools.carry()
-- some questions maybe?
--some settup
OnTick=function ()
-- do stuff what is written here every "tick"
end
end
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on August 15, 2011, 06:28:31 am
Okay two things one kinda got it to work, but it's giving me the error of a pattern.lua issue of attempt to index global 'bit' (giving a nil value).
so here's the Git version of a simple carry command
Code: [Select]
function rum_tools.Gitcarry()
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff,ptr_vector)
indx=GetCreatureAtPos(getxyz())
print("grabbing person")
OnTick=function () 
flg=engine.peek(vector:getval(0),ptr_Creature.flags)
flg2=engine.peek(vector:getval(indx),ptr_Creature.flags)
enty=engine.peek(vector:getval(0),ptr_Creature.y)+1
entx=engine.peek(vector:getval(0),ptr_Creature.x)
move=engine.peek(vector:getval(0),ptr_Creature.z)
engine.poke(vector:getval(indx),ptr_Creature.z,move)
engine.poke(vector:getval(indx),ptr_Creature.x,entx)
engine.poke(vector:getval(indx),ptr_Creature.y,enty)
if flg:get(15) ==true or flg2:get(1) ==true then
end
end
end
the issue of using this is you can't let go of the target and the game is slow.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: martinuzz on August 19, 2011, 04:30:41 am
When and how exactly should I use simple embark? I got to the prepare for the journey carefully screen, but when I use simple embark, nothing happens, there's no prompt asking me for the required number of dwarves or something like that.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on August 19, 2011, 04:47:11 am
When and how exactly should I use simple embark? I got to the prepare for the journey carefully screen, but when I use simple embark, nothing happens, there's no prompt asking me for the required number of dwarves or something like that.
before you embark, there no prompt but you can still enter the number oh and the number has to be above 7 or else the game will crash.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: darius on August 19, 2011, 12:32:39 pm
Good news: fixed both 'g' letters (somehow concat- ".." operator is not working correctly) and dfusion stopping DF (had to remove ontick, but if somebody uses it i can put it back)

To get it: either use my fork of dfhack or wait for peterix to make a release.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on August 19, 2011, 02:52:15 pm
I don't know if any one had found a work around with Ontick really, kinda like the idea of making game modes for dwarf fortress.
Kinda need to dive into Items and learn up creature cover in syndrome calls so I can make a venom that changes the race of a dwarf to a Queen to set up nice scenarios where players have to look out for Queens hiding among their fortress and make sure they don't go and build a nest box or the "what ever the race name is" soon over breed and crush a person's FPS.
To do this I have to write up the raws of the race make sure the race match the dwarf race enough so that players don't end up crashing the game and
program a function where the game constantly or periodically checks if any dwarf was covered in the syndrome and check if any of the creature's eggs has been layed for fast hatching and more Chaos.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: mstram on September 28, 2011, 01:51:57 pm
Hi Guys,

I just found this thread and haven't read through it yet, but am wondering if it's possible to use dfusion (or if there is some other tool(s) available) to :

1) Display the linked item(s) to a selected lever / pressure plate ... anything "linkable" ... mechanical

and

2) Would be great to be able to trace triggered actions :

"Door '#27' (or whatever the internal id is) has responded (opened / closed) after <dwarf name> stepped on / pulled the lever ... etc  at  <time>"

2a) Even terse debug output would be great

Item Id#    Type      Action          target(s)
---------      -----       -------         ----------
001            presPad  triggered           door #001,  hatch#003 .... etc


This would be great for exploring the machine area of DF, as the game itself seems to have little or no tools like the above.

Mike
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on September 28, 2011, 03:16:58 pm
to answer this question
yes you can, though you need to know lua and hex editing to find those triggers. so far you can use dfusion to look up items and where they are in the map and align it to the creature and where they are on the map.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: mstram on September 28, 2011, 06:39:18 pm
Heh,  ok, what I should have asked ....has anyone already done it ? :)
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on September 28, 2011, 07:41:18 pm
well no, it gives me an idea for setting up clone factories, if I can figure out how to attach a search for triggers being flip. though this might lead to melding of DFusion with DF and all types of FUN it brings.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: mstram on September 30, 2011, 12:55:05 pm
Ok, well after playing with dfusion, I ran the items/ print ref, and collected the names it found.

I don't see anything with a name like "lever" or "pressure plate".

I do see a few names that look like the linkable items :
  item_cagest
  item_chainst
  item_doorst
  item_floodgatest
  item_hatch_coverst
  item_gratest
  item_barst

Would plugging those items's addresses into Cheat Engine etc, be what I need to do?

Items found :


   item_cabinetst
   item_crownst
   item_weaponst
   item_anvilst
   item_glovesst
   item_coffinst
   item_millstonest
   item_backpackst
   item_armorstandst
   item_blocksst
   item_amuletst
   item_gemst
   item_gobletst
   item_liquid_miscst
   item_quernst
   item_boulderst
   item_totemst
   item_splintst
   item_plantst
   item_toyst
   item_binst
   item_tablest
   item_corpsest
   item_statuest
   item_crutchst
   item_roughst
   item_pipe_sectionst
   item_weaponrackst
   item_woodst
   item_traction_benchst
   item_scepterst
   item_corpsepiecest
   item_earringst
   item_bucketst
   item_quiverst
   item_instrumentst
   item_bedst
   item_chairst
   item_boxst
   item_helmst
   item_figurinest
   item_threadst
   item_skin_tannedst
   item_pantsst
   item_clothst
   item_smallgemst
   item_drinkst
   item_armorst
   item_foodst
   item_ringst
   item_shoesst
   item_seedsst
   item_flaskst
   item_shieldst
   item_barrelst
   item_braceletst
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on September 30, 2011, 09:45:05 pm
oh you just remind me of a member who gave me this large flowchart of all the target wordings.
has a section on traps so maybe one could dive into that. (http://dl.dropbox.com/u/21273392/df/31_19_win_Full_RTTI_fdp.svg)
Title: Re: DFusion - a lua based plugin system v3.8
Post by: mstram on September 30, 2011, 11:49:58 pm
Well that's a nice looking drawing..

But not very informative ;)
Title: Re: DFusion - a lua based plugin system v3.8
Post by: mstram on October 01, 2011, 01:54:43 pm
Ok, I have it on "good authority", that I need to be looking at *buildings*, and not items :)

It seems that offsets.lua is where I would plug in a buildings_vector" value="0x1ed4d98"

It seems it needs a small lookup function to be added with values for the "offsets.find" function.

I have no idea what to plug in there.

I tried just using the exisiting items - items.select() function with myoff=offsets.getEx("Buildings") (after "adding Buildings : 0x1ed4d98" to
offsets.txt), but it wasn't happy with that.

Mike
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Warmist on October 02, 2011, 04:15:45 am
First - you are correct you need to look into buildings. Second it's not that simple. No building data structure is known for dfusion. I'll try to make something (at least temporary)

Some clarification: Offsets.lua is used to automatically find new offsets with new df versions (almost never works fully). Adding value to offsets.txt (if you know it) is usually enough.
Found correct vector for buildings:
Code: [Select]
Buildings : 0x12C4DA8
Also onfunction trigger for levers:
Code: [Select]
onfunction.AddFunction(0x3D5886+offsets.base(),"Flip",{building="esi"})
Also some building patterns:
Code: [Select]
ptr_building={}
ptr_building.RTI={off=0,rtype=DWORD}
ptr_building.xs={off=4,rtype=DWORD}
ptr_building.ys={off=6,rtype=DWORD}
ptr_building.zs={off=8,rtype=DWORD}
ptr_building.xe={off=12,rtype=DWORD}
ptr_building.ye={off=16,rtype=DWORD}
ptr_building.ze={off=20,rtype=DWORD}
ptr_building.flags={off=24,rtype=ptt_dfflag.new(4)}
ptr_building.materials={off=28,rtype=DWORD}
ptr_building.builditems={off=228,rtype=ptr_vector}
function ptr_building.getname(self,RTI)
if RTI == nil then
return string.sub(RTTI_GetName(self.RTI),5,-3)
else
return string.sub(RTTI_GetName(RTI),5,-3)
end
end
ptr_subbuilding={}
ptr_subbuilding["building_trapst"]={}
ptr_subbuilding["building_trapst"].state={off=250,rtype=DWORD} -- atleast lever has this
ptr_subbuilding["building_doorst"]={}
ptr_subbuilding["building_doorst"].flg={off=248,rtype=WORD} --maybe flags?
ptr_subbuilding["building_doorst"].state={off=250,rtype=DWORD}
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on October 02, 2011, 08:18:37 am
so now we can set up horrible science experiments and create mutants through a single flip of a switch?
Title: Re: DFusion - a lua based plugin system v3.8
Post by: mstram on October 02, 2011, 09:07:10 am
> No building data structure is known for dfusion. I'll try to make something (at least temporary)

Is the buildings.cpp in dfhack of any relevance ?

>onfunction.AddFunction(0x3D5886+offsets.base(),"Flip",{building="esi"})

Where does that code go, and how do I use it?

I put it in offsets.lua, and got :

offsets.lua:3: attempt to index global 'onfunction' (a nil value)

I'm not sure where the rest of the code should go either.

offsets.lua ?

or  plugins\buildings\plugin.lua ?

What would be the function for :

Code: [Select]
offsets.new("Buildings", <?????????)
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on October 02, 2011, 11:51:50 am
I think warmist talking about Onfunction folder in dfhdfusion
you need to stick the second line in the onfunction/location file

the building patterns(third set of code) go to the patterns file best to stick it at the bottom so that it doesn't get mix in with anything else.
the only thing that goes into offsets is the top one.
the onfunction code suppose to set a trigger on any fliped lever to run the function you set it to.
the rest is just making a command that eithers runs on it's own after the trigger or take what triggers it and "poke at it".
I just hope this means we can build teleporters and spark space stations.

Title: Re: DFusion - a lua based plugin system v3.8
Post by: mstram on October 02, 2011, 02:58:49 pm
I created a folder plugins\buildings, and created plugin.lua inside of that, copied from plugins\items\plugin.lua

I changed the name of  function items.select() to  function buildings.select(), but when I run it I get :
plugins/buildings/plugin.lua:88: attempt to index global 'buildings' (a nil value)

 
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on October 02, 2011, 04:55:31 pm
hmm did you change the rest of the item.select to building.select?
it might be an issue of dfusion getting mix messages.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Warmist on October 02, 2011, 05:08:38 pm
"Buildings.<anything>" must go after line "Buildings={}". The second second sentence creates a new table to put functions/values into. Effectively what the dfusion says is that there is no table to put Select function into. Putting this into start of the file should fix it:
Code: [Select]
buildings=buildings or {} -- if there is table named "buildings" leave it alone, if not create an empty one.
The function also needs to be changed a bit (disclaimer writing before going to bed/not tested):
Code: [Select]
function buildings.select()
myoff=offsets.getEx("Buildings")
vector=engine.peek(myoff,ptr_vector)
tx,ty,tz=getxyz()
T={}
for i=0,vector:size()-1 do --this finds all item offsets that are on pointer
itoff=vector:getval(i)
xs=engine.peek(itoff,ptr_building.xs)
xe=engine.peek(itoff,ptr_building.xe)
ys=engine.peek(itoff,ptr_building.ys)
ye=engine.peek(itoff,ptr_building.ye)
zs=engine.peek(itoff,ptr_building.zs)
ze=engine.peek(itoff,ptr_building.ze)
if tx>=xs and ty>=ys and tz>=zs and tx<=xe and ty<=ye and tz<=ze then
table.insert(T,itoff)
end
end
print("Buildings under cursor:")
i=1
for _,v in pairs(T) do
RTI=engine.peek(v,ptr_building.RTI)
print(i..". "..ptr_building.getname(nil,RTI))
i=i+1
end
print("Type number to edit or 'q' to exit")
while true do
q=io.stdin:read()
if q=='q' then return end
if tonumber(q) ~=nil and tonumber(q)<i then break end
end
return T[tonumber(q)]
end
Don't remember if this works correctly but could help (generic function to edit anything that has a pattern entry)
Code: [Select]
ModPattern(itoff,ptr_building) -- first argument is offset (could be gotten with buildings.select) and second which pattern to use (could be ptr_subbuilding[name])
Title: Re: DFusion - a lua based plugin system v3.8
Post by: mstram on October 02, 2011, 07:07:47 pm
Don't we need some kind of function in the offsets.lua file too ?

offsets.new("Buildings",f_buildings)

function f_buildings
   pos=offsets.find(??????????????????????????)
.....
end
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Warmist on October 02, 2011, 11:19:49 pm
Don't we need some kind of function in the offsets.lua file too ?

offsets.new("Buildings",f_buildings)

function f_buildings
   pos=offsets.find(??????????????????????????)
.....
end

Not necessary. This is used only when dfusion is run without offsets.txt
Title: Re: DFusion - a lua based plugin system v3.8
Post by: mstram on October 03, 2011, 12:14:11 pm
Ok, I have the names of the buildings being displayed.

"building_screw_pumpst", seems to be the only recognizable mechanism "actuator"

I guess I can start with that and use the address in cheat engine

Any idea where the lever and pressure plate are ?

And do you know what the address for the buildings offset is for version 28.40d ?

   building_cabinetst
   building_statuest

   building_workshopst

   building_traction_benchst
   building_chairst
   building_bedst
   building_coffinst
   building_wellst
   building_civzonest

   building_gear_assemblyst
   building_windmillst
   building_weaponst
   building_hatchst

   building_screw_pumpst

   building_floodgatest
   building_grate_floorst
   building_bridgest
   building_weaponrackst
   building_armorstandst
   building_furnacest

   building_doorst
   building_cagest
   building_trapst
   building_chainst
   building_tablest
   building_boxst
   building_farmplotst
   building_stockpilest
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on October 12, 2011, 12:48:08 am
I wrote up a guide on how to use Site changer and how to manually search for the site number if site changer's own search engine doesn't work.
 part 1 (http://www.truimagz.com/host/fortcrush2/folder2/tut-site-changing-1.png)
 part 2 (http://www.truimagz.com/host/fortcrush2/folder2/tut-site-changer-2.png)
 part 3 (http://www.truimagz.com/host/fortcrush2/folder2/tut-site-changer-3.png)
hopefully this would clear up some issues.

oh here's a onfunction command that will make any one of the same civ companions to the adventurer, so folks who want to hotseat playstyle can swap around companions and not lose every one on board except for new recruits which then the convert function kicks in and fixes that.
Code: [Select]
function ControlCiv3()
--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)
leg=offsets.getEx("Legends")
legvec=engine.peek(leg,ptr_vector)
local trgs=selectciv()
for k,v in pairs(trgs) do
--print("members:"..k)
trgid=engine.peek(vector:getval(0),ptr_Creature.ID) --get players ID
playerlegid=getlegendsid(vector:getval(0))
trglegid=getlegendsid(v)
trgid=engine.peek(vector:getval(0),ptr_Creature.ID) --get players ID
engine.poke(v,ptr_Creature.followID,trgid) -- if not just write the players ID.
engine.poke(legvec:getval(trglegid),ptr_legends2.follow,playerlegid)
engine.poke(vector:getval(0),ptr_Creature.followID,-1)
engine.poke(legvec:getval(trglegid),ptr_legends2.follow,-1)
end
end
function selectciv()
  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)
     local crciv=engine.peek(off,ptr_Creature.civ)
     local curciv=engine.peek(vector:getval(0),ptr_Creature.civ)
     if curciv==crciv then
     --[[local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(1)==false then]]--  --if dead ...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end
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 Convert()
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff,ptr_vector)
--id=engine.peekd(offsets.getEx("CreaturePtr"))
--print(string.format("Vec:%d cr:%d",vector:size(),id))
local trgs=selectcomp()
for k,v in pairs(trgs) do
print("members:"..k)
off=v
crciv=engine.peek(off,ptr_Creature.civ)
curciv=engine.peek(vector:getval(0),ptr_Creature.civ)
if curciv==crciv then
--print("Civ Align")
else
--print("Civ not set up- setting")
engine.poke(off,ptr_Creature.civ,curciv)
end
end
end


onfunction.SetCallback("Move",ControlCiv3)
onfunction.SetCallback("Move",ControlCiv3)


So Warmist are the new locations that was updated for your copy of dfhack Dfusion can be applied to dfusion location.lua or do I need the extra bits to get them to work properly?
I want to make a ingame teleporter, but don't know the proper way to do so.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Tirion on October 13, 2011, 10:28:20 am
So, sorry if anyone asked it already, but how do I put non-dwarves in my military? I ran Embark and Friendship at embark to start with 3 dorfs, 3 kobolds and 3 modded tigermen. All are [INTELLIGENT], could get skill points in embark and I can manually assign them jobs, but they don't seem to actually do any work, and only the dorfs appear on the military screen. What am I doing wrong?

EDIT: repeated friendship solved the problem, though now I have a tantrum spiral brewing for no apparent reason-  the guys "lost a friend", even when I only butchered some stray animals. And it crashes when I activate multi-race migrants... sadly, I didn't get the sex distribution of my founders right at first, so it will soon be a dwarf-only fort  :-\
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on October 13, 2011, 03:57:04 pm
So, sorry if anyone asked it already, but how do I put non-dwarves in my military? I ran Embark and Friendship at embark to start with 3 dorfs, 3 kobolds and 3 modded tigermen. All are [INTELLIGENT], could get skill points in embark and I can manually assign them jobs, but they don't seem to actually do any work, and only the dorfs appear on the military screen. What am I doing wrong?

EDIT: repeated friendship solved the problem, though now I have a tantrum spiral brewing for no apparent reason-  the guys "lost a friend", even when I only butchered some stray animals. And it crashes when I activate multi-race migrants... sadly, I didn't get the sex distribution of my founders right at first, so it will soon be a dwarf-only fort  :-\
you either a) run friendship beforehand and have a citizen on the fort be leader of the squad the rest of the creatures should be to work.
b) change their race to match the one currently running the fort go into military and add them in(they might not be able to be leaders of their squads so make sure you have a normal citizen assign before you go changing the race of a dragon.) make sure to change the creature's race back once you enlist them to the army C) use race changer to flip over to the other race and add them into the military. oh best to make sure the creature has the is resident flag off which can be checked through runesmith.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Tirion on October 13, 2011, 04:13:44 pm
Umm...sorry for being a noob, would someone please point me to a step-by-step guide to race changing? It's not quite self-evident in Runesmith.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on October 13, 2011, 10:27:29 pm
Umm...sorry for being a noob, would someone please point me to a step-by-step guide to race changing? It's not quite self-evident in Runesmith.
which one adventure race changing or Fort race changing?
both work similar but leads to two different functions
Adventure race change: change the creature race(dwarf to human or Human to Cat)
Fort race change: change the playable race of the fort(if you ever play a modded Df where they had multiple races to play in fort mode? well this here command will allow you to change hope runs the fort and flip control. like if you have a tigerman slave in a dwarf civ you can change the race to Tigerman and get Tigerman Migrants and get to control the Tigerman while the Dwarfs act friendly)

Adventure Race change can be done by having the "x"pointer on the creature you want to change and selecting the function, the utility will look for the creature under the X pointer race and ask you for the name of race you want to change to IN ALL CAPS and the RAW name(which means you need to dive into the raw/object folder and search for the creature's name if you don't already know and even then Race changing Is crash happy if you unpause or fail to save the game after changing for unless the creature you swap to has the same body type and facial descriptions it don'g any task will break the game though you only using this to trick DF into allowing the creature access to military and can revert the process after you are done).(note this is in old dfusion where adventure tools still work)
Fort mode Race change can be done by just simply typing in the RAW name of the creature you want to play as in fort mode, but beware the creature must be apart of the civ or else the game will switch see no sentient works around and end it.

and usually all this knowledge is from Me going through trial and error(and diving into the plugin.lua to read the developer text which explains what parts do what) and asking what does this do to Darius when he introduces them.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: darkRenegade on October 28, 2011, 11:05:28 pm
Hi, I'm new to Dwarf Fortress, and I read here: http://www.bay12forums.com/smf/index.php?topic=95060.0
that DFusion could make other creatures into companions(Adventurer mode) I am wondering how to do that. I tried it with a dragon, and it became a companion, but still attacked me.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on October 29, 2011, 12:26:22 am
Hi, I'm new to Dwarf Fortress, and I read here: http://www.bay12forums.com/smf/index.php?topic=95060.0
that DFusion could make other creatures into companions(Adventurer mode) I am wondering how to do that. I tried it with a dragon, and it became a companion, but still attacked me.
well there might be a case of Civ number having an effect on the creature hostility if it's -1 it will attack no matter what, then there the chance of getting a kill quest which will also make it hostile to you(well that and befriending it will betray the site you got the quest from and banish you from the area.), if the dragon hit you or if you attack it first it already aggro with you and you lose the ability to tame it*, oh then there the case of it attacked your site before might make it hostile to you on the spot.



*there ways to regain it's trust but It's to costly and I haven't perfected it yet.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: darkRenegade on October 29, 2011, 12:46:18 am
Wow, I didn't expect to get a reply so soon.
Thanks, that's a bit confusing, but if I found a creature not from a quest, used DFusion to tame it, and used something like Runesmith to change the civ number, i might get a tamed dragon?
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on October 29, 2011, 12:58:57 am
Wow, I didn't expect to get a reply so soon.
Thanks, that's a bit confusing, but if I found a creature not from a quest, used DFusion to tame it, and used something like Runesmith to change the civ number, i might get a tamed dragon?
yes. Though good luck not getting caught in the cross fire of it's dragon breathe.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: thistleknot on November 06, 2011, 06:13:48 pm
MAybe I'm not using it right.  But I dl'd 3.8, installed it to my dwarf fortress root directory (where DwarfFortress.exe is at), and when I run it, I guess "can not find DF".
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on November 06, 2011, 06:21:14 pm
MAybe I'm not using it right.  But I dl'd 3.8, installed it to my dwarf fortress root directory (where DwarfFortress.exe is at), and when I run it, I guess "can not find DF".
well Dfusion 3.8 doesn't need to be in the DF folder for it to work.
question which version of DF are you using?
Title: Re: DFusion - a lua based plugin system v3.8
Post by: thistleknot on November 06, 2011, 06:24:03 pm
31.25
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Taricus on November 06, 2011, 06:25:49 pm
Is DF running when you use it? It needs DF actively running for it to access it.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: thistleknot on November 06, 2011, 06:36:34 pm
no it was not.  Didn't know.  THe instructions don't really elaborate (altho I'm learning from dfhack that this is the case).

Okay, now it's just crashing when I open Dwarf Fortress, but dfusion says it's running okay
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on November 06, 2011, 07:01:09 pm
31.25
is it SDL df or legacy?
Title: Re: DFusion - a lua based plugin system v3.8
Post by: thistleknot on November 06, 2011, 07:06:04 pm
windows.  I'm using the lazy new pack, but I have a straight 31.25 I was using.  Wuz the difference?  It's capable of running in a window.  It's the standard version dl'd from bay12games.

I did get it working with dfhack r8 package. :)  Just not with the standalone package.

Tee hee 20 dorfs!
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on November 06, 2011, 09:50:22 pm
windows.  I'm using the lazy new pack, but I have a straight 31.25 I was using.  Wuz the difference?  It's capable of running in a window.  It's the standard version dl'd from bay12games.

I did get it working with dfhack r8 package. :)  Just not with the standalone package.

Tee hee 20 dorfs!

okay so you are using Lazy new pack and haven't downloaded the game normally so this means LNP interfering with Dfusion and/or LNP is legacy and not SDL.


but since you are running DFHacks Dfusion I can use this time to pimp dump this onfunction command set up so that you can no longer have rotten foods.

add this line to the dfusion/onfunction/plugin.lua file
Code: [Select]
function derot()
myoff=offsets.getEx("Items") -- first find out where "item vector" is
vector=engine.peek(myoff,ptr_vector) --  get list of items
for i=0,vector:size()-1 do --look at each item
flg=engine.peek(vector:getval(i),ptr_item.flags)
flg:set(5,0)
engine.poke(vector:getval(i),ptr_item.flags,flg)
end
end


function Dfolder()
DeathMsg()
Ghost()
makeghost()
end
function Mfolder()
derot()
end
function Bfolder()
Burn()
end
function Hfolder()
DeathMsg()
end
stick this under the first "onfunction.setcallback" line
Code: [Select]
--onfunction.SetCallback("Die",Dfolder)
onfunction.SetCallback("Move",Mfolder)
onfunction.SetCallback("Flip",Bfolder)
Title: Re: DFusion - a lua based plugin system v3.8
Post by: thistleknot on November 07, 2011, 12:19:55 am
lnp is sdl.  It's possible I was using legacy with another df I had (31.25).  But I'm not sure.  At this point I'm not sure if I care if the new dfhack r8 has the latest dfusion, cuz I got it worked with dfhack r8.

Update: I re-dl'd sdl 31.25, a-ok :)
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on November 07, 2011, 02:45:36 am
lnp is sdl.  It's possible I was using legacy with another df I had (31.25).  But I'm not sure.  At this point I'm not sure if I care if the new dfhack r8 has the latest dfusion, cuz I got it worked with dfhack r8.
dfhack only updated dfusion in r7, r8 just an addon to Minecraft. oh well hopefully you can prevent scattering and soon playing with "turn dead to zombies" mode in no time.

Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on November 07, 2011, 10:42:23 am
Sorry if I sound dumb or the subject's been answered, but is there a way to make some of the embark creatures females? I seem to only have males on embark. And I plan on killing every single migrant who comes to my fort.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on November 07, 2011, 12:44:39 pm
Sorry if I sound dumb or the subject's been answered, but is there a way to make some of the embark creatures females? I seem to only have males on embark. And I plan on killing every single migrant who comes to my fort.
well you could make a race of dwarves that the males lay eggs. race change one dwarf to that one, then run egg hatcher and race change the first female born to a normal dwarf.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: thistleknot on November 08, 2011, 12:23:17 pm
Anyway I can add my own offset's?  I used cheat engine 6.1 to find 1 byte values that specify dwarf embark points (there's 7 dorfs) that are spent on skills.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on November 08, 2011, 01:37:04 pm
yes it's under the offsets.txt file
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on November 10, 2011, 10:56:20 am
Hm...well, that answers my question. Thanks!
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on November 16, 2011, 10:55:01 am
Hm...I heard it is possible to make half-breeds...I have a half-elf raw file, now how do I do the whole human-elf breeding thing so I can put this raw into action? I know it involves race-changer, but the only functions I use are the ones pertaining to fortress mode (embark, friendship, migrants), so how do I attempt half-breeds?
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on November 16, 2011, 11:59:45 pm
Hm...I heard it is possible to make half-breeds...I have a half-elf raw file, now how do I do the whole human-elf breeding thing so I can put this raw into action? I know it involves race-changer, but the only functions I use are the ones pertaining to fortress mode (embark, friendship, migrants), so how do I attempt half-breeds?
okay Dfusion from Dfhack removed Adventure tools warmist didn't add them back so you just have to use dfusion 3.8 or copy paste the race change function from that into Dfhack dfusion.

you need to race change the mother into the father race to have them mingle around and to get her knock up once knock up you either race change her into the half elf race or back to her normal race and give birth to horrible ugly spawn that will crash the game if you try to read their descriptions.

 I found a solution to that bug but it based around making sure the race you going to change into has the  same facial feature and body type as the mother so that dwarf fortress doesn't go nuts trying to figure out who's who.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on November 17, 2011, 10:36:51 am
Hm...hopefully a human-elf hybrid should work if I make sure the bodies are the same. No half-orcs...
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on November 17, 2011, 03:48:34 pm
Spoiler (click to show/hide)

edit: here's my trait, Trigger folders for Onfunction and my WIP Voodoo functions* due to post space issues and I don't want to fill other threads with these codes over and over again hopefully these get added in to Dfhack.

Code: [Select]
function trait() --this here is the central hub for adventure mode ongoing functions based on the creature's race, this will work in fort mode if you set up one of the members in the area as the "adventurer"
RaceTable=RaceTable or BuildNameTable() --slow.If loaded don't load again
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff,ptr_vector)
trai=engine.peek(vector:getval(0),ptr_Creature.race)
tra=RaceTable["KEEPER_INFECTED"] --all these are set for different creature races the adventurer could be, one can change this to what ever they want
tra4=RaceTable["FRAWD"]
tra2=RaceTable["KEEPER"]
tra3=RaceTable["DWARF"]
tra5=RaceTable["MAGE"]
tra6=RaceTable["INTERN"]

if trai==tra then --this is the 'folder' section that checks if the adventurer is either a Keeper infected and if so then runs the functions in it.
--ControlZom3()
keeptrack() --these are functions stored in the folder if the above is true dfusion will run the functions
ControlRace()
end
if trai==tra2 or Trai==tra4 then
ControlCiv3()
end
if trai==tra5 then
--Magi()
Keeptrack()
end
if trai==tra6 then
Nightfriend()
end
if trai==tra3 then
--ControlCiv3()
--wepbrn2()
ControlRace()
--Voodoo1()
end
Voodoo2() --this goes to a function that does the same thing Trait does but to items and tracks them through material and item type.
end
Code: [Select]
function Voodoo2() --stick normal spells here to add or make a spell you need to use Dfusion item edit to find out the item itmser,mat,submat,submat2 number
myoff=offsets.getEx("Items")
vector=engine.peek(myoff,ptr_vector)
for i=0,vector:size()-1 do --check all items
off=vector:getval(i)
itmser=ptr_item.getname(nil,RTI)
mat=engine.peek(off,ptr_item.mat)
submat=engine.peek(off,ptr_item.submat)
submat2=engine.peek(off,ptr_item.submat2)
lid=engine.peek(off,ptr_item.legendid)
RTI=engine.peek(off,ptr_item.RTI)
if itmser=="item_verminst" then --this checks if the item is a vermin
if mat==(293) then --this checks if the item is a certain type of vermin which as of now checks to see if it's a fluffly wambler
Nightfriend()
flg=engine.peek(off,ptr_item.flags) --this should destroy the wambler to prevent the above function to repeat each move
flg:set(17,true)
end
end
if itmser=="item_boulderst" then
if mat==(129) then
print("it really works")
Nightfriend()
end
if submat2==(305) then
--ControlZom3()
Zombieressurect()
end
if submat2==(306) then
print("teleport spell goes here")
end
end
if mat==(0) and submat2==(304) then
print("works")
end
if itmser=="item_statuest" then
if submat2==(275) then
print("this is the trigger")
end
if submat2==(306) then
print("teleport here")
itemwarp()
end
end
if itmser=="item_eggst" then
if mat==(129) then
print("it really works")
end
end
end
end
Code: [Select]
function Dfolder() --these folders are here because Onfunction doesn't run all commands if you attach them to the bottom, so I though why not make a function that does that for me. this is the on death folder which holds key commands that trigger if someone dies.
DeathMsg()
Ghost()
makeghost()
end
function Mfolder() --this is the on move folder which holds functions I want to run forever, or if someone moves. so playing adventure mode this will happen constantly
raceconvert()
--ControlCiv3()
derot()
--Zombieressurect()
--zombiearmy()
trait()
--Nightfriend()
makeghost()
end
function Bfolder() --this is the on building flip folder if someone pulls a level this triggers
Burn()
end
function Hfolder()--this is on hurt suppose to flip off when someone is damaged haven't found use for it as of now.
DeathMsg()
end
if mypos then
print("Onfunction already installed")
--onfunction.patch(0x189dd6+offsets.base())
else
onfunction.install()
dofile("dfusion/onfunction/locations.lua")
--onfunction.SetCallback("Die",Dfolder) --this is where the folders go
onfunction.SetCallback("Move",Mfolder)
onfunction.SetCallback("Flip",Bfolder)
end

so far
Title: Re: DFusion - a lua based plugin system v3.8
Post by: VerdantSF on December 07, 2011, 01:04:50 pm
Is there a way to toggle the size of the armor that armorsmiths make?  Or can elves and humans wear the same armor as their dwarven fortmates?
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Warmist on December 07, 2011, 03:41:05 pm
Is there a way to toggle the size of the armor that armorsmiths make?  Or can elves and humans wear the same armor as their dwarven fortmates?
Easy way- nope. But AFAIK some of them share the same armor size. And armorsmith makes armor that fits himself. So if you have a troll army you will need troll smiths too. I think because there is no easy way to manage this is the main reason why multirace forts are not enabled by Toady One.

Edit: although i tried starting new thread but look like this is a more lively one... hmm
Edit2: should have named it somehow differently :/ anyway @rumrusher: really interested what will you make :) also a neat lua trick is to make tabled functions (saw it somewhere) works if you have name-> function relation
Code: [Select]
f_table={}
--fill in the table with choices
f_table[RaceTable["KEEPER_INFECTED"]]=function () keeptrack();ControlRace() end
f_table[RaceTable["FRAWD"]]=ControlCiv3
f_table[RaceTable["KEEPER"]]=ControlCiv3
f_table[RaceTable["DWARF"]]=ControlRace
f_table[RaceTable["MAGE"]]=Keeptrack
f_table[RaceTable["INTERN"]]=Nightfriend
--f_table[ raceid]= some function, if you need more then one function you can do inplace functions i.e. like KEEPER_INFECTED above.
if f_table[trai] ~= nil then
   f_table[trai]() -- call the function from the table
else
   Voodoo2() -- did not find this race so call default function
end
this is like switch statements in other programming languages.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on December 07, 2011, 07:25:39 pm
well here's the revised version of Voodoo2
Code: [Select]
function Voodoo2() --stick normal spells here
mattbl=mattbl or BuildMaterialTable() -- could be slow so if there is a table don't do it again
myoff=offsets.getEx("Items")
vector=engine.peek(myoff,ptr_vector)
for i=0,vector:size()-1 do --check all creatures
local off=vector:getval(i)
local mat=engine.peek(off,ptr_item.mat)
local submat=engine.peek(off,ptr_item.submat)
local submat2=engine.peek(off,ptr_item.submat2)
local lid=engine.peek(off,ptr_item.legendid)
local RTI=engine.peek(off,ptr_item.RTI)
local itmser=ptr_item.getname(nil,RTI)
q=mattbl["ADAMANTINE"]
q2=mattbl["SPELL_ZOM"]
q3=mattbl["SPELL_TEL"]
q4=mattbl["SPELL_TRAIT"]
q5=mattbl["SPELL_TRAIT2"]
q6=mattbl["SPELL_TRAIT3"]
q7=mattbl["PERMAICE"]
--[[if submat2==q then
--print("Thank's Warmist")
end]]--
if itmser=="item_backpackst" then
if submat2==q2 then
--print("works")
zombiearmy2()
end
end
if itmser=="item_boulderst" then
if submat2==q4 then
--print("it really works")
Nightfriend()
flg=engine.peek(off,ptr_item.flags)
flg:set(17,1)
end
if submat2==q2 then
--ControlZom3()
--Zombieressurect()
flg=engine.peek(off,ptr_item.flags)
flg:set(17,true)
end
end
if itmser=="item_statuest" then
if submat2==mattbl["SLADE"] then
print("this is the target")
end
if submat2==q3 then
--print("teleport here")
itemwarp()
flg=engine.peek(off,ptr_item.flags)
flg:set(17,true)
end
if submat2==q2 then
Zombieressurect()
flg=engine.peek(off,ptr_item.flags)
flg:set(17,true)
end
end
if itmser=="item_eggst" then
if mat==(129) then
makeghost()
print("it really works")
flg=engine.peek(off,ptr_item.flags)
flg:set(17,true)
end
end
end
end
So now I just need to do is go back to my old rumtools functions and swap out the whole use pointer bits with item placement maybe have yes and no be items that if true will disappear(to clear the function and to prevent horrible game crashes from certain functions.).
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Koronii on December 07, 2011, 08:41:31 pm
Is there a way to toggle the size of the armor that armorsmiths make?  Or can elves and humans wear the same armor as their dwarven fortmates?

Elves can wear dwarven armor, they're the same size as our dwarves. But humans can't wear it.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on December 08, 2011, 02:45:01 am
Is there a way to toggle the size of the armor that armorsmiths make?  Or can elves and humans wear the same armor as their dwarven fortmates?

Elves can wear dwarven armor, they're the same size as our dwarves. But humans can't wear it.
well it's based on Race than size really. the size bit is just their for flavor text and to explain which race can fit that.

edit: hey when did Prevent scatter stop working in Hamlets?
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Warmist on December 08, 2011, 11:35:08 am
Is there a way to toggle the size of the armor that armorsmiths make?  Or can elves and humans wear the same armor as their dwarven fortmates?

Elves can wear dwarven armor, they're the same size as our dwarves. But humans can't wear it.
well it's based on Race than size really. the size bit is just their for flavor text and to explain which race can fit that.

edit: hey when did Prevent scatter stop working in Hamlets?
Did it ever work?
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on December 08, 2011, 12:09:45 pm
And yet I havent found a single community fort using this yet. Why not? At least you dont have to be a dwarf when it starts up.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: VerdantSF on December 08, 2011, 12:31:28 pm
And yet I havent found a single community fort using this yet. Why not?
The game census itself only reads actual dwarves.  A quick glance at "z" is no longer accurate for the total fort population.  Related to this, the current version of Dwarf Therapist only reads actual dwarves, and thus you'll have quite a few fort denizens who have to be toggled manually.  Perhaps there are other big reasons, but those two certainly don't help.  It's too bad.  It's a nifty program!
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on December 08, 2011, 01:59:28 pm
:( Ah, well, at least I still have my minotaur death squad.


EDIT: Wouldn't it be possible to just change the controlling race using Dfusion and do a combined census? That would also work for the DT problem. I know since I use it for my own fortress.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: VerdantSF on December 08, 2011, 02:08:39 pm
Oh, I was only talking about multi-species forts.  For that, changing the controlling race still leaves all the other races out in the cold, census-wise.

EDIT: Unless you mean that it's possible to have more than one controlling race.  Is it?
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Warmist on December 08, 2011, 02:33:11 pm
Oh, I was only talking about multi-species forts.  For that, changing the controlling race still leaves all the other races out in the cold, census-wise.

EDIT: Unless you mean that it's possible to have more than one controlling race.  Is it?
I think IamanElfCollaborator meant that you could cycle through races i.e. do a census/DT on dwarves, on elves, then on trolls. The most annoying thing that i have to tackle is migrants sometimes ignore the list (tested with only dogs as migrants but still dwarves appeared).
I was thinking about starting a community fort with evolution of DFusion itself (i.e. if something can be done, and it would fit the story/occasion). Not only it would be interesting but also benefit other users of DFusion. But as always real life takes away too much time :D
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on December 08, 2011, 05:49:12 pm
Is there a way to toggle the size of the armor that armorsmiths make?  Or can elves and humans wear the same armor as their dwarven fortmates?

Elves can wear dwarven armor, they're the same size as our dwarves. But humans can't wear it.
well it's based on Race than size really. the size bit is just their for flavor text and to explain which race can fit that.

edit: hey when did Prevent scatter stop working in Hamlets?
Did it ever work?
well... hmm the last time I remember using it was Tweak where I physically changed the area to that.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on December 09, 2011, 10:15:45 am
I haven't yet had problems with the migrant list, and the census thing works well in my forts. Hm... excuse me while I go figure something out...
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Tirion on December 09, 2011, 06:27:02 pm
Would someone tell me how to equip companions in Adventurer mode with this utility? In a noob-compatible way if possible, please ;)
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on December 09, 2011, 09:29:28 pm
Would someone tell me how to equip companions in Adventurer mode with this utility? In a noob-compatible way if possible, please ;)
First place the X pointer on the companion you want to change to.
then run Adv_tools and the command change Adventurer(either one works also best get the old 3.8 version and not Dfhack's Dfusion for Dfhack's doesn't have an Adv_tools you can add them in but that's intermediate level)
if you succeed you will be swap and dfusion will prompt something about being swapped.
now go back to the game and pick up items, to change back just go back to Dfusion and hit enter.

Adv_tools is based all on using the pointer, where as Tools more "fort mode"or "can't wrap head around use of X pointer for functions." and while it works you screw out of selecting folks if you have over 700 entries you wont be able to look at the first 300, let alone having to wait for it to load up all those creatures.

oh and in personal coding...
(http://www.truimagz.com/host/fortcrush2/folder2/zombie-yodelers.png)

Okay so I was testing out necromancy and this happens.
Oh the night creature over to the right is a ghost spawner I place down... and the ghost was former freshly turned zombie companions I accidentally killed.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Tirion on December 10, 2011, 05:20:36 am
By the X pointer, you mean [l]ook, or tal[k]? Both bring up an X.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on December 10, 2011, 11:40:15 am
Look.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on December 10, 2011, 05:46:00 pm
Look.
both actually even throw/fire works.

edit: here's my lever function for those dealing with wild animals, demons, bandits any thing that's not apart of your civ.
Code: [Select]
function itemanimalwarp()
--[[if itoff==nil then
itoff=selectstatue3()
end]]--
local myoff=offsets.getEx("AdvCreatureVec")
local vector=engine.peek(myoff,ptr_vector)
--local indx=0
local sx,sy,sz
local curoff=vector:getval(0)
local trgs=selectstatue2()
for k,v in pairs(trgs) do
local trgs=selectwild()
for t,b in pairs(trgs) do
ix=engine.peek(v,ptr_item.x)
iy=engine.peek(v,ptr_item.y)
iz=engine.peek(v,ptr_item.z)
sx=engine.peek(b,ptr_Creature.x)
sy=engine.peek(b,ptr_Creature.y)
sz=engine.peek(b,ptr_Creature.z)
--r=io.stdin:read()
local tx,ty,tz
tx=ix
ty=iy
tz=iz
engine.poke(b,ptr_Creature.x,tx)
engine.poke(b,ptr_Creature.y,ty)
engine.poke(b,ptr_Creature.z,tz)
local flags=engine.peek(b,ptr_Creature.flags)
engine.poke(b,ptr_Creature.flags,flags)
end
end
end

function selectstatue2()
  mattbl=mattbl or BuildMaterialTable() -- could be slow so if there is a table don't do it again
  local retvec={} --return vector (or a list)
  myoff=offsets.getEx("Items")
  vector=engine.peek(myoff,ptr_vector)
  for i=0,vector:size()-1 do --check all creatures
     off=vector:getval(i)
mat=engine.peek(off,ptr_item.mat)
submat=engine.peek(off,ptr_item.submat)
submat2=engine.peek(off,ptr_item.submat2)
lid=engine.peek(off,ptr_item.legendid)
     RTI=engine.peek(off,ptr_item.RTI)
--entry=io.stdin:read()
q=mattbl["SPELL_TEL"]
--if q~=nil then return end
     itmser=ptr_item.getname(nil,RTI)
     --local flags=engine.peek(off,ptr_item.flags)
     if itmser=="item_statuest" and submat2==q then  --if a weapon in anyway...
        table.insert(retvec,off)--... add it to return vector
--print("drugs")
     end
  end
  return retvec --return the "return vector" :)
end

function selectwild()
  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)
     local crciv=engine.peek(off,ptr_Creature.civ)
     curciv=engine.peekd(offsets.getEx("CurrentRace")-12)
wild=(-1)
     if crciv==curciv then
else
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end


this goes to the flip switch called  Bfolder.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: darius on December 12, 2011, 06:42:15 am
Are there any lizard men in vanilla df? Also what other cool races are there?

Spoiler: next version (click to show/hide)
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on December 12, 2011, 10:38:48 am
Nope. There are serpentmen and snake men.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on December 12, 2011, 07:48:53 pm
Code: [Select]
okay here's a fresh batch of item functions that a personal necromancer would love.
sadly
code]function itemghostwarptest(off) --this will take the item(from voodoo2) that triggered it and teleport all ghosts to it's coordinates. usefullness depends on what you do to the ghosts.
--[[if itoff==nil then
itoff=selectstatue3()
end]]--
local myoff=offsets.getEx("AdvCreatureVec")
local vector=engine.peek(myoff,ptr_vector)
--local indx=0
local sx,sy,sz
local curoff=vector:getval(0)
local trgs=selectghost()
for t,b in pairs(trgs) do
ix=engine.peek(off,ptr_item.x)
iy=engine.peek(off,ptr_item.y)
iz=engine.peek(off,ptr_item.z)
sx=engine.peek(b,ptr_Creature.x)
sy=engine.peek(b,ptr_Creature.y)
sz=engine.peek(b,ptr_Creature.z)
--r=io.stdin:read()
local tx,ty,tz
tx=ix
ty=iy
tz=iz
engine.poke(b,ptr_Creature.x,tx)
engine.poke(b,ptr_Creature.y,ty)
engine.poke(b,ptr_Creature.z,tz)
local flags=engine.peek(b,ptr_Creature.flags)
engine.poke(b,ptr_Creature.flags,flags)
end
end
function itemcompwarptest(off) --a code set up to teleport companions to places you want them to be, like on the roof, several feet into lava, or with you so they don't end up chasing off for some hard to kill animal during a raid
--[[if itoff==nil then
itoff=selectstatue3()
end]]--
local myoff=offsets.getEx("AdvCreatureVec")
local vector=engine.peek(myoff,ptr_vector)
--local indx=0
local sx,sy,sz
local curoff=vector:getval(0)
local trgs=selectcomp()
for t,b in pairs(trgs) do
ix=engine.peek(off,ptr_item.x)
iy=engine.peek(off,ptr_item.y)
iz=engine.peek(off,ptr_item.z)
sx=engine.peek(b,ptr_Creature.x)
sy=engine.peek(b,ptr_Creature.y)
sz=engine.peek(b,ptr_Creature.z)
--r=io.stdin:read()
local tx,ty,tz
tx=ix
ty=iy
tz=iz
engine.poke(b,ptr_Creature.x,tx)
engine.poke(b,ptr_Creature.y,ty)
engine.poke(b,ptr_Creature.z,tz)
local flags=engine.peek(b,ptr_Creature.flags)
engine.poke(b,ptr_Creature.flags,flags)
end
end

function selectghost()
  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)
     local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(76)==true then  --if dead ...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end
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



I might get started working on two way teleporters or the kind that warps folks if they walk over it.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Hugo_The_Dwarf on December 25, 2011, 11:24:14 pm
the 'races.txt' files for Friendship and Migrants is all wonky. This is in the intergrated DFusion for the newest version of DFhack r8. How do I use it? all the Races are jammed together with nospaces all on one line. I was used to the old DFusion where each race had to be on it's own line, and when I format to fit that way I get loading fails and crashes.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Warmist on December 26, 2011, 06:40:44 am
the 'races.txt' files for Friendship and Migrants is all wonky. This is in the intergrated DFusion for the newest version of DFhack r8. How do I use it? all the Races are jammed together with nospaces all on one line. I was used to the old DFusion where each race had to be on it's own line, and when I format to fit that way I get loading fails and crashes.
I think it happened because of different newline format (linux vs windows newline format). It still needs to be one race per line.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Hugo_The_Dwarf on December 26, 2011, 10:20:04 am
for Friendship it works when I have

DWARFHUMAN

but fails when I put it as (cannot load module)

DWARF
HUMAN

Also I'm using Win 7 Pro SP1 just in case the OS is the main issue

but with the

DWARFHUMAN

I have no idea if it's acaully working or making some random creature up....

EDIT:
Ok now it just completely crapped out :/
 this is what happens if I place each race on seperate lines
(http://img.ie/38760.png)

And if I leave it on the same line I now (finally) get the error of "No such things as DAWRFHUMAN"

EDIT2:
Nvm it was my error, surpised I didn't see it before. The races.txt must be altered BEFORE running DF and/or DFhack, You guys probally have that written somewhere.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Warmist on December 26, 2011, 03:40:54 pm
EDIT2:
Nvm it was my error, surpised I didn't see it before. The races.txt must be altered BEFORE running DF and/or DFhack, You guys probally have that written somewhere.
Totally confused now... Should work either way. Oh and races.txt will probably go, but before i need to think of some better way to enter races.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Hugo_The_Dwarf on December 26, 2011, 04:43:32 pm
I was making changes to the Races.txt while I was playing (always before I run Dfusion tho) Idk either it is kinda hit and miss here.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on December 31, 2011, 04:09:30 am
Also, when are multi-civ forts going to be possible? I was thinking of making a fort with three separate factions in it.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Hugo_The_Dwarf on December 31, 2011, 12:30:39 pm
I was going to try with that, but migrants are broken. DF crashes as soon as a migrant comes... Wait maybe its because I only have one DWARF entry doesn't DFusion freak out if the Migrant function only has one entry?

Anyways since I can't get the migrated other civs, I can't use friendship. I'll probally try with filling the races.txt with more entries and see if im just stupid
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on December 31, 2011, 09:00:03 pm
Its out already? Oh. I don't need migrants. I was thinking about somehow converting one faction (civ) to another. Like thieves kidnapping and training a random civilian.

Title: Re: DFusion - a lua based plugin system v3.8
Post by: Hugo_The_Dwarf on December 31, 2011, 10:15:16 pm
Its out already? Oh. I don't need migrants. I was thinking about somehow converting one faction (civ) to another. Like thieves kidnapping and training a random civilian.

In a way you can, it requires runesmith and the Friendship option on here. If I think I know what your talking about, say you get invaded and a goblin/kobold/elf gets caught in a cage trap you can use runesmith to remove all the hostile flags and add the friendly ones then change his civ number to yours.

Then use friendship to allow control over your "enslaved" invader, of course if he/she kills a pet/member of your civ he/she is now a horrible cause of a loyalty cascade. But using friendship causes oddies such as your dwarves insisting they must bury all the dead that you specify in the races.txt in the friendship foulder.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on December 31, 2011, 11:29:47 pm
Its out already? Oh. I don't need migrants. I was thinking about somehow converting one faction (civ) to another. Like thieves kidnapping and training a random civilian.

In a way you can, it requires runesmith and the Friendship option on here. If I think I know what your talking about, say you get invaded and a goblin/kobold/elf gets caught in a cage trap you can use runesmith to remove all the hostile flags and add the friendly ones then change his civ number to yours.

Then use friendship to allow control over your "enslaved" invader, of course if he/she kills a pet/member of your civ he/she is now a horrible cause of a loyalty cascade. But using friendship causes oddies such as your dwarves insisting they must bury all the dead that you specify in the races.txt in the friendship foulder.

and or if you don't stick the race you using in the list it will count all of them as tamed and end the fort.
Well Dfusion does have access to creature flags and Creature civs so you could just make a function that does that for you.
now making a function that does that depends on if you want it to run always or on command.

Code: [Select]
function selectcaged()
  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)
     --[[local crciv=engine.peek(off,ptr_Creature.civ)
     local curciv=engine.peek(vector:getval(0),ptr_Creature.civ)
     if curciv==crciv then]]--
     local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(25)==true then  --if caged ...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end
function convertcage()
local trgs=selectcaged()
for k,v in pairs(trgs) do
flags=engine.peek(v,ptr_Creature.flags)
flags:set(17,false)
flags:set(19,false)
flags:set(26,true) --this is the tamed flag
local crciv=engine.peek(v,ptr_Creature.civ)
local curciv=engine.peekd(offsets.getEx("CurrentRace")-12)
engine.poke(v,ptr_Creature.civ,curciv)
end
end
this will take any one caged and safely turn them into apart of the fort tamed. hopefully you guys know how to open up a plugin.lua file using notepad and edit it in right?
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Hugo_The_Dwarf on December 31, 2011, 11:47:31 pm
I do yes... Well I have only dabbled in lua. But I know how to open one up, And i've worked with a few programming languages.

I'm acaully interested in the "on command" feature, which Plugin.lua will I have to open and how to do the "On Command"?
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on January 01, 2012, 12:43:08 am
I can open up the lua files, but sadly I am not even a dabbling lua programmer. Well, there's that solution. All I need to do now is make me a thieves den. :D

Yay, my own personal group of thieving kobolds who I can release to steal from the city at my own leisure.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on January 01, 2012, 03:54:37 am
okay the On command is when you use command dfusion to do it.

which could be done through sticking something kinda like this
"   items.menu:add("prompt name of function here that comes up when you go into that menu",items.functionnamehere)"
with the rest of coding similar to it that's at the bottom of the entire page.

Hugo,Iaman I never known lua when I started coding for it or to mess with it on Darius level I just fiddle with the existing code and slightly modify it to see if it works.

Its out already? Oh. I don't need migrants. I was thinking about somehow converting one faction (civ) to another. Like thieves kidnapping and training a random civilian.


on this subject I remember I could kidnap(use dfusion to force joining) a couple royal men and women from their forts and walk them into my fort then made them breed(through race changing them to a identical race that just reproduce by laying eggs) to fuel my royal army(with use of egg hatcher).
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on January 01, 2012, 04:32:09 am
Meh, I'll just take my pick from the normal batch of migrants, the ones for the original fort civ.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on January 01, 2012, 04:50:43 am
Meh, I'll just take my pick from the normal batch of migrants, the ones for the original fort civ.
oh one thing I also found out that if you slap on "is resident" on a military unit they don't need to feed any more.
though if you mix this with getting non same race members into military you could have spiders, birdsmen, and minotaurs guarding the place while your kobolds nibble on bone safely.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on January 01, 2012, 04:59:13 am
I know. Although, seeing as I'd rather the pissed-off city guard be able to invade their pathetic den, I'll just leave naked kobolds armed with training daggers to stand guard while I leave the back door wide open.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Hugo_The_Dwarf on January 01, 2012, 11:59:48 am
okay the On command is when you use command dfusion to do it.

which could be done through sticking something kinda like this
"   items.menu:add("prompt name of function here that comes up when you go into that menu",items.functionnamehere)"
with the rest of coding similar to it that's at the bottom of the entire page.

Hugo,Iaman I never known lua when I started coding for it or to mess with it on Darius level I just fiddle with the existing code and slightly modify it to see if it works.

Its out already? Oh. I don't need migrants. I was thinking about somehow converting one faction (civ) to another. Like thieves kidnapping and training a random civilian.


on this subject I remember I could kidnap(use dfusion to force joining) a couple royal men and women from their forts and walk them into my fort then made them breed(through race changing them to a identical race that just reproduce by laying eggs) to fuel my royal army(with use of egg hatcher).

Maybe I will wait until I have mastered another 2-3 languages then start learning lua. I think what gets me is I have no idea how to properly hex edit or use offsets, best thing I've ever hex'd is the number of lives in a game or ammo. I've seen some crazy things modders have done with Hex editing for games that didn't allow third partie plugins or easy to edit core files.

I'm acually more confused on which plugin.lua I need to drop/work this into because:
1. there is one in almost every foulder in the DFhack's version of DFusion
2. all the .lua and .txt files have lost all form of formatting and are basically compacted to one line :-/
Title: Re: DFusion - a lua based plugin system v3.8
Post by: darius on January 02, 2012, 01:26:59 am
I'm acually more confused on which plugin.lua I need to drop/work this into because:
1. there is one in almost every foulder in the DFhack's version of DFusion
2. all the .lua and .txt files have lost all form of formatting and are basically compacted to one line :-/

1. put it in whatever place it seems best.
2. don't use notepad. Use notepad++ (with syntax higlight) or (should work) wordpad.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on January 04, 2012, 10:06:58 am
Armok be damned. I just...somehow...got a baby out of a fire imp and dwarf marriage. That means...he's a half breed. But...that's impossible. SOMEBODY EXPLAIN WHAT IN ARMOKS NAME IS GOING ON IN HERE?!
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Warmist on January 04, 2012, 12:12:12 pm
Armok be damned. I just...somehow...got a baby out of a fire imp and dwarf marriage. That means...he's a half breed. But...that's impossible. SOMEBODY EXPLAIN WHAT IN ARMOKS NAME IS GOING ON IN HERE?!
ehehe... probably should put a disclaimer somewhere... Because i have no f idea what could go wrong (or right). My experiments before shown that there could not be interracial babies. But i guess new version friendship is even more... friendly :D
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on January 04, 2012, 05:49:50 pm
Armok be damned. I just...somehow...got a baby out of a fire imp and dwarf marriage. That means...he's a half breed. But...that's impossible. SOMEBODY EXPLAIN WHAT IN ARMOKS NAME IS GOING ON IN HERE?!
ehehe... probably should put a disclaimer somewhere... Because i have no f idea what could go wrong (or right). My experiments before shown that there could not be interracial babies. But i guess new version friendship is even more... friendly :D
Wait, what?! Well if anything happens the baby would either be a dwarf/imp that can't be look at to tell the descriptions with out crashing the game, or you can and I was going through mixrace breeding all wrong.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on January 04, 2012, 07:05:36 pm
It came out of a fire imp/dwarf marriage. He's considered a dwarf...but that still doesnt explain how he was even BORN:
Desc:
(http://i1184.photobucket.com/albums/z329/skybrigadier/screenshot1.jpg)

And his family screen:
(http://i1184.photobucket.com/albums/z329/skybrigadier/screenshot2.jpg)

Please explain to me how THAT happened.  :o
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on January 04, 2012, 07:31:15 pm
His name is Asmel Wheelscalded, Fireimpborn.
Well looks like all my years of work on crossbreeding issues was slightly WRONG. all I needed to do is just waited for two races mingle a little longer.
he takes his natural race from the mother side that part of my research is true.
but does he take any bits from his father?
and does the fort have any other cross race relationships? my usually don't get to the point where they befriend any other races.

If you want to know when a dwarf woman is married they end up allowing themselves to breed. Now what the question I like to ask is how she find the fire imp attractive enough to get married and is she friends with other fire imps?
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on January 04, 2012, 07:38:44 pm
Most of my fort dwellers are friends with each other. I'm looking for more lovers/married couples.

He and his father both find it hard to form social relationships, they both are illiterates, and they both have poor kinesthetic ability. So, while he got no physical characteristics, he got his mental attributes.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on January 05, 2012, 12:18:27 am
Yes. She's friends with 3 other fire imps, 2 male one female if that helps. Hm...

Maybe she wanted a little adventure in her life? :P

EDIT: Actually, this is intresting enough that I might track the story of Asmel.
 
'The Story of Asmel Wheelscalded, Impborn.'
'Never has such a creation existed, neither shall it exist again.'
I'll be posting the story in the Community Stories forum, and I'll be posting here the progress of the mysterious half-breed.

EDIT2: For some reason, if I try to look at Asmel's description now, it crashes. What happened?

EDIT3:Look's like this world's screwed. IT crashes before I can do much else anyway. :(
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Reudh on January 05, 2012, 02:43:40 am
So this code
Code: [Select]
function selectcaged()
  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)
     --[[local crciv=engine.peek(off,ptr_Creature.civ)
     local curciv=engine.peek(vector:getval(0),ptr_Creature.civ)
     if curciv==crciv then]]--
     local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(25)==true then  --if caged ...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end
function convertcage()
local trgs=selectcaged()
for k,v in pairs(trgs) do
flags=engine.peek(v,ptr_Creature.flags)
flags:set(17,false)
flags:set(19,false)
flags:set(26,true) --this is the tamed flag
local crciv=engine.peek(v,ptr_Creature.civ)
local curciv=engine.peekd(offsets.getEx("CurrentRace")-12)
engine.poke(v,ptr_Creature.civ,curciv)
end
end

linked earlier DOES work without a hitch?
And how do I access it?
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Warmist on January 05, 2012, 03:36:42 am
Yes. She's friends with 3 other fire imps, 2 male one female if that helps. Hm...

Maybe she wanted a little adventure in her life? :P

EDIT: Actually, this is intresting enough that I might track the story of Asmel.
 
'The Story of Asmel Wheelscalded, Impborn.'
'Never has such a creation existed, neither shall it exist again.'
I'll be posting the story in the Community Stories forum, and I'll be posting here the progress of the mysterious half-breed.

EDIT2: For some reason, if I try to look at Asmel's description now, it crashes. What happened?

EDIT3:Look's like this world's screwed. IT crashes before I can do much else anyway. :(

:/ it a shame. Really wanted this to grow into something more.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on January 05, 2012, 03:59:30 am
Yes. She's friends with 3 other fire imps, 2 male one female if that helps. Hm...

Maybe she wanted a little adventure in her life? :P

EDIT: Actually, this is intresting enough that I might track the story of Asmel.
 
'The Story of Asmel Wheelscalded, Impborn.'
'Never has such a creation existed, neither shall it exist again.'
I'll be posting the story in the Community Stories forum, and I'll be posting here the progress of the mysterious half-breed.

EDIT2: For some reason, if I try to look at Asmel's description now, it crashes. What happened?

EDIT3:Look's like this world's screwed. IT crashes before I can do much else anyway. :(
hmm did you close out of DF then reload, maybe you need friendship running to view?


reudt to get that to work you need to add this line
"   tools.menu:add("Convert those in cages",convertcage)"
To the one similar to it. You can find it in the plugin.lua.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on January 05, 2012, 05:05:48 am
I'ma going to need a gender change function to do moar !!SCIENCE!!
So far, I have proved it is possible to look at a half-breeds description, and to have a half-breed born under normal, fort mode circumstances without using adventurers or race changers. We must do !!SCIENCE!!, for we can make some real breakthroughs using this knowledge.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Reudh on January 05, 2012, 05:24:24 am
I have embedded Dfusion, is it any different? I had to create a new plugins.lua, as there wasn't one before.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on January 05, 2012, 06:03:02 am
lol I find it strange that you are not somehow curious about this new development.
And nope, not to my knowledge. Unless Rumrusher or Darius proves me wrong, there isn't anything different about embedding Dfusion.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on January 05, 2012, 08:04:47 am
by embedded Dfusion you mean DFhack Dfusion, if so then the difference is little, there's no adv_tools and it has onfunction. Though non Dfhack dfusion has access to typing messages into Dwarf fortress and one could set up series of print commands.


Iaman, Adventurer's fall under Race changers, I had not got an adventurer recently to be in a romantic relationship I got up to buds and friends though.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on January 05, 2012, 08:08:04 am
Ah. In that case I have actually sort of gotten farther than you by getting two different races to be married and have children. Most of my dwellers are friends as well. Maybe adventure mode halfbreed mechanics are different from fort mode?
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on January 05, 2012, 11:07:28 am
Ah. In that case I have actually sort of gotten farther than you by getting two different races to be married and have children. Most of my dwellers are friends as well. Maybe adventure mode halfbreed mechanics are different from fort mode?
there no Adventure mode breeding mechanics, or I haven't seen them.

but man I hate how dfhack's mode set prevents people from changing modes if they are in Reclaim mode.

if I'm luckily AVG hasn't banned all of Dfhack's old programs from use.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on January 05, 2012, 11:10:33 am
Hell, theres a lot of !!SCIENCE!! to go through here. I'll be working to see if I can replicate Asmel Impborn.

EDIT: I just noticed I was using the unsupported Dfusion standalone. I just put that out just in case that influenced the existence of the hybrid in a fort mode without race change.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Warmist on January 05, 2012, 12:53:45 pm
Damn dfusion is buggy... And almost all are super stupid bugs (e.g. forgetting to make some space for migrant races...)

Quickfix:
pls edit init.lua in migrants folder (or is it plugin.lua... i forget what version is other ppl using...) and edit
Code: [Select]
modpos,modsize=engine.loadmod("dfusion/migrants/migrants.o","Migrants")
to something like
Code: [Select]
modpos,modsize=engine.loadmod("dfusion/migrants/migrants.o","Migrants",400) -- make space for 100 migrant races...

Edit2: oh actually kobold just said that he's unhappy that his best friend (gremlin medic) has decayed... So interracial friendship is possible. Let's see what will happen next :)
Edit3: slight bug...
Spoiler (click to show/hide)
i think all the civs want to trade with me... and at the same time.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on January 05, 2012, 06:08:52 pm
Lucky..
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Hugo_The_Dwarf on January 05, 2012, 06:32:54 pm
i think all the civs want to trade with me... and at the same time.
i think all the civs want to trade with me...
all the civs want to trade with me...
If this could be mastered... There could be more then just your parent civ trading with you...

EDIT:
If a cap could be set for how many civs of a certain entiti could come and what ones (2 HUMAN/PLAINS, 3 DWARF/MOUNTIAN) could request more stuff, and have larger trades without making Multiple Entities of the same race creature.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Nighthawk on January 05, 2012, 06:34:08 pm
I haven't played DF in a while. I remember the last time I used this mod, it was to resurrect my slain adventurer.

Unfortunately, the enemies simply killed me every time I was brought back to life.

It was depressing.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on January 05, 2012, 07:40:38 pm
Depressing?

Losing is fun.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on January 05, 2012, 07:48:40 pm
I haven't played DF in a while. I remember the last time I used this mod, it was to resurrect my slain adventurer.

Unfortunately, the enemies simply killed me every time I was brought back to life.

It was depressing.
you should have flip on Ghost mode first before finishing the revival.
that way you can safely walk a good distance away from spawn killers.

Wait so is this migrants only or do stolen folks work also?

Hell, theres a lot of !!SCIENCE!! to go through here. I'll be working to see if I can replicate Asmel Impborn.
I remember way back when I created my first half breed hybrid.
her name was Olon Toolpalaces but this was back when toady one didn't include race detailing.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on January 05, 2012, 08:27:21 pm
I must have more halfbreeds....

I at least found a way to display mental characteristics. DT.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on January 05, 2012, 10:04:01 pm
I must petition you for a gender change mode. That way, !!SCIENCE!! using half-breeds in fort mode can be more easily conducted.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on January 06, 2012, 03:44:23 am
I must petition you for a gender change mode. That way, !!SCIENCE!! using half-breeds in fort mode can be more easily conducted.
well I think runesmith has a female male gender change. but then why stop at gender and go full fiddling with caste swapping.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Warmist on January 06, 2012, 04:14:34 am
Damn this is getting messier by the second... Need some way to track versions, do documentations, add user made code... Also tracking wishes would be nice.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Reudh on January 06, 2012, 05:31:51 am
Hate to be a noob, but it'd be great if someone could walk me through putting that code into the embedded Dfusion/Dfhack thing. and also to point out any errors. I'm thinking of making a multirace fort in a new world, which should be interesting.

Code: [Select]
function selectcaged()
  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)
     --[[local crciv=engine.peek(off,ptr_Creature.civ)
     local curciv=engine.peek(vector:getval(0),ptr_Creature.civ)
     if curciv==crciv then]]--
     local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(25)==true then  --if caged ...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end
function convertcage()
local trgs=selectcaged()
for k,v in pairs(trgs) do
flags=engine.peek(v,ptr_Creature.flags)
flags:set(17,false)
flags:set(19,false)
flags:set(26,true) --this is the tamed flag
local crciv=engine.peek(v,ptr_Creature.civ)
local curciv=engine.peekd(offsets.getEx("CurrentRace")-12)
engine.poke(v,ptr_Creature.civ,curciv)
end
end
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on January 06, 2012, 07:50:07 am
Hate to be a noob, but it'd be great if someone could walk me through putting that code into the embedded Dfusion/Dfhack thing. and also to point out any errors. I'm thinking of making a multirace fort in a new world, which should be interesting.

Code: [Select]
function selectcaged()
  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)
     --[[local crciv=engine.peek(off,ptr_Creature.civ)
     local curciv=engine.peek(vector:getval(0),ptr_Creature.civ)
     if curciv==crciv then]]--
     local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(25)==true then  --if caged ...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end
function tools.convertcage()
local trgs=selectcaged()
for k,v in pairs(trgs) do
flags=engine.peek(v,ptr_Creature.flags)
flags:set(17,false)
flags:set(19,false)
flags:set(26,true) --this is the tamed flag
local crciv=engine.peek(v,ptr_Creature.civ)
local curciv=engine.peekd(offsets.getEx("CurrentRace")-12)
engine.poke(v,ptr_Creature.civ,curciv)
end
end
Code: [Select]
tools.menu:add("convert caged animals",tools.convertcage)find the plugin.lua for Tools folder(if you have notepad or say Flash develop that might make this easier) then stick in my modified version of the code I did in your quote in the plugin.lua,
then take the tools.menu:add line and insert it into the bottom set of coding in the tools's plugin.lua.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Reudh on January 06, 2012, 08:00:26 am
Thanks Rumrusher.

Now I'm off to test it.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Warmist on January 06, 2012, 08:30:06 am
Looks like interracial marriages are more common than i thought... Serpent man (man) with dwarf (woman) had a healthy little (dwarf) girl. I probably need to add ability to make different races for mixed breeds (with something like "DWARF+ELF=DWELF" where DWELF was added by modding)
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on January 06, 2012, 10:01:28 am
Looks like interracial marriages are more common than i thought... Serpent man (man) with dwarf (woman) had a healthy little (dwarf) girl. I probably need to add ability to make different races for mixed breeds (with something like "DWARF+ELF=DWELF" where DWELF was added by modding)
well that means you have to fix how dwarf fortress handles parental descriptions. also I'm one step ahead with interns safe crossing breeding with humans for they have the same detail descriptions the only difference is interns lay eggs and have mind flayer attacks.
Title: Re: DFusion - a lua based plugin system v3.8
Post by: IamanElfCollaborator on January 07, 2012, 04:19:57 am
Hm....in that case I'll need to be even further above you and make a creature able to breed in between dwarves, humans, elves, goblins, kobolds, and so many other creatures.

!!SCIENCE!! TO BE DONE!
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Reudh on January 07, 2012, 05:39:38 am
Ah, Rumrusher, it simply doesn't appear. My lua knowledge is scant, but does --end mean 'end of file' as opposed to 'end of code snippet'?
Title: Re: DFusion - a lua based plugin system v3.8
Post by: Rumrusher on January 07, 2012, 01:58:24 pm
Hm....in that case I'll need to be even further above you and make a creature able to breed in between dwarves, humans, elves, goblins, kobolds, and so many other creatures.

!!SCIENCE!! TO BE DONE!
Wait how did you do this feature any way? Using Migrants or just straight friendship mode? or did you did the friendship at the beginning to get multiple creature races access to noble jobs?
Title: Re: DFusion - a lua based plugin system (integrated into DFHack)
Post by: Cardinal on January 08, 2012, 04:22:51 pm
Has anyone written there a Leaving Your Fort on Autopilot for Dummies guide?  I just want to let my fort keep running while I go adventuring and start other forts.  I never was able to do this with DFusion when I tried a while back.

Also, is this all going to be significantly screwed up by the new release?
Title: Re: DFusion - a lua based plugin system (integrated into DFHack)
Post by: darius on January 08, 2012, 05:58:20 pm
Has anyone written there a Leaving Your Fort on Autopilot for Dummies guide?  I just want to let my fort keep running while I go adventuring and start other forts.  I never was able to do this with DFusion when I tried a while back.

Also, is this all going to be significantly screwed up by the new release?
1. AFAIK impossible changing into adventure mode stops everything.
2. Yes it will be screwed quite significantly. But not as much as dfusion (old one) or spellcraft(dead with one version change :/ )
Title: Re: DFusion - a lua based plugin system (integrated into DFHack)
Post by: Rumrusher on January 09, 2012, 11:08:50 am
Has anyone written there a Leaving Your Fort on Autopilot for Dummies guide?  I just want to let my fort keep running while I go adventuring and start other forts.  I never was able to do this with DFusion when I tried a while back.

Also, is this all going to be significantly screwed up by the new release?
1. AFAIK impossible changing into adventure mode stops everything.
2. Yes it will be screwed quite significantly. But not as much as dfusion (old one) or spellcraft(dead with one version change :/ )
Well you can't get the fort to continue working on making metal swords when you switch over to adventure mode but you can set up a main hall where every one spawned will walk towards.

1/12/12 edit Here's a unfinished dump of my work so far, made for genesis 3.25k(which is really outdated)
Please be warned most of the lua functions are buggy and will kill FPS faster than opening hell.
The stuff that are accessible is the fort mode lever functions one being able to turn an iron statue into 5 different items. Though 2 only have effects that either give you free meat, or kill your fort from all the dead pile around.

the file is here (http://dffd.wimbli.com/file.php?id=5351)
Title: Re: DFusion - a lua based plugin system (integrated into DFHack)
Post by: EngineerFromHell on February 11, 2012, 02:35:44 am
If I want a multiracial military I should run friendship pre-embark? Or friendship and migrants? Or there's no way at all for that?
Title: Re: DFusion - a lua based plugin system (integrated into DFHack)
Post by: Warmist on February 11, 2012, 05:53:10 am
Run friendship (migrants too if you want to have multirace migrants coming) and if there is no other race creatures in military list (dunno why but sometimes it happens) try tool->set race and change "main" race to something else (e.g. TROLL) set squads and then (optionally) set it back.
Title: Re: DFusion - a lua based plugin system (integrated into DFHack)
Post by: EngineerFromHell on February 11, 2012, 06:21:06 am
Run friendship (migrants too if you want to have multirace migrants coming) and if there is no other race creatures in military list (dunno why but sometimes it happens) try tool->set race and change "main" race to something else (e.g. TROLL) set squads and then (optionally) set it back.
Even after that there's no other race units in military list.
Should I run friendship pre- or postembark?
Title: Re: DFusion - a lua based plugin system (integrated into DFHack)
Post by: Warmist on February 11, 2012, 07:42:34 am
Run friendship (migrants too if you want to have multirace migrants coming) and if there is no other race creatures in military list (dunno why but sometimes it happens) try tool->set race and change "main" race to something else (e.g. TROLL) set squads and then (optionally) set it back.
Even after that there's no other race units in military list.
Should I run friendship pre- or postembark?
pre-embark
Title: Re: DFusion - a lua based plugin system (integrated into DFHack)
Post by: EngineerFromHell on February 11, 2012, 08:21:00 am
Well, it finally works in new world, but I still can't create squad out of creatures obtained after embark through Runesmith (Human caravan guards and serpent man, for example), maybe it doesn't display some flags?
Title: Re: DFusion - a lua based plugin system (integrated into DFHack)
Post by: Rumrusher on February 11, 2012, 10:42:26 am
Well, it finally works in new world, but I still can't create squad out of creatures obtained after embark through Runesmith (Human caravan guards and serpent man, for example), maybe it doesn't display some flags?
That's because if their not migrants, or born into the civ, they would be lock out of access the noble selections and being a leader to a military group is part of it.
you need to make dwarf(normal) leaders that has a multirace squadmembers for it to work (now), or make the new converted men and women have children so the children could be enlisted.
Title: Re: DFusion - a lua based plugin system (integrated into DFHack)
Post by: IamanElfCollaborator on February 11, 2012, 10:45:08 am
That's where the half-breed problem crops up.
Title: Re: DFusion - a lua based plugin system (integrated into DFHack)
Post by: EngineerFromHell on February 11, 2012, 11:04:41 am
That's because if their not migrants, or born into the civ, they would be lock out of access the noble selections and being a leader to a military group is part of it.
you need to make dwarf(normal) leaders that has a multirace squadmembers for it to work (now), or make the new converted men and women have children so the children could be enlisted.
But I can't add them even to squad with dwarven leader, they're simply not in the list.
Also, is there some way to deal with tile occupancy bug?
Title: Re: DFusion - a lua based plugin system (integrated into DFHack)
Post by: Rumrusher on February 11, 2012, 04:38:04 pm
That's where the half-breed problem crops up.
well the half breed issue comes from the facial(random generated) descriptions of the two creatures are different and the game calling for one set while looking at a creature who set up with something different.
The theory is that if you get two races with the same randomgen part DF won't see there's a problem all allow you to look into it. What IamanElfCollaborator did was prove that the game won't do this in a natural birth and use the mother side info for the baby until what ever you did to cause it to stop. I still don't know how you done it either so I chalk this up to high level random event that might advance !!SCIENCE!! and lead to horrible hybrid babies on command.
Title: Re: DFusion - a lua based plugin system (integrated into DFHack)
Post by: IamanElfCollaborator on February 12, 2012, 04:11:36 am
I know THAT,but the effort needed to have children, not to mention the fact that some may make half-breeds, and also that there is a SLIGHT chance of world crashing after the birth, makes waiting for the converted people non-viable.
Title: Re: DFusion - a lua based plugin system (integrated into DFHack)
Post by: Rumrusher on February 12, 2012, 08:48:36 am
the game crashing after the birth is a new one.
usually when I get past one step I just save scum the hell out of the results so that if I screw up some where down the line I can go back a save.
That's because if their not migrants, or born into the civ, they would be lock out of access the noble selections and being a leader to a military group is part of it.
you need to make dwarf(normal) leaders that has a multirace squadmembers for it to work (now), or make the new converted men and women have children so the children could be enlisted.
But I can't add them even to squad with dwarven leader, they're simply not in the list.
Also, is there some way to deal with tile occupancy bug?
had you tried checking if they have: "is resident" flag check off, The Tame flag check off, have the civ number correct to the civ your in, a dwarf in the leaders spot.
have you gone into the miltary screen and on the select member screen use dfusion to change who running the Civ?

you could also change them(the beast) to the civ race(dwarf) add them to the list then change their race back.
Oh and make sure all custom race are added to the friendship race.txt before using it or you'll end up losing access to playing with them and might autodoom a fort that way.


okay what is this Tile occupancy bug?
Title: Re: DFusion - a lua based plugin system (integrated into DFHack)
Post by: tahujdt on December 24, 2012, 12:18:08 pm
Big bump, how do I use the Embark plugin to choose castes of whichever race I want? Example: I play the Fallout:Equestria mod, wherein the author used hundreds of castes to get the right cutie marks. How would I pick which ponies I want?
Title: Re: DFusion - a lua based plugin system (integrated into DFHack)
Post by: Thundercraft on February 02, 2013, 09:45:28 pm
Has anyone written there a Leaving Your Fort on Autopilot for Dummies guide?  I just want to let my fort keep running while I go adventuring and start other forts.  I never was able to do this with DFusion when I tried a while back.
AFAIK impossible changing into adventure mode stops everything.
Well you can't get the fort to continue working on making metal swords when you switch over to adventure mode but you can set up a main hall where every one spawned will walk towards.

I also just want to "retire" my old fort while leaving behind living dwarves (or whatever) and have the fort continue to be a part of my race's civilization, while I either go adventuring or start a new embark. Basically, I REALLY want a "legacy" game. I understand the old fort will not keep running while adventuring, but that does not matter to me.

Please, would you explain how to "set up a main hall where every one spawned will walk towards"?
Title: Re: DFusion - a lua based plugin system (integrated into DFHack)
Post by: Dr_Scallion on November 17, 2013, 07:55:47 am
Hello,
when I try to use the "friendship" plugin, I have this error :

(http://img11.hostingpics.net/pics/688997friendshiperror.jpg)
I use a custom race made by NW_Kohaku, the Nagas...
Thank you in davance