• 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.
For events, you can just remake the event with the same ID. As long as your file loads after the original, it will use your version of the event.
For decisions, you can't do anything about it, though.
 
For events, you can just remake the event with the same ID. As long as your file loads after the original, it will use your version of the event.
For decisions, you can't do anything about it, though.
Wow! I will be so happy if that is the case. I'm at work right now so cannot try it. Have you tried it and found it to work that way?

I've heard that duplicate event IDs cause bugs and CTDs.
 
Maybe if those are used daily. But I have literally hundreds of global variables that are counted and updated once per year, and it doesn't cause any kind of noticeable slowdown. Don't be worried about using them in moderation.

Here's the basic code that I use for counting:
Code:
set_variable = { which = global_just value = 0 }
any_character = {
   limit = {
       trait = just
   }
   change_variable = { which = global_just value = 1 }
}
log = "Just: [global_just.GetValue]"
Just replace the trait parts with whichever conditional you need to count.

Among other things, I've been using global variables to check how often the events get run. Which is absolutely priceless for debugging: I've found plenty of events that get ran far too often (no wonder vanilla is so slow) and some that don't get run at all because of broken triggers...
Just wanted to say again that I am impressed by your debugging genius. The things you notice with your methods are everything from game-breaking to incredible-old-and-overlooked, and frankly I am almost worried that Paradox with all their behind the scenes know-how did not notice them, when you do.
So thumbs up - if you live in Sweden, I can picture you as head of QA at Paradox ^^

Also, your usage of variables takes away my fears for my next modding approach, where I plan to spam multiple variables on all provinces, but only check them rarely.
In relation with that, I also have a question:

Can I localize Province Modifiers to show the value of variables?
Preferably dynamically, but if not I could adjust it by re-adding the modifier with maintenance events - if it is possible at all, that is.
 
In my experience, I just created an event with the same ID, and my event overrode the original. I didn't have to do anything special.
Decisions would have unwanted behavior (possibly a crash, but sometime just not working as intended) if an ID was reused.

EDIT: What you're changing about the event may have an impact - Most of my changes were to trigger conditions
 
Last edited:
In my experience, I just created an event with the same ID, and my event overrode the original. I didn't have to do anything special.
Decisions would have unwanted behavior (possibly a crash, but sometime just not working as intended) if an ID was reused.

EDIT: What you're changing about the event may have an impact - Most of my changes were to trigger conditions
I just did some testing. I created a mod to replace RIP.5000 event. I created a .txt file in my mod and copy pasted this event into it from the vanilla file. Then I changed the "desc" and "option" parameters. Executed the event in the game and my changes were NOT incorporated. The event fired as in vanilla.

Another dummy event I created in the same mod to check if my mod is working is firing as designed. So my mod is loading fine.

This indicates that my copy of the RIP.5000 event is being discarded by the game and it only loads the first copy (i.e. from vanilla files).
 
Try renaming you file to something earlier, like aa_whatever.txt. If it's first-wins, that should fix it.
I'm at work so I can't check the naming structure from my files, and CK2 is a bit inconsistent on how load order works.
 
Roughly like this

Code:
decisions = {
   count_age_zero = {
       potential = {
           ai = no
       }
      
       allow = {
           always = yes
       }
      
       effect = {
           set_variable = {
               which = counter
               value = 0
           }
           any_character = {
               limit = {
                   is_alive = yes
                   NOT = {
                       age = 1
                   }
               }
               ROOT = {
                   change_variable = {
                       which = counter
                       value = 0
                   }
               }
           }
           character_event = { id = report.1 }
       }
      
       ai_will_do = {
           factor = 0
       }
   }
}

report.1 would be an event with some localization that used [Root.counter.getValue] to tell you the number of characters that fulfilled the condition.
Maybe if those are used daily. But I have literally hundreds of global variables that are counted and updated once per year, and it doesn't cause any kind of noticeable slowdown. Don't be worried about using them in moderation.

Here's the basic code that I use for counting:
Code:
set_variable = { which = global_just value = 0 }
any_character = {
   limit = {
       trait = just
   }
   change_variable = { which = global_just value = 1 }
}
log = "Just: [global_just.GetValue]"
Just replace the trait parts with whichever conditional you need to count.

