• 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.
Is there a way to have the duration of a character_modifier be variable?

I attempted "duration = 90 random = 100" but that just left the duration at 90 days?

I know I _could_ set the duration to the maximum I want and then write an event with a random value in its delay and have that event just remove the character modifier, but that seems really kludgey.
I don't believe so, the event method would be the best way
 
I don't believe so, the event method would be the best way
Ah well. So much for me writing "clean" code, eh?

Thank you for answering. Have a good one.
 
I'm coming back to CK2 after a uh....rather long time not playing it. The last time I played it, I spent an inordinate, stupid amount of time trying to convert the 'reincarnation' event to trigger for ANY dynasty member, whereas its vanilla state is for only men to be reincarnated from other men.

When I tried then, the scopes were father_even_if_dead or mother_even_if_dead, and I couldn't get my head around the if-then loops, because its been a long time since I've even done psuedocode, and I wasn't sure where everything was pointing to. But now they have a scope "random_dynasty_member_even_if_dead" - and I'm thinking I could put that in there and cut out most of the nested loops, right? In theory, it would be much better code then vanilla, since you could be the reincarnation of dead cousins or siblings, but .... even with that in mind, there is just SO MUCH GOING ON I can't figure out what they are doing to re-write it. And I've stared at this before.

Could someone explain to me what each of these if loops are doing?

I think the psuedocode below means:

if the baby's father has the supernatural events trigger and if his father's father is dead, then set his father's father as his reincarnation. Otherwise, if limit is-reincarnated is no (what does that mean?) set it to his father, if he's dead.

Do I have that right?

Then it checks for the mother's grandfather and father.

Right?


Code:
immediate = {
        if = {
            limit = {
                father = {
                    supernatural_events_trigger = yes
                }
            }
            if = {
                limit = {
                    father = {
                        father_even_if_dead = {
                            father_even_if_dead = {
                                is_alive = no
                            }
                        }
                    }
                }
                father = {
                    father_even_if_dead = {
                        father_even_if_dead = {
                            ROOT = {
                                set_reincarnation = THIS
                            }
                        }
                    }
                }
            }
            if = {
                limit = {
                    is_reincarnated = no
                }
                father = {
                    father_even_if_dead = {
                        ROOT = {
                            set_reincarnation = THIS
                        }
                    }
                }
            }
          
            father = {
                character_event = {
                    id = ancrel.0271
                    days = 3
                }
            }
        }
        if = {
            limit = {
                mother = {
                    supernatural_events_trigger = yes
                }
                is_reincarnated = no
            }
            if = {
                limit = {
                    mother = {
                        father_even_if_dead = {
                            father_even_if_dead = {
                                is_alive = no
                            }
                        }
                    }
                }
                mother = {
                    father_even_if_dead = {
                        father_even_if_dead = {
                            ROOT = {
                                set_reincarnation = THIS
                            }
                        }
                    }
                }
            }
            if = {
                limit = {
                    is_reincarnated = no
                }
                mother = {
                    father_even_if_dead = {
                        ROOT = {
                            set_reincarnation = THIS
                        }
                    }
                }
            }
          
            mother = {
                character_event = {
                    id = ancrel.0271
                    days = 3
                }
            }
        }
    }

Assuming I'm understanding the psuedocode, it still seems like a really, really wierd way to implement it. I mean, if it were me, I'd just have it plunk down a randomn dead dynasty member, and thats that. I wouldn't check to see if it was someone they knew, as most of the cultures which believed in this kept good records. I'd assume they'd have some way of handling nested reincarnations (like the Dalai Llama) but I don't see it.
 
Question: How do you start an epidemic in the Reaper's Due DLC via event?

Context: I've tried adding an is_epidemic = yes trait (has_tuberculosis) to several characters, all of which recovered after a few days which leads me to conclude that I either need to fire an event, set a character flag/modifier, or something else to get the ball rolling.
 
Question: How do you start an epidemic in the Reaper's Due DLC via event?

