v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Difference between revisions of "Memory hacking"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
(creature hacking with DFHack's gui/gm-editor - flags1)
m
 
(11 intermediate revisions by 3 users not shown)
Line 7: Line 7:
  
  
−
[[File:Glazing with dfhack 4.png|thumb|600px|center|Job ingredient definition viewed with gui/gm-editor.]]
+
[[File:Glazing with dfhack 4.png|thumb|640px|center|Job ingredient definition viewed with gui/gm-editor.]]
  
  
Line 13: Line 13:
  
 
== Creature hacking ==
 
== Creature hacking ==
 +
 +
{| {{prettytable}}
 +
|- bgcolor="#ddd"
 +
! width="10%" | Field
 +
! width="10%" | Value
 +
! width="50%" | Effect
 +
 +
|-
 +
| ``name``
 +
| ``language_name`` object
 +
| [[Name]] of this creature, eg. [[Cacame Awemedinade]].
 +
 +
|-
 +
| ``custom_profession``
 +
| string
 +
| Custom [[profession]] nickname given by the player, blank if none.
 +
 +
|-
 +
| ``profession``
 +
| profession ID
 +
| Creature's current [[profession]].
 +
 +
|-
 +
| ``profession2``
 +
| profession ID
 +
|
 +
 +
|-
 +
| ``race``
 +
| creature definition ID
 +
| Creature's current race, 572 is [[dwarf]] (in [[modding|unmodded]] games). Read-only; if edited, the creature will transform back into what it was on the next tick. To change the race, edit ``enemy.were_race`` and ``enemy.normal_race`` instead, and the creature will transform accordingly.
 +
 +
|-
 +
| ``pos``
 +
| x, y, z ``coord``
 +
| Creature's position on the local map.
 +
 +
|-
 +
| ``idle_area``
 +
| x, y, z ``coord``
 +
|
 +
 +
|-
 +
| ``idle_area_threshold``
 +
| number
 +
|
 +
 +
|-
 +
| ``idle_area_type``
 +
| number
 +
|
 +
 +
|-
 +
| ``follow_distance``
 +
| number
 +
|
 +
 +
|-
 +
| ``path``
 +
| ``unit.T_path`` object
 +
|
 +
 +
|-
 +
| ``flags1``
 +
| ``unit_flags1`` array
 +
| [[wikipedia:Boolean data type|Boolean]] unit flags. See '''Flags''' below.
 +
 +
|-
 +
| ``flags2``
 +
| ``unit_flags2`` array
 +
| Boolean unit flags. See '''Flags''' below.
 +
 +
|-
 +
| ``flags3``
 +
| ``unit_flags3`` array
 +
| Boolean unit flags. See '''Flags''' below.
 +
 +
|-
 +
| ``flags4``
 +
| ``unit_flags4`` array
 +
| Boolean unit flags. See '''Flags''' below.
 +
 +
|-
 +
| ``meeting``
 +
| ``unitplotst`` object
 +
|
 +
 +
|-
 +
| ``caste``
 +
| caste ID
 +
| Creature's current [[caste]]. Read-only; if edited, the creature will transform back on the next tick. To change the caste, edit ``enemy.were_caste`` and ``enemy.normal_caste`` instead, and the creature will transform accordingly.
 +
 +
|-
 +
| ``sex``
 +
| number
 +
| Creature's biological gender; creature can give birth only when set to 0 (female). Also affects pronouns and gendered names.
 +
 +
|-
 +
| ``id``
 +
| number
 +
| Creature's unit ID.
 +
 +
|-
 +
| ``millpref``
 +
| number
 +
|
 +
 +
|-
 +
| ``training_level``
 +
| number
 +
| Creature's [[animal trainer|tameness]] level, such as {{dftext|Tame|2:1}}, {{dftext|Trained|7:1}}, or {{dftext|Semi-Wild|6:1}}. Requires the ``tame`` flag set, for the creature to be considered tamed.
 +
 +
|-
 +
| ``schedule_id``
 +
| number
 +
|
 +
 +
|-
 +
| ``civ_id``
 +
| entity ID
 +
| What [[civilization]] the creature belongs to. When set to the same as the [[fortress mode|player fortress]], the creature will be considered a [[citizen]] or tame animal, depending on whether it's [[sapient]] or not, unless it has a flag that forbids such.
 +
 +
|-
 +
| ``population_id``
 +
| number
 +
|
 +
 +
|-
 +
| ``breed_id``
 +
| number
 +
|
 +
 +
|-
 +
| ``cultural_identity``
 +
| number
 +
|
 +
 +
|-
 +
| ``invasion_id``
 +
| number
 +
|
 +
 +
|-
 +
| ``invasion_section_index``
 +
| number
 +
|
 +
 +
|-
 +
| ``invasion_role``
 +
| number
 +
|
 +
 +
|-
 +
| ``invasion_plan_id``
 +
| number
 +
|
 +
 +
|-
 +
| ``invasion_plan_path_index``
 +
| number
 +
|
 +
 +
|-
 +
| ``invasion_plan_bestattained_path_index``
 +
| number
 +
|
 +
 +
|-
 +
| ``invasion_dig_progress_index``
 +
| number
 +
|
 +
 +
|-
 +
| ``patrol_route``
 +
| ``coord_path`` object
 +
|
 +
 +
|-
 +
| ``patrol_index``
 +
| number
 +
|
 +
 +
|-
 +
| ``specific_refs``
 +
| vector
 +
|
 +
 +
|-
 +
| ``general_refs``
 +
| vector
 +
|
 +
 +
|-
 +
| ``military``
 +
| ``squad_infost`` object
 +
|
 +
 +
|-
 +
| ``uniform``
 +
| ``unit_clothing_infost`` object
 +
|
 +
 +
|-
 +
| ``individual_drills``
 +
| vector of numbers
 +
|
 +
 +
|-
 +
| ``social_activities``
 +
| vector of numbers
 +
|
 +
 +
|-
 +
| ``conversations``
 +
| vector of numbers
 +
|
 +
 +
|-
 +
| ``activities``
 +
| vector of numbers
 +
|
 +
 +
|-
 +
| ``ignored_activities``
 +
| vector of numbers
 +
|
 +
 +
|-
 +
| ``animal``
 +
| ``unit.T_animal`` object
 +
|
 +
 +
|-
 +
| ``opponent``
 +
| ``unit.T_opponent`` object
 +
|
 +
 +
|-
 +
| ``mood``
 +
| number
 +
|
 +
 +
|-
 +
| ``moodstage``
 +
| number
 +
|
 +
 +
|-
 +
| ``pregnancy_timer``
 +
| number
 +
| How long (in ticks) until a pregnant creature gives birth.
 +
 +
|-
 +
| ``pregnancy_genes``
 +
| ``unit_genes`` object or nil
 +
| Defines the appearance traits of the creature's future child. Required for pregnancies.
 +
 +
|-
 +
| ``pregnancy_caste``
 +
| number
 +
| Required for pregnancies. Effects unknown.
 +
 +
|-
 +
| ``pregnancy_spouse``
 +
| [[historical figure]] ID
 +
| The [[historical figure]] ID of the husband, used for determining fatherhood. ``-1`` is unidentified ({{dftext|The identity of <his/her> father has been lost to time.|7:0}})
 +
 +
|-
 +
| ``mood_copy``
 +
| number
 +
|
 +
 +
|-
 +
| ``ghost_info``
 +
| ``unit_ghost_info`` object or nil
 +
| Additional data of [[ghost]]ly creatures, such as the ghost's type. Requires the ``ghostly`` flag set to be relevant.
 +
 +
|-
 +
| ``disturbed_heid``
 +
| [[legends|historical event]] ID
 +
|
 +
 +
|-
 +
| ``birth_year``
 +
| number
 +
| Which year the creature was born. ``-1`` is "the time before time".
 +
 +
|-
 +
| ``birth_time``
 +
| number
 +
| Which time of year (in ticks) the creature was born.
 +
 +
|-
 +
| ``curse_year``
 +
| number
 +
| Which year the creature was cursed to become a [[night creature]]. ``-1`` means it wasn't cursed at all.
 +
 +
|-
 +
| ``curse_time``
 +
| number
 +
| Which time of year (in ticks) the creature was cursed into a [[night creature]]. ``-1`` means it wasn't cursed at all.
 +
 +
|-
 +
| ``birth_year_bias``
 +
| number
 +
|
 +
 +
|-
 +
| ``birth_time_bias``
 +
| number
 +
|
 +
 +
|-
 +
| ``old_year``
 +
| number
 +
| Which year the creature will [[death|die]] of old [[age]]. ``-1`` means it's naturally immortal. Creatures that acquired immortality through [[syndrome|other means]] still have their former date set, albeit defunct.
 +
 +
|-
 +
| ``old_time``
 +
| number
 +
| Which time of year the creature will [[death|die]] of old [[age]]. ``-1`` means it's naturally immortal. Creatures that acquired immortality through [[syndrome|other means]] still have their former date set, albeit defunct.
 +
 +
|-
 +
| ``following``
 +
|
 +
|
 +
 +
|-
 +
| ``owner_type``
 +
| number
 +
|
 +
 +
|-
 +
| ``relationship_ids``
 +
| array of unit IDs
 +
|
 +
 +
|-
 +
| ``mount_type``
 +
| number
 +
|
 +
 +
|-
 +
| ``last_hit``
 +
| ``unit.T_last_hit`` object
 +
| What item the creature was last hit with. Used for attributing kills to weapons in [[kill list]]s and [[legends]] entries.
 +
 +
|-
 +
| ``on_item_id``
 +
| item ID
 +
|
 +
 +
|-
 +
| ``inventory``
 +
| vector of ``unit_inventory_item`` objects
 +
| Defines the creature's wielded, worn, and hauled [[item]]s.
 +
 +
|-
 +
| ``owned_items``
 +
| vector of numbers
 +
|
 +
 +
|-
 +
| ``traded_items``
 +
| vector of numbers
 +
|
 +
 +
|-
 +
| ``owned_buildings``
 +
| vector
 +
|
 +
 +
|-
 +
| ``corpse_parts``
 +
| vector of numbers
 +
|
 +
 +
|-
 +
| ``job``
 +
| ``unit.T_job`` object
 +
|
 +
 +
|-
 +
| ``body``
 +
| ``unit.T_body`` object
 +
|
 +
 +
|-
 +
| ``appearance``
 +
| ``unit.T_appearance`` object
 +
|
 +
 +
|-
 +
| ``actions``
 +
| vector of ``unit_action`` objects
 +
|
 +
 +
|-
 +
| ``next_action_id``
 +
| number
 +
|
 +
 +
|-
 +
| ``counters``
 +
| ``unit.T_counters`` object
 +
|
 +
 +
|-
 +
| ``uwss_flag``
 +
| ``unit_wound_special_stats_flag`` array of booleans
 +
|
 +
 +
|-
 +
| ``uwss_add_caste_flag``
 +
| ``cie_add_tag_mask1`` array of booleans
 +
| [[Creature token]]s added to this creature via [[syndrome]]s.
 +
 +
|-
 +
| ``uwss_remove_caste_flag``
 +
| ``cie_add_tag_mask1`` array of booleans
 +
| [[Creature token]]s removed from this creature via [[syndrome]]s.
 +
 +
|-
 +
| ``uwss_add_property``
 +
| ``cie_add_tag_mask2`` array of booleans
 +
| Special traits (such as ``NO_AGING``) added to this creature via [[syndrome]]s.
 +
 +
|-
 +
| ``uwss_remove_property``
 +
| ``cie_add_tag_mask2`` array of booleans
 +
| Special traits removed from this creature via [[syndrome]]s.
 +
 +
|-
 +
| ``uwss_use_display_name``
 +
| boolean
 +
| Whether a name suffix added by [[syndrome]]s is displayed.
 +
 +
|-
 +
| ``uwss_display_name_sing``
 +
| string
 +
| Name suffix added to this creature by [[syndrome]]s, such as ''[[intelligent undead|dismal zombie]]''.
 +
 +
|-
 +
| ``uwss_display_name_plur``
 +
| string
 +
| As above, but in plural form.
 +
 +
|-
 +
| ``uwss_display_name_adj``
 +
| string
 +
| As above, but as adjective.
 +
 +
|-
 +
| ``uwss_display_tile``
 +
| [[tilesets]] ID
 +
| Creature's custom ASCII icon set by [[syndrome]]s.
 +
 +
|-
 +
| ``uwss_display_color_f``
 +
| number
 +
| Color of the ASCII icon set by a syndrome. This is the first [[color]] notation number ('''7''':0:1), denoting foreground hue.
 +
 +
|-
 +
| ``uwss_display_color_b``
 +
| number
 +
| Color of the ASCII icon set by a syndrome. This is the second [[color]] notation number (7:'''0''':1), denoting background hue.
 +
 +
|-
 +
| ``uwss_display_color_br``
 +
| number
 +
| Color of the ASCII icon set by a syndrome. This is the third [[color]] notation number (7:0:'''1'''), denoting foreground brightness.
 +
 +
|-
 +
| ``uwss_flash_tile``
 +
| [[tilesets]] ID
 +
| In ASCII mode, creature will flash between this icon and its normal creature icon. Set by [[syndrome]]s.
 +
 +
|-
 +
| ``uwss_flash_color_f``
 +
| number
 +
| Color of the flashing ASCII icon set by a syndrome. This is the first [[color]] notation number ('''7''':0:1), denoting foreground hue.
 +
 +
|-
 +
| ``uwss_flash_color_b``
 +
| number
 +
| Color of the flashing ASCII icon set by a syndrome. This is the second [[color]] notation number (7:'''0''':1), denoting background hue.
 +
 +
|-
 +
| ``uwss_flash_color_br``
 +
| number
 +
| Color of the flashing ASCII icon set by a syndrome. This is the third [[color]] notation number (7:0:'''1'''), denoting foreground brightness.
 +
 +
|-
 +
| ``uwss_alt_period``
 +
| number
 +
| For how long the creature will display its normal ASCII icon instead of the flashing alternate one.
 +
 +
|-
 +
| ``uwss_alt_on_period``
 +
| number
 +
| For how long the creature will display the flashing alternate icon.
 +
 +
|-
 +
| ``uwss_body_modifier``
 +
| vector of numbers
 +
|
 +
 +
|-
 +
| ``uwss_bp_modifier``
 +
| vector of numbers
 +
|
 +
 +
|-
 +
| ``uwss_speed_add``
 +
| number
 +
| Alters the creature's movement speed by a flat amount, that can be negative. Set by [[syndrome]]s with {{token|CE_SPEED_CHANGE|syndrome}}.
 +
 +
|-
 +
| ``uwss_speed_perc``
 +
| number
 +
| Multiplies the creature's movement speed by a percentage. Set by [[syndrome]]s with {{token|CE_SPEED_CHANGE|syndrome}}.
 +
 +
|-
 +
| ``uwss_att_change``
 +
|
 +
|
 +
 +
|-
 +
| ``uwss_skill_role_adjust``
 +
| number
 +
|
 +
 +
|-
 +
| ``uwss_erratic_level``
 +
| number
 +
|
 +
 +
|-
 +
| ``usable_interaction``
 +
| ``unit_usable_interactionst`` object
 +
| All data regarding [[interaction]]s this creature can use.
 +
 +
|-
 +
| ``counters2``
 +
| ``unit.T_counters2`` object
 +
|
 +
 +
|-
 +
| ``status``
 +
| ``unit.T_status`` object
 +
|
 +
 +
|-
 +
| ``hist_figure_id``
 +
| [[historical figure]] ID
 +
| [[Historical figure]] ID of this creature. ``-1`` means none.
 +
 +
|-
 +
| ``hist_figure_id2``
 +
| [[historical figure]] ID
 +
| On [[undead]], this is the [[historical figure]] ID of the creature whose body was reanimated. Otherwise it's the same as the ``hist_figure_id``.
 +
 +
|-
 +
| ``status2``
 +
| ``unit.T_status2`` object
 +
|
 +
<!-- to be continued -->
 +
 +
|}
  
 
=== Flags ===
 
=== Flags ===
Line 46: Line 615:
 
| ``flags1``
 
| ``flags1``
 
| ``marauder``
 
| ``marauder``
−
|
+
| Marks the creature as a {{dftext|Hostile|4:0}} intruder in [[fortress mode]] - used on [[kobold]] thieves, for example.
  
 
|-
 
|-
Line 116: Line 685:
 
| ``flags1``
 
| ``flags1``
 
| ``hidden_in_ambush``
 
| ``hidden_in_ambush``
−
| The creature is [[ambusher|stealthed]] and not visible until noticed by someone. Used by [[gremlin]]s, [[werebeast]]s, [[ambush]]ing invaders, and [[adventure mode]] sneaking.
+
| The creature is [[ambusher|stealthed]] and not visible until noticed by someone. Used by [[gremlin]]s, [[werebeast]]s, [[ambush]]ing invaders, and [[adventure mode]] {{Adv menu icon|S}} sneaking.
  
 
|-
 
|-
Line 156: Line 725:
 
| ``flags1``
 
| ``flags1``
 
| ``tame``
 
| ``tame``
−
|
+
| Creature is a [[tame]]d animal, and usable as livestock in [[fortress mode]]. Tameness level ({{dftext|Tame|2:1}}, {{dftext|Trained|7:1}}, {{dftext|Semi-Wild|6:1}}) is defined by the ``training_level`` root variable.
  
 
|-
 
|-
Line 175: Line 744:
 
|-
 
|-
 
| ``flags1``
 
| ``flags1``
−
| ``supress_wield``
+
| ``suppress_wield``
 
|
 
|
  
Line 183: Line 752:
 
|
 
|
  
 +
|-
 +
| ``flags2``
 +
| ``swimming``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``sparring``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``no_notify``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``uniquebody``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``calculated_nerves``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``calculated_bodyparts``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``important_historical_figure``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``killed``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``cleanup_1``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``cleanup_2``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``cleanup_3``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``for_trade``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``trade_resolved``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``has_breaks``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``gutted``
 +
| Creature has its guts spilled, which incurs a movement penalty and counts as a [[wound|major injury]].
 +
 +
|-
 +
| ``flags2``
 +
| ``must_forget_completely_keep_rooms``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``locked_in_for_trading``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``slaughter``
 +
| The animal is queued for being [[slaughter]]ed in [[fortress mode]].
 +
 +
|-
 +
| ``flags2``
 +
| ``underworld``
 +
| Marks the creature as an {{dftext|Underworld|4:0}} [[demon]].
 +
 +
|-
 +
| ``flags2``
 +
| ``resident``
 +
| Creature is a hostile {{dftext|Current Resident|4:0}}, for example if you happen to embark on a [[dragon]] lair, or unretire a fortress with a [[forgotten beast]] already present.
 +
 +
|-
 +
| ``flags2``
 +
| ``cleanup_4``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``calculated_insulation``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``visitor_uninvited``
 +
| Creature is a hostile {{dftext|Uninvited Guest|4:0}}. Used on rampaging [[megabeast]]s.
 +
 +
|-
 +
| ``flags2``
 +
| ``visitor``
 +
| Creature is a [[visitor]] in fortress mode.
 +
 +
|-
 +
| ``flags2``
 +
| ``calculated_inventory``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``vision_good``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``vision_damaged``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``vision_missing``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``breathing_good``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``breathing_problem``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``roaming_wilderness_population_source``
 +
|
 +
 +
|-
 +
| ``flags2``
 +
| ``roaming_wilderness_population_source_not_a_map_feature``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``body_part_relsize_computed``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``size_modifier_computed``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``stuck_weapon_computed``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``compute_health``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``announce_titan``
 +
| Displays a pop-up message announcing the arrival of a [[megabeast]].
 +
:{{dftext|The Forgotten Beast Juwog has come! A towering blob composed of flame. It has a stubby tail and it has a bloated body. Beware its fire!|4:1}}
 +
 +
|-
 +
| ``flags3``
 +
| ``training_tired_wait``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``on_crutch``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``weight_computed``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``body_temp_in_range``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``wait_until_reveal``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``scuttle``
 +
| Used on caravan [[wagon]]s. When set on anything else, turns the creature into a "wagon" which in [[fortress mode]] is instantly scuttled, insta-killing said creature.
 +
 +
|-
 +
| ``flags3``
 +
| ``verify_personal_training``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``ghostly``
 +
| Turns the creature into a [[ghost]].
 +
 +
|-
 +
| ``flags3``
 +
| ``just_sprung_ambush``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``disturbed_from_death``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``diving``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``flee_if_birth_race``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``no_meandering``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``floundering``
 +
| Creature flounders in the [[water]] due to insufficient [[swimming]] skill.
 +
 +
|-
 +
| ``flags3``
 +
| ``exit_vehicle1``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``exit_vehicle2``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``dangerous_terrain``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``adv_yield``
 +
| Creature is [[File:status_yielded_icon.png]] [[surrender]]ing. Used in [[adventure mode]].
 +
 +
|-
 +
| ``flags3``
 +
| ``vision_cone_set``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``multipart_vision_have_at_least_damaged``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``emotionally_overloaded``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``check_reorganize_possessions``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``available_for_adoption``
 +
| The animal is allowed to be adopted as a [[pet]] in [[fortress mode]].
 +
 +
|-
 +
| ``flags3``
 +
| ``gelded``
 +
| Creature has been [[gelder|gelded]] and cannot reproduce anymore.
 +
 +
|-
 +
| ``flags3``
 +
| ``marked_for_gelding``
 +
| The animal is queued to be gelded in fortress mode.
 +
 +
|-
 +
| ``flags3``
 +
| ``injury_thought``
 +
|
 +
 +
|-
 +
| ``flags3``
 +
| ``guest``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``lazy_goblet_check``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``urgent_goblet_check``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``counts_as_great_beast``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``counts_as_animal``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``counts_as_merchant_for_del``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``might_be_holding_artifact``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``might_possess_artifact``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``invader_waits_for_parley``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``might_have_moving_inventory``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``any_texture_must_be_refreshed``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``only_do_assigned_jobs``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``mood_succeeded``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``agitated_wilderness_creature``
 +
| Makes the creature [[agitated]] and more aggressive. Used on wildlife in [[savage]] biomes. Agitation is removed by [[taming]] the creature.
 +
 +
|-
 +
| ``flags4``
 +
| ``path_failed_recently``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``portrait_must_be_refreshed``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``may_have_magical_inventory_item``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``may_have_mythical_substance``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``did_dungeon_move_unit``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``carrying_somebody``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``has_announced_stuck``
 +
|
 +
 +
<!-- these are not labelled by DFHack and likely not used yet.
 +
|-
 +
| ``flags4``
 +
| ``20``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``21``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``22``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``23``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``24``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``25``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``26``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``27``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``28``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``29``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``30``
 +
|
 +
 +
|-
 +
| ``flags4``
 +
| ``31``
 +
|
 +
-->
 
|}
 
|}
−
 
  
 
= Legacy hacking =
 
= Legacy hacking =

Latest revision as of 11:02, 16 November 2026

This article is about the current version of DF.
Note that some content may still need to be updated.

Memory hacking means editing the game's memory data directly, unlike modding. The most prevalent tool for hacking the memory is DFHack, which provides access to internal data in a human-readable form, unlike most utilities which display binary values only.

DFHack offers two primary commands for accessing the memory data, gui/gm-editor which displays and allows editing the data for the selected object (creature, item, job, etc), and gui/gm-editor world which allows editing global variables.


Job ingredient definition viewed with gui/gm-editor.


Hacking with gui/gm-editor[edit]

Creature hacking[edit]

Field Value Effect
name language_name object Name of this creature, eg. Cacame Awemedinade.
custom_profession string Custom profession nickname given by the player, blank if none.
profession profession ID Creature's current profession.
profession2 profession ID
race creature definition ID Creature's current race, 572 is dwarf (in unmodded games). Read-only; if edited, the creature will transform back into what it was on the next tick. To change the race, edit enemy.were_race and enemy.normal_race instead, and the creature will transform accordingly.
pos x, y, z coord Creature's position on the local map.
idle_area x, y, z coord
idle_area_threshold number
idle_area_type number
follow_distance number
path unit.T_path object
flags1 unit_flags1 array Boolean unit flags. See Flags below.
flags2 unit_flags2 array Boolean unit flags. See Flags below.
flags3 unit_flags3 array Boolean unit flags. See Flags below.
flags4 unit_flags4 array Boolean unit flags. See Flags below.
meeting unitplotst object
caste caste ID Creature's current caste. Read-only; if edited, the creature will transform back on the next tick. To change the caste, edit enemy.were_caste and enemy.normal_caste instead, and the creature will transform accordingly.
sex number Creature's biological gender; creature can give birth only when set to 0 (female). Also affects pronouns and gendered names.
id number Creature's unit ID.
millpref number
training_level number Creature's tameness level, such as Tame, Trained, or Semi-Wild. Requires the tame flag set, for the creature to be considered tamed.
schedule_id number
civ_id entity ID What civilization the creature belongs to. When set to the same as the player fortress, the creature will be considered a citizen or tame animal, depending on whether it's sapient or not, unless it has a flag that forbids such.
population_id number
breed_id number
cultural_identity number
invasion_id number
invasion_section_index number
invasion_role number
invasion_plan_id number
invasion_plan_path_index number
invasion_plan_bestattained_path_index number
invasion_dig_progress_index number
patrol_route coord_path object
patrol_index number
specific_refs vector
general_refs vector
military squad_infost object
uniform unit_clothing_infost object
individual_drills vector of numbers
social_activities vector of numbers
conversations vector of numbers
activities vector of numbers
ignored_activities vector of numbers
animal unit.T_animal object
opponent unit.T_opponent object
mood number
moodstage number
pregnancy_timer number How long (in ticks) until a pregnant creature gives birth.
pregnancy_genes unit_genes object or nil Defines the appearance traits of the creature's future child. Required for pregnancies.
pregnancy_caste number Required for pregnancies. Effects unknown.
pregnancy_spouse historical figure ID The historical figure ID of the husband, used for determining fatherhood. -1 is unidentified (The identity of <his/her> father has been lost to time.)
mood_copy number
ghost_info unit_ghost_info object or nil Additional data of ghostly creatures, such as the ghost's type. Requires the ghostly flag set to be relevant.
disturbed_heid historical event ID
birth_year number Which year the creature was born. -1 is "the time before time".
birth_time number Which time of year (in ticks) the creature was born.
curse_year number Which year the creature was cursed to become a night creature. -1 means it wasn't cursed at all.
curse_time number Which time of year (in ticks) the creature was cursed into a night creature. -1 means it wasn't cursed at all.
birth_year_bias number
birth_time_bias number
old_year number Which year the creature will die of old age. -1 means it's naturally immortal. Creatures that acquired immortality through other means still have their former date set, albeit defunct.
old_time number Which time of year the creature will die of old age. -1 means it's naturally immortal. Creatures that acquired immortality through other means still have their former date set, albeit defunct.
following
owner_type number
relationship_ids array of unit IDs
mount_type number
last_hit unit.T_last_hit object What item the creature was last hit with. Used for attributing kills to weapons in kill lists and legends entries.
on_item_id item ID
inventory vector of unit_inventory_item objects Defines the creature's wielded, worn, and hauled items.
owned_items vector of numbers
traded_items vector of numbers
owned_buildings vector
corpse_parts vector of numbers
job unit.T_job object
body unit.T_body object
appearance unit.T_appearance object
actions vector of unit_action objects
next_action_id number
counters unit.T_counters object
uwss_flag unit_wound_special_stats_flag array of booleans
uwss_add_caste_flag cie_add_tag_mask1 array of booleans Creature tokens added to this creature via syndromes.
uwss_remove_caste_flag cie_add_tag_mask1 array of booleans Creature tokens removed from this creature via syndromes.
uwss_add_property cie_add_tag_mask2 array of booleans Special traits (such as NO_AGING) added to this creature via syndromes.
uwss_remove_property cie_add_tag_mask2 array of booleans Special traits removed from this creature via syndromes.
uwss_use_display_name boolean Whether a name suffix added by syndromes is displayed.
uwss_display_name_sing string Name suffix added to this creature by syndromes, such as dismal zombie.
uwss_display_name_plur string As above, but in plural form.
uwss_display_name_adj string As above, but as adjective.
uwss_display_tile tilesets ID Creature's custom ASCII icon set by syndromes.
uwss_display_color_f number Color of the ASCII icon set by a syndrome. This is the first color notation number (7:0:1), denoting foreground hue.
uwss_display_color_b number Color of the ASCII icon set by a syndrome. This is the second color notation number (7:0:1), denoting background hue.
uwss_display_color_br number Color of the ASCII icon set by a syndrome. This is the third color notation number (7:0:1), denoting foreground brightness.
uwss_flash_tile tilesets ID In ASCII mode, creature will flash between this icon and its normal creature icon. Set by syndromes.
uwss_flash_color_f number Color of the flashing ASCII icon set by a syndrome. This is the first color notation number (7:0:1), denoting foreground hue.
uwss_flash_color_b number Color of the flashing ASCII icon set by a syndrome. This is the second color notation number (7:0:1), denoting background hue.
uwss_flash_color_br number Color of the flashing ASCII icon set by a syndrome. This is the third color notation number (7:0:1), denoting foreground brightness.
uwss_alt_period number For how long the creature will display its normal ASCII icon instead of the flashing alternate one.
uwss_alt_on_period number For how long the creature will display the flashing alternate icon.
uwss_body_modifier vector of numbers
uwss_bp_modifier vector of numbers
uwss_speed_add number Alters the creature's movement speed by a flat amount, that can be negative. Set by syndromes with [CE_SPEED_CHANGE].
uwss_speed_perc number Multiplies the creature's movement speed by a percentage. Set by syndromes with [CE_SPEED_CHANGE].
uwss_att_change
uwss_skill_role_adjust number
uwss_erratic_level number
usable_interaction unit_usable_interactionst object All data regarding interactions this creature can use.
counters2 unit.T_counters2 object
status unit.T_status object
hist_figure_id historical figure ID Historical figure ID of this creature. -1 means none.
hist_figure_id2 historical figure ID On undead, this is the historical figure ID of the creature whose body was reanimated. Otherwise it's the same as the hist_figure_id.
status2 unit.T_status2 object