Among other things, I've been using global variables to check how often the events get run. Which is absolutely priceless for debugging: I've found plenty of events that get ran far too often (no wonder vanilla is so slow) and some that don't get run at all because of broken triggers...

Thanks for the replies, will have to test them out
 
I guess its not really a modding question, but for events like 39601 where the pagan ruler has the option to convert to the religion of the court priest proselytizing their capital, if I play as the pagan ruler and fire the event with "event 39601" it offers me the choice to convert to the religion I already am, and not to the court priests one. How can I fire it so that it will work correctly?
 
Hey all, I'm trying to mod in a custom culture (using the preexisting gfx/unit models), and it seems to be working well enough with everything else. The problem is that the game instantly freezes and then crashes whenever certain events (such as reaper's due prosperity events). I have all the main game DLCs except for Monks and Mystics, and my modded religion+government type both work fine. The exception that is thrown out when the game closes is this:

######## EXCEPTION: 0xC0000005 at address: 0x00900D68: ACCESS VIOLATION read attempt to address 0x00000000
Version: CK2/branches/2_7_1
37283

05/05/17 22:36:28​

Does anyone know what specifically these memory values point to, and how it could be solved?
QUICK EDIT: In the console I ran the event RIP.11719, which is the reaper's due prosperity event(s) where it randomly offers a province modifier to add to a level 3 prosperity province. The event runs fine without having a level 3 province and with a regular/hardcoded culture, but my custom culture causes the game to crash.
 
Last edited:
I guess its not really a modding question, but for events like 39601 where the pagan ruler has the option to convert to the religion of the court priest proselytizing their capital, if I play as the pagan ruler and fire the event with "event 39601" it offers me the choice to convert to the religion I already am, and not to the court priests one. How can I fire it so that it will work correctly?

If you are cool with using the console to fire an event, just change your religion with the console.
 
If you are cool with using the console to fire an event, just change your religion with the console.
I dont want to know because I want the religion change, its that I am the one trying to convert the pagan but it is taking forever for the event to fire. I want it to fire already so he can either kick my court priest out or convert, I dont care
 
I've been trying to figure out which event causes Depressed characters to die. I see the 'died of depression' death often, and I'd like to make it a bit less frequent. Since it feels like most characters drop dead almost instantly after acquiring the trait, without ever triggering the depression-related events.

But can't find any event or decision that actually uses that death cause (depressed_death). What am I overlooking...? Surely it's not hard-coded?
 
Last edited:
I've been trying to figure out which event causes Depressed characters to die. I see the 'died of depression' death often, and I'd like to make it a bit less frequent. Since it feels like most characters drop dead almost instantly after acquiring the trait, without ever triggering the depression-related events.

But can't find any event or decision that actually uses that death cause (depressed_death). What am I overlooking...? Surely it's not hard-coded?

I believe that's sort-of hard-coded through the Traits?
In localisation, you have 'trait', 'trait_desc' and 'trait_death' :

depressed;Depressed;Dépression;Depressiv;;Deprimido;;;;;;;;;x
depressed_desc;Life has lost its luster to this character.;Pour ce personnage, la vie a perdu tout son sens.;Für diesen
depressed_death;of depression;d'une dépression;an Depression;;de depresión;;;;;;;;;x

Since depressed has 'is_health = yes', and 'health = -1', I believe that when you die it can potentially grab that description as a possible "death reason", rather than it being a specific event. The solution might be to just modify depressed to be less negative?

(You seem to have the opposite of me :p My characters survive Depressed fine, but a cough seems to lead to a fatal illness within a month :/ )

I dont want to know because I want the religion change, its that I am the one trying to convert the pagan but it is taking forever for the event to fire. I want it to fire already so he can either kick my court priest out or convert, I dont care
Try using 'CharInfo' on the foreign ruler you want to convert, and get his character ID, then use
Code:
event CharacterID 39601
That should force fire it on him. (Note, it might be CharacterID after the event ID, I can't recall off the top of my head)


Edit: Is there a way to detect when you change your Primary Title?

Also, how do I get a character_event from the gain_effect of a Title? I cannot seem to get it to fire, or at least not get it to Scope to the person who gains the title for some reason.
 
Last edited:
Question about some vanilla code:

Look at this code from the vanilla "mnm_secret_religious_societies_decisions.txt" file:

Code:
if = { # Papacies are given to a random new character
                    limit = {
                        NOR = {
                            religion_group = muslim
                            religion = norse_pagan_reformed
                        }
                        any_demesne_title = {
                            controls_religion = yes
                        }
                    }
                    hidden_tooltip = {
                        liege = {
                            save_event_target_as = liege_target
                        }
                        create_character = {
                            age = 38
                            dynasty = random
                            religion = ROOT
                            culture = ROOT
                            random_traits = yes
                        }
                        new_character = {
                            save_event_target_as = new_holder
                        }
                    }
                    any_demesne_title = {
                        limit = {
                            controls_religion = yes
                        }
                        grant_title = event_target:new_holder
                        holder_scope = {
                            any_vassal = {
                                set_defacto_liege = event_target:liege_target
                            }
                        }
                    }
                    hidden_tooltip = {
                        set_defacto_liege = event_target:liege_target
                    }
       }

This is a part of the "effect" of the "secret_religions_openly_adopt_faith" decision, which is the first decision in the file. I understand that this effect code above creates a new character and gives the religious head title (which was held by the decision taker) to him. What I do not understand:
  1. Does "any_vassal" only scope to count-tier and above vassals? Or does it include baron tier vassals?
  2. Why is "any_vassal" of the religious title being given to the "defacto_liege" of the decision taker? In my view, they should either remain vassals of the decision taker (because he was the religious head before taking this decision), OR they should be given to the new religious head. Or did I misunderstand the code?
  3. The last hidden tooltip just before the code ends, isn't that redundant? It seems it only says: set the defacto liege of the decision taker to be his current liege, which is already his liege? What is going on here?
I will be grateful for any help :)
 
Last edited:
Since depressed has 'is_health = yes', and 'health = -1', I believe that when you die it can potentially grab that description as a possible "death reason", rather than it being a specific event. The solution might be to just modify depressed to be less negative?

(You seem to have the opposite of me :p My characters survive Depressed fine, but a cough seems to lead to a fatal illness within a month :/ )
Ah, of course. Thanks. The health penalty is -2 in the mod that I'm currently using, which is major. Didn't realize that it even had a health penalty. Will have to change that, since I'd prefer that they lose their life (or the depressed trait) through various events, rather than just instantly drop dead when they get the trait.

I've added some events for that. For instance, it's been told that the pagans of my homeland often chose to go on suicidal raids against overwhelming odds, if they lost their will to live.
 
Last edited:
Try using 'CharInfo' on the foreign ruler you want to convert, and get his character ID, then use
Code:
event CharacterID 39601
That should force fire it on him. (Note, it might be CharacterID after the event ID, I can't recall off the top of my head)

I dont know if you read my original post, but there lies the problem, when I used 39601 on him, instead of him getting the event to convert to orthodox, like me and the court priest, he gets the event asking if he will convert to slavic, the religion he already is.
 
I dont know if you read my original post, but there lies the problem, when I used 39601 on him, instead of him getting the event to convert to orthodox, like me and the court priest, he gets the event asking if he will convert to slavic, the religion he already is.
The scoping is probably messed up, the event likely includes something like religion = FROM to set the characters religion to the person who sent that event. If you trigger it from the console then there is no FROM as no event sent it so it defaults to FROM being ROOT which means that religion = FROM has the effect of doing religion = ROOT so his religion gets set to his current religion.
 
The scoping is probably messed up, the event likely includes something like religion = FROM to set the characters religion to the person who sent that event. If you trigger it from the console then there is no FROM as no event sent it so it defaults to FROM being ROOT which means that religion = FROM has the effect of doing religion = ROOT so his religion gets set to his current religion.
Thank you very much for the info, I assume there is not a way to solve this?
 
I guess its not really a modding question, but for events like 39601 where the pagan ruler has the option to convert to the religion of the court priest proselytizing their capital, if I play as the pagan ruler and fire the event with "event 39601" it offers me the choice to convert to the religion I already am, and not to the court priests one. How can I fire it so that it will work correctly?
The event normally fires *from* the priest *to* the ruler. There is no way to set the FROM when invoked from the console. You would need to mod an event or decision to accomplish it.
 
Last edited:
The event normally fires *from* the priest *to* the ruler. There is no way to set the FROM when invoked from the console. You would need to mod an event or decision to accomplish it.
Okay thanks