Skip to content

Instantly share code, notes, and snippets.

@warmist
Created April 2, 2012 16:49
Show Gist options
  • Save warmist/2284959 to your computer and use it in GitHub Desktop.
Save warmist/2284959 to your computer and use it in GitHub Desktop.
A dfusion script to find places that set death flag.
function DEATH_FIND()
local unit=df.global.world.units.all[0]
local offset=select(2,df.sizeof(unit:_field("flags1")))-select(2,df.sizeof(unit))
print(string.format("flags offset:%x",offset))
local list=offsets.findall(GetTextRegion().start,0x83,ANYBYTE,DWORD_,offset,2)
for k,v in pairs(list) do
local call_pos=offsets.find(v,0xe8,DWORD)
if call_pos~=nil and call_pos~=0 and call_pos-v<1000 then
print(string.format("%3d.%6d =>%6x",k,(call_pos-v),v))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment