• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

Seraron

Private
32 Badges
Sep 3, 2019
19
31
  • Crusader Kings II
  • Magicka 2
  • Surviving Mars
  • Crusader Kings II: Horse Lords
  • Knights of Pen and Paper 2
  • Crusader Kings II: Conclave
  • Crusader Kings II: Reapers Due
  • Tyranny: Archon Edition
  • Crusader Kings II: Monks and Mystics
  • Pillars of Eternity
  • Age of Wonders III
  • Crusader Kings II: Jade Dragon
  • Shadowrun Returns
  • Shadowrun: Dragonfall
  • Crusader Kings II: Holy Fury
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Crusader Kings II: Way of Life
  • Cities: Skylines
  • War of the Roses
  • Warlock: Master of the Arcane
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Sword of Islam
  • Dungeonland
  • Leviathan: Warships
  • Magicka
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Republic
Hello all, first time posting and first time ever attempting to mod anything! (though I do have occupational coding and scripting experience)

On looking over the wiki, at religious modifications, I see an option for 'max_wives'. On further investigation it seems that this option only applies to wives and not to husbands too. There is a separate modifier for 'max_consorts' which covers both consorts and concubines with the same value. But consorts are not the same as husbands!

So I figured I'd trying to make a mod to allow a religion / culture to allow women to take multiple husbands. I figured this task might serve as a fun and (hopefully) fairly simple introduction to the broader topic of adding entirely new attributes / modifiers to the game; since I'm hoping it's just a case of defining a new attribute 'max_husbands', then copy-pasting whatever is written for 'max_wives', and then just swapping the gender pointers.

But I can't for the life of me find where the cultural / religious attributes themselves are stored. Any advice?
 
Hi and welcome to the forums :)
Though I'm afraid what you are attempting is not possible by regular modding.
You seem to know a thing or two about coding, and what you describe would probably work for a regular language like say C# in which many unity games are written.
However, in CK2 we are only given access to an exposed layer of scripting language that is kinda built "on top" of the actual game programming language (which I suspect to be C++ or something similar). That means that we are writing mods in a "super-"high language that does only expose certain access points to the underlying logic.
Over time, this modding layer has grown and covers more now than ever before. For example, it wasn't even possible to have male consorts until a short while ago. But then the devs decided to add a new parameter that allows modders to enable that. "max_husbands", as the appropriate other parameter would read, however, remains hidden in the underlying, inaccessible layer. It's "hardcoded", and as modders we can't access or expose it :(
There's a thread to pester the game devs to expose more stuff, but it's a complicated process and they can only do so much at a time. There's still plenty of what you can do by modding, especially in regards to "dynamic" behaviour via events, but some things are just not possible (yet?).
The benefit is that it's far easier to learn how to mod CK2 than to learn actual programming, but the downside is that it is more limiting.
 
Ah damn, that's a shame! :/

And yes I see now, looking at the religious modding suggestions it seems someone has already requested a polyandry feature.

So all mods that we can potentially make at the moment are just re-arrangements and re-skinnings of what we've been given in that exposed layer? There's no way to add entirely new material without 'hacking' the game completely? (which I'm not prepared to do).

Alrighty then, well maybe there's a compromise and I can still make something of this exercise! So my next question is, are localisation files global or individual? For example, if I added a new culture / religion that allowed consorts—since this is just a re-arangement of the the surface layer—and then renamed "consorts" to "secondary husbands" and then removed the 'child of consort' trait for that culture specifically. Would that work; or would a change like that affect all consorts and children of consorts for all religions / cultures?

Thanks!
 
So all mods that we can potentially make at the moment are just re-arrangements and re-skinnings of what we've been given in that exposed layer? There's no way to add entirely new material without 'hacking' the game completely? (which I'm not prepared to do).
Yes, that is correct.
However, especially if you are looking at adding stuff, there are a lot of possibilites: Since just a few patches ago, we have now access to persistent event targets, which are basically a sort of pointer (just not applicable to everything), as well as variables - together, these will allow do simulate some behaviour that you would expect from normal programming if you are willing to experiment.
I suggest you read through that wiki page since it really has a lot of valuable information.

Alrighty then, well maybe there's a compromise and I can still make something of this exercise! So my next question is, are localisation files global or individual? For example, if I added a new culture / religion that allowed consorts—since this is just a re-arangement of the the surface layer—and then renamed "consorts" to "secondary husbands" and then removed the 'child of consort' trait for that culture specifically. Would that work; or would a change like that affect all consorts and children of consorts for all religions / cultures?
That would be partly doable. I do not know whehter you could rename the consort title to "husband" for specific religions - however, it might be possible. You would have to search through the localisation files for something relating to consort. But you can, for example, rename how a <religion>_king should be called, so renaming a consort might be possible unless it is an (arbitrarily) hardcoded exception.
You can definitely influence whether children born to such a "fake consort" should get the child_of_consort_male trait. Because that is part of the dynamic modding side. Here's how I found out how:
First I went to /common/on_actions.txt, and searched for "on_birth". This is the on action (read that wiki page as well!) that is fired by the engine whenever any child is born (think of it like a normal C# "event" with subscribers and all that - in CK2, an event means something different ofc). Here I was lucky, as it has an entry called:
Code:
312 # The child of a consort is born
I suspected now already that the trait was assigned by this event and thus the behaviour not hardcoded. But now I had to locate that event to make sure. Went to /events and searched for a file that was appropriately named (otherwise I could have ofc searched all their contents, but just three numbers would have yielded too many results). Quickly found "birth_events.txt" which looked what I was searching for. Opened it, searched for "312" - and voilà, found it:
Code:
character_event = {
    id = 312
    picture = "GFX_evt_birth"
  
    is_triggered_only = yes
    hide_window = yes
  
    trigger = {
        OR = {
            mother = {
                is_consort = yes
            }
            father = {
                is_consort = yes
            }
        }
    } 
  
    option = {
        if = {
            limit = {
                mother = { is_consort = yes }
            }
            add_trait = child_of_consort
        }
        if = {
            limit = {
                father = { is_consort = yes }
            }
            add_trait = child_of_consort_male
        }
    }
}
Now equipped with knowledge about the logic you could easily alter these clauses to only apply the trait if the religion of the child (or of one or both parents) is NOT your new one.
 
Last edited:
Thank you very much for your help, I will have to read through all these wikis properly and try some stuff out myself now!
(my guess is that I can add to that IF statement and check if the father is of X religion too to make an exception)
 
Figured I'd give an update here for posterity.

So in the end I had to go off and define a new religion first (it seems that number of consorts can't be defined by culture), but the result was this: on line 3450 of birth_events.txt I modified the born to consort character event as follows
Code:
trigger = {
        OR = {
            mother = {
                is_consort = yes
                NOT = { religion_group = test_group }
            }
            father = {
                is_consort = yes
                NOT = { religion_group = test_group }
            }
        }
    }

I suppose this might get unwieldy if you had lots of religions with this feature, but it works for one or two. (I also suspect that it might slow the game a tad because it will make this extra check for every child born of a consort in the world... so may be a better way would be to make members of the new religion immune to the 'child of consort' trait, but idk how to do that yet or if it's possible). But it otherwise works a charm:

Children born by consorts under the defined religious group will not gain the stigma of being born to a consort, making them rightful heirs and suffering them no opinion penalty. The effect is that 'consorts' are basically 'secondary husbands'. They won't get any special events like your main husband gets, but it's a passable work-around in the meantime before a proper form of polyamory can be modded (if the devs ever add that).

My hope is that I can also rename 'consort / concubine' to 'secondary husband / wife' in the localisation files, or somewhere else, for the new religion. But as LordPeter mentioned it's also possible that those two words are hard-coded. I will investigate more later.

Thanks again Peter.