• 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.
I'm trying to add a faction in my mod, and it's not showing up in the list to create a faction. Besides adding the faction in common/objectives, is there more you have to add before it shows up?

Also, are there any hard-coded restrictions for Merchant Republic Patricians to create a faction?
 
EDIT: Apparently my belief was incorrect - see next post.
Also, are there any hard-coded restrictions for Merchant Republic Patricians to create a faction?
I believe MR Patricians are blocked from fighting against their Doge under any circumstances. (Because, if they became independent of the Doge they would spawn a new MR. And/or the original MR's succession would be broken. And/or a new family would be autogenerated for the original MR, so there would be no room for the rebel family once the war was over.)

If I'm correct about Patricians being blocked from wars, I wouldn't be surprised if Patricians are hard-blocked from joining factions. (Because you have to be able to fight your liege to enforce your faction demands.)
 
Last edited:
I believe MR Patricians are blocked from fighting against their Doge under any circumstances. (Because, if they became independent of the Doge they would spawn a new MR. And/or the original MR's succession would be broken. And/or a new family would be autogenerated for the original MR, so there would be no room for the rebel family once the war was over.)

If I'm correct about Patricians being blocked from wars, I wouldn't be surprised if Patricians are hard-blocked from joining factions. (Because you have to be able to fight your liege to enforce your faction demands.)

Revolting against your liege doesn't make you independent. Independence means being your own liege and not being in revolt. In addition, the merchant republic government accounts for patricians revolting. I don't see why patricians couldn't in principle join factions and be involved in faction revolt wars.
 
  • 1
Reactions:
Revolting against your liege doesn't make you independent. Independence means being your own liege and not being in revolt. In addition, the merchant republic government accounts for patricians revolting. I don't see why patricians couldn't in principle join factions and be involved in faction revolt wars.
How does Patrician revolts work? Wouldn't being in revolt means you have a temporary title, and it'll cause problems having a merchant republic government and temporarily separate from your merchant republic?

I thought that might not work, so I was only trying to add a patrician faction that just fires events, no revolt wars. From the code, it looks like you can have factions without triggering revolt wars, the war is triggered by your code. I just wasn't sure if there are hard-blocks in the source code or not, even though the vanilla faction code does have checks for it.

My problem was that I couldn't get it to show up in the list at all, wasn't sure what I was missing. Plots I added in common/objectives shows up no problem, but the faction I added did not. It doesn't need interface stuff or localisation to show up does it?
 
How does Patrician revolts work? Wouldn't being in revolt means you have a temporary title, and it'll cause problems having a merchant republic government and temporarily separate from your merchant republic?

I thought that might not work, so I was only trying to add a patrician faction that just fires events, no revolt wars. From the code, it looks like you can have factions without triggering revolt wars, the war is triggered by your code. I just wasn't sure if there are hard-blocks in the source code or not, even though the vanilla faction code does have checks for it.

My problem was that I couldn't get it to show up in the list at all, wasn't sure what I was missing. Plots I added in common/objectives shows up no problem, but the faction I added did not. It doesn't need interface stuff or localisation to show up does it?

The game tracks a 'liege before war' for revolting rulers, so simply going into revolt doesn't separate a patrician from his merchant republic realm.

Anyway, it looks like I'll have to look into patricians and factions for myself.
 
EDIT: Apparently my belief was incorrect - see next post.
I believe MR Patricians are blocked from fighting against their Doge under any circumstances. (Because, if they became independent of the Doge they would spawn a new MR. And/or the original MR's succession would be broken. And/or a new family would be autogenerated for the original MR, so there would be no room for the rebel family once the war was over.)

If I'm correct about Patricians being blocked from wars, I wouldn't be surprised if Patricians are hard-blocked from joining factions. (Because you have to be able to fight your liege to enforce your faction demands.)
Interestingly there aren't any hard blocks for Patricians warring against their Doge liege. If you somehow gained a claim on the MR, you're allowed to declare war on the Doge, but it's jank because your game ends immediately, due to the loss of your palace and government change.
 
The game tracks a 'liege before war' for revolting rulers, so simply going into revolt doesn't separate a patrician from his merchant republic realm.

Anyway, it looks like I'll have to look into patricians and factions for myself.
I could test it myself too if I could get the faction to show up.

But looks like the faction doesn't show up even for feudal vassals after I removed the conditions, so something else is missing.
 
I could test it myself too if I could get the faction to show up.

But looks like the faction doesn't show up even for feudal vassals after I removed the conditions, so something else is missing.
When you say "the faction", do you mean "only my modded faction" or "any faction". Because I think non-patrician vassals of a MR should be able to join factions. (Although, obviously, you can only test this directly with count+ tier tribal/feudal characters.)

EDIT: If vanilla factions show up and are joinable, but yours doesn't, the problem is with your coding. Have you tried the Validator?
 
Last edited:
Alright I figured it out, it was a bug in my code, copied some template code from a vanilla faction and missed a line on a check making it fail always ugh. Drove me nuts doing trial and error finding it.

And I've got my answer, Patricians can create factions. Now I can experiment with them.
 
The game tracks a 'liege before war' for revolting rulers, so simply going into revolt doesn't separate a patrician from his merchant republic realm.

Anyway, it looks like I'll have to look into patricians and factions for myself.
Is there a specific way this needs to be coded for the revolt?

I tried triggering a faction revolt war as a Patrician, basing it on vanilla faction revolt code, and that didn't work as you described. I lose the merchant republic government, and switched government based on what primary holding I had while in revolt. So if I only have the palace, then my game ends becoming unlanded.
 
Is there a specific way this needs to be coded for the revolt?

I tried triggering a faction revolt war as a Patrician, basing it on vanilla faction revolt code, and that didn't work as you described. I lose the merchant republic government, and switched government based on what primary holding I had while in revolt. So if I only have the palace, then my game ends becoming unlanded.
That was kinda my original point: I don't think Patricians can go to war with their Doge. @Whizzer pointed out that they technically can... but the ways he tried gave an instant game over due to loss of Patrician status.

MRs are a well-known pit of hardcoded jankiness; you need to take this into account if you're modding MRs.

So, before spending too much more time writing your mod, it might be a good idea to do your own testing to figure out if there is any way a Patrician can go to war with his Doge and then rejoin the republic. If you find a way, you need to make sure your mod follows that path. If you don't find a way, you need to build that into your mod too - either give up on the idea of factions, or find some way to ensure that the faction will never fire and use events to effect the changes.
 
1. Does anyone know what exactly the relative_power condition measures?

2. Can anyone suggest a good way to measure whether another character has a larger army?

3. (Slight tangent) Is there a reason why both suzerain and any_suzerain exist as valid scopes? Is this the source of my issue somehow? Surely a character can only have one suzerain? (I've tried both suzerain and any_suzerain, but it doesn't seem to make a difference.)

Context: I'm trying to put together a decision which allows someone to stop being a tributary if their suzerain is less powerful than they are, and the condition is not valid when it seems like it really should be.

AI Bavaria is suzerain of lots of tributaries, in part because I messed up the AI logic in earlier versions of the mod. He has an army of ~3k (in part because I recently beat him up as an ally in a defensive war).
20230120220901_1.jpg

AI France has an army of ~12k, which is a LOT more than the ~3k of his overlord, but the "suzerain's relative_power is less than 0.8" trigger is still invalid:
20230120220756_1.jpg20230120220835_1.jpg

Here's the relevant part of the mod code, for reference. (I've updated it slightly since the screenshots, but the broad structure is unchanged.)
Code:
decisions = {
    expd_t_protectorate_independence_normal = {
...
        allow = {
...
                        # Suzerain has fewer troops than you and/or less prestige than you.
                        # (Because you become the suzerain by having more troops or significantly more prestige.)
                        any_suzerain = {
                            relative_power = {
                                who = ROOT
                                power < 0.25
                            }
                        }
                        AND = {
                            any_suzerain = {
                                relative_power = {
                                    who = ROOT
                                    power < 0.5
                                }
                            }
                            expd_t_this_characters_suzerain_has_less_prestige_than_this_character = yes
                        }
                        AND = {
                            any_suzerain = {
                                relative_power = {
                                    who = ROOT
                                    power < 0.8
                                }
                            }
                            expd_t_this_characters_suzerain_has_less_than_half_the_prestige_of_this_character = yes
                        }
 
That was kinda my original point: I don't think Patricians can go to war with their Doge. @Whizzer pointed out that they technically can... but the ways he tried gave an instant game over due to loss of Patrician status.

MRs are a well-known pit of hardcoded jankiness; you need to take this into account if you're modding MRs.

So, before spending too much more time writing your mod, it might be a good idea to do your own testing to figure out if there is any way a Patrician can go to war with his Doge and then rejoin the republic. If you find a way, you need to make sure your mod follows that path. If you don't find a way, you need to build that into your mod too - either give up on the idea of factions, or find some way to ensure that the faction will never fire and use events to effect the changes.
I'm aware of the lack of modability of a lot of aspects of MRs, was told by another modder that certain ideas of mine weren't possible, but I did find some workarounds. I was expecting MR revolts to not work though, had the same thought as you, so I wasn't planning on implementing them. It was worth a shot though to test it out. And even if a revolt was possible, based on some posts I found, it would likely be a pain for the player to fight, because Patricians may not have holdings besides the palace and trade posts, and it might be a pain to gain warscore.

So I plan to avoid faction revolts, my idea was to restrict what cases the faction can be formed, but if it is formed and get strong enough, then the Doge will be forced to yield if it fires.
 
Another question:
Is restricting certain diplomatic actions such as Resigning from council hard-coded to be global? I can't find it in the decisions folder, in minor_titles I can prevent revokes but I don't see one for retire/resign, and I found parameters for it in Defines but that's global.
 
Another question:
Is restricting certain diplomatic actions such as Resigning from council hard-coded to be global? I can't find it in the decisions folder, in minor_titles I can prevent revokes but I don't see one for retire/resign, and I found parameters for it in Defines but that's global.
Yes, everything you can't find in decisions is nearly 100% hardcoded. Most of the fun stuff can't be modded in any meaningful way.
 
  • 1
Reactions:
1. Does anyone know what exactly the relative_power condition measures?

2. Can anyone suggest a good way to measure whether another character has a larger army?

3. (Slight tangent) Is there a reason why both suzerain and any_suzerain exist as valid scopes? Is this the source of my issue somehow? Surely a character can only have one suzerain? (I've tried both suzerain and any_suzerain, but it doesn't seem to make a difference.)

Context: I'm trying to put together a decision which allows someone to stop being a tributary if their suzerain is less powerful than they are, and the condition is not valid when it seems like it really should be.
1. It's on the wiki.
3. It may be possible to have multiple suzerains, although vanilla pretty much ensures it will never happen by always removing all current suzerains before creating a new tributary relationship.
 
3. It may be possible to have multiple suzerains, although vanilla pretty much ensures it will never happen by always removing all current suzerains before creating a new tributary relationship.

I made a mistake with some history files a while back and ended up with a character that simultaneously was a tributary of two characters after loading, so it seems to work to some extent (unlike e.g. setting multiple lieges, where the last liege set is the only liege that someone gets).

However, as it isn't the intended behavior it could be buggy in different ways depending on what happens under the hood, it's unclear how the suzerain scope is determined (last suzerain? first suzerain? highest charid? lowest charid?), and vanilla does -- as mentioned -- remove all suzerains when a new tributary relationship is set up (which presumably would need to be changed), so I would recommend further testing to ensure that it actually works as desired (and, if anyone does said testing, I'd be interested in hearing about the result).

Yes, everything you can't find in decisions is nearly 100% hardcoded. Most of the fun stuff can't be modded in any meaningful way.

I don't believe the AI ever resigns from the council outside events (or becoming ineligible), seeing as it at the very least isn't coded to do it when it really should (e.g. a powerful AI claimant that hates its liege will not resign to start/join a faction for its own claim), so I don't think it'd be that bad from a performance standpoint or scripting standpoint to replace it with a targeted_decision (unlike something like marriages, which the AI of course checks a bunch more).
 
  • 1
Reactions:
1. It's on the wiki.
I know, that's why I started using relative_power ;-)

However, in my original example: the King of France has 12k army size (in his character profile); the King of Bavaria has 3k; 3k/12k = 25%; but Bavaria's "relative power" is NOT <80% of France's.

Alternatively, if you add up their max levy sizes (instead of actual levy sizes) plus any raised troops that don't have a maximum, the result is 14231/12544=113%.

I added some more conditions to the modded decision, to probe what the game thinks their "relative power" is, and it turns out that Bavaria's relative power is between 80% and 100% of France's. Which doesn't fit either of the two approaches above.

However, Bavaria is a Child of Destiny, so perhaps this is a weighted calculation based on actual levy sizes, and his army is about 3.5x "better" than France's? But that's a very large multiplier for two adjacent nations, so I'm skeptical. (I find it hard to imagine that a CoD's army is worse than that of a normal character, so it's probably not a weighted calculation based on max levy sizes.)

What is going on here?!

20230122162053_1_cropped_annotated.jpg20230122162048_1_cropped_annotated.jpg20230122161816_1_cropped_annotated.jpg
 
Last edited:
However, as it isn't the intended behavior it could be buggy in different ways depending on what happens under the hood, it's unclear how the suzerain scope is determined (last suzerain? first suzerain? highest charid? lowest charid?), and vanilla does -- as mentioned -- remove all suzerains when a new tributary relationship is set up (which presumably would need to be changed), so I would recommend further testing to ensure that it actually works as desired (and, if anyone does said testing, I'd be interested in hearing about the result).
FYI, based on some further experimentation, any_suzerain works for effects but not for triggers. (Switching triggers from any_suzerain = { whatever } to suzerain = { whatever } changes them from completely nonfunctional to working properly.)