• 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.
Not dynamically if you mean that, no.
An older CK2+ version had a Iceland with "no character" as holder until it would have been colonized, but the system was bugged. And AGOT seems to circumvent the problem by having fake characters such as "Ruin" to hold the supposedly empty provinces.
So no, there is no known way to properly make provinces into wasteland or vice versa dynamically, only crafty workarounds.

Did you make your own mod (as opposed to editing vanilla files), and activate it?
Forgive me if this sounds obvious, but I tend to begin with asking the easy things first ^^

I didn't create my own but I do have some downloaded off the workshop but none of them affect religion. I noticed my save games are not in the default save folder but in a folder named after those mods. I turned off those mods and now the changes I made do work it seems like 1 mod that gives a custom trait is messing things up.

Thanks for the help
 
Ok, allow me to specify what exactly I'm doing, so hopefully I can get some specific advice. In my localization, I'm using [sicilian_vespers_claimant.GetTitledFirstName] to get the titled name of the event target. It has worked well in previous versions, but for some reason it's not working now.
 
I'm trying to create a racial hybridization system that stores the "genotype" of each character as a set of variables (one for each race). There are currently six races (after which the variables are named): dwarf (D), elf (E), goblin (G), human (H), orc (O), and pech (P).

A pureblood human has the genotype D0/E0/G0/H1/O0/P0.

A hybrid with a pureblood dwarf father and a pureblood pech mother has the genotype D0.5/E0/G0/H0/O0/P0.5.

A hybrid with a pureblood orc father and a halfblood dwarf/human mother has the genotype D0.25/E0/G0/H0.25/O0.5/P0.

A hybrid with a pureblood elf father and a halfblood elf/human mother has the genotype D0/E0.75/G0/H0.25/O0/P0.

A hybrid with a halfblood elf/orc father and halfblood human/pech mother has the genotype D0/E0.25/G0/H0.25/O0.25/P0.25.

Etc.

What I need to know is, how to script the calculations that derive the genotype of a newborn from that of its parents. The math is straightforward: add each variable from the father's genotype to the same variable from the mother's genotype, then halve the sums. I think the following (iterated across each of the variables) may be what I need, but I'm not sure:
Code:
    set_variable = { which = dwarf which = real_father }
    change_variable = { which = dwarf which = mother }
    divide_variable = { which = dwarf value = 2 }

Is this close to correct? Also, if one or both parents dies prior to or upon childbirth, do their variables get discarded, borking the calculations?
 
Last edited:
I'm trying to write a targeted decision to commit infanticide (don't judge me this game already lets you do some pretty horrible things) but it isn't working. I've narrowed down the problem to this code:


Code:
        potential = {
            any_child = { character = FROM }
            NOT = {
                    age = 1
                    is_heir = { character = FROM }
            }
        }

But it's not working. All I want is for the target to be 1) My Child, 2) Less than 1 year old, 3) Not an heir to my titles

What am I doing wrong?
 
... As for the mods not showing up on the Workshop, just be patient,..

It wasn't me who had that problem. ;)

I was just putting them directly into my CK2/mods folder
Good to know.
I edited my comment on that to be more clear.
I think that it isn't mentioned on the Wiki part for the Workshop.
Someone could edit..:cool:

You can't actually modify the thumbnail for the mod using "Add/edit images..." you need to update the mod with the new thumbnail
through the content tab in-game.

Not modify, but upload it or additional pics.
As you didn't exactly say what you had trouble with and how it occured, i had to guess and just listed everything i recalled
and which could potentially be helpful.

Good to know you got it to work without any bigger hassle. :)

I still suspect that the size, resolution or format of a picture matters sometimes, as the AGOT mod for instance has a picture which shows fine on its page,
but not when listed in the client. Well i don't know. Only suspect.
Suspects everwhere. :eek::D
Cheers
 
Last edited:
Code:
    set_variable = { which = dwarf which = real_father }
    change_variable = { which = dwarf which = mother }
    divide_variable = { which = dwarf value = 2 }

Is this close to correct? Also, if one or both parents dies prior to or upon childbirth, do their variables get discarded, borking the calculations?

This code will only work if the child is a bastard (real_father doesn't scope to anyone otherwise), or if the child was generated with less than 2 parents (like demon spawn or rose bush babies), and won't work if the character if dead.
This should do what you want:
Code:
if = {
    limit = { real_father_even_if_dead = { always = yes } }
    set_variable = { which = dwarf which = real_father_even_if_dead }
}
else_if = {
    limit = { father_even_if_dead = { always = yes } }
    set_variable = { which = dwarf which = father_even_if_dead }
}
else = {
    set_variable = { which = dwarf value = <some default, probably 0> }
}
if = {
    limit = { mother_even_if_dead = { always = yes } }
    change_variable = { which = dwarf which = mother_even_if_dead }
}
else = {
    change_variable = { which = dwarf value = <some default, probably 0> }
}
divide_variable = { which = dwarf value = 2 }

I think an upcoming patch is going to add true_father and true_father_even_if_dead, which scope to the biological father regardless of bastardry, which will simplify the father black, but this is what you'll need for now.
 
I'm trying to write a targeted decision to commit infanticide (don't judge me this game already lets you do some pretty horrible things) but it isn't working. I've narrowed down the problem to this code:


Code:
        potential = {
            any_child = { character = FROM }
            NOT = {
                    age = 1
                    is_heir = { character = FROM }
            }
        }

But it's not working. All I want is for the target to be 1) My Child, 2) Less than 1 year old, 3) Not an heir to my titles

What am I doing wrong?
As it stands you are checking if the child *is* FROM, not if its FROM's child. What you want is 'is_child_of = FROM', which the legitimize_bastard decision uses.

And you need to put separate NOTs around age and is_heir. As-is, it wouldn't block an older heir or an infant non-heir.

Also, is_heir doesn't take a bracketed clause. Just use 'is_heir = FROM'.

Code:
        potential = {
            is_child_of = FROM
            NOT = { age = 1 }
            NOT = { is_heir = FROM }
            }
        }
 
