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.
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
name.words - Word parts for the family name and heroic additional names; 32-bit integer values, indices into the
].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.
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 ...
... to start DFusion-extended lua interpreter. In there, copy & paste the following small program:
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
v.name.nickname = ""
... and done.