Bay 12 Games Forum

Dwarf Fortress => DF Modding => Utilities and 3rd Party Applications => Topic started by: nrh on November 18, 2021, 07:38:29 pm

Title: DFHack script: patrilineal/matrilineal surname inheritance
Post by: nrh on November 18, 2021, 07:38:29 pm
Not thoroughly tested. WIP. Make backup of your save before use!

Meaningful surnames might help you keep track of who is related to who.

This script reassigns surnames of all your alive fortress dwarves according to patrilineal or matrilineal inheritance rules.

For each dwarf it founds his greatest patrilineal/matrilineal line ancestor and copies his/her surname.

Optionally every dwarf  gets surname of her/his spouse.

It also modifies surnames for every ancestor in line, even if they are not present in your fort.

Example result for "surnames -patrilineal -inherit_parents -inherit_spouse":
Spoiler (click to show/hide)
In one fort I got two major clans with like ~20 dwarves in them.

Before doing anything you can also check number of descendants with common greatest ancestor using -list option.
Spoiler (click to show/hide)

Github link: https://github.com/Uvellibash/df-surnames
Script raw: https://raw.githubusercontent.com/Uvellibash/df-surnames/main/hack/scripts/surnames.lua

I only tested this script on Linux with dfhack 0.47.05-r1.
Title: Re: DFHack script: patrilineal/matrilineal surname inheritance
Post by: Garfunkel on November 18, 2021, 11:05:02 pm
Oh wow, that's nice!