This code will only work if the child is a bastard (real_father doesn't scope to anyone otherwise), or if the child was generated with less than 2 parents (like demon spawn or rose bush babies), and won't work if the character if dead.
This should do what you want:
Code:
if = {
    limit = { real_father_even_if_dead = { always = yes } }
    set_variable = { which = dwarf which = real_father_even_if_dead }
}
else_if = {
    limit = { father_even_if_dead = { always = yes } }
    set_variable = { which = dwarf which = father_even_if_dead }
}
else = {
    set_variable = { which = dwarf value = <some default, probably 0> }
}
if = {
    limit = { mother_even_if_dead = { always = yes } }
    change_variable = { which = dwarf which = mother_even_if_dead }
}
else = {
    change_variable = { which = dwarf value = <some default, probably 0> }
}
divide_variable = { which = dwarf value = 2 }

I think an upcoming patch is going to add true_father and true_father_even_if_dead, which scope to the biological father regardless of bastardry, which will simplify the father black, but this is what you'll need for now.
To the best of my knowledge, variables are indeed deleted on death. So all the *_even_if_dead parts will be useless. :(
 
In that case, you may want to try using something like hidden traits to store the information. You would only need to store the full (variable is 1) trait, then just track back the appropriate number of generations. For consistency, you may also want to have a check in case an ancestor is missing (e.g. their mother was formed through Present Debutant and has no parents), in which case you assume both parents had the same race as their child.
 
................
I think an upcoming patch is going to add true_father and true_father_even_if_dead, which scope to the biological father regardless of bastardry, which will simplify the father black, but this is what you'll need for now.

You probably saw it here: https://forum.paradoxplaza.com/forum/index.php?threads/captains-log.774248/page-32#post-23627045
- Added set_immune_to_pruning command. Prevents a character from being pruned from AI courts or removed from save games. WARNING: the effects cannot be undone
- Added is_immune_to_pruning trigger. Checks if the character has specifically been made immune to pruning either by script or the game internally
- Added true_father and true_father_even_if_dead scopes. Scopes to the real_father if one exists else it scopes to the father
- Added TrueFather localization promotion. As above, promotes to the RealFather if one exists else it promotes to the Father
- Added twin and twin_even_if_dead scopes. Scopes to the twin of a character. WARNING: if your mod tries to use triplets etc. via the twin system you may encounter some oddities with these scopes.
- Added Twin localization promotion. As above, promotes to the twin of a character. WARNING: if your mod tries to use triplets etc. via the twin system you may encounter some oddities with this scope.
- Added is_twin_of condition. Checks if the scoped character is the twin of the target character.

Just in case you're wondering where you read it.
 
In that case, you may want to try using something like hidden traits to store the information. You would only need to store the full (variable is 1) trait, then just track back the appropriate number of generations. For consistency, you may also want to have a check in case an ancestor is missing (e.g. their mother was formed through Present Debutant and has no parents), in which case you assume both parents had the same race as their child.

Might something like this work?
Code:
    any_dynasty_member_even_if_dead = {
        limit = { is_ancestor_of = ROOT }
        ROOT = {
            change_variable = { which = genotype_total value = 1 }
        }
    }
   
    any_dynasty_member_even_if_dead = {
        limit = {
            is_ancestor_of = ROOT
            trait = marker_dwarf
        }
        ROOT = {
            change_variable = { which = dwarf value = 1 }
        }
    }
    any_dynasty_member_even_if_dead = {
        limit = {
            is_ancestor_of = ROOT
            trait = marker_elf
        }
        ROOT = {
            change_variable = { which = elf value = 1 }
        }
    }
    any_dynasty_member_even_if_dead = {
        limit = {
            is_ancestor_of = ROOT
            trait = marker_goblin
        }
        ROOT = {
            change_variable = { which = goblin value = 1 }
        }
    }
    any_dynasty_member_even_if_dead = {
        limit = {
            is_ancestor_of = ROOT
            trait = marker_human
        }
        ROOT = {
            change_variable = { which = human value = 1 }
        }
    }
    any_dynasty_member_even_if_dead = {
        limit = {
            is_ancestor_of = ROOT
            trait = marker_orc
        }
        ROOT = {
            change_variable = { which = orc value = 1 }
        }
    }
    any_dynasty_member_even_if_dead = {
        limit = {
            is_ancestor_of = ROOT
            trait = marker_pech
        }
        ROOT = {
            change_variable = { which = pech value = 1 }
        }
    }
   
    divide_variable = { which = dwarf which = genotype_total }
    divide_variable = { which = dwarf value = 2 }
    divide_variable = { which = elf which = genotype_total }
    divide_variable = { which = elf value = 2 }
    divide_variable = { which = goblin which = genotype_total }
    divide_variable = { which = goblin value = 2 }
    divide_variable = { which = human which = genotype_total }
    divide_variable = { which = human value = 2 }
    divide_variable = { which = orc which = genotype_total }
    divide_variable = { which = orc value = 2 }
    divide_variable = { which = pech which = genotype_total }
    divide_variable = { which = pech value = 2 }

Where marker_[race] is a hidden trait with the following flags:
Code:
marker_[race] = {
    hidden = yes
    agnatic = yes
    enatic = yes
}
 
Last edited:
any_dynasty_member won't work, since only one parent will be of their dynasty (usually - See also: House von Habsberg)

Edit: Also, if you already have an existing trait for each race, you won't need to add a hidden trait.

Edit: Also, how much precision do you need? That will affect how many generations back you need to go.
 
trying to make an event to reduce threat/infamy for underaged rulers that has inherited a threat level above 75.
validator says there is an invalid node at the trigger, but i can not resolve it.

Code:
namespace = abs_events

# The young king
character_event = {
   id = abs_events.20
   desc = "abs_events.20.desc"
   picture = GFX_evt_child_emperor
   
   is_triggered_only = yes
   
   only_independent = yes
   max_age = 15
   
   trigger = {
       infamy = 75
   }   
   option = {
       name = abs_events.20.name
       change_infamy = {
           value = -50
           localisation = CHANGE_INFAMY_EFFECT
       }
   }   
}
 
any_dynasty_member won't work, since only one parent will be of their dynasty (usually - See also: House von Habsberg)

Edit: Also, if you already have an existing trait for each race, you won't need to add a hidden trait.

Edit: Also, how much precision do you need? That will affect how many generations back you need to go.

So any_character, instead? Expensive, but if that's the only way to capture all progenitors...

How then to keep track of recessive racial components that are too small to warrant a (visible) phenotypal trait, but are still part of the character's genotype? Realistically, these could remain latent until some confluence of bloodlines unexpectedly causes them to express, giving rise to "changelings" -- which is actually a neat side effect of this system, which I'd like to preserve if possible.

Although up to 16 generations back is undoubtedly overkill, it's far more parsimonious to code the block using is_ancestor_of than to script individual segments for parents, grandparents, great-grandparents, great-great-grandparents, etc. Is there a compelling reason to do the latter? I don't imagine the performance gain would be that significant. A lot of bloodlines die out before they ever reach 16 generations deep.
 
The biggest advantage of modeling it out completely would be handling missing ancestors. For instance, if a character's mother doesn't have a father or mother, the character's ancestry should still reflect that the mother represents half their ancestry. Just counting all ancestors won't do that, and would treat the father as contributing a disproportional amount of the character's ancestry. Counting all ancestors also gives each one equal weight, even though you realistically have more in common genetically with your father than with your great-great-great-grandfather.

16 generations is overkill. 6 generations is probably the most you need. Past that, you don't have much in common genetically with any single ancestor, with each representing 1/64. Even 4 or 5 (1/16 and 1/32 respectively) is likely to be more than enough

I have attached a partial version of the code. It uses the true_father scope blackninja mentioned in the captain's log, though I don't know when that will be implemented in-game.
It currently goes 4 generations. If extended, you'll need to double all the numbers. Beyond that, extending is mostly copy/paste
This is designed to give all ancestors at the furthest checked generation equal weight, including those the game doesn't actually have characters for, by assuming those non-existent characters are the same race as their nearest descendent.
This currently only checks for dwarves and elves, but can easily be extended. If a character has no father/mother at all, it assumes the missing character is human, though this can also be easily changed.

I've actually already given a lot of thought to this design, but had to scrap it, since it can't account for things like a character becoming a werewolf later in life, Loki (a giant/god)being Sleipnir's (a horse) mother Jormungandr (a snake) and Fenrir's (a wolf) father. Mythology is weird.
 

Attachments

  • example_genetics.txt
    22,1 KB · Views: 5
Two quick questions:

1) Is "Years" not valid for mean_time_to_happen? I had two events set to happen roughly 100 years, and they both fired within a month of starting the game.

2) Is the pope hard-coded to be unmarried? I added a spouse via event, but as soon as gameplay continued he divorced(?) her, and became unmarried.
 
