• 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.
Hello, I'm writing a small personal mod for the ability to de jure shift certain other areas to the Empire of Slavia upon its creation in accordance with my thread on the topic (https://forum.paradoxplaza.com/foru...ess-inconsistencies-and-other-issues.1423337/). There's a TL;DR at the end of this post, because I wanted to describe my process first. The description also mentions the relevant files though, but for ease of finding them I put those names in bold.

While I haven't started on the events and the like, I have a general idea on how to make it work. So instead I decided to first make a tooltip explaining that upon conquering certain other areas you could be faced with a choice to shift them to Slavia as well. The reason for the tooltip is in case I decided to make the mod public, because personally I know what areas I'd be adding so I don't really need it. And since I'd be making multiple events to make the choice on an area by area basis, I decided to make the tooltip a general one.

Since I want it to be interactive, I created a custom region of "Great Slavia" in map_data/geographical_region representing the additional areas compared to the standard region of Slavia and added its name in localization/english/regions_l_english. Actually, to make sure the region works as intended, I first edited the already existing region of Slavia to contain the additional duchies I then added to my custom "Greater Slavia" to check it via the working clickable tooltip for Slavia already in the decision. And it worked, the region became larger. So then I returned the region of Slavia to what it originally was and created the custom one.

Which is where I ran into an issue. Because for the life of me I can't figure out how to make a clickable "Greater Slavia" appear in my custom tooltip. The one for Slavia already existing in the decision seems to be automatically generated with values from localization/english/game_concepts_l_english, as the decision to form Slavia (common/decisions/00_major_decisions_east_europe) makes no tooltip for that and simply has a value of
Code:
completely_controls_region = custom_slavia

The "completely_controls_region" value has localization in the aforementioned localization/english/game_concepts_l_english file, while custom_slavia is taken from localization/english/regions_l_english.

And since I don't want this to be about controlling the entire region, that simply can't do. I don't think it'd work in a localization file anyway.

So here's what I tried. In the common/decisions/00_major_decisions_east_europe file I added the following change:
Code:
unite_the_slavs_decision = {
effect = {
        save_scope_as = slav_uniter
   
        show_as_tooltip = { unite_the_slavs_decision_effects = yes } #Actually applied in east_europe.0010 - prestige, laws, title, innovation effects
        custom_tooltip = unite_the_slavs_decision_effects_great_slavia

I cut out the irrelevant parts of the decision for the sake of brevity. My custom tooltip is at the bottom. Anyway, I then defined that tooltip in localization/english/decisions_l_english where the rest of the decision is localized.

At first I put my custom tooltip above the "show_as_tooltip" line that was already there. But that made it appear as the first line of the effects part of the decision window, which I thought to be the wrong choice. After putting it below, the custom tooltip now appears in the middle of the effects, after information that you'll create the Empire of Slavia and that it will become your primary title, but before information that your titles of the Wendish Empire, Empire of Russia and Empire of Carpathia will be destroyed, as well as before the information that every Slavic kingdom will become de jure part of the new Empire of Slavia.

The reason for that is the way this event is coded, I suppose. Because the decision triggers an event in events/decisions_events/east_europe_events (that, as per the first line in the decision I quoted above, is where parts of the tooltip about prestige, innovations and Empire of Slavia being created come from) and that event in turn triggers a scripted effect from scripted_effects/00_decisions_effects, which is where the rest of the tooltip comes from. And this is another case of the tooltip being somehow automatically generated with values from localization/english/game_concepts_l_english because the scripted effect only has the code to destroy those empire titles and create the de jure shift without making specific localization for that.

Anyway, I digress. I don't know how to put the custom tooltip after the part of the tooltip that comes from the scripted effect. I even tried removing it from the decision and putting it at the end of the scripted effect and it still ended up in the exact same place. However, putting it in the scripted effect file solved the other problem I had.

To describe what it is here's my localization for the tooltip:
Code:
unite_the_slavs_decision_effects_great_slavia:0 "If you control certain areas of the [region|E] of [great_slavia.GetName], you may choose to also make them [de_jure|E] of the [slavia.GetName]"

Personally I think it'd make most sense to have it at the end of the effects part of the decision, after the default last line of de jure shift of Slavic kingdoms to the Empire of Slavia. But if even putting it at the end of the scripted effect file did not help with that, I don't know how to achieve that. I also have no idea whether the number after the name should be. Most values for the Slavia decision have zeroes, but one has a 1 and another has a 2. I have no clue what those numbers mean, but the tooltip (minus the clickable region thing) works with both a 0 and a 1, so I left it at 0.

Anyway, the issue I had that was solved by moving this tooltip to the scripted effect file is the [slavia.GetName] bit. When I had it in the decision file, the clickable name of the Empire of Slavia did not appear in the tooltip. Even though I got it from the part of the decision's tooltip that resulted in such a clickable name for the empire, i.e.
Code:
unite_the_slavs_decision_titles_tt:2 "Every Slavic [kingdom|E] [title|E] will become [de_jure|E] of the [slavia.GetName]"

But upon reading the scripted effects file, I figured out the way. Like I said, the part of the decision tooltip about the de jure shift of Slavic kingdoms to the Empire of Slavia actually comes from the scripted effects file. Here's the relevant part:
Code:
# Inform players of the de jure drift
    title:e_slavia = { custom_tooltip = unite_the_slavs_decision_titles_tt } #Scope change for tooltip formatting.

And the reason why this resulted in a clickable Empire of Slavia title name in the tooltip while my custom tooltip did not when I initially put it in the decision file is because the scripted effects file has the following line earlier on:
Code:
title:e_slavia = { save_scope_as = slavia } #For localisation

In my modding noobness I though that it simply took the value for slavia from localization/english/regions_l_english but it turned out it needed to be first saved as a scope for it to work, with no such scope-saving being in the decision. But this gave me an idea on how to make the clickable region of Great Slavia in the tooltip. I added the following line right after the above one in the scripted effects file:
Code:
region:custom_great_slavia = { save_scope_as = great_slavia } #For localisation

Which didn't work either. At least it fixed the issue where every part of the custom tooltip before the [great_slavia.GetName] didn't show, but that's as far as I got.

EDIT: After stumbling upon a line "geographical_region" in the decision to form the Kingdom of Burgundy, I tried the following as well, to no avail:
Code:
geographical_region:custom_great_slavia = { save_scope_as = great_slavia } #For localisation

TL;DR So, my question is, how do I get a clickable name of my custom region of Great Slavia (that would show the region on the map upon clicking it) to show up in the custom tooltip? I get that I probably need to save it as a scope for localization first, but I don't know what exactly should I write there. Also, if anyone could figure out how to make the custom part of the tooltip show at the end of the description of the decision's effects, that would also be welcome. Finally, I attached the screenshot of the current result of the decision description for reference.
2020_11_11_3.png
 
Last edited:
Is it possible to make some specific innovations faster to discover? Or, if that's not possible, have them partially (like 30% of the progress bar) unlocked at the start of the game?
Also, alternatively, is it possible to create a modifier that gives a bonus to the Cultural Fascination Progress for only a specific innovation?

Looks like it. From _culture.info:

Code:
Name of the file is the culture key that should get the history.
Culture groups can be used too; if a file exists for an individual culture that'll be used rather than the group. E.G., if "north_germanic_group.txt" and "norwegian.txt" both exist, Norwegian culture will use "norwegian.txt" while Swedish culture will use "north_germanic_group.txt".

date = {                                    # When is executed
    discover_innovation = innovation_key    # Discovers this innovations. There can be multiple per date.
    add_innovation_progress = {                # Advances a % defined on the defined innovation. There can be multiple per date.
        culture_innovation = innovation_key # Innovation
        progress = 50                        # How much progress dos it gains
    }
    join_era = culture_era_key                # Joins the defined era. Only one per date.
    progress_era = 50                        # Progress inthe current era. Only one per date.
}

##################################
Everything is executed in the order specified before

So basically if I wanted anglo_saxon culture to have 50% progress in the Barracks innovation in 867, I'd change their culture to show

Code:
# Anglo_saxon
867.1.1 = {
    discover_innovation = innovation_motte
    discover_innovation = innovation_catapult
    discover_innovation = innovation_quilted_armor
    #
    discover_innovation = innovation_gavelkind
    discover_innovation = innovation_currency_01
    discover_innovation = innovation_crop_rotation
    discover_innovation = innovation_ledger

    add_innovation_progress = {
      culture_innovation = innovation_barracks
      progress = 50
    }
}
950.1.1 = {
    discover_innovation = innovation_barracks
    discover_innovation = innovation_bannus
    discover_innovation = innovation_mustering_grounds
    #
    discover_innovation = innovation_development_01
    discover_innovation = innovation_city_planning
    discover_innovation = innovation_plenary_assemblies
    discover_innovation = innovation_casus_belli
    #
    join_era = culture_era_early_medieval
}
1066.1.1 = {
    discover_innovation = innovation_burhs
    discover_innovation = innovation_mangonel
    discover_innovation = innovation_house_soldiers
    #
    discover_innovation = innovation_hereditary_rule
    discover_innovation = innovation_manorialism
    discover_innovation = innovation_currency_02
    discover_innovation = innovation_baliffs
    #
    discover_innovation = innovation_hird
}
 
Also, while I'm at it, is there a code command to change the name of a specific title to something else? The names of titles you own can be changed at will after all and I thought that changing the name of the Empire of Slavia to the Empire of Great Slavia would be a nice touch at the end of my yet-to-be-written event chain part of the mod, keeping with its spirit.
 
Is there a way to find the casus belli type that's selected in the declare_war_interaction? neither the war nor the casus_belli scope is set, so using_cb = claim_cb didn't work. I am working on a mod that gives more control over the wars your vassals can declare while also somewhat decoupling it from crown authority and I want the option to forbid wars over claims against fellow vassals unless they use a hook on their liege. From digging in the gui trying to understand it, I found
Code:
DeclareWarInteractionWindow = {
    ...
    GetCbType -> CasusBelliType
    ...
}
but I have no idea if or how I could access this function/variable. I guess the last resort would be to modify the interaction_declare_war.gui and somehow expose the type but I don't know how to do that either.
 
How do I make sure my events overwrite vanilla events? At first I thought it was related to paths/filenames but I can't figure out just how to make it work. For example, here's 3 lines from my error.log:

Code:
[22:22:57][jomini/script_system/jomini_eventmanager.h:204]: Duplicated event ID 'lover.0003' found. New Location: 'events/zzoverwrite_mm_relations_events/zz_mm_lover_events.txt:8', Previous Location: 'events/relations_events/lover_events.txt:594'
[22:22:57][jomini/script_system/jomini_eventmanager.h:204]: Duplicated event ID 'knights.0001' found. New Location: 'events/zzoverwrite_mm_war_events/zz_mm_knight_events.txt:6', Previous Location: 'events/war_events/knight_events.txt:10'
[22:22:57][jomini/script_system/jomini_eventmanager.h:204]: Duplicated event ID 'seduce_outcome.8101' found. New Location: 'events/scheme_events/seduce_scheme/seduce_scheme_outcome_events.txt:2928', Previous Location: 'events/zzoverwrite_mm_scheme_events/zz_overwrite_mm_seduce_scheme/zz_mm_seduce_scheme_outcome_events.txt:4'

As you can see, for the first two events it correctly overwrites the vanilla event with mine, but for the third event it's actually overwriting my event with the vanilla one. I do not know why, I've tried a variety of file names and file structures but I have yet to find one that gets it to load my event after the vanilla event.
 
How do I make sure my events overwrite vanilla events? At first I thought it was related to paths/filenames but I can't figure out just how to make it work. For example, here's 3 lines from my error.log:

Code:
[22:22:57][jomini/script_system/jomini_eventmanager.h:204]: Duplicated event ID 'lover.0003' found. New Location: 'events/zzoverwrite_mm_relations_events/zz_mm_lover_events.txt:8', Previous Location: 'events/relations_events/lover_events.txt:594'
[22:22:57][jomini/script_system/jomini_eventmanager.h:204]: Duplicated event ID 'knights.0001' found. New Location: 'events/zzoverwrite_mm_war_events/zz_mm_knight_events.txt:6', Previous Location: 'events/war_events/knight_events.txt:10'
[22:22:57][jomini/script_system/jomini_eventmanager.h:204]: Duplicated event ID 'seduce_outcome.8101' found. New Location: 'events/scheme_events/seduce_scheme/seduce_scheme_outcome_events.txt:2928', Previous Location: 'events/zzoverwrite_mm_scheme_events/zz_overwrite_mm_seduce_scheme/zz_mm_seduce_scheme_outcome_events.txt:4'

As you can see, for the first two events it correctly overwrites the vanilla event with mine, but for the third event it's actually overwriting my event with the vanilla one. I do not know why, I've tried a variety of file names and file structures but I have yet to find one that gets it to load my event after the vanilla event.

You have to overwrite the original file, its a direct swap. You have to use the same path.
Instead or [ events/zzoverwrite_mm_relations_events/zz_mm_lover_events.txt ] put your updates in this file in your mod [ events/relations_events/lover_events.txt ]
 
You have to overwrite the original file, its a direct swap. You have to use the same path.
Instead or [ events/zzoverwrite_mm_relations_events/zz_mm_lover_events.txt ] put your updates in this file in your mod [ events/relations_events/lover_events.txt ]

The first two work though. Only the last one doesn't work.

I suppose I can replace the entire file if I have to, I'd really rather have avoided it, but I was wondering why in the first two cases it would overwrite the vanilla event with mine, and in the last case it overwrites my event with the vanilla one.
 
The first two work though. Only the last one doesn't work.

I suppose I can replace the entire file if I have to, I'd really rather have avoided it, but I was wondering why in the first two cases it would overwrite the vanilla event with mine, and in the last case it overwrites my event with the vanilla one.
Perhaps the others didn't cause a big enough error? the mods are only additions or overwrites to the vanilla therefore anything not in the mod will still be loaded first. If the path isn't the same both get loaded. Check Documents\Paradox Interactive\Crusader Kings III\logs\error.log even if the system allowed it doesn't mean it didn't count it as an error.
 
Perhaps the others didn't cause a big enough error? the mods are only additions or overwrites to the vanilla therefore anything not in the mod will still be loaded first. If the path isn't the same both get loaded. Check Paradox Interactive\Crusader Kings III\logs\error.log even if the system allowed it doesn't mean it didn't count it as an error.

Oh, sure, they show up as errors. That's where I pasted it from.

Code:
[22:22:57][jomini/script_system/jomini_eventmanager.h:204]: Duplicated event ID 'lover.0003' found. New Location: 'events/zzoverwrite_mm_relations_events/zz_mm_lover_events.txt:8', Previous Location: 'events/relations_events/lover_events.txt:594'
[22:22:57][jomini/script_system/jomini_eventmanager.h:204]: Duplicated event ID 'knights.0001' found. New Location: 'events/zzoverwrite_mm_war_events/zz_mm_knight_events.txt:6', Previous Location: 'events/war_events/knight_events.txt:10'

Notice in these two cases, it says "new location" and lists my mod folder, and then in "previous location" it shows the base game folder. However, that is reversed here:

Code:
[22:22:57][jomini/script_system/jomini_eventmanager.h:204]: Duplicated event ID 'seduce_outcome.8101' found. New Location: 'events/scheme_events/seduce_scheme/seduce_scheme_outcome_events.txt:2928', Previous Location: 'events/zzoverwrite_mm_scheme_events/zz_overwrite_mm_seduce_scheme/zz_mm_seduce_scheme_outcome_events.txt:4'

Now, in game, it uses my events for the first two events, but it uses the base game event for the last one. So despite the "Duplicated event ID" line, it seems like these things work, so I was hoping to figure out why the last event is so problematic. But I guess I can just overwrite the whole file if it comes down to it.
 
Oh, sure, they show up as errors. That's where I pasted it from.

Code:
[22:22:57][jomini/script_system/jomini_eventmanager.h:204]: Duplicated event ID 'lover.0003' found. New Location: 'events/zzoverwrite_mm_relations_events/zz_mm_lover_events.txt:8', Previous Location: 'events/relations_events/lover_events.txt:594'
[22:22:57][jomini/script_system/jomini_eventmanager.h:204]: Duplicated event ID 'knights.0001' found. New Location: 'events/zzoverwrite_mm_war_events/zz_mm_knight_events.txt:6', Previous Location: 'events/war_events/knight_events.txt:10'

Notice in these two cases, it says "new location" and lists my mod folder, and then in "previous location" it shows the base game folder. However, that is reversed here:

Code:
[22:22:57][jomini/script_system/jomini_eventmanager.h:204]: Duplicated event ID 'seduce_outcome.8101' found. New Location: 'events/scheme_events/seduce_scheme/seduce_scheme_outcome_events.txt:2928', Previous Location: 'events/zzoverwrite_mm_scheme_events/zz_overwrite_mm_seduce_scheme/zz_mm_seduce_scheme_outcome_events.txt:4'

Now, in game, it uses my events for the first two events, but it uses the base game event for the last one. So despite the "Duplicated event ID" line, it seems like these things work, so I was hoping to figure out why the last event is so problematic. But I guess I can just overwrite the whole file if it comes down to it.
My bad I had crash log in my mind. According to the log it moved to the new location, odd that it isn't working. How are you firing the event? normally or directly through debug? If through debug have you tried having it run through the seduce scheme?
 
My bad I had crash log in my mind. According to the log it moved to the new location, odd that it isn't working. How are you firing the event? normally or directly through debug? If through debug have you tried having it run through the seduce scheme?

I only discovered it wasn't working when the event fired and it didn't have the change I included in it (I tried to disable the hard reject option if it had a certain trigger, but since I got hard rejected I knew it wasn't working). This happened a few times before I looked at the log and noticed the discrepancy between the first two lines and the third one.
 
I only discovered it wasn't working when the event fired and it didn't have the change I included in it (I tried to disable the hard reject option if it had a certain trigger, but since I got hard rejected I knew it wasn't working). This happened a few times before I looked at the log and noticed the discrepancy between the first two lines and the third one.

Hmm. Id rewrite the file and see if it still doesn't fire properly, it may just be something in the event code itself that is causing the line to be ignored. You could always revert back after you troubleshoot.
 
Hmm. Id rewrite the file and see if it still doesn't fire properly, it may just be something in the event code itself that is causing the line to be ignored. You could always revert back after you troubleshoot.

It's not that it's being ignored per se, it's just if you check the "New Location" and "Previous Location" entries in the error.log, it seems to be reading my event first and then replacing it with the base game one. It actually did this for the lover event too until I changed the file name by adding "zz" to the front, which I thought at the time meant I could manipulate the load order by changing the file name. But that doesn't seem to be working here, for some reason it's always reading the base game's seduce_outcome.8101 after it reads mine. I will try a new file, and more file names/file paths, but so far nothing I've been able to think of seems to make it load mine after it loads the base game's.
 
It's not that it's being ignored per se, it's just if you check the "New Location" and "Previous Location" entries in the error.log, it seems to be reading my event first and then replacing it with the base game one. It actually did this for the lover event too until I changed the file name by adding "zz" to the front, which I thought at the time meant I could manipulate the load order by changing the file name. But that doesn't seem to be working here, for some reason it's always reading the base game's seduce_outcome.8101 after it reads mine. I will try a new file, and more file names/file paths, but so far nothing I've been able to think of seems to make it load mine after it loads the base game's.

for naming conventions the only thing I seen work is 00_ and 01_ etc.. if you want it to load after but that's if the file starts with numbers. Sorry I couldn't be more helpful.
 
So basically you want to grab an item from a list and pair it with another random item and then remove them both?

Consider using a while block, since this will allow you to pick the first character and then randomly pick another.

Something like this:

Code:
while = {
    limit = {
        any_in_list = {
            list = my_list
            count > 1
        }
    }
    random_in_list = {
        list = my_list
        save_temporary_scope_as = picked_character

        # the picked character is removed here in case they don't have any consorts or lovers available
        # and must be removed from the list to satisfy the while block

        remove_from_list = scope:picked_character

        random_in_list = {
            list = my_list
            limit = {
                OR = {
                    has_relation_lover = scope:picked_character
                    is_consort_of = scope:picked_character
                }
            }
            save_temporary_scope_as = paired_character
            # Do something
            remove_from_list = scope:paired_character
        }
    }
}

Also, by any chance are you making some kind of CK3 speed dating mod or something? :D

Ooh, thanks! I don't think this is exactly what I need, but it might be a good template regardless, as I had no idea while loops even existed in script. I'll give it a whirl and see where it takes me!

Unfortunately I'm not doing anything so cool; I've just got some family-focused stress coping mechanisms that unlanded AI never use because they're character interactions, and I'm trying to fudge it with a pulse event. :p
 
So I made a decision to allow for switching to Roman culture, and it worked pretty much perfectly (almost) first time. However what was less perfect was that on doing so the spot of culture head remained empty, and all the culture-specific innovations (longships, west african canoes, that sort of thing) were seemingly available.

I dunno, is there some sort of 'refresh' command that will get the game to wake up and sort out a culture that has only just (re-)emerged?
 
So I made a decision to allow for switching to Roman culture, and it worked pretty much perfectly (almost) first time. However what was less perfect was that on doing so the spot of culture head remained empty, and all the culture-specific innovations (longships, west african canoes, that sort of thing) were seemingly available.

I dunno, is there some sort of 'refresh' command that will get the game to wake up and sort out a culture that has only just (re-)emerged?

Let the game run a month to update and see if that resolves it.
 
One more thing for my Slavia project. Is it possible to move a culture from one culture group to another? Because it seems weird to me that upon making a big deal out of unifying all Slavs into one empire each Slavic group still has the same exact negative opinion modifier towards the others that they'd have towards the Germans or the Mongols. So I was thinking about creating a giant Slavic culture group with no cultures of its own and then moving all individual West, East and South Slavic cultures to that through the decision.

I guess the same result could be achieved by filling that Slavic culture group with copies of each individual Slavic culture and then shifting, for example, West Slavic Polish characters, zones and whatnot to Slavic Polish culture and do it for each individual Slavic culture, but that's a ton of new localization and a ton of extra code in the event. So if it's possible to shift cultures from one group to another that'd be much faster.

Also, I'd still appreciate answers to my issue with how to get a clickable name of my custom region to appear in my tooltip (and possibly how to make that tooltip appear at the end of the decision's description), as well as whether it's possible to change a title's name to a custom one through an event or not. I found an event that changes a title's coat of arms, but no examples of titles being renamed.
 
One more thing for my Slavia project. Is it possible to move a culture from one culture group to another? Because it seems weird to me that upon making a big deal out of unifying all Slavs into one empire each Slavic group still has the same exact negative opinion modifier towards the others that they'd have towards the Germans or the Mongols. So I was thinking about creating a giant Slavic culture group with no cultures of its own and then moving all individual West, East and South Slavic cultures to that through the decision.

I guess the same result could be achieved by filling that Slavic culture group with copies of each individual Slavic culture and then shifting, for example, West Slavic Polish characters, zones and whatnot to Slavic Polish culture and do it for each individual Slavic culture, but that's a ton of new localization and a ton of extra code in the event. So if it's possible to shift cultures from one group to another that'd be much faster.

Also, I'd still appreciate answers to my issue with how to get a clickable name of my custom region to appear in my tooltip (and possibly how to make that tooltip appear at the end of the decision's description), as well as whether it's possible to change a title's name to a custom one through an event or not. I found an event that changes a title's coat of arms, but no examples of titles being renamed.

I can't answer your questions about culture, but renaming a title should be able to be done using set_title_name:

Code:
# using England as an example
title:k_england = {
    set_title_name = new_england_name
}

# localization
l_english:
new_england_name:0 "New England"
new_england_name_adj:0 "New English"

You can also use set_title_prefix and set_definitive_form = yes to fine-tune it some more, though I'm less sure about how those work in practice.