• 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.
Sorry if I'm not understanding, but wouldn't you have to always put the version that uses CE cultures after it in the load order? It would need to read the cultures first in order to be able to assign them? At least, I'm assuming here that by "doesn't work" you mean it doesn't load as you'd expect, not that it's crashing the game, yeah?

If it has to go ahead of CE in the playset, maybe try changing the names of the files to be alphabetically after the culture files in CE. So if CE has the relevant culture files named with a prefix like 00_ try adding a prefix to your character files like 99_ or zz_ if there's no prefix, and you want it to load last over files that start like ce_.

EDIT: Clarity
No, no crashes. The problem is no characters I've added or changes I've made show at all. Wouldn't the only problem I have, if I have any problems at all, be the characters showing but not having that culture? I'd have assumed since characters are generated at game start and because vanilla version put before CE works fine, that load order shouldn't matter but perhaps not.
As for the load order, it doesn't necessasirly need to be loaded before it but CE suggests any other mod be loaded before it so people would by default go with that loading order which currently ends up with mine not working. I'll try your suggestions on the naming and if it doesn't work I'll just suggest it being loaded last. Thanks.
 
  • 1
Reactions:
Thanks for the clear explanation. This is the code now. It still doesn't work. Did I miss something?

Code:
option = {
        name = roman_restoration.0140.a
        add_prestige = major_prestige_gain


        every_culture_global = {
        limit = {
            OR = { 
                has_cultural_pillar = heritage_latin
                has_cultural_pillar = heritage_hellenic 
                }
            }
            add_innovation_if_missing_effect = { INNOVATION = innovation_men_at_arms }
            add_innovation_if_missing_effect = { INNOVATION = innovation_pike_columns }
            add_innovation_if_missing_effect = { INNOVATION = innovation_guilds }
            }
That looks right to me. The only thing is that you're missing a closing curly bracket } at the end, to close up the option, but I have a feeling you might have just not including that when you pasted it into the post. If adding an extra cultural pillar to it is the only change you've made to the file, I can't see immediately why it doesn't work, but if you want to attach the file that has roman_restoration.0140 I'll take a look at it.
No, no crashes. The problem is no characters I've added or changes I've made show at all. Wouldn't the only problem I have, if I have any problems at all, be the characters showing but not having that culture?
Yeah, that was what I was assuming was happening when you mentioned that loading them without CE defaulted all characters to Akan culture, but if the characters aren't showing up at all, then I'm not too sure. It sounds like the files you're adding are being overwritten by the files in CE, which happens when you put the files of the same name in the same location in a mod.

If Mod A has a file in the same place and named file_A, and mod B also has a file named file_A in the same place, whichever file gets loaded last will be the file that the game goes with. It's what allows mods to overwrite vanilla files and make changes, without having conflicts. I don't know anything about CE, though, so I was assuming that your files and their files are not the same ones (such as files from vanilla with the same names but their contents altered and/or added to), but if they are the same file names/locations, then whichever gets loaded last will be the file that the game uses.

Assuming this is what's happening, I would recommend offloading your changes into their own files for the mod that is meant to work with CE. But if that's not what's happening, then I'm just a crazy person rambling right now, and I should definitely be disregarded. The best thing to do might be to get in touch with the creator of CE and see if they can offer you any advice about how to make your mod compatible with theirs.
 
  • 1
Reactions:
Yeah, that was what I was assuming was happening when you mentioned that loading them without CE defaulted all characters to Akan culture, but if the characters aren't showing up at all, then I'm not too sure. It sounds like the files you're adding are being overwritten by the files in CE, which happens when you put the files of the same name in the same location in a mod.

If Mod A has a file in the same place and named file_A, and mod B also has a file named file_A in the same place, whichever file gets loaded last will be the file that the game goes with. It's what allows mods to overwrite vanilla files and make changes, without having conflicts. I don't know anything about CE, though, so I was assuming that your files and their files are not the same ones (such as files from vanilla with the same names but their contents altered and/or added to), but if they are the same file names/locations, then whichever gets loaded last will be the file that the game uses.

Assuming this is what's happening, I would recommend offloading your changes into their own files for the mod that is meant to work with CE. But if that's not what's happening, then I'm just a crazy person rambling right now, and I should definitely be disregarded. The best thing to do might be to get in touch with the creator of CE and see if they can offer you any advice about how to make your mod compatible with theirs.
It was late at night, and I could've been a bit clearer I think. CE is Culture Expanded. It adds a lot of cultures, traditions, some decisions etc. among other things but doesn't change any character or dynasty files. My mod adds some dynasties, houses etc. but as new files and doesn't change the base files and adds characters with new files, and changes some existing characters, which are the only files that is changed but CE doesn't touch that so there are no files that we change in common. Two versions of it are pretty much the same just some characters have different cultures such as a character being German for vanilla version due to lack of appropriate culture but being Vandal for CE version. If I try to use the vanilla version, loading it before CE than it works fine together with that but loading the CE version before CE, it doesn't work. CE version works fine if loaded after CE and it also work on it's own although since some characters cultures don't exist in game they will go Akan if loaded by itself.


But anyway, your suggested fix of adding zz_ seems to have worked, thanks. The why of the problem will remain a mystery to me I guess.
 
Last edited:
  • 1
Reactions:
I cannot figure out the syntax of the script command to cancel a truce.

Long story short, had a vassal with strong allies who continued to be a thorn in my side, even fought a war in the past. Finally, a reason to imprison him has appeared. I tried, he escaped and started a rebellion. After another arduous war, I won.

I wanted to revoke his titles after the victory, but I couldn't, because... The old truce didn't expire yet. It's extremely frustrating.

I know it's cheating, but I wanted to run a script that would remove our truce. However, while I know the basics of scripts, I cannot figure out how to make the cancel_truce_both_ways work properly.

The ID of my character is 16810933, the ID of my asshole vassal is 49551.

Can anyone help me figure out what the script is supposed to look like?
 
  • 1Like
Reactions:
I cannot figure out the syntax of the script command to cancel a truce.

Long story short, had a vassal with strong allies who continued to be a thorn in my side, even fought a war in the past. Finally, a reason to imprison him has appeared. I tried, he escaped and started a rebellion. After another arduous war, I won.

I wanted to revoke his titles after the victory, but I couldn't, because... The old truce didn't expire yet. It's extremely frustrating.

I know it's cheating, but I wanted to run a script that would remove our truce. However, while I know the basics of scripts, I cannot figure out how to make the cancel_truce_both_ways work properly.

The ID of my character is 16810933, the ID of my asshole vassal is 49551.

Can anyone help me figure out what the script is supposed to look like?
Try pinning the character you want to end the truce with and run this:

effect = { random_pinned_character = { save_scope_as = character } cancel_truce_both_ways = scope:character }

I tested it and it seemed to work.

2024-03-23 18-11-10 - .png

If you absolutely have to use the character code, make sure you have it written as character:16810933 when trying to use it, and make sure that that number isn't the one that's in the debug mode while the game is running, but the character id from the history files. The numbers don't match up in the game, and that would be my guess as to what your problem is. The best way, I think, is to find a way to save the character you want to target as a scope and use that scope in your effect. I find pinning works very well for this, and if you had multiple characters you wanted to do this to, you could pin them all and then change random_pinned_character to every_pinned_character and it would run through all pinned characters you have a truce with, and end it.

You could also find the character other ways, though, like if you only have one vassal you have a truce with, then random_vassal might work, but it can get confusing when multiple characters fit in the same list and you only want one of them. For this, pinning characters is the easiest way I've found to access them quickly and easily in game.

EDIT: Sorry, I just realized I didn't explain the changes you would need to make at all with the every_pinned_character version. I don't think that's relevant here, but just in case anyone ever sees this and it's helpful, to remove truces with multiple characters, pin them and then run:

effect = { every_pinned_character = { cancel_truce_both_ways = root } }

You could also simplify the original with just effect = { random_pinned_character = { cancel_truce_both_ways = root } }. I just got fixated on needing to save a character, I think.
 
Last edited:
  • 1
  • 1Like
Reactions:
That looks right to me. The only thing is that you're missing a closing curly bracket } at the end, to close up the option, but I have a feeling you might have just not including that when you pasted it into the post. If adding an extra cultural pillar to it is the only change you've made to the file, I can't see immediately why it doesn't work, but if you want to attach the file that has roman_restoration.0140 I'll take a look at it.

Yeah, that was what I was assuming was happening when you mentioned that loading them without CE defaulted all characters to Akan culture, but if the characters aren't showing up at all, then I'm not too sure. It sounds like the files you're adding are being overwritten by the files in CE, which happens when you put the files of the same name in the same location in a mod.

If Mod A has a file in the same place and named file_A, and mod B also has a file named file_A in the same place, whichever file gets loaded last will be the file that the game goes with. It's what allows mods to overwrite vanilla files and make changes, without having conflicts. I don't know anything about CE, though, so I was assuming that your files and their files are not the same ones (such as files from vanilla with the same names but their contents altered and/or added to), but if they are the same file names/locations, then whichever gets loaded last will be the file that the game uses.

Assuming this is what's happening, I would recommend offloading your changes into their own files for the mod that is meant to work with CE. But if that's not what's happening, then I'm just a crazy person rambling right now, and I should definitely be disregarded. The best thing to do might be to get in touch with the creator of CE and see if they can offer you any advice about how to make your mod compatible with theirs.
Thanks again. I've attached Major Events that contains Unify Italia, I guess the error could be there, and Roman Restoration.
 

Attachments

  • 80_major_decisions_roman.txt
    28,1 KB · Views: 0
  • roman_restoration_events.txt
    65,7 KB · Views: 0
  • 1
Reactions:
Thanks again. I've attached Major Events that contains Unify Italia, I guess the error could be there, and Roman Restoration.
I cleaned up the every_culture_global part, which had one too many curly braces, but it still didn't work at first. It turns out not having heritage_hellenic defined in common/culture/pillars somehow was breaking it for me and giving the innovations to every culture in the game. When I added a heritage_hellenic entry in the right place, though, everything worked just fine.

2024-03-24 15-27-56 - .png


So, the attached file does work. And in fact, I tested it with your original every_culture_global, and even with the extra curly brace it still worked for me. If you haven't set a heritage_hellenic, then I would say try doing that, maybe that will get it to work, but if you have done that already and it's still like this, then there must be a problem outside of this file.
 

Attachments

  • roman_restoration_events.txt
    68,7 KB · Views: 0
Is there any documentation on the details of map modding? I want to add the Swahili coast and Great Zimbabwe to the Vanilla map but I'm not entirely sure where to start. Ideally Id like to just extend the vanilla maps southern border to the rough area of cape Correntes Without otherwise warping the existing map. I'm not sure its possible but id at the least like to know if there are any guides/documentation that point me in the right direction.
 
  • 1Like
Reactions:
Hey there! Quick question!

I want to make a trait that removes the title of the name of the character with the trait.
For example -> "King Bob Gerald of England" to just "Bob Gerald of England" (whilst still being the king of england)

I've gone around and used my own knowledge from the ck3 wiki AND some help from ChatGPT- knowing that it's coding aspect isn't all that 'bad'.

However, when I ran the trait with code on a new mod.
I was able to find the trait and equip it in the character creator but nothing happened. Both in the creator and in-game, once I started playing as "X" character.

Here is the code I did:

titleless_trait = {
# Potential trigger condition
potential = {
is_ruler_designer = yes
}

# Define the category of the trait
category = fame

# Localization
name = "Titleless"
desc = "This character's name does not include their title."

# Icon (replace the path with the actual path to your icon)
icon = {
first_valid = {
desc = "gfx/interface/icons/traits/titleless.dds"
}
}

# Immediate effect to remove title prefix
immediate = {
change_primary_title = {
remove_title_prefix = yes
}
}
}

I've checked, and it should be in the right folder and everything -> "common" -> "traits"

I also tried making an events file as well with some added code afterwards to see if that might fix the problem

character_event = {
id = title_removal_event
hide_window = yes

trigger = {
has_trait = titleless_trait
NOT = {
has_title_prefix = no
}
}

immediate = {
change_primary_title = {
remove_title_prefix = yes
}
}
}


Any help is appreciated!
(The reason why I want to do this is throughout the year-or years-, I want to turn my little fantasy world into Ck3 for me and my mates. Seeing as we've turned them into crappy movies, why not have some fun using Ck3!)

Thank you
 
I want to make a trait that removes the title of the name of the character with the trait.
There isn't remove_title_prefix. There's set and reset, but it's different stuff.
ChatGPT does not know how to mod CK3. It gave you very wrong event syntax too.

I think there are two ways around it:
Edit the character window to have two different titles and show one when the character has the trait.
This is gui/window_character.gui, line 785.
Of course, that would only work in the character window, others would still use the titled version unless you edit them all as well.

Code:
text_single = {
    raw_text = "#high [Character.GetFirstNameNicknamedNoTooltip]#! [AddTextIf(Character.GetPrimaryTitle.IsValid, 'of ')][AddTextIf(Character.GetPrimaryTitle.IsValid, Character.GetPrimaryTitle.GetNameNoTierNoTooltip)], "
    margin_left = 2
    max_width = 398
    fontsize = 20
    fontsize_min = 14
    align = nobaseline
    default_format = "#medium"
    visible = "[Character.HasTraitByKey('titleless_trait')]"
}

text_single = {
    name = "character_name"
    visible = "[Not(Character.HasTraitByKey('titleless_trait'))]"
    raw_text = "[Character.GetUINameNotMeNoTooltip], "
    margin_left = 2
    max_width = 398
    fontsize = 20
    fontsize_min = 14
    align = nobaseline
    default_format = "#medium"
    tooltip = "[Character.GetUINameNotMeNoTooltip]"
}

The other option is to edit localization keys for "king", "emperor", etc, to only add the text depending on the trait, like this:
king_feudal_male:0 "[AddTextIf(CHARACTER.HasTraitByKey('titleless_trait'), 'King')]"
This is in localization\english\culture\culture_titles_l_english.yml
You would need to replace all of the keys, though. Do it if you know regex.
 
Last edited:
  • 1
  • 1Like
Reactions:
There isn't remove_title_prefix. There's set and reset, but it's different stuff.
ChatGPT does not know how to mod CK3. It gave you very wrong event syntax too.

I think there are two ways around it:
Edit the character window to have two different titles and show one when the character has the trait.
This is gui/window_character.gui, line 785.
Of course, that would only work in the character window, others would still use the titled version unless you edit them all as well.

Code:
text_single = {
    raw_text = "#high [Character.GetFirstNameNicknamedNoTooltip]#! [AddTextIf(Character.GetPrimaryTitle.IsValid, 'of ')][AddTextIf(Character.GetPrimaryTitle.IsValid, Character.GetPrimaryTitle.GetNameNoTierNoTooltip)], "
    margin_left = 2
    max_width = 398
    fontsize = 20
    fontsize_min = 14
    align = nobaseline
    default_format = "#medium"
    visible = "[Character.HasTraitByKey('titleless_trait')]"
}

text_single = {
    name = "character_name"
    visible = "[Not(Character.HasTraitByKey('titleless_trait'))]"
    raw_text = "[Character.GetUINameNotMeNoTooltip], "
    margin_left = 2
    max_width = 398
    fontsize = 20
    fontsize_min = 14
    align = nobaseline
    default_format = "#medium"
    tooltip = "[Character.GetUINameNotMeNoTooltip]"
}

The other option is to edit localization keys for "king", "emperor", etc, to only add the text depending on the trait, like this:
king_feudal_male:0 "[AddTextIf(CHARACTER.HasTraitByKey('titleless_trait'), 'King')]"
This is in localization\english\culture\culture_titles_l_english.yml
You would need to replace all of the keys, though. Do it if you know regex.

Hey, thank you for this!
I'm specifically curious about the first section you sent me. Would I have to do this as a modification within Ck3 files or as a new window_character GUI file in my mod folder?

Sorry about asking such but thank you, again.


EDIT:

Ignore my insolence! I have found the fix through your added code.
THANK YOU VERY MUCH.
 
Last edited:
  • 1Like
Reactions:
Hey, I'm looking to adjust some events such that rather than having a stacking stress impact with multiple applicable traits, they have the set stress impact if they have any of the applicable traits. How would I properly set up an OR statement with stress impact to do that, ideally while still showing that you are getting the stress due to having those traits?
 
Last edited:
Is there any documentation on the details of map modding? I want to add the Swahili coast and Great Zimbabwe to the Vanilla map but I'm not entirely sure where to start. Ideally Id like to just extend the vanilla maps southern border to the rough area of cape Correntes Without otherwise warping the existing map. I'm not sure its possible but id at the least like to know if there are any guides/documentation that point me in the right direction.
The only documentation I can recall is on the Wiki. It's a bit lacking, but with some trial and error I found it helpful. In my experience, extending the map is doable, but it might be very tedious. You'd have to add provinces, not to mention update all the graphical masks for terrain, plus you'd have to find a heightmap that covers the area you want, or edit the heightmap that exists by hand. It would probably be a lot of work, but yes, theoretically you can extend the map.
Hey, I'm looking to adjust some events such that rather than having a stacking stress impact with multiple applicable traits, they have the set stress impact if they have any of the applicable traits. How would I properly set up an OR statement with stress impact to do that, ideally while still showing that you are getting the stress due to having those traits?
As far as I can tell, you'd have to do it with a switch (or an if) statement. stress_impact only takes trait IDs and base = according to the effects.log, and I've never seen it used other than how it's described there.

So I would think you'd have to do something like one of these:

Code:
    option = {
        name = "Switch Statement Example"

        switch = {
            trigger = has_trait
            arrogant = {
                stress_impact = { arrogant = 10 }
            }
            cynical = {
                stress_impact = { cynical = 10 }
            }
            compassionate = {
                stress_impact = { compassionate = 10 }
            }
        }
    }

    option = {
        name = "If Statement Example"

        if = {
            limit = {
                OR = {
                    has_trait = arrogant
                    has_trait = cynical
                    has_trait = compassionate
                }
            }
            custom_tooltip = {
                text = "You gain 10 stress for being Arrogant, Cynical, or Compassionate" # use a loc key like text = my_mod_gain_stress_tooltip
                add_stress = 10
            }
        }
    }

From the perspective of a character who has Arrogant and Cynical, the above looks like:
2024-03-25 14-36-03 -.png


If the second one looks ugly, that's only because I didn't localize it. With a localization key, you can add in the Stress Icon, the Stress concept, and colour the 10 red to show it's a penalty.
 
  • 1
Reactions:
Hello, I'm creating a personal mod for me and my friends and I want to give all dejure counties, duchies and kingdoms of an empire to a single character (also including the empire title) in the 1066 start date. The problem that I'm having is that its very tedious typing out every single county/duchy/kingdom that i want to give to the character. Is there an easier way to do this? also same thing for changing the faith and culture of all the counties to a single culture and faith. Thank you!
 
Last edited:
  • 1Like
Reactions:
Hello, I'm creating a personal mod for me and my friends and I want to give all dejure counties, duchies and kingdoms of an empire to a single character (also including the empire title) in the 1066 start date. The problem that I'm having is that its very tedious typing out every single county/duchy/kingdom that i want to give to the character. Is there an easier way to do this? also same thing for changing the faith and culture of all the counties to a single culture and faith. Thank you!
I might have an answer, but I need to know a few things: Do you want this to only apply to players, or do you just want to give every de jure empire to a separate character? If it's the latter, which character do you want to get it? Do you want the character to have direct control of every title in the de jure empire? Vassals at the barony level? County level? All levels except for their own Empire/Kingdom/Duchy/County title?

EDIT: Also, wanted to ask if you knew how you were going to trigger it? Did you want it to happen at the game start, or do you want to use it in a decision/event/etc.? If you don't know how, that's fine, I just thought I would ask for clarity.
 
I might have an answer, but I need to know a few things: Do you want this to only apply to players, or do you just want to give every de jure empire to a separate character? If it's the latter, which character do you want to get it? Do you want the character to have direct control of every title in the de jure empire? Vassals at the barony level? County level? All levels except for their own Empire/Kingdom/Duchy/County title?

EDIT: Also, wanted to ask if you knew how you were going to trigger it? Did you want it to happen at the game start, or do you want to use it in a decision/event/etc.? If you don't know how, that's fine, I just thought I would ask for clarity.
Like if i wanted to give one character all of Britannia at the 1066 start date and all of the titles underneath it. What I want is whenever I load up the game the custom characters I want to insert into history is already there with all their titles. I already made my custom character and im wondering if theres a way to give him all titles without typing each title out individually like this:
Code:
e_britania = {
    1066.9.14 = {
        holder = 900001
    }
}k_england = {
    1066.9.14 = {
        holder = 900001
    }
}

k_wales = {
    1066.9.14 = {
        holder = 900001
    }
}

k_scotland = {
    1066.9.14 = {
        holder = 900001
    }
}

Also a part im wondering is if i can change the faith/culture of an entire dejure land to one single faith/culture without changing the code of every single province.
 
  • 1
Reactions:
Like if i wanted to give one character all of Britannia at the 1066 start date and all of the titles underneath it. What I want is whenever I load up the game the custom characters I want to insert into history is already there with all their titles. I already made my custom character and im wondering if theres a way to give him all titles without typing each title out individually like this:
Code:
e_britania = {
    1066.9.14 = {
        holder = 900001
    }
}k_england = {
    1066.9.14 = {
        holder = 900001
    }
}

k_wales = {
    1066.9.14 = {
        holder = 900001
    }
}

k_scotland = {
    1066.9.14 = {
        holder = 900001
    }
}

Also a part im wondering is if i can change the faith/culture of an entire dejure land to one single faith/culture without changing the code of every single province.
You can use every_in_de_jure_hierarchy. Set up an on_action to trigger from on_game_start_after_lobby, and you can have the game go through and give every title in the hierarchy and get it to get_title to the character you want to have it (use character:900001 when calling on characters from the history files in effects). You will go massively over the domain limit, but you can use create_title_and_vassal_change (it requires create_title_and_vassal_change and resolve_title_and_vassal_change to work, and one of change_title_holder_include_vassals or change_liege) instead of using get_title.

I spent some time experimenting with it because I was curious about a few things, and I (mostly, there's still a few bugs) came up with a more complicated way of retaining vassals and stuff as well, but I don't think that's what you want, and to avoid vomitting text at you I'll just show you my method for giving all the titles to the character. I would put this in a file in the on_action folder.

Code:
on_game_start_after_lobby = {
    on_actions = {
        my_mod_on_game_start
    }
}

my_mod_on_game_start = {
    effect = {
        title:k_france = { # Set the title you want to start from -- has to be a title that already has a holder
            character:214 = { save_temporary_scope_as = character_to_receive } # If you numbered your character, put the numbers here, e.g., character:123456
            random_this_title_or_de_jure_above = { # Find the empire title in the de jure hierarchy above it
                limit = { tier = tier_empire }
                every_in_de_jure_hierarchy = { # For every title beneath the de jure that is a county or greater:
                    if = {
                        limit = {
                            tier >= tier_county
                        }
                        scope:character_to_receive = { # Give the title to the character
                            get_title = prev
                        }
                    }
                    if = { # If this title is a county, set the culture and faith to that of the character receiving it
                        limit = { tier = tier_county }
                        set_county_culture = scope:character_to_receive.culture
                        set_county_faith = scope:character_to_receive.faith
                    }
                }
            }
        }
    }
}

With this, you'll get all titles for a character. You'll have to repeat it for each character/title you want to rearrange, and if you have any characters that are part of the same de jure empire, only one of them will get titles, and the other will get nothing.

I don't know how much help you were looking for, so hopefully that helps and isn't too much.
 
  • 1
Reactions:
You can use every_in_de_jure_hierarchy. Set up an on_action to trigger from on_game_start_after_lobby, and you can have the game go through and give every title in the hierarchy and get it to get_title to the character you want to have it (use character:900001 when calling on characters from the history files in effects). You will go massively over the domain limit, but you can use create_title_and_vassal_change (it requires create_title_and_vassal_change and resolve_title_and_vassal_change to work, and one of change_title_holder_include_vassals or change_liege) instead of using get_title.

I spent some time experimenting with it because I was curious about a few things, and I (mostly, there's still a few bugs) came up with a more complicated way of retaining vassals and stuff as well, but I don't think that's what you want, and to avoid vomitting text at you I'll just show you my method for giving all the titles to the character. I would put this in a file in the on_action folder.

Code:
on_game_start_after_lobby = {
    on_actions = {
        my_mod_on_game_start
    }
}

my_mod_on_game_start = {
    effect = {
        title:k_france = { # Set the title you want to start from -- has to be a title that already has a holder
            character:214 = { save_temporary_scope_as = character_to_receive } # If you numbered your character, put the numbers here, e.g., character:123456
            random_this_title_or_de_jure_above = { # Find the empire title in the de jure hierarchy above it
                limit = { tier = tier_empire }
                every_in_de_jure_hierarchy = { # For every title beneath the de jure that is a county or greater:
                    if = {
                        limit = {
                            tier >= tier_county
                        }
                        scope:character_to_receive = { # Give the title to the character
                            get_title = prev
                        }
                    }
                    if = { # If this title is a county, set the culture and faith to that of the character receiving it
                        limit = { tier = tier_county }
                        set_county_culture = scope:character_to_receive.culture
                        set_county_faith = scope:character_to_receive.faith
                    }
                }
            }
        }
    }
}

With this, you'll get all titles for a character. You'll have to repeat it for each character/title you want to rearrange, and if you have any characters that are part of the same de jure empire, only one of them will get titles, and the other will get nothing.

I don't know how much help you were looking for, so hopefully that helps and isn't too much.
Thank you so much for this, I found a way that also works for the title changing

If i create a new file in history/titles and put in every title it mostly works. The only issue is it gives land around the assigned that belonged to the previous duchy/king that owned the title before I took it due to the de_jure_liege = statement but thats basically negligible. BUT to speed up this tedious process i created a title scraper:

Python:
import requests
from bs4 import BeautifulSoup

def kingdoms(empire):
url = "URL of CK3 list of kingdoms" # cannot post links in paradox forms :(
    response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')

    king_ids = []

# Find the table with the county IDs. You may need to adjust this depending on the structure of the page.
    table = soup.find('table')
for row in table.find_all('tr'):
cells = row.find_all('td')
 if cells:
# The county ID is in the first cell. You may need to adjust this depending on the structure of the page.
            king_id = cells[9].text.strip()
if (cells[5].text.strip()==empire):
                king_ids.append(king_id)

 return king_ids

def duchys(empire):
url = "URL of CK3 list of duchys" # cannot post links in paradox forms :(
    response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')

    duchy_ids = []

# Find the table with the county IDs. You may need to adjust this depending on the structure of the page.
    table = soup.find('table')
for row in table.find_all('tr'):
cells = row.find_all('td')
 if cells:
# The county ID is in the first cell. You may need to adjust this depending on the structure of the page.
            duchy_id = cells[10].text.strip()
if (cells[1].text.strip()==empire):
                duchy_ids.append(duchy_id)

 return duchy_ids

def counties(empire):
url = "URL of CK3 list of counties" # cannot post links in paradox forms :(
    response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')

    county_ids = []

# Find the table with the county IDs. You may need to adjust this depending on the structure of the page.
    table = soup.find('table')
for row in table.find_all('tr'):
cells = row.find_all('td')
 if cells:
# The county ID is in the first cell. You may need to adjust this depending on the structure of the page.
            county_id = cells[11].text.strip()
if (cells[4].text.strip()==empire):
                county_ids.append(county_id)

 return county_ids



empire=input('What empire do you want the tags to? (case specific)\n')
year=input('What year do you want them?(yyyy.m.d format)\n Start dates: (867.1.1) and (1066.9.15)')
holder=input('What is the holders ID\n')

king_ids= kingdoms(empire)
duchy_ids= duchys(empire)
county_ids= counties(empire)

for i in range(len(king_ids)):
print(king_ids[i]+" = { \n    ",year," = { \n        holder = ",holder,"\n    }\n}\n \n")

for i in range(len(duchy_ids)):
print(duchy_ids[i]+" = { \n    ",year," = { \n        holder = ",holder,"\n    }\n}\n \n")

for i in range(len(county_ids)):
print(county_ids[i]+" = { \n    ",year," = { \n        holder = ",holder,"\n    }\n}\n \n")

It asks the user (you/me) for the empire title, year, and the character ID it wants to assign it to and then prints out a:
Code:
title_ID= {
     year  = {
        holder =  character_ID
    }
}

for every single county duchy and kingdom title under an empire as defined by the wiki. And I copy pasted that into my txt file inside of history/titles and manually added the empire title and it works.

The only issue with it is that the wiki isn't up to date on some counties (only one i noticed was in India) but that's negligible. Also with some characters in 1066 start date they get their titles on the day of the start date and they take priority over whoever I'm trying to add but that's also negligible. Feel free to rework my code to get title IDs or to do the same thing with duchy's with kingdoms etc., I'm sure it has lots of uses

I will use your code though for the changing of cultures. Thank you very much!
 
  • 1
Reactions:
Hi,
i try to get lists with the name of e.g. all dynasties, houses etc. in order to get them shown in a new window as independent variables. But i'm struggling with even getting them shown. I have a scripted gui and a window defined but it only shows an empty window. I've even tried a few things but nothing worked and i#m getting a bit confused. Is it even possible to store such a list in a dynasty scope?

I've modded some script_values before but gui modding is something I've never tried before. So I appreciate every hint.

#in the file dir common/scriptedguis
House_List = {
scope = dynasty

effect = {
clear_variable_list = STA_House_List

# set_global_variable = {
# name = STA_list_type
# #value = flag:House
# }

# Set List
every_dynasty = {

root = {
add_to_variable_list = {
name = STA_House_List
target = prev
}
}
}




}
}

#in the file dir gui
window = {
name = "ranking_window"
size = { 750 90% }
widgetid = "ranking_window"
parentanchor = top|right
position = { -50 65 }
allow_outside = yes
layer = middle

using = Window_Background
using = Window_Decoration_Spike
using = Window_Size_CharacterList

#datacontext = "[RankingWindow.GetHouse]"
#datacontext = "[House.GetList('House_List')]"

#datacontext = "[GetScriptedGui('House_List')]"


dynamicgridbox = {
datamodel = "[GetDynastyHouse.MakeScope.GetList('STA_House_List')]"

item = {
flowcontainer = {
datacontext = "[Scope.GetDynastyHouse]"

##portrait_head_small = {}

text_single = {
text = "[DynastyHouse.GetName]"
}
}
}
}


#datacontext = "[GetVariableSystem]"
#datacontext = "[CharacterFinderWindow.GetCharacterList]"
#datacontext = "[GetGlobalVariable( 'STA_target' ).GetDynastyHouse]"
##datacontext = "[CharacterFinderWindow.GetCharacterList]"
##datacontext = "[DynastyHouseView.GetDynastyHouse]"
# state = {
# name = _show
# using = Animation_FadeIn_Quick
# }

# state = {
# name = _hide
# using = Animation_FadeOut_Quick
# }

vbox = {
using = Window_Margins

header_pattern = {
layoutpolicy_horizontal = expanding

blockoverride "header_text"
{
text = "Ranking"
}

blockoverride "button_close"
{
##onclick = "[ranking_window.Close]"
onclick = "[ExecuteConsoleCommand('gui.ClearWidgets ranking_window')]"
}
}
}


1711572674775.png