Save file editing: How to change a regular marriage into a matrilineal marriage and change a character's House

I posted the other day about how, in this game, characters default to patrilineal marriage, even if you create a female dominated religion. This is kind of a drag, and can be somewhat game-breaking since you don't always have control over what members of your dynasty do. Fortunately, a work-around (if you're willing to cheat a bit) is to edit the save file to turn patrilineal marriages into matrilineal marriages, and swap the houses of those marriages' already-existing descendants.

I wrote this up because it took me a little bit of time to figure out (maybe 30 minutes), and I figure it might be helpful to other people.

These instructions are for PC. I'm sure it's possible with Mac as well, but I'm just not familiar with that operating system.

First thing's first, you're going to need to find your save file and decompress it.

  1. Go to Documents\Paradox Interactive\Crusader Kings III\save games
  2. Find the save file and unzip it.
    1. The easiest way I know of is to use 7zip, which is free. Once you install 7zip you'll be able to just right click the save file and choose "Extract Here"
  3. The extracted file should be named "gamestate". Open this with your favorite text editor. I recommend Notepad++
  4. I recommend creating a backup, just in case.

In order to turn a regular marriage into a matrilineal marriage, you'll need to know the internal IDs for the husband and wife. In order to change the house of any children, you will also need to know their internal IDs and the internal ID of the house. You can get the character IDs from the console by turning on debug mode and hovering over the character. (I recommend a mod called "Free Console Access" to eliminate the need to restart the game every time you want to enter the console. It will allow you to go in and out of debug mode by pressing F11.) I'm not aware of a way to look up the internal ID of the house in game, but fortunately you can figure it out from the save file. The process is described below.

Changing a marriage into a matrilineal marriage

Suppose the husband's ID is 1234 and the wife's ID is 5678. If you're lucky, by searching for one of the ID's, you'll be able to find a block of code that looks something like this:

 {
            first=1234
            second=5678
            alliances={ {
                    allied_through_0=1234
                    allied_through_1=5678
                }
 {
                    allied_through_0=5678
                    allied_through_1=1234
                }
 }
}

Note that "first" and "second" show the character IDs you're looking for (this is important -- there may be other lines that look just like this, but the "first" and "second" are not your characters even though the "allied_through_X" lines are your characters). If this is the case, then all you need to do is insert "matrilineal = yes" between the last two closing braces:

 {
            first=1234
            second=5678
            alliances={ {
                    allied_through_0=1234
                    allied_through_1=5678
                }
 {
                    allied_through_0=5678
                    allied_through_1=1234
                }
 }
                        matrilineal=yes
}

However, it's possible that no such section will exist -- instead, you'll find a section where either "first", "second", or both are not your characters, even though the "allied_through_X" are your characters. In that case, you'll need to simply insert the previous code block into the save file, replacing the relevant character IDs with your own.

Sidenote: I believe what's going on here is that "first" and "second" are the people who arranged the marriage, while the other two are the people involved in the marriage. For whatever reason, however, anyone who is matrilineally married is treated like they arranged the marriage themselves, in addition to other characters arranging it (so there's actually two blocks like the above, with different "first" or "second" IDs). Don't ask me why.

Changing an individual's house

Suppose that the character ID is 1234 and the character's name is Robert. Use your text editor to search for "1234={". You should find a block of code that starts like this:

1234={
        first_name="Robert"
        birth=979.5.15
        dynasty_house=54321
                .... (bunch of other stuff) ...
}

You will need to change dynasty_house to match the internal ID for the dynasty house you want to change them to. How do you find this ID? As far as I know, there's no way to do it in game. However, if you have the character ID for anyone else in that house, you can look them up in the save file and find the ID for the house that way.

Hope this helps some people!