5

I can add, change and remove the nick names of my Dwarves (or any other playable and currently played race) easily; that's one of the functions of the unit screen. This visually replaces the first name of the Dwarf in this list and a few other places, but their actual first name stays and is being used in places like combat reports and so on.

I'd like to be able to rename the Dwarf in question instead, both first and last name (the last name so that I can have children inherit the last names of their parents, as strange as it may sound to a real Dwarf). I couldn't find anything in the game itself and the most commonly used DF admin tool - Dwarf Therapist - only allows changing in the nick name.

Is there a way to do it? Ideally in-game, but using external programs is fine too, especially if I don't have to shut down the game to do so.

1
  • I wouldn't be surprised if you can do it with DFHack.
    – SaintWacko
    Sep 19, 2012 at 14:02

2 Answers 2

8

It looks like it can be possible with DFusion (which is a part of newer DFHack releases), though nobody - as far as I could find - created such a program so far.

Technical details

Specifically, the "units" (Dwarves, but also any other "living" entity on the map) have the following fields:

  • name.first_name - First name; std::string (max length 27 characters in the memory dump, but likely more than 16 will produce errors), can be freely changed. This is the one used for "v" unit info, the unit screen and a few other places.
  • name.nickname - Nick name; std::string, same as above.
  • name.language - Language of the family name and other (heroic) additional names; index into the df.global.world.raws.language.translations table
  • name.words[7] - Word parts for the family name and heroic additional names; 32-bit integer values, indices into the df.global.world.raws.language.translations[languagename].words array. If -1, this part is missing. According to Dwarf Therapist source code:
    • Index 0 + 1 is used for the original family name (2 parts, stuck together).
    • Index 2 + 5 is used for the heroic surname (again 2 parts).
    • Index 6 is used for the additional heroic surname (1 part only).
    • Indices 3 and 4 are unused.
  • hist_figure_id - Index into the df.global.world.history.figures array, which includes the full name record duplicated - all the above fields. This is used for the detail view of the Dwarf (v-target the Dwarf-z or u-pick the Dwarf from the list-v displays).

There's also a hist_figure_id2 field, but I'm not sure what it is for; possibly to store the ID of vampire as opposed to their cover identity.

One important caveat of it all is: Surnames can only be constructed out of existing words in a language. On the other hand, they don't have to be constructed of the language of the character's race.

Example

As an example on how to use it, assume you want to set some Dwarves nicknames, then transfer them all(!) to their first names. Start up Dwarf Fortress with DFHack enabled, load your game and add nicknames as you wish. Then change to the DFHack command line window and type ...

lua

... to start DFusion-extended lua interpreter. In there, copy & paste the following small program:

figs=df.global.world.history.figures
units=df.global.world.units.active
for _,v in ipairs(units) do
  if v.race == df.global.ui.race_id and v.name.nickname and v.name.nickname ~= "" then
    v.name.first_name = v.name.nickname
    for _2,f in ipairs(figs) do
      if v.hist_figure_id  == f.id then
        f.name.first_name = v.name.nickname
      end
    end
    v.name.nickname = ""
  end
end

... and done.

enter image description here

1
  • As much as I hate self-answering my own questions, so far nobody posted anything better, so I'll mark this one. If you happen onto a mod or tool which makes this easier (or write one yourself - hint, hint ...), feel free to add an answer with a link to it and a quick description how to accomplish the renaming using it, and I'll switch the accepted answer to yours. Sep 21, 2012 at 17:02
0

Iirc it isn't directly possible. At least not in the base game or using DT.

Looking at this topic, they also are only able to give nicknames, not change names.

There might be some memory editors out there that could do it. But I wouldn't advice using them.

What you can try is this: The Dwarf names are generated the same way every other name is generated: By stringing together words from their language word list (raw/objects/language_DWARF.txt and so on), as modified by the [SELECT_SYMBOL], [SUBSELECT_SYMBOL] and [CULL_SYMBOL] tokens in their entity description (for Dwarves: raw/objects/entity_default.txt). Urist means Dagger, for example. The question isn't how the names are generated, but where to poke the game or save files to change them.

2
  • 2
    The Dwarf names are generated the same way every other name is generated: By stringing together words from their language word list (raw/objects/language_DWARF.txt and so on), as modified by the [SELECT_SYMBOL], [SUBSELECT_SYMBOL] and [CULL_SYMBOL] tokens in their entity description (for Dwarves: raw/objects/entity_default.txt). "Urist" means "Dagger", for example. The question isn't how the names are generated, but where to poke the game or save files to change them. Sep 19, 2012 at 14:02
  • That is very useful information. I'll put it into the answer. The answer is now also a community wiki answer, so feel free to edit it people.
    – Ids
    Sep 19, 2012 at 15:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .