• 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.
Custom loc is unlikely to fully work since you can't access the current wealth "variable" and checking the character's exact wealth would require hundreds or thousands of possibilities... but you could perhaps have the custom loc set up with "wealth tiers" and have it show something like "<character> has a personal wealth between <bounds>", since you can check e.g. "wealth >= 400 wealth < 500".
That's not at all elegant, but it really works - thank you!

20240129222636_1.jpg

EDIT: And I added artifact detection too :)

20240129225318_1.jpg
 
Last edited:
Thanks for the clarification.

I know ai = no makes only_playable = yes redundant, but since the former is a normal pre-trigger and the latter is a filtering pre-trigger, I figure that it improves performance even more, if only marginally.

That is, on the fastest, quickest, easiest level of performance, that of an event's filtering pre-triggers being checked, only_playable = yes eliminates all non-playable characters as "junk" and doesn't waste time even beginning to evaluate them, then it reaches the normal pre-triggers level, where it eliminates all the playable rulers except the player with ai = no.

Am I misunderstanding the difference between normal pre-triggers and filtering pre-triggers here?

I don't know about ai = yes but as of patch 2.6 (see here) ai = no is 100% a filtering pre-trigger, and by far the most efficient of all pre-triggers. The wiki page should probably be amended (edit: done).
 
Last edited:
  • 1
Reactions:
If you're using any_??? = { count >= N } as a trigger, is there a way to show the player how far they are towards fulfilling the condition?

As a more concrete example, I have the code below in the allow block of an intrigue-menu decision, and I would ideally like to have a tooltip that shows early-game players that they are 2/20 (or whatever) towards completing this goal.

Code:
            custom_tooltip = {
                text = emb_celtic_unity_this_character_owns_at_least_20_provinces_of_any_celtic_culture_in_western_europe_region_tt
                any_realm_province = {
                    region = world_europe_west
                    culture_group = celtic
                    count >= 20
                }
            }

Things I've tried or thought about:
  • Removing the custom_tooltip:
    • The condition works, but the "count" requirement is completely absent from the tooltip. This is worse than useless, because it's misleading.
  • Custom localisation (some kind of script that would generate "2/20" for insertion in the custom_tooltip):
    • I believe this can only be used for triggers/conditions (not effects/commands); and counting the number of provinces that fit a criterion seems to require a command; so I don't think this is possible.
  • Exhaustive if-statements (if count == 1 display 1/20; else if count == 2 display 2/20; etc):
    • This would definitely work, but it's high-maintenance and fragile and way too much effort for a "would be nice" feature.
    • Also, this solution is not generally applicable, ie. it's impractical for a N/100 or N/1000 check.
Essentially, I'm hoping there's some nice way to get the CK2 UI to display a count of objects that exist in a defined scope. There very well may not be, but I thought it was worth checking with the hivemind!
 
If you're using any_??? = { count >= N } as a trigger, is there a way to show the player how far they are towards fulfilling the condition?

As a more concrete example, I have the code below in the allow block of an intrigue-menu decision, and I would ideally like to have a tooltip that shows early-game players that they are 2/20 (or whatever) towards completing this goal.

Code:
            custom_tooltip = {
                text = emb_celtic_unity_this_character_owns_at_least_20_provinces_of_any_celtic_culture_in_western_europe_region_tt
                any_realm_province = {
                    region = world_europe_west
                    culture_group = celtic
                    count >= 20
                }
            }

Things I've tried or thought about:
  • Removing the custom_tooltip:
    • The condition works, but the "count" requirement is completely absent from the tooltip. This is worse than useless, because it's misleading.
  • Custom localisation (some kind of script that would generate "2/20" for insertion in the custom_tooltip):
    • I believe this can only be used for triggers/conditions (not effects/commands); and counting the number of provinces that fit a criterion seems to require a command; so I don't think this is possible.
  • Exhaustive if-statements (if count == 1 display 1/20; else if count == 2 display 2/20; etc):
    • This would definitely work, but it's high-maintenance and fragile and way too much effort for a "would be nice" feature.
    • Also, this solution is not generally applicable, ie. it's impractical for a N/100 or N/1000 check.
Essentially, I'm hoping there's some nice way to get the CK2 UI to display a count of objects that exist in a defined scope. There very well may not be, but I thought it was worth checking with the hivemind!

I can't come up with anything better than your second and third options. It's rather unfortunate that Paradox never bothered with this, and that the count doesn't even show up in tooltips.
 
  • 1
Reactions:
A rough idea that'll need some expansion:

Code:
set_up_holy_sites_effect = { # Put in the scripted_effects folder, call from the religion creator after swapping their religion to the new religion
    any_province = {
        limit = {
            is_holy_site = ROOT
        }
        remove_holy_site = ROOT
    }
   
    # Creator's capital should probably be a holy site
    capital_scope = {
        county = {
            save_event_target_as = holy_site_1
        }
    }
   
    # Add four additional holy site locations
    any_province = {
        limit = {
            is_land = yes
            has_owner = yes
            NOR = {
                province = event_target:holy_site_1
                any_neighbor_province = {
                    province = event_target:holy_site_1
                }
            }
            # Possibly add more limits, e.g. having a temple holding, being within a certain distance, being further than a certain distance
        }
       
        score_value = {
            value = 10
            holy_site_province_selection_score = yes
        }
       
        county = {
            save_event_target_as = holy_site_2
        }
    }
   
    any_province = {
        limit = {
            is_land = yes
            has_owner = yes
            NOR = {
                province = event_target:holy_site_1
                any_neighbor_province = {
                    province = event_target:holy_site_1
                }
                province = event_target:holy_site_2
                any_neighbor_province = {
                    province = event_target:holy_site_2
                }
            }
            # Possibly add more limits, e.g. having a temple holding, being within a certain distance, being further than a certain distance
        }
       
        score_value = {
            value = 10
            holy_site_province_selection_score = yes
        }
       
        county = {
            save_event_target_as = holy_site_3
        }
    }
   
    any_province = {
        limit = {
            is_land = yes
            has_owner = yes
            NOR = {
                province = event_target:holy_site_1
                any_neighbor_province = {
                    province = event_target:holy_site_1
                }
                province = event_target:holy_site_2
                any_neighbor_province = {
                    province = event_target:holy_site_2
                }
                province = event_target:holy_site_3
                any_neighbor_province = {
                    province = event_target:holy_site_3
                }
            }
            # Possibly add more limits, e.g. having a temple holding, being within a certain distance, being further than a certain distance
        }
       
        score_value = {
            value = 10
            holy_site_province_selection_score = yes
        }
       
        county = {
            save_event_target_as = holy_site_4
        }
    }
   
    any_province = {
        limit = {
            is_land = yes
            has_owner = yes
            NOR = {
                province = event_target:holy_site_1
                any_neighbor_province = {
                    province = event_target:holy_site_1
                }
                province = event_target:holy_site_2
                any_neighbor_province = {
                    province = event_target:holy_site_2
                }
                province = event_target:holy_site_3
                any_neighbor_province = {
                    province = event_target:holy_site_3
                }
                province = event_target:holy_site_4
                any_neighbor_province = {
                    province = event_target:holy_site_4
                }
            }
            # Possibly add more limits, e.g. having a temple holding, being within a certain distance, being further than a certain distance
        }
       
        score_value = {
            value = 10
            holy_site_province_selection_score = yes
        }
       
        county = {
            save_event_target_as = holy_site_5
        }
    }
   
    # Actually add the new holy sites
    event_target:holy_site_1 = {
        set_holy_site = ROOT
    }
   
    event_target:holy_site_2 = {
        set_holy_site = ROOT
    }
   
    event_target:holy_site_3 = {
        set_holy_site = ROOT
    }
   
    event_target:holy_site_4 = {
        set_holy_site = <ROOT
    }
   
    event_target:holy_site_5 = {
        set_holy_site = ROOT
    }
}


holy_site_province_selection_score = { # Put in the scripted_score_values folder
    # Put weights here
}

The above, with some distance checks and possibly some weights should allow you to get five holy sites with a reasonable spread.

Regarding your very helpful post here, what are you intending to be ROOT, i.e. when the selected province targets are set_holy_site = ROOT. I was assuming at first that ROOT would be the religion founder, but will set_holy_site = ROOT work then, making them holy sites of ROOT's religion? Or do I need to scope it to the religion directly?
 
Regarding your very helpful post here, what are you intending to be ROOT, i.e. when the selected province targets are set_holy_site = ROOT. I was assuming at first that ROOT would be the religion founder, but will set_holy_site = ROOT work then, making them holy sites of ROOT's religion? Or do I need to scope it to the religion directly?

Looking at the wiki, it seems it can't take a character as the target scope. However, you could probably save the founder's religion_scope as an event target and reference that instead of ROOT.
 
Regarding your very helpful post here, what are you intending to be ROOT, i.e. when the selected province targets are set_holy_site = ROOT. I was assuming at first that ROOT would be the religion founder, but will set_holy_site = ROOT work then, making them holy sites of ROOT's religion? Or do I need to scope it to the religion directly?

Looking at the wiki, it seems it can't take a character as the target scope. However, you could probably save the founder's religion_scope as an event target and reference that instead of ROOT.

It's quite possible anything with a religion is a valid target scope to use here. Paradox were fairly reasonable with later effects/triggers, at least as of 2.7 (Monks & Mystics).
 
Has anyone ever figured out why a custom title that controls a custom religion "can't be created normally" according to tooltip when playing as that custom religion? It's not just a mismatched tooltip, either, the title simply cannot be created, unlike, say, d_sunni.

I've tried a ton of things. Random start vs historical start, duchy title vs kingdom title, is_primary = yes/no, adding caliphate = yes, etc. I simply cannot figure out why d_sunni can be created but my custom religion's religion head title can't be.

Any ideas please? At my wit's end.

I can, and have, made a decision to artificially create the title in the Intrigue Menu, but that's nowhere near as satisfying. If there is some way to make the title creatable normally, I would love to know.
 
Is there a way to select a character's base ability (i.e. before traits and artifacts)? I was going to mod the old raise ability ambitions and remembered that I always hated how they triggered off the final score rather than the base score.
 
Is there a way to select a character's base ability (i.e. before traits and artifacts)? I was going to mod the old raise ability ambitions and remembered that I always hated how they triggered off the final score rather than the base score.
I'm not aware of any way to do this using only a trigger. (Which doesn't mean there isn't a way - others may have found something!)

---

However, in an effect block, you could:
  • Record the current attribute value in a temporary variable (via export_to_variable);
  • Remove 100 base points of that attribute (which should be enough to reduce the base score to zero, unless someone is seriously cheating);
  • Calculate the difference (which is the base score);
  • Record that difference in a character-scope variable; and
  • Give the character that number of attribute points.
Then, in a later trigger, you could check that base score that you stored in the character-scope variable.

If you do all of this in an event that's triggered on_yearly_pulse with a pre-filter of only_playable = yes, then you would have a fairly-up-to-date value for pretty much every character that matters, and I don't think it would have too big an impact on performance. (If you explicitly limit it to players only, ie. ai = no, then you could afford to run the same code much more frequently.)
 
Last edited:
Is there a simple way to mod out the Africa rain events? Or at least to remove (or turn the mtth to 100+ years) all the "pay a bunch of gold or see a bunch of people die" events? I would love for there to have been a game rule to turn them off since they are so annoying.
 
Is there a simple way to mod out the Africa rain events? Or at least to remove (or turn the mtth to 100+ years) all the "pay a bunch of gold or see a bunch of people die" events? I would love for there to have been a game rule to turn them off since they are so annoying.
I agree, those are incredibly annoying.

The relevant events are in events\hf_african_flavor_events.txt.

The specific event you're talking about is HF.15121.

The event that triggers it is HF.15120 just above it, which picks from a number of events at random. HF.15121 is only one of the possibilities.

HF.15120 itself is called from HF.15098 immediately above that, which is called from on_bi_yearly_pulse in common\on_actions.txt.

You have a number of options. You could add in a modifier with factor = 0 in HF.15120 for the random chance of triggering HF.15121 to be zero, you could add another option to HF.15121 that the player can select that doesn't kill off people or destroy buildings (optionally in exchange for some cost of your choice), you could go into common\on_actions.txt and transfer HF.15098 from on_bi_yearly_pulse to on_decade_pulse (that would make all the random events from HF.15120 happen less often, not only the landslide flooding), or you could add ai = yes to the trigger for HF.15121 so it never fires for the player but will fire for other rulers.

I'm sure there are many more options you could choose to address this too, so have at it! Hopefully this helps.
 
Is there a simple way to mod out the Africa rain events? Or at least to remove (or turn the mtth to 100+ years) all the "pay a bunch of gold or see a bunch of people die" events? I would love for there to have been a game rule to turn them off since they are so annoying.
Yeah, I occasionally play in Africa... then I get hit by these events and immediately move my entire demesne out because it's just not worth it.

I keep telling myself I want to rebalance these events to be fun instead of awful, but it's a big job because IMO they need to be fully reimagined (not just tweaked)...
 
Yeah, I occasionally play in Africa... then I get hit by these events and immediately move my entire demesne out because it's just not worth it.

I keep telling myself I want to rebalance these events to be fun instead of awful, but it's a big job because IMO they need to be fully reimagined (not just tweaked)...
You're right, it would be a big job, but I'd like to know if you had any specific ideas to make them fun? It'd give you, me, or someone else a starting point at least.
 
You're right, it would be a big job, but I'd like to know if you had any specific ideas to make them fun? It'd give you, me, or someone else a starting point at least.
Off the top of my head:
  • Mouldy artifacts:
    • Cost to repair should be proportional to artifact quality
    • Cost to repair should be capped (and the cap should also be proportional to quality)
    • Some types of artifacts should never become mouldy:
      • Equipped artifacts
      • Unique artifacts (eg. ark of the covenant)
      • Maybe some semi-unique artifacts too?
      • Maybe some types of artifact, if they are active?
      • Maybe some types of artifact, if they are magical or otherwise resistant to deterioration? (eg. emerald tablet)
    • Some recognition of the fact that preserving artifacts is difficult, so you need to actively pay for it somehow.
      • Maybe a great scriptorium which costs money to maintain but occasionally duplicates your books?
      • Maybe this would fit better as an expansion of the existing great library - some way to turn on/off active maintenance, and when it's on you won't lose books and you might actually trigger the event which gives you a book (I've never seen it in a real game)?
      • If active maintenance sounds good, the armory feature in the ??fortress?? could unlock a similar decision for weapons and armor? And the throne room in the palace for crown jewels?
    • Some way for vassals to protect against artifact loss would be good too. (The previous point is very focused on top lieges.)
    • Eventually, once this category is fun, expand it to cover the entire world (because sub-Saharan Africa is hardly the only place in the world where unmaintained artifacts will decay).
  • Building collapse:
    • Gold cost should be capped
    • Gold cost should vary between options
    • Add more event options (and possibly short event chains) based on traits, and ensure the AI chooses appropriately. Eg:
      • Brave/strong/brawny - dive in yourself and carry out a daring rescue (event chain: gain friendship, gain martial, risk of wounds and death)
      • Greedy - use the collapse as an excuse to expropriate land (ie. gain gold).
  • Rains:
    • Holding a rain dance should not be a "pious option" for Muslims/Jews/Christians/etc
    • Add an option to spend the capital's prosperity to subsidise the affected province
    • Gold cost to subsidise a province should be capped (eg. proportional to {number of holding slots} for {tribals & nomads} and {number of holdings} for all non-tribals)
    • Heavy rains could expose ancient ruins (ie. new mini event chain)
    • Mitigate droughts by building cisterns in holdings (these would be a new type of building; the amount of water in the cistern would be tracked using province variables and updated in relevant events).
Basically, look at RD's epidemics (bad! really bad!), hospitals (really expensive!) and seclusion (unique events and event chains!), and try to do something similar for the rains. Of course, RD is an entire DLC, ie. thousands of hours of work, so you probably need to scale back your ambitions somewhat.
 
Last edited:
  • 1Like
Reactions:
You're right, it would be a big job, but I'd like to know if you had any specific ideas to make them fun? It'd give you, me, or someone else a starting point at least.

I've considered doing something about it in the past, but have never gotten around to it. My broad design ideas are:

- More options for preventative measures so that you can choose between taking your chances and spending money up front to hopefully avoid the worst outcomes (with some maintenance events to keep the preventative measures in place).

- More neutral/mildly negative outcomes so that it doesn't feel like disaster after disaster. It shouldn't generally rise to a level where the ruler personally needs to get involved, and memorable disasters (loss of courtiers/artefacts/etc.) shouldn't be frequent.

- Saner caps on the scaled_wealth; some of the events can be excessively costly.

- Other locations could use their own issues (e.g. unusually severe winters, earthquakes, floods near rivers) so that the "Just move out of Africa to avoid the weather/disaster mechanic!" isn't an option, because "Avoid at all cost!" is generally not good design.
 
  • 2Like
Reactions:
Has anyone ever figured out why a custom title that controls a custom religion "can't be created normally" according to tooltip when playing as that custom religion? It's not just a mismatched tooltip, either, the title simply cannot be created, unlike, say, d_sunni.

I've tried a ton of things. Random start vs historical start, duchy title vs kingdom title, is_primary = yes/no, adding caliphate = yes, etc. I simply cannot figure out why d_sunni can be created but my custom religion's religion head title can't be.

Any ideas please? At my wit's end.

I can, and have, made a decision to artificially create the title in the Intrigue Menu, but that's nowhere near as satisfying. If there is some way to make the title creatable normally, I would love to know.
I finally figured it out.

I needed to give it a capital in the landed title entry, because without that, titular titles can't be created. This is not obvious whatsoever.

The wiki entry notes that a capital must be controlled in order to create a regular titular title, but it doesn't say that a capital must be listed to begin with in order to create a titular title. Perhaps a clarification would help?
 
Is there a way to give someone an amount of offmap_currency (i.e. Grace with China) equal to the amount of Grace someone else has with them?

I ask because of the inherit command. That doesn't transfer wealth or artifacts, but there are commands for transferring those that can be added on to the decision or event that the inherit command is in. But how do I transfer over offmap_currency? Testing shows that it does not automatically transfer over with the inherit command.

I was looking at maybe variables, but I can't see a way to set a variable to the value of the offmap_currency. Offmap currency is not listed as one of the triggers that export_to_variable can use.

Is there any kind of workaround I'm missing?
 
Is there a way to give someone an amount of offmap_currency (i.e. Grace with China) equal to the amount of Grace someone else has with them?

I ask because of the inherit command. That doesn't transfer wealth or artifacts, but there are commands for transferring those that can be added on to the decision or event that the inherit command is in. But how do I transfer over offmap_currency? Testing shows that it does not automatically transfer over with the inherit command.

I was looking at maybe variables, but I can't see a way to set a variable to the value of the offmap_currency. Offmap currency is not listed as one of the triggers that export_to_variable can use.

Is there any kind of workaround I'm missing?

Check if the target has non-zero Grace, then do a while loop with smaller step changing the Grace of both parties by e.g. 1000/100/10/1 in the opposite direction.

However, keep in mind that this might result in weird things if the old character remains alive where e.g. a former ruler that recently attacked China will be viewed in a neutral manner while the heir is viewed as an enemy of China.
 
  • 1
Reactions:
Is there a way to prevent a holy mercenary group from existing on game start? It's a custom one, modeled after the Papal Guards, in that they are mercenaries but must be my custom religion and serve the leader of the custom religion. But I don't want them to exist until the custom religion is founded.

Is there some way to set it automatically, or do I just need to create an on_game_start event with is_save_game = no and deactivate the title? That seems kind of messy, since it means that the group will exist for a single day, and when the title is destroyed, there will still be the members of that religion out there who used to be part of the group, and I don't want anyone of that religion to exist until the player founds it.