1. Mean time to happen can be in years. However, if you wanting something at roughly 100 years, (or, in pretty much any scenario) you're better off using an on_action. MTTH is very resource intensive, and gets checked about every 14 days, which is overkill for a rare event.

2. Catholic priests aren't allowed to marry. The Pope is a Catholic priest.
 
1. Mean time to happen can be in years. However, if you wanting something at roughly 100 years, (or, in pretty much any scenario) you're better off using an on_action. MTTH is very resource intensive, and gets checked about every 14 days, which is overkill for a rare event.

2. Catholic priests aren't allowed to marry. The Pope is a Catholic priest.

1) Ah, thanks, I'll look into that. :D

2) So events don't totally over-ride religion, then? I'd assumed that add_spouse would circumvent the limitation. Thanks, that explains it.

Edit :
Does anyone know why this decision is not being allowed?
Code:
allow = {
   is_playable = yes
   ai = no
   c_desmond = {
    OR = {
     any_province_holding = {
      holding_type = castle
     }
     capital_holding = {
      holding_type = castle
     }
    }
   }

I originally just had 'any_province_holding', and I've confirmed that c_desmond has a Castle, both as a Capical Holding, and as a normal Holding, but in both cases it comes up as unfulfilled in the requirements. I also tried moving it to the Potential Scope (in case for some reason it did not work with allow, but it just did not appear at all.
 
Last edited:
I've tried doing this (except in a mod folder) and it doesn't seem to work; created a new dynasty in common/dynasties, new character in history/characters and finally an edited history/titles file. Started game and was same old character ruling it; actually starting the game caused a crash.

Then I tried copying the entire history/titles folder, except with one edited titles file, and using replace_path... and all provinces have no rulers?

Need help. I don't want to edit base game files if I can help it.
 
Last edited: