• 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.
Excellent question, unfortunately I'm not too clear either.

Tangentially related, I managed to get primogeniture succession working for merchant republics! It requires some working in \common\laws\succession_laws.txt. First step is obvious: change the code of succ_primogeniture so that potential = {} and allow ={} blocks both allow patricians and merchant republics.

This step alone makes the default succession primogeniture when you pick a merchant republic to start the game as (Pisa in 1066, for my testing). There's some tooltip weirdness, because the kingdom still says another patrician is the expected successor, but it does in fact get passed onto your oldest son.

If that's all you do, though, then as soon as you die, you'll get a game over. This is because, despite your successor holding the merchant republic titles and having a merchant_republic_government, there's one title he didn't inherit: the family palace, which was still set to Seniority and went to your oldest dynasty member. Not having a family palace is what disqualifies you from playing a government in the republic_governments group, rather than not having merchant_republic_government per se.

Thus, the second required step is to edit succ_seniority in a similar manner to succ_primogeniture, but in reverse, making sure that a merchant republic does not qualify for it.

Presto!

Still some tooltip weirdness, like I said, and the F4 succession window shows the expected patrician successors, but the actual successor is your oldest son, and is listed as such for your family palace and some of the title (and he inherits all the titles despite the tooltips not always matching up with that).

I assume that, instead of doing the above two steps, you could just edit succ_seniority alone, to make it so that a merchant republic can have it, thus your heir there matches your family palace heir.
 
Does anyone know what the difference between trade_route_wealth and trade_route_value? I think there is also a "trade_route_income", but it doesn't show up on the wiki and I cannot find any examples so I might have imagined it (or it might be a localization of something else).

I am trying to make a patrician trade-post building that increases the total value of a trade route and gives some income based on the trade route itself. only trade_route_wealth seems to get used in vanilla trade post buildings.
Judging by the comments on trade route modding:
  • trade_route_wealth likely modifies a trade route's wealth, which is a "multiplier for other modifiers" where "modifiers [are] calculated as (Wealth * modifier)/# of trade provinces".
  • trade_route_value is a "modifier used to determine base trade route income for a trade post on a province".
From that, it seems likely that trade_route_wealth modifies everything about the trade route (city tax, trade post income, etc), whereas trade_route_value only modifies trade post income.

---

FYI, the list of possible modifiers can be found in the "trade" section of the modifiers page.
 
Judging by the comments on trade route modding:
  • trade_route_wealth likely modifies a trade route's wealth, which is a "multiplier for other modifiers" where "modifiers [are] calculated as (Wealth * modifier)/# of trade provinces".
  • trade_route_value is a "modifier used to determine base trade route income for a trade post on a province".
From that, it seems likely that trade_route_wealth modifies everything about the trade route (city tax, trade post income, etc), whereas trade_route_value only modifies trade post income.

Thank you. So trade_route_wealth increases the trade route for everyone while trade_route_value increases it for trade post holders, possibly only the local trade route holder. This calls for testing, but only raising the two of them with my new building will probably do what I want better than trying to also include trade_value and tax.

FYI, the list of possible modifiers can be found in the "trade" section of the modifiers page.
That is where I found trade_route_wealth and trade_route_value as modifiers. I didn't remember that there was a "trade route modding" page on the wiki.
 
Judging by the comments on trade route modding:
  • trade_route_wealth likely modifies a trade route's wealth, which is a "multiplier for other modifiers" where "modifiers [are] calculated as (Wealth * modifier)/# of trade provinces".
  • trade_route_value is a "modifier used to determine base trade route income for a trade post on a province".
From that, it seems likely that trade_route_wealth modifies everything about the trade route (city tax, trade post income, etc), whereas trade_route_value only modifies trade post income.

---

FYI, the list of possible modifiers can be found in the "trade" section of the modifiers page.
I don't see that info on that page at all. You say "comments" on it, where are those comments and how do I view them?
 
Thank you. So trade_route_wealth increases the trade route for everyone while trade_route_value increases it for trade post holders, possibly only the local trade route holder.
Yeah, it's not entirely clear to me whether it'll increase TP income on all provinces or just on that one province - I can interpret the text both ways. Needs testing, as you say :)

(And, if you find definitive answers, please add them to the wiki!)

I didn't remember that there was a "trade route modding" page on the wiki.

The wiki's search function is awful. It's usually very helpful to go out to google eg: "trade route site:ck2.paradoxwikis.com".

I don't see that info on that page at all. You say "comments" on it, where are those comments and how do I view them?
I'm talking about the comments embedded in the code on the main page. (After the "#" characters on nearly every line.)

I assumed it was a copy/paste of an actual file somewhere in the base game (ie. that this was developer documentation), but it has a lot more info than the actual files in ...\common\trade_routes\ - so now my best guess is that this entire page was written specifically for the wiki by "Ironvak", back in 2020, based on their own testing. If so: thanks from the future, whoever you are!
 
Last edited:
Is there a way to make a character join a particular war as secondary participant?

I have a targeted decision which allows me to make someone my tributary diplomatically. They are more willing to accept if they are in a losing defensive war. The new suzerain should immediately join all wars where the new tributary is primary defender (because AI defenders sometimes don't issue a call to arms).

join_defensive_wars would be fine... except that the documentation says it only forces the character to join the oldest defensive war, not all defensive wars. (Maybe the documentation is incorrect?)

Ideally, I'd like to write something like this:

Code:
ROOT = {
    any_war = {
        limit = { defender = { character = ROOT } }
        add_secondary_defender = FROM ########## Obviously this is not a real command - replace it with something that works!
    }
}

I would like to somehow declare war on behalf of my tributaries, where I get the prestige/piety/gold reward (and pay the penalty for losing), and they get the land/title.

(This would be something like the "request to embargo" interaction for MRs, but that unfortunately relies on hardcoding and some very-specific circumstances. Side-note: The way the penalty for losing is paid by the requesting MR is both brilliant and terrible.)

So, I would like to somehow ensure that one specific tributary and myself are added to the same war. (I'm not sure whether this works best as a targeted decision on the tributary, or on the defender, or as a completely new CB for the suzerain. The exact implementation will probably depend on what's actually possible in-engine...)

In this case, it would be possible to set up a precondition that the suzerain and tributary aren't primary attackers in any war, and then use join_attacking_wars, but it would be nice if there was a way to avoid that precondition, because large empires might have several simultaneous ongoing wars.
 
Yeah, it's not entirely clear to me whether it'll increase TP income on all provinces or just on that one province - I can interpret the text both ways. Needs testing, as you say :)

(And, if you find definitive answers, please add them to the wiki!)



The wiki's search function is awful. It's usually very helpful to go out to google eg: "trade route site:ck2.paradoxwikis.com".


I'm talking about the comments embedded in the code on the main page. (After the "#" characters on nearly every line.)

I assumed it was a copy/paste of an actual file somewhere in the base game (ie. that this was developer documentation), but it has a lot more info than the actual files in ...\common\trade_routes\ - so now my best guess is that this entire page was written specifically for the wiki by "Ironvak", back in 2020, based on their own testing. If so: thanks from the future, whoever you are!
I see it now. Maybe I was tired before. Sorry.
Is there a way to make a character join a particular war as secondary participant?

I have a targeted decision which allows me to make someone my tributary diplomatically. They are more willing to accept if they are in a losing defensive war. The new suzerain should immediately join all wars where the new tributary is primary defender (because AI defenders sometimes don't issue a call to arms).

join_defensive_wars would be fine... except that the documentation says it only forces the character to join the oldest defensive war, not all defensive wars. (Maybe the documentation is incorrect?)

Ideally, I'd like to write something like this:

Code:
ROOT = {
    any_war = {
        limit = { defender = { character = ROOT } }
        add_secondary_defender = FROM ########## Obviously this is not a real command - replace it with something that works!
    }
}

I would like to somehow declare war on behalf of my tributaries, where I get the prestige/piety/gold reward (and pay the penalty for losing), and they get the land/title.

(This would be something like the "request to embargo" interaction for MRs, but that unfortunately relies on hardcoding and some very-specific circumstances. Side-note: The way the penalty for losing is paid by the requesting MR is both brilliant and terrible.)

So, I would like to somehow ensure that one specific tributary and myself are added to the same war. (I'm not sure whether this works best as a targeted decision on the tributary, or on the defender, or as a completely new CB for the suzerain. The exact implementation will probably depend on what's actually possible in-engine...)

In this case, it would be possible to set up a precondition that the suzerain and tributary aren't primary attackers in any war, and then use join_attacking_wars, but it would be nice if there was a way to avoid that precondition, because large empires might have several simultaneous ongoing wars.
I've bashed my head against the first one too. I've tried things like looking at Call to Arms to see what it does, or whether the ai_chance can be improved, but that must be hardcoded because I can't find it anywhere except localization. Same with Offer to Join War. I honestly can't remember for sure whether join_defender_wars only works for one defensive war or not. There are some HF events (when you're a warrior lodge member) where someone asks you to join their defensive wars, but I can't recall if that makes you join all their defensive wars or not. I checked the China grace decision to request an invasion, because that gives you an option to join the invasion, but that just uses the command join_attacker_wars - and, tellingly, the decision cannot be taken if China's governor is already at war.

Wish I could offer something more helpful.

For the second, you can probably use third-party elements of decisions to declare a war on behalf of a tributary, but a new CB is probably your best bet. I can't think of any better way than checking that they're not primary attackers in a war, but perhaps only check the suzerain for being a primary attacker. While large empires might be in several wars at once, they can control how many offensive wars they start. Thus, it doesn't matter how many allies they're helping or how many people are attacking them - so long as they (the suzerain) hasn't initiated an offensive war against anyone else, they will fulfill the precondition. Yes, it'd be ideal if they could initiate it even while having other self-initiated wars ongoing, but as I see it, it shouldn't be that onerous a precondition: AI are predisposed to be reluctant to initiate an offensive war if they've already got one going on, while I personally find it difficult to manage multiple offensive wars at once and can't imagine purposefully doing so.
 
  • 1
Reactions:
Wish I could offer something more helpful.
No worries, it's actually good to see that someone else has thought about this and that it's not super-obvious :)

I personally find it difficult to manage multiple offensive wars at once and can't imagine purposefully doing so.
I know it's off-topic, but I just... can't... resist... ;-)

For large offensive wars? Sure. But for small offensive wars, I find it very useful to have several at the same time. For example:
  • If you're reliant on levies, you can declare 4-5 wars in the same region then send all your levies there.
  • If you're warring in areas of low supply, eg. Siberia, occupied adjacent provinces provide extra supply.
  • If you have event troops which disappear on peace, eg. Call to Glory, it's best to stay at war for as long as possible.
  • If you're holy-warring for 1-2 highly-fragmented duchies, they're all going to join each others' wars anyway, so you might as well declare all the wars at the same time.
  • If you're holy-warring for a duchy wholly-owned by a faction rebel, you might as well declare another war against their overlord at the same time, since you'll be hostile to them anyway.
  • If you fabricated claims with your chancellor, it can take a really long time, so you can often be on a time-limit to press them before you die.
  • If you get 1-2 entire duchies from 5-6 peace treaties all on the same day, you can also give out those new duchies all at once.
 
  • 1Like
Reactions:
join_defensive_wars would be fine... except that the documentation says it only forces the character to join the oldest defensive war, not all defensive wars. (Maybe the documentation is incorrect?)

I assure you that the documentation is still 100% up to date. I tested it myself. These commands are some of the sloppiest work Paradox did on this poor game. Who could have thought this would be useful at all, let alone satisfactory? Someone apparently did, and no one ever bothered to patch it up.
 
  • 1
  • 1
Reactions:
I assure you that the documentation is still 100% up to date. I tested it myself. These commands are some of the sloppiest work Paradox did on this poor game. Who could have thought this would be useful at all, let alone satisfactory? Someone apparently did, and no one ever bothered to patch it up.
After the debacle where remove_instances_of_character_modifier literally doesn't work, I'm not even surprised.
 
After the debacle where remove_instances_of_character_modifier literally doesn't work, I'm not even surprised.

And that was many years after the initial release after the game, so quality control can't have been very high until then. join_attacker/defender_wars dates back to the game's original launch, if I'm not mistaken.
 
Different question. I can't get an NPC to use the tribal_invasion CB. I've used a custom event to spawn an NPC that has several martial, aggressive, and ambitious traits and an army of about 100,000 soldiers. Sort of like Aztecs or Mongols, except he can show up nearly anywhere on the map. I gave him a unique character flag, and added that flag to an OR trigger for being able to use tribal_invasion, but he simply won't use it. (But he regularly declares county conquests without any problems.)

I've used the play console command to double-check that he can actually use the CB, and while playing as him I can use the CB with no problem. I've added a modifier to the ai_chance with factor = 20 if the character has that NPC's unique flag, and he still won't use the CB.

Any ideas why not?
 
I assure you that the documentation is still 100% up to date. I tested it myself. These commands are some of the sloppiest work Paradox did on this poor game. Who could have thought this would be useful at all, let alone satisfactory? Someone apparently did, and no one ever bothered to patch it up.
Thanks, I just had the world's most painful and ironic laugh...
 
Different question. I can't get an NPC to use the tribal_invasion CB. I've used a custom event to spawn an NPC that has several martial, aggressive, and ambitious traits and an army of about 100,000 soldiers. Sort of like Aztecs or Mongols, except he can show up nearly anywhere on the map. I gave him a unique character flag, and added that flag to an OR trigger for being able to use tribal_invasion, but he simply won't use it. (But he regularly declares county conquests without any problems.)

I've used the play console command to double-check that he can actually use the CB, and while playing as him I can use the CB with no problem. I've added a modifier to the ai_chance with factor = 20 if the character has that NPC's unique flag, and he still won't use the CB.

Any ideas why not?
Try setting this character's ai_chance factor for tribal_invasion to 1000, and his ai_chance factor for pagan_county_conquest to 0. Whatever happens afterwards, the outcome will be informative.
 
  • 1
Reactions:
Try setting this character's ai_chance factor for tribal_invasion to 1000, and his ai_chance factor for pagan_county_conquest to 0. Whatever happens afterwards, the outcome will be informative.
When I went to alter the code per your recommendation, I realized I scoped things wrong for that ai_chance factor. I fixed the scope there, and still set the other to 0, and lo! He declared an invasion within the year. Thanks.

Bad news, the invasion was declared on my ally. Haha.
 
  • 1Like
Reactions:
How exactly are you supposed to set up a third-party CB?
(EDIT: For context, I'm creating a holy-war CB which is declared by a suzerain on behalf of his same-religion permanent tributary, where the tributary receives all conquered land and the suzerain pays all costs and receives all piety/prestige benefits.)

I thought maybe you just had to put other_ in front of the CB name, but I'm not sure if that's enough.

Also, the wiki says that FROMFROM is the third-party claimant... but (a) this doesn't work at all; and (b) a quick read-through of the vanilla other_claim CB suggests that in fact ROOT is the third party and FROMFROM is the primary attacker. But, in the places where FROMFROM is coming through in tooltips (eg. on_add) it's sometimes something really unexpected (eg. the target duchy title?!?!!). And, in the can_use clause, it seems like ROOT is the attacker (because, when can_use = { ROOT = { ai = no } }, the CB is visible to the player, and when this is changed to ai = yes it is invisible to the player).

What's going on here?! My symptoms are so weird that the only thing I can think is that I'm missing "something" that will cause the game to recognise that this is a third-party CB. But third-party CBs are not well documented, and I can't see anything obvious in the three vanilla examples...

Finally, is there anything else to be aware of when working with third-party CBs?
 
Last edited:
How exactly are you supposed to set up a third-party CB?
(EDIT: For context, I'm creating a holy-war CB which is declared by a suzerain on behalf of his same-religion permanent tributary, where the tributary receives all conquered land and the suzerain pays all costs and receives all piety/prestige benefits.)

I thought maybe you just had to put other_ in front of the CB name, but I'm not sure if that's enough.

Also, the wiki says that FROMFROM is the third-party claimant... but (a) this doesn't work at all; and (b) a quick read-through of the vanilla other_claim CB suggests that in fact ROOT is the third party and FROMFROM is the primary attacker. But, in the places where FROMFROM is coming through in tooltips (eg. on_add) it's sometimes something really unexpected (eg. the target duchy title?!?!!). And, in the can_use clause, it seems like ROOT is the attacker (because, when can_use = { ROOT = { ai = no } }, the CB is visible to the player, and when this is changed to ai = yes it is invisible to the player).

What's going on here?! My symptoms are so weird that the only thing I can think is that I'm missing "something" that will cause the game to recognise that this is a third-party CB. But third-party CBs are not well documented, and I can't see anything obvious in the three vanilla examples...

Finally, is there anything else to be aware of when working with third-party CBs?

I think the other_ pre-fix is indeed how a third party CB is recognised as such by the game.

Wiki is wrong, ROOT is the claimant, FROMFROM is the attacker, but they're the same character in most CB's, of course. Why Paradox decided this was sensible is anyone's guess, as usual. Also, the available scopes are of course not all the same, and they're not all available in all trigger and effect clauses. Again, what need for consistency?

Another thing to be aware of is that ai_will_do is not evaluated for third party CBs, so that's probably handled in hardcode.
 
I think the other_ pre-fix is indeed how a third party CB is recognised as such by the game.

Wiki is wrong, ROOT is the claimant, FROMFROM is the attacker, but they're the same character in most CB's, of course. Why Paradox decided this was sensible is anyone's guess, as usual. Also, the available scopes are of course not all the same, and they're not all available in all trigger and effect clauses. Again, what need for consistency?

Another thing to be aware of is that ai_will_do is not evaluated for third party CBs, so that's probably handled in hardcode.
OK, I've cut it down as much as I possibly can, and I still don't understand what's going on.

Code:
other_expd_t_tributary_holy_war_cb = {
    name = CB_NAME_RELIGIOUS
    war_name = WAR_NAME_RELIGIOUS
    sprite = 9
    truce_days = 3650
    is_permanent = yes
    is_holy_war = yes
    check_de_jure_tier = DUKE # this scans all dejure duchies for the counties which are held by or vassals(or below) of selected character. Only valid if is_permanent = yes
 
    allowed_to_target_tributaries = no
 
    sort_priority = 801 # Appears immediately after your own Holy War CBs vs the same target
 
    can_use = {
        # Temporary for testing - only available for players
        FROMFROM = { ai = no }
    }
 
    can_use_gui = {
        always = yes
    }
 
    can_use_title = {
        always = yes
    }

... Cut out all the validity / on_add / etc, since it's not important for this investigation

}

Test results:
  • With can_use = { FROMFROM = { ai = no } }, the CB is not visible in-game
  • With can_use = { ROOT = { ai = no } }, it is visible vs all independent AI (!)
  • With can_use = { e_mali = { holder_scope = FROM } }, as expected it is only visible vs the Emperor of Mali
  • With can_use = { k_kanem = { holder_scope = { character = FROMFROM } } }, it is not visible (Kanem is my tributary)
  • With can_use = { k_kanem = { holder_scope = { character = ROOT } } }, it is also not visible (!)
  • With can_use = { k_iraq = { holder_scope = { character = FROMFROM } } }, it is not visible (Iraq is my vassal)
  • With can_use = { k_iraq = { holder_scope = { character = ROOT } } }, it is also not visible (!)
  • With can_use = { c_aden = { holder_scope = { character = FROMFROM } } }, it is not visible (Aden is my capital, ie. attacker's demesne county)
  • With can_use = { c_aden = { holder_scope = { character = ROOT } } }, it is visible (!)
  • I also did a quick non-exhaustive test changing the name of the CB to other_claim_expd_t_tributary_holy_war_cb, and it didn't seem to change anything.
In summary: In can_use, ROOT is the attacker, FROM is the defender, and FROMFROM is completely nonfunctional. (Or, at least, FROMFROM doesn't seem to refer to any involved character.)

My current hypothesis is that I haven't set up the CB correctly, somehow, so the game is treating it like a normal non-third-party CB. Can anyone spot my error?
 
Last edited:
OK, I've cut it down as much as I possibly can, and I still don't understand what's going on.

Code:
other_expd_t_tributary_holy_war_cb = {
    name = CB_NAME_RELIGIOUS
    war_name = WAR_NAME_RELIGIOUS
    sprite = 9
    truce_days = 3650
    is_permanent = yes
    is_holy_war = yes
    check_de_jure_tier = DUKE # this scans all dejure duchies for the counties which are held by or vassals(or below) of selected character. Only valid if is_permanent = yes
 
    allowed_to_target_tributaries = no
 
    sort_priority = 801 # Appears immediately after your own Holy War CBs vs the same target
 
    can_use = {
        # Temporary for testing - only available for players
        FROMFROM = { ai = no }
    }
 
    can_use_gui = {
        always = yes
    }
 
    can_use_title = {
        always = yes
    }

... Cut out all the validity / on_add / etc, since it's not important for this investigation

}

Test results:
  • With can_use = { FROMFROM = { ai = no } }, the CB is not visible in-game
  • With can_use = { ROOT = { ai = no } }, it is visible vs all independent AI (!)
  • With can_use = { e_mali = { holder_scope = FROM } }, as expected it is only visible vs the Emperor of Mali
  • With can_use = { k_kanem = { holder_scope = { character = FROMFROM } } }, it is not visible (Kanem is my tributary)
  • With can_use = { k_kanem = { holder_scope = { character = ROOT } } }, it is also not visible (!)
  • With can_use = { k_iraq = { holder_scope = { character = FROMFROM } } }, it is not visible (Iraq is my vassal)
  • With can_use = { k_iraq = { holder_scope = { character = ROOT } } }, it is also not visible (!)
  • With can_use = { c_aden = { holder_scope = { character = FROMFROM } } }, it is not visible (Aden is my capital, ie. attacker's demesne county)
  • With can_use = { c_aden = { holder_scope = { character = ROOT } } }, it is visible (!)
  • I also did a quick non-exhaustive test changing the name of the CB to other_claim_expd_t_tributary_holy_war_cb, and it didn't seem to change anything.
In summary: In can_use, ROOT is the attacker, FROM is the defender, and FROMFROM is completely nonfunctional. (Or, at least, FROMFROM doesn't seem to refer to any involved character.)

My current hypothesis is that I haven't set up the CB correctly, somehow, so the game is treating it like a normal non-third-party CB. Can anyone spot my error?

Two things: I think third party CBs only work for claims, whether explicit personal claims, or de jure claims, and likely only for characters directly or indirectly under your rule, which tributaries are technically not (you are not a direct or indirect liege of your tributaries).
 
Two things: I think third party CBs only work for claims, whether explicit personal claims, or de jure claims, and likely only for characters directly or indirectly under your rule, which tributaries are technically not (you are not a direct or indirect liege of your tributaries).
Hmm. In that case, I have to rethink.

In theory, I think you could make a "normal" (ie. non-third-party) CB which only allows you to declare if you have at least one tributary who could be a beneficiary. (For players, you would need to find a way to list the possible beneficiaries in the war dec dialog.) Then the on_add clause fires an event where you are forced to select a beneficiary. But, since this is an event (ie. only 4 buttons) and I'm too lazy to make long chains of menus, I'd probably have to go back and limit the CB so that it's only valid if there are <=4 possible beneficiaries.

I think the main issue with this approach will be that, during the war, the beneficiary won't be obvious to the player. (Because the beneficiary will only exist after the war has started.) Unless there's a clever way to use event_targets to dynamically set the portrait in the war screen and/or war name?

(The reason I'm leaning towards this approach is because it would allow the AI to use the CB with minimal extra effort. Contrast with an alternative design where you use multiple targeted_decisions and/or events to force the tributary to declare holy war on a specified target - probably much more obvious for a player, but getting the AI to use it correctly would be a nightmare.)