Flags[edit]

Creature flags are boolean true/false values, split into four arrays named flags1 - flags4.

Array Name Effect
flags1 move_state
flags1 inactive Marks the creature as Deceased (dead) and no longer an active unit.
flags1 has_mood
flags1 had_mood
flags1 marauder Marks the creature as a Hostile intruder in fortress mode - used on kobold thieves, for example.
flags1 drowning
flags1 merchant Set on caravan Merchants and their pack animals.
flags1 forest The creature is a Friendly npc and not a citizen of the fortress. Set on caravan guards, for instance.
flags1 left
flags1 rider
flags1 incoming
flags1 diplomat
flags1 temp_flag
flags1 check_active_heist
flags1 can_swap
flags1 on_ground Whether the creature is ☺ lying prone on the ground.
flags1 projectile Used for creatures in ☺ projectile status (thrown, falling, or jumping).
flags1 active_invader
flags1 hidden_in_ambush The creature is stealthed and not visible until noticed by someone. Used by gremlins, werebeasts, ambushing invaders, and adventure mode Adv ui S.pngS sneaking.
flags1 invader_origin
flags1 coward
flags1 hidden_ambusher
flags1 invades
flags1 check_flows
flags1 ridden
flags1 caged
flags1 tame Creature is a tamed animal, and usable as livestock in fortress mode. Tameness level (Tame, Trained, Semi-Wild) is defined by the training_level root variable.
flags1 chained
flags1 royal_guard
flags1 fortress_guard
flags1 suppress_wield
flags1 important_historical_figure
flags2 swimming
flags2 sparring
flags2 no_notify
flags2 uniquebody
flags2 calculated_nerves
flags2 calculated_bodyparts
flags2 important_historical_figure
flags2 killed
flags2 cleanup_1
flags2 cleanup_2
flags2 cleanup_3
flags2 for_trade
flags2 trade_resolved
flags2 has_breaks
flags2 gutted Creature has its guts spilled, which incurs a movement penalty and counts as a major injury.
flags2 must_forget_completely_keep_rooms
flags2 locked_in_for_trading
flags2 slaughter The animal is queued for being slaughtered in fortress mode.
flags2 underworld Marks the creature as an Underworld demon.
flags2 resident Creature is a hostile Current Resident, for example if you happen to embark on a dragon lair, or unretire a fortress with a forgotten beast already present.
flags2 cleanup_4
flags2 calculated_insulation
flags2 visitor_uninvited Creature is a hostile Uninvited Guest. Used on rampaging megabeasts.
flags2 visitor Creature is a visitor in fortress mode.
flags2 calculated_inventory
flags2 vision_good
flags2 vision_damaged
flags2 vision_missing
flags2 breathing_good
flags2 breathing_problem
flags2 roaming_wilderness_population_source
flags2 roaming_wilderness_population_source_not_a_map_feature
flags3 body_part_relsize_computed
flags3 size_modifier_computed
flags3 stuck_weapon_computed
flags3 compute_health
flags3 announce_titan Displays a pop-up message announcing the arrival of a megabeast.
The Forgotten Beast Juwog has come! A towering blob composed of flame. It has a stubby tail and it has a bloated body. Beware its fire!
flags3 training_tired_wait
flags3 on_crutch
flags3 weight_computed
flags3 body_temp_in_range
flags3 wait_until_reveal
flags3 scuttle Used on caravan wagons. When set on anything else, turns the creature into a "wagon" which in fortress mode is instantly scuttled, insta-killing said creature.
flags3 verify_personal_training
flags3 ghostly Turns the creature into a ghost.
flags3 just_sprung_ambush
flags3 disturbed_from_death
flags3 diving
flags3 flee_if_birth_race
flags3 no_meandering
flags3 floundering Creature flounders in the water due to insufficient swimming skill.
flags3 exit_vehicle1
flags3 exit_vehicle2
flags3 dangerous_terrain
flags3 adv_yield Creature is Status yielded icon.png surrendering. Used in adventure mode.
flags3 vision_cone_set
flags3 multipart_vision_have_at_least_damaged
flags3 emotionally_overloaded
flags3 check_reorganize_possessions
flags3 available_for_adoption The animal is allowed to be adopted as a pet in fortress mode.
flags3 gelded Creature has been gelded and cannot reproduce anymore.
flags3 marked_for_gelding The animal is queued to be gelded in fortress mode.
flags3 injury_thought
flags3 guest
flags4 lazy_goblet_check
flags4 urgent_goblet_check
flags4 counts_as_great_beast
flags4 counts_as_animal
flags4 counts_as_merchant_for_del
flags4 might_be_holding_artifact
flags4 might_possess_artifact
flags4 invader_waits_for_parley
flags4 might_have_moving_inventory
flags4 any_texture_must_be_refreshed
flags4 only_do_assigned_jobs
flags4 mood_succeeded
flags4 agitated_wilderness_creature Makes the creature agitated and more aggressive. Used on wildlife in savage biomes. Agitation is removed by taming the creature.
flags4 path_failed_recently
flags4 portrait_must_be_refreshed
flags4 may_have_magical_inventory_item
flags4 may_have_mythical_substance
flags4 did_dungeon_move_unit
flags4 carrying_somebody
flags4 has_announced_stuck

Legacy hacking[edit]

The following information is mostly obsolete and superseded by df-structures.

Version identification[edit]

Version MD5 hash PE timestamp
0.40.01 legacy
0.40.01 SDL
0.40.02 legacy
0.40.02 SDL 11a7da1fda05dfc826655d8aff4e9f9b 53BEF285
0.47.04 SDL x86 6df64d9f3b413e6ad436e718ebeee070 5E5B11F9

General offsets[edit]

Legacy versions[edit]

Description 0.40.01 legacy 0.40.02 legacy
cursor_xyz
mouse_x
mouse_y
mouse_z
window_dims
window_grid_x
window_grid_y
window_x (viewport_x)
window_y (viewport_y)


window_z (viewport_z)



SDL versions[edit]

Description 0.40.01 SDL 0.40.02 SDL 0.47.04 SDL x86
cursor_xyz 1D0CD40 20f8bc8
mouse_x
mouse_y 1D0CD44 20f8bcc
mouse_z 1D0CD48 20f8bd0
window_dims 20f8cd0
window_grid_x
window_grid_y 20f8cd8
window_x (viewport_x) 2a9a2f0
window_y (viewport_y) 2a9a314


window_z (viewport_z) 2976dac


Map data[edit]

Legacy versions[edit]

Description 0.40.01 legacy 0.40.02 legacy
map_data


map_info



SDL versions[edit]

Description 0.40.01 SDL 0.40.02 SDL 0.47.04 SDL x86
map_data 2996f24 2be609c


map_info 2996f3c ?

map_info struct[edit]

Type Name Description
int32 block_count_x Size of the current map region in 16x16 blocks.
int32 block_count_y
int32 block_count_z Should be the same as tile_count_z
int32 tile_count_x Size of the current map region in tiles.
int32 tile_count_y
int32 tile_count_z
int32 region_x Position of the current map region within the world as a whole.
int32 region_y
int32 region_z Base Z-level - add this to Z coordinates to get the Z-level displayed on the screen

Map block data offsets[edit]

Description 0.40.01–02 0.47.04 SDL x86
map_data_map_x_offset 0060 0054
map_data_map_y_offset 0062 0056
map_data_map_z_offset 0064 0058
map_data_tiletype_offset 006a 005e
map_data_designation_offset 026c 0260
map_data_occupancy_offset 066c 0660
map_data_0a60_offset 0A6c 0A60
map_data_pathfinding_offset 0D6c 0D60
map_data_1160_offset 116c 1160
map_data_1360_offset 136c 1360
map_data_temperature1_offset 156c 1560
map_data_temperature2_offset 176c 1760
map_data_1960_offset 196c 1960
map_data_1b60_offset 1B6c 1B60