Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 251 252 [253] 254 255 ... 373

Author Topic: DFHack 0.34.11 r3  (Read 1456468 times)

Kurik Amudnil

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3780 on: May 20, 2013, 07:21:47 pm »

I guess my question got lost,
does anyone have a script to totally heal a dwarf or remove all wounds as it were?

I don't know where I got it from but I have a heal script.  I thought it came preinstalled with dfhack but maybe that was an older version.  Looking at the zip I can't seem to find it.  Also, I had to fix a couple of lines to be compatible with dfhack r3.  It won't restore lost limbs, but here it is:  hack/scripts/heal.lua

Fake edit: my heal.lua is Andux's healunit.lua (he posted while I was composing) but I have updated my copy for r3.  If I remember correctly the only changes I made to it were  unit.status2.limbs_stand_count=unit.status2.limbs_stand_max and unit.status2.limbs_grasp_count=unit.status2.limbs_grasp_max

Code: [Select]
-- Repairs all health issues except for syndromes and severed limbs.
local unit=dfhack.gui.getSelectedUnit()
if unit then
print("Erasing wounds...")
while #unit.body.wounds > 0 do
unit.body.wounds:erase(#unit.body.wounds-1)
end
unit.body.wound_next_id=1

print("Refilling blood...")
unit.body.blood_count=unit.body.blood_max

print("Resetting status flags...")
unit.status2.limbs_stand_count=unit.status2.limbs_stand_max
unit.status2.limbs_grasp_count=unit.status2.limbs_grasp_max

unit.flags2.has_breaks=false
unit.flags2.gutted=false
unit.flags2.circulatory_spray=false
unit.flags2.vision_good=true
unit.flags2.vision_damaged=false
unit.flags2.vision_missing=false
unit.flags2.breathing_good=true
unit.flags2.breathing_problem=false

unit.flags2.calculated_nerves=false
unit.flags2.calculated_bodyparts=false

print("Resetting counters...")
unit.counters.winded=0
unit.counters.stunned=0
unit.counters.unconscious=0
unit.counters.webbed=0
unit.counters.pain=0
unit.counters.nausea=0
unit.counters.dizziness=0

unit.counters2.paralysis=0
unit.counters2.fever=0
unit.counters2.exhaustion=0
unit.counters2.hunger_timer=0
unit.counters2.thirst_timer=0
unit.counters2.sleepiness_timer=0
unit.counters2.vomit_timeout=0

end

The other script I have is for resurrecting or restoring lost limbs, name it what you like (heal2.lua or resurrect.lua or whatever):
Code: [Select]
-- Resurrect and/or restore lost limbs
function heal2()
unit = dfhack.gui.getSelectedUnit()
unit.flags1.dead = false
unit.flags2.killed = false
if unit.caste == 0 then
unit.caste = 1
else
unit.caste = 0
end
end
heal2()

« Last Edit: May 20, 2013, 07:28:18 pm by Kurik Amudnil »
Logged

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3781 on: May 20, 2013, 07:33:56 pm »

Is it possible to change a dwarf's skill level using DFHack? I seem to remember a utility that could in the past, but don't remember if it was this
Logged

Worryn

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3782 on: May 20, 2013, 08:46:13 pm »

What's the command to add a foreign or wild unit to your fort?

Edit: I'm playing an orc fortress mod. Could I, for example, create an ogre, or really strong orc in arena control with "mode set" and then add it to my fort? I want it to be like a peasant, not like a tame animal, so it can do work and join the army

Anyone? :c

Gunna get attacked eventually. could really use those ogres xP

Your current race is tracked. i.e. if your play orcs you can only have orcs but for military purposes you can create blank squad entries then use gm-editor to change the tame creature's squad reference then just order the squad around currently i haven't found a way to make them do actual work. it seems "Tame" is a job priority that is set rather high. hope this was helpful
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3783 on: May 20, 2013, 09:16:30 pm »

in the latest version of the masterwork-mod some skillnames have been changed within the executable, however this feature wasn't provided for linux - which i am using
now i've applied these changes on the linux-executable myself
starting df normally it runs fine, but using dfhack it crashes with a segmentation fault (with and without plugins - the stderr.log seems fine, though)
???

what could be the problem?
https://github.com/peterix/dfhack/blob/master/Readme.rst#id9
You need to add <md5-hash value="..."/> to symbols.xml (use md5 dwarfort.exe to determine it).
Also, I've found segfaults occur most often when you change the length of the skill name - using an abbreviated version with the same number of letters should work (I'm not entirely sure why this doesn't crash on Windows).
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

breadman

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3784 on: May 20, 2013, 11:17:30 pm »

Is there a convenient way to determine whether a given item can be stored in a given stockpile?  The canStoreItem virtual method on buildings looks tempting, but always returns false for stockpiles.

I could reverse engineer from stockpile settings and item properties, but that's more work than I really want to put in for this use case.
Logged
Quote from: Kevin Wayne, in r.g.r.n
Is a "diety" the being pictured by one of those extremely skinny aboriginal statues?

crossmr

  • Bay Watcher
    • View Profile
    • Jeonsa
Re: DFHack 0.34.11 r3
« Reply #3785 on: May 21, 2013, 03:35:38 am »

thanks guys I'll try that script, but exactly which command is it that removes infection?
I just cleaned up a unit, because he for some silly reason (the one who had weird healthcare issues) was treated several times but left with like 3 or 4 infections. I wouldn't mind just cleaning those up but leaving old scars or things like that.

« Last Edit: May 21, 2013, 03:45:45 am by crossmr »
Logged

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3786 on: May 21, 2013, 07:40:41 am »

That heal2 script should fix infections.  It abuses the way werecreatures are handled by the game and makes the game think your dwarf is currently suffering from a werecurse that has expired.  They transform back instantaneously and any health problems are immediately resolved.  There's no actual werecurse or lasting harm from doing it though.  The only caution that I'd provide is unless I'm imagining things, it can cause the physical attributes of the dwarf to be rerolled.  When I was screwing around with doing that manually, I believe I saw the physical attributes of a soldier (who was very strong and tough at the time) be rerolled into something worse after I applied it.

Other than abusing werecurses, I'm not sure if infections are stored in the wounds vector or not.  One of the healing scripts shown earlier had a section for erasing wounds in the wounds vector, and if infections are stored there that should in theory remove them if you put just that snippet in a script file.  It would remove all wounds though, aside from presumably severed limbs if I recall a comment in the script.  Not sure if it affects scars.
Logged
Through pain, I find wisdom.

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3787 on: May 21, 2013, 07:41:44 am »

hmm doesn't Dfusion have a heal script you can use?
Logged
I thought I would I had never hear my daughter's escapades from some boy...
DAMN YOU RUMRUSHER!!!!!!!!
"body swapping and YOU!"
Adventure in baby making!Adv Homes

leafar

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3788 on: May 21, 2013, 12:52:19 pm »

You need to add <md5-hash value="..."/> to symbols.xml (use md5 dwarfort.exe to determine it).
Quote
the stderr.log seems fine
means in particular no 'wrong md5-sum' error, as i changed it accordingly

Quote
Also, I've found segfaults occur most often when you change the length of the skill name - using an abbreviated version with the same number of letters should work (I'm not entirely sure why this doesn't crash on Windows).
Quote
starting df normally it runs fine
as i haven't changed any string's length (if the replacement was shorter i padded zero-bytes)

so that's not it :(
Logged
Quote from: LookingForGroup
I bet you would've laughed more if you were on fire.

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: DFHack 0.34.11 r3
« Reply #3789 on: May 21, 2013, 01:47:57 pm »

Be warned that editing strings in the Linux version of DF can potentially have "interesting" results due to GCC's method of string optimization, where strings that overlap at the end get combined - for example, "Object" would be treated as 11 characters into "Melt Metal Object", so changing "Melt Metal Object" to "Melt Something" would cause "Object" to become "ing".
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

breadman

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3790 on: May 21, 2013, 01:51:20 pm »

Quote
Also, I've found segfaults occur most often when you change the length of the skill name - using an abbreviated version with the same number of letters should work (I'm not entirely sure why this doesn't crash on Windows).
Quote
starting df normally it runs fine
as i haven't changed any string's length (if the replacement was shorter i padded zero-bytes)

so that's not it :(

Does padding with spaces work?
Logged
Quote from: Kevin Wayne, in r.g.r.n
Is a "diety" the being pictured by one of those extremely skinny aboriginal statues?

InsanityPrelude

  • Bay Watcher
  • O SHI--
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3791 on: May 21, 2013, 02:41:40 pm »

I tried to run DFHack with the patched .exe from Modest Mod (since the readme mentioned binary patches that aren't included with DFHack), but DF crashed on startup. Should I assume DFHack isn't compatible with Modest Mod, or am I doing something wrong?


Edit: Also, if I use binpatch through the client rather than binpatch.exe, are the patches applied permanently or do I need to run the command again every time I start DF? I'm sorry if this sounds like a total noob question, but I wasn't totally clear after reading the readme.

Edit 2: I wasn't able to replicate the crash. Guess I don't have to choose between sets of bugfixes after all. :)
« Last Edit: May 21, 2013, 09:18:47 pm by InsanityPrelude »
Logged
Forget down stairs, make an up stair
And then what?  Mine the sky? . . .  Actually, that'd be awesome.

leafar

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3792 on: May 21, 2013, 02:46:56 pm »

Quote
Does padding with spaces work?
it's the same: works fine without dfhack, crashes with it
Logged
Quote from: LookingForGroup
I bet you would've laughed more if you were on fire.

ag

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3793 on: May 21, 2013, 03:02:38 pm »

Maybe if you run it as "./dfhack -g" the backtrace for the crash would contain something useful.

Also, if I use binpatch through the client rather than binpatch.exe, are the patches applied permanently or do I need to run the command again every time I start DF?

You do need to rerun the binpatch script after restart; the most reasonable way to do that is to use dfhack.init.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3794 on: May 21, 2013, 03:12:40 pm »

You need to add <md5-hash value="..."/> to symbols.xml (use md5 dwarfort.exe to determine it).
Quote
the stderr.log seems fine
means in particular no 'wrong md5-sum' error, as i changed it accordingly

Quote
Also, I've found segfaults occur most often when you change the length of the skill name - using an abbreviated version with the same number of letters should work (I'm not entirely sure why this doesn't crash on Windows).
Quote
starting df normally it runs fine
as i haven't changed any string's length (if the replacement was shorter i padded zero-bytes)

so that's not it :(

Oh, I thought stderr.log was from DF, not dfhack. Oops.
I guess this isn't what I thought it was... :( something similar to this happened to me when I was editing the executable, but it crashed even when I ran DF normally.
Out of curiosity, what hex editor do you use?
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.
Pages: 1 ... 251 252 [253] 254 255 ... 373