Bugfixing Scripts

fix/* scripts fix various bugs and issues, some of them obscure.


Makes it so that future caravans won’t bring barrels full of blood, ichor, or goo.


Fixes construction jobs that are stuck trying to build a wall while standing on the same exact tile (Bug 5991), designates the tile restricted traffic to hopefully avoid jamming it again, and unsuspends them.


Removes uninteresting dead units from the unit list. Doesn’t seem to give any noticeable performance gain, but migrants normally stop if the unit list grows to around 3000 units, and this script reduces it back.


Adds a Diplomat position to all Elven civilizations, allowing them to negotiate tree cutting quotas - and you to violate them and start wars. This was vanilla behaviour until version 0.31.12, in which the “bug” was “fixed”.


Removes water from all buckets in your fortress, allowing them to be used for making lye. Skips buckets in buildings (eg a well), being carried, or currently used by a job.


Avoids 5-10% FPS loss due to constant recalculation of insulation for dwarves at maximum fatness, by reducing the cap from 1,000,000 to 999,999. Recalculation is triggered in steps of 250 units, and very fat dwarves constantly bounce off the maximum value while eating.


Reset the GiveWater and GiveFood timers of all living citizens.


Diagnoses and fixes issues with nonexistant ‘items occupying site’, usually caused by autodump bugs or other hacking mishaps. Checks that:

  1. Item has flags.on_ground <=> it is in the correct block item list
  2. A tile has items in block item list <=> it has occupancy.item
  3. The block item lists are sorted


Aborts loyalty cascades by fixing units whose own civ is the enemy.


Adds the Guild Representative position to all Human civilizations, allowing them to make trade agreements. This was the default behaviour in version and earlier.


Run this after every migrant wave to ensure your population cap is not exceeded.

The reason for population cap problems is that the population value it is compared against comes from the last dwarven caravan that successfully left for mountainhomes. This script instantly updates it. Note that a migration wave can still overshoot the limit by 1-2 dwarves because of the last migrant bringing his family. Likewise, king arrival ignores cap.


This script forces some units off the map to enter the map, which can fix issues such as the following:

  • Stuck [SIEGE] tags due to invisible armies (or parts of armies)
  • Forgotten beasts that never appear
  • Packs of wildlife that are missing from the surface or caverns
  • Caravans that are partially or completely missing.


For caravans that are missing entirely, this script may retrieve the merchants but not the items. Using fix/stuck-merchants followed by force to create a new caravan may work better.


Instantly sets the temperature of all free-lying items to be in equilibrium with the environment, which stops temperature updates until something changes. To maintain this efficient state, use tweak fast-heat.


Dismisses merchants that haven’t entered the map yet. This can fix Bug 9593. This script should probably not be run if any merchants are on the map, so using it with repeat is not recommended.

Run fix/stuck-merchants -n or fix/stuck-merchants --dry-run to list all merchants that would be dismissed but make no changes.


Fix doors that are stuck open due to incorrect map occupancy flags, eg due to incorrect use of teleport.


Clears bad occupancy flags at the selected tile. Useful for getting rid of phantom “building present” messages. Currently only supports issues with building and unit occupancy. Requires that a tile is selected with the in-game cursor (k).

Can be used to fix problematic tiles caused by Issue 1047.