Skip to content

Instantly share code, notes, and snippets.

@ajs
Last active June 17, 2024 19:13
Show Gist options
  • Save ajs/696102691eaa0d2792ed687d9b437741 to your computer and use it in GitHub Desktop.
Save ajs/696102691eaa0d2792ed687d9b437741 to your computer and use it in GitHub Desktop.
Dwarf Fortress DFHack and Tips Cheat Sheet

Info

This document pertains to the free version of Dwarf Fortress with DFHack. These commands will not work in the Steam version (yet!)

Useful DFHack Commands

Movement speed

Fast movement, no teleport

fastdwarf 1 0

Fast movement + teleport

fastdwarf 1 1

Note the teleporting is game breaking in many ways. Its use is not only obviously cheating, but might result in strange and unresolvable problems.

Items

See also the section on the createitem wiki.

createitem ROUGH INORGANIC:CITRINE 5
createitem GEM INORGANIC:CITRINE 5
createitem WEAPON:ITEM_WEAPON_PICK INORGANIC:STEEL 5
createitem GLOVES:ITEM_GLOVES_GAUNTLETS INORGANIC:STEEL 2
create-items bars CREATURE_MAT:CAT:SOAP 20
createitem CLOTH CREATURE_MAT:SHEEP:HAIR 3
createitem THREAD PLANT_MAT:COTTON:THREAD 3
createitem CLOTH CREATURE_MAT:SPIDER_CAVE_GIANT:SILK 10
createitem SKIN_TANNED CREATURE_MAT:COW:LEATHER 5
createitem WEAPON:ITEM_WEAPON_AXE_BATTLE COPPER 5
createitem CHEESE CREATURE_MAT:COW:CHEESE 10

Adding Booze to Barrels

By Urist9876

I could not find any posts using the update, so here how to create alcohol:

  • select container.
  • type createitem item in dfhack console to make the alcohol spawn inside the container.
  • type createitem DRINK PLANT_MAT:POD_SWEET:DRINK 100
  • type createitem floor so you don't keep wondering why your subsequent cheats fails.

This will create rum. Replace sweet pod according to taste. Enjoy.

Relocating units

# Find the unitid
teleport -showunitid
# ... and use it at the new location
teleport -unit XXXX
# or you can select a unit with “v” and then:
gui/teleport

labormanager and autolabor

labormanager enable
labormanager allow-hunting
labormanager allow-fishing
# autolabor can be enabled with
enable autolabor
# and can be better
# for some tasks (especially when it comes to not over-tasking
# too many dwarves for a given thing)

General utilities

Remove contaminants/blood

clean all

Mark crap for removal

cleanowned x
# Same as above, but just the REALLY worn stuff
cleanowned X

Show requirements of selected strange mood dwarf

showmood

Auto butchering

autobutcher target 2 1 2 1 new
autobutcher autowatch
autobutcher start

You can also manage autobutcher settings with the GUI:

gui/autobutcher

Auto farming

enable autofarm

Zone

To drop all trained animals into three zones by type:

# press i and move to first zone (with nestboxes)
zone set
zone assign all own egglayer tame
# move to the second
zone set
zone assign all own not egglayer not grazer not race DOG not race CAT tame
# and the third
zone set
zone assign all own not egglayer not grazer not race DOG not race CAT tame

Auto Cleanup

repeat -time 4 -timeUnits days -command [ multicmd cleanowned X; clean all ] -name clean

Managing Stress

There is a long and excellent post on this by u/Atkana

Remove all stress

remove-stress -all

Prevent citizens from getting upset about corpses

combat-harden -tier 4 -citizens

Satisfy the needs of citizens

modtools/set-need -edit -all -focus 400 -citizens

Remove all stress periodically

repeat -time 1 -timeUnits months -command [ remove-stress -all ] -name removestress

Setting Skill Levels

Select a unit and use the below commands.

Appraisal for your broker (seems like appraisal is super-rare, and that can be really harmful since it takes so long to train)

assign-skills -skills [ APPRAISAL 15 ]

Leadership for your militia leaders can make or break raids

assign-skills -skills [ LEADERSHIP 15 ]

In case you run into a loyalty cascade, you might end up with no one that can work the hospital!

assign-skills -skills [ DIAGNOSE 15 ]

Guildhall Agreements

list-agreements

Dumping Caged Items

When animals are fed in cages (e.g. to train) it can sometimes leave items behind like seeds

stripcaged items

Autodumping

A small stockpile that takes corpses and any refuse you aren’t using can be set to “autodump” in the stockpile configuration menu (q-D)

Be careful not to include “fresh hides” or you will never make any leather. Also forbid any refuse that you make crafts / decorate with (e.g. bone, shells)

Workorders

You can set up workorders for your whole fort using orders, e.g. with this input file:

ajs_dfhack_orders_iron_zinc_copper.json (source gist)

You load an orders preset by putting the file into your .../dfhack-config/orders directory and then running:

orders import ajs_dfhack_orders_iron_zinc_copper

... or whatever you named the file (without the .json extension)

Additional notes

Other DFHack Command Lists

DFhack/createitem Wiki

http://dwarffortresswiki.org/Utility:DFHack/createitem

RAW unit info

To extract RAW info for a unit:

gui/gm-editor df.creature_raw.find(unit.race)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment