Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: DFHack script: patrilineal/matrilineal surname inheritance  (Read 2201 times)

nrh

  • Escaped Lunatic
    • View Profile
DFHack script: patrilineal/matrilineal surname inheritance
« 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.
Logged

Garfunkel

  • Bay Watcher
    • View Profile
Re: DFHack script: patrilineal/matrilineal surname inheritance
« Reply #1 on: November 18, 2021, 11:05:02 pm »

Oh wow, that's nice!
Logged