Context: I've tried adding an is_epidemic = yes trait (has_tuberculosis) to several characters, all of which recovered after a few days which leads me to conclude that I either need to fire an event, set a character flag/modifier, or something else to get the ball rolling.
To start an epidemic in a province use spawn_disease = disease_name in a province scope.
If you want to make specific character start developing the disease then follow the same actions taken by the on_character_infection in 00_disease.txt where you set the correct character flags for the illness and the developing_illness flag as well as trigger the event from RD that comes with that illness developing.
If you want to straight up add the trait without its progression of getting symptoms then just trigger the event which adds the illness trait, for example typhus uses the event RIP.5040 and that should work I imagine,
 
  • 1
Reactions:
Hello everyone.
So, I'm trying to make it so a character with a specific modifier (swore_uphold) cannot join a faction to install a claimant against someone who has a specific flag (designated_heiress). To achieve this, I added the following lines under the "allow_join" part of the 00_factions file:

Code:
allow_join = {
        NOT = {
            AND = {
                ROOT = { has_character_modifier = swore_uphold }
                FROM = { has_character_flag = designated_heiress }
            }
}

However, the character can still join the faction. I know that the code I wrote looks kinda silly, but it's the only way I could think of that made sense. Can someone please point out the mistake? Thanks!
 
To start an epidemic in a province use spawn_disease = disease_name in a province scope.
If you want to make specific character start developing the disease then follow the same actions taken by the on_character_infection in 00_disease.txt where you set the correct character flags for the illness and the developing_illness flag as well as trigger the event from RD that comes with that illness developing.
If you want to straight up add the trait without its progression of getting symptoms then just trigger the event which adds the illness trait, for example typhus uses the event RIP.5040 and that should work I imagine,
Thanks! That helped a lot.
 
Hello everyone.
So, I'm trying to make it so a character with a specific modifier (swore_uphold) cannot join a faction to install a claimant against someone who has a specific flag (designated_heiress). To achieve this, I added the following lines under the "allow_join" part of the 00_factions file:

Code:
allow_join = {
        NOT = {
            AND = {
                ROOT = { has_character_modifier = swore_uphold }
                FROM = { has_character_flag = designated_heiress }
            }
}

However, the character can still join the faction. I know that the code I wrote looks kinda silly, but it's the only way I could think of that made sense. Can someone please point out the mistake? Thanks!
You're missing a bracket which should be closing the allow_join (assuming that you don't have more to say within that field). Maybe try running the Validator, if you haven't. I'm a little bit out of practice, but I don't see why that code shouldn't work, so long as you are correctly adding that modifier and character flag.

Note: You don't need the AND or the ROOT, as both are implied. You can write it as follows:
Code:
allow_join = {
   NOT = { has_character_modifier = swore_uphold } # Since I haven't designated a scope, the assumption is that it is ROOT
   FROM = { has_character_flag = designated_heiress }
}

EDIT: Once again, I'm a little bit out of practice but I hope that helped...
 
Last edited:
Is it possible to make and event/decision that effects every ruler or province in a realm? I'm trying to make something that would change the religion of a kingdom from orthodox to catholic after I've mended the great schism, for RP reasons. I've been searching the guides and I can't quite figure out how to make something that effects everyone or every province as opposed to just one.
 
Is it possible to make and event/decision that effects every ruler or province in a realm? I'm trying to make something that would change the religion of a kingdom from orthodox to catholic after I've mended the great schism, for RP reasons. I've been searching the guides and I can't quite figure out how to make something that effects everyone or every province as opposed to just one.

The way I have seen this done is by firing an event at the king, and have that event fire itself recursively at all vassals/courtiers the next day.

The alternative is setting the event as major, match everybody in the realm in the major_trigger block, and work from there.
 
Is it possible to make and event/decision that effects every ruler or province in a realm? I'm trying to make something that would change the religion of a kingdom from orthodox to catholic after I've mended the great schism, for RP reasons. I've been searching the guides and I can't quite figure out how to make something that effects everyone or every province as opposed to just one.

This should work as the effect block of the decision (I added in the Orthodox heresies as well as they also can mend the Great Schism).

Code:
# Converts the decision-taker
religion = catholic

# Converts the decision-taker's provinces that are of the dominant religion
any_demesne_province = {
   limit = {
      OR = {
          religion = orthodox
          religion = iconoclast
          religion = paulician
          religion = monothelite
      }
     is_heretic = no
   }
   religion = catholic
}

# Converts all other provinces in the realm that are of the dominant religion
any_realm_lord = {
   limit = {
       NOT = {
           tier = baron
       }
   }
   any_demesne_province = {
       limit = {
           OR = {
               religion = orthodox
               religion = iconoclast
               religion = paulician
               religion = monothelite
           }
          is_heretic = no
       }
       religion = catholic
   }
}

# Converts any ruler in the realm to Catholic if they previously followed the dominant religion
any_realm_lord = {
   limit = {
       OR = {
           religion = orthodox
           religion = iconoclast
           religion = paulician
           religion = monothelite
       }
      is_heretic = no
   }
   religion = catholic
}

Note that the above would force every vassal to convert (regardless of opinion, being zealous, etc.) if they follow the non-heretical religion that presumably mended the Great Schism, that it would not affect courtiers (which might cause some issues if they inherit or murder their converting liege), and that it would convert every province in the realm that follows the non-heretical religion that presumably mended the Great Schism, which in theory could make the Catholic faith the dominant religion in an instant at very low MA if the converting realm is large enough.
 
  • 1
Reactions:
I might becoming a little vexing of lately, but bear with me, please. I really don't understand what I'm doing wrong here:
Code:
modifier = {
    factor = 0
    ROOT = {
        limit = {
            NOR = {
                is_foe = FROM
                trait = ambitious
                trait = deceitful
            }
        }
        is_close_relative = FROM
    }
}

And since I'm here I wanted to ask if having more than five option for an event, in which more than four can't show simultaneously since two trigger options are mutually exclusive, is a problem.
 
This should work as the effect block of the decision (I added in the Orthodox heresies as well as they also can mend the Great Schism).

Code:
# Converts the decision-taker
religion = catholic

# Converts the decision-taker's provinces that are of the dominant religion
any_demesne_province = {
   limit = {
      OR = {
          religion = orthodox
          religion = iconoclast
          religion = paulician
          religion = monothelite
      }
     is_heretic = no
   }
   religion = catholic
}

# Converts all other provinces in the realm that are of the dominant religion
any_realm_lord = {
   limit = {
       NOT = {
           tier = baron
       }
   }
   any_demesne_province = {
       limit = {
           OR = {
               religion = orthodox
               religion = iconoclast
               religion = paulician
               religion = monothelite
           }
          is_heretic = no
       }
       religion = catholic
   }
}

# Converts any ruler in the realm to Catholic if they previously followed the dominant religion
any_realm_lord = {
   limit = {
       OR = {
           religion = orthodox
           religion = iconoclast
           religion = paulician
           religion = monothelite
       }
      is_heretic = no
   }
   religion = catholic
}

Note that the above would force every vassal to convert (regardless of opinion, being zealous, etc.) if they follow the non-heretical religion that presumably mended the Great Schism, that it would not affect courtiers (which might cause some issues if they inherit or murder their converting liege), and that it would convert every province in the realm that follows the non-heretical religion that presumably mended the Great Schism, which in theory could make the Catholic faith the dominant religion in an instant at very low MA if the converting realm is large enough.

Thank you so much. this is exactly what I was looking for. Would this work for the decision?

Code:
decisions = {

    convert_entire_realm = {
        only_independent = yes
        is_high_prio = yes
       
        potential = {
            is_playable = yes
            ai = no
        }
        allow = {
            prestige = 100
        }
        effect = {
[INDENT][INDENT]# Converts the decision-taker
religion = catholic

# Converts the decision-taker's provinces that are of the dominant religion
any_demesne_province = {
   limit = {
      OR = {
          religion = orthodox
          religion = iconoclast
          religion = paulician
          religion = monothelite
      }
     is_heretic = no
   }
   religion = catholic
}

# Converts all other provinces in the realm that are of the dominant religion
any_realm_lord = {
   limit = {
       NOT = {
           tier = baron
       }
   }
   any_demesne_province = {
       limit = {
           OR = {
               religion = orthodox
               religion = iconoclast
               religion = paulician
               religion = monothelite
           }
          is_heretic = no
       }
       religion = catholic
   }
}

# Converts any ruler in the realm to Catholic if they previously followed the dominant religion
any_realm_character = {
   limit = {
       OR = {
           religion = orthodox
           religion = iconoclast
           religion = paulician
           religion = monothelite
       }
      is_heretic = no
   }
   religion = catholic
}
        }
        ai_will_do = {
            factor = 0
        }
    }[/INDENT][/INDENT]
}
[INDENT][INDENT][/INDENT][/INDENT]
 
@Marvoch: You should not have a limit inside a modifier. Other than that, it is hard to tell what's wrong without any context. What are you trying to do, and what does the rest of the event/decision look like?

@calol61: It should work (read: be available and do what it is supposed to do), though right now it doesn't check for anything other than the fact that you are a human player, so technically you could spam that decision to convert every ruler and province that has a certain faith in your realm to the Catholic faith, which seems rather strange, as it doesn't check your religion or anything else aside from having 100 prestige. Depending on how you intend to use it, that might be fine, especially as the AI won't be able to use it, but it would, for example, allow the Schism mender to go Catholic the second after he mends the Schism and would force his realm to convert as well.
 
  • 1
Reactions:
@Marvoch: You should not have a limit inside a modifier. Other than that, it is hard to tell what's wrong without any context. What are you trying to do, and what does the rest of the event/decision look like?

To think it was something so silly, I reformulated it this way:

Code:
            modifier = {
                factor = 0
                ROOT = {
                    AND = {
                        is_close_relative = FROM
                        NOR = {
                            is_foe = FROM
                            trait = ambitious
                            trait = deceitful
                        }
                    }
                }
            }
and now it does indeed work. For what I'm trying to do, is simply a piece of a long chain, so the two option simply trigger different events, that's all.
 
So I tried to look for it, and I'm not even sure it can be done, but where are is the the data for the set Crown Focus ability stored? I want to lower the requirements for vassals to set one, but I can't find the data. If it's even accessible, and not hard-coded, of course.
 
So I tried to look for it, and I'm not even sure it can be done, but where are is the the data for the set Crown Focus ability stored? I want to lower the requirements for vassals to set one, but I can't find the data. If it's even accessible, and not hard-coded, of course.
decisions/title_decisions the set_crown_focus and move_crown_focus decisions
 
To think it was something so silly, I reformulated it this way:

Code:
            modifier = {
                factor = 0
                ROOT = {
                    AND = {
                        is_close_relative = FROM
                        NOR = {
                            is_foe = FROM
                            trait = ambitious
                            trait = deceitful
                        }
                    }
                }
            }
and now it does indeed work. For what I'm trying to do, is simply a piece of a long chain, so the two option simply trigger different events, that's all.

Just so you know, but the ROOT and the AND clauses are entirely unnecessary. ROOT is the default scope, similarly AND is the default behavior.
 
And since I'm here I wanted to ask if having more than five option for an event, in which more than four can't show simultaneously since two trigger options are mutually exclusive, is a problem.
This isn't a problem as long as you don't confuse yourself. I've had lots of options for one event and quite a few descriptions set to trigger each time repeat_event (same event) was used. It can get a bit muddled and start to feel like juggling though.
i.e. set this character flag = desc 'a' and options a/b/c/d -- option a selected adds character flag 2 -- option b selected adds character flag 3 -- option c selected add character flag 4 --- option d selected adds character flag 5 --- repeat_event = { id = same_event } --- character_flags 2/3/4/5 = desc 2/3/4/5 and options 5-8/9-12/13-16/17-20 respectively-- option 20 = random_list (add random character_flags) -- each character flag brings about a different description and set of options. Anyway. You can see where that would get confusing.

Short answer: Yes. You can do more than four options ( a lot more) so long as you only display four of those options at any given time and you are careful not to confuse yourself. :)
 
Last edited:
  • 1
Reactions: