• 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.
Would it be possible to prevent the AI from messing with job actions I set for councilors? I think I could set a flag to prevent it from using job actions I don't want it to use, but that wouldn't prevent it from moving around the councillor, which would make some actions like train troops pointless, or maybe even deassign the job action and end up with an iddle councilor.
 
Would it be possible to prevent the AI from messing with job actions I set for councilors? I think I could set a flag to prevent it from using job actions I don't want it to use, but that wouldn't prevent it from moving around the councillor, which would make some actions like train troops pointless, or maybe even deassign the job action and end up with an iddle councilor.

I'm really not sure what you want here. Councillors are placed only when giving them a job action, so if you disable all of a given councillor's job actions, AI can't move it around at all.
 
  • 1
Reactions:
My initial thought was to not disable the one job action I assigned, which would still allow to assign the councillor to another province. I realized that with a province flag I should be able to restrict this job action to that province so this should not be a problem after all.

However it does not solve my other issue, which is like when my marshal is doing something I can tell him to stop doing it so I can use him as commander. Ideally I would like to find out what sets the cooldown before being able to change job actions so I could replicate and extend it as necessary.
 
My initial thought was to not disable the one job action I assigned, which would still allow to assign the councillor to another province. I realized that with a province flag I should be able to restrict this job action to that province so this should not be a problem after all.

However it does not solve my other issue, which is like when my marshal is doing something I can tell him to stop doing it so I can use him as commander. Ideally I would like to find out what sets the cooldown before being able to change job actions so I could replicate and extend it as necessary.

The cooldown is set by the ASSIGN_ACTION_DAYS define (it should be higher than 0) and applied by hardcode. You could in theory set it to an extremely high value (say 36500) and use a maintenance event for the AI to go "Do I like the current job for this councillor?" (based on whatever criteria you want) and the cancel_job_action command to allow reassignment (the player could perhaps get to do it with a targeted_decision instead).
 
  • 1
Reactions:
Code:
            # Back to the tombola
            character_event = {
                id = WoL.110
                days = 60
                random = 30
                tooltip = EVTTOOLTIP_WoL_110
            }

What is the impact of random here? I would imagine it could be -30 to +30 days, or perhaps 0 to +30 days, on top of the 60 days.
 
Code:
            # Back to the tombola
            character_event = {
                id = WoL.110
                days = 60
                random = 30
                tooltip = EVTTOOLTIP_WoL_110
            }

What is the impact of random here? I would imagine it could be -30 to +30 days, or perhaps 0 to +30 days, on top of the 60 days.

It's a random delay, from 0 up to 30 days, on top of the 60.
 
  • 1
Reactions:
Is there anything that particularly looks incorrect with this logic? Don't mind the regions, it's a submod for Tianxia I'm working on. But it doesn't seem to be working, it should be firing on startup from on_actions. If I get it working I'm hoping to expand on it to be more dynamic.

Code:
namespace = pentarchy

character_event = {
    id = pentarchy.01
    hide_window = yes
    is_triggered_only = yes
    
    immediate = {
        kingdom_title = {
            capital_scope = {
                region = {
                    AND = {
                        world_africa_east
                        world_africa_north_nile
                    }
                }
            }
            set_pentarchy = b_alexandria
            capital_scope = {
                region = {
                    AND = {
                        world_africa_north_west
                        world_europe_south_italy
                        world_europe_south_sardinia_corsica
                        world_europe_west
                        world_europe_north
                        world_europe_east_baltic
                    }
                }
            }
            set_pentarchy = b_roma
            capital_scope ={
                region = {
                    world_europe_south_east
                    world_europe_south_sicily
                    world_middle_ease_asia_minor
                    world_steppe_west
                    world_europe_east_pannonia
                    world_europe_east_russia
                }
            }
            set_pentarchy = b_hagiasophia
            capital_scope = {
                region = {
                    world_middle_east_arabia
                    world_middle_east_levant
                }
            }
            set_pentarchy = b_jerusalem
            capital_scope = {
                region = {
                    world_middle_east_persia
                    world_middle_east_mesopotamia
                }
            }
            set_pentarchy = b_antiocheia
        }
        k_armenia = {
            set_pentarchy = b_antiocheia
        }
        k_croatia = {
            set_pentarchy = b_roma
        }
        k_sicily = {
            set_pentarchy = b_hagiasophia
        }
    }
}
 
Is there anything that particularly looks incorrect with this logic? Don't mind the regions, it's a submod for Tianxia I'm working on. But it doesn't seem to be working, it should be firing on startup from on_actions. If I get it working I'm hoping to expand on it to be more dynamic.

Code:
namespace = pentarchy

character_event = {
    id = pentarchy.01
    hide_window = yes
    is_triggered_only = yes
   
    immediate = {
        kingdom_title = {
            capital_scope = {
                region = {
                    AND = {
                        world_africa_east
                        world_africa_north_nile
                    }
                }
            }
            set_pentarchy = b_alexandria
            capital_scope = {
                region = {
                    AND = {
                        world_africa_north_west
                        world_europe_south_italy
                        world_europe_south_sardinia_corsica
                        world_europe_west
                        world_europe_north
                        world_europe_east_baltic
                    }
                }
            }
            set_pentarchy = b_roma
            capital_scope ={
                region = {
                    world_europe_south_east
                    world_europe_south_sicily
                    world_middle_ease_asia_minor
                    world_steppe_west
                    world_europe_east_pannonia
                    world_europe_east_russia
                }
            }
            set_pentarchy = b_hagiasophia
            capital_scope = {
                region = {
                    world_middle_east_arabia
                    world_middle_east_levant
                }
            }
            set_pentarchy = b_jerusalem
            capital_scope = {
                region = {
                    world_middle_east_persia
                    world_middle_east_mesopotamia
                }
            }
            set_pentarchy = b_antiocheia
        }
        k_armenia = {
            set_pentarchy = b_antiocheia
        }
        k_croatia = {
            set_pentarchy = b_roma
        }
        k_sicily = {
            set_pentarchy = b_hagiasophia
        }
    }
}
Several things.

First, there's no such scope as kingdom_title, unless you have a saved event target from earlier in the event chain.

Second, you repeatedly scope to capital_scope but then never do anything with them. I think you're trying to set pentarchy capitals in different places based on what region of the world the kingdom title is in? If so, then you need if statements.
Code:
if = {
       limit = {
              capital_scope = {
                region = {
                    OR = {
                        world_africa_east
                        world_africa_north_nile
                    }
                }
            }
       }
       set_pentarchy = b_alexandria
}
else_if = {
       limit = {
            capital_scope = {
                region = {
                    OR = {
                        world_africa_north_west
                        world_europe_south_italy
                        world_europe_south_sardinia_corsica
                        world_europe_west
                        world_europe_north
                        world_europe_east_baltic
                    }
                }
            }
      }
      set_pentarchy = b_roma
}
And so on for the rest of the code, adding more else_if statements with limits for when the capital scope is in a particular region.

Third, I also changed the regions' AND to OR, because otherwise, you're asking the game to do something only if the capital scope is simultaneously in all those regions. While there are some regions that overlap, this would still lead to a very narrow limitation. You'd need to change the other ANDs inside the region limits to ORs too.

Fourth, you want the command set_pentarch_title rather than set_pentarchy.
 
  • 1Like
Reactions:
I am testing my mod, which randomly selects two "potential" independent AI lords to become "The only hegemon", and create a large army for them in their capital.
In my imagination, while posing a threat to the surrounding areas, they should have an evenly matched relationship with each other, assuming all other conditions remain the same.
But in testing, whether I create one troop of 100000 people, or ten troops of 10000 people, or one hundred troops of 1000 people for them, in most cases one side can eliminate the other with extremely low losses, and in a few cases, both sides' event troops would be exhausted in the war.
This makes me feel confused. In the test, I generated commanders with the same abilities for them and set their abilities to be the same. I also considered issues such as geographical location, but I didn't expect the result to be like this.
 
I am testing my mod, which randomly selects two "potential" independent AI lords to become "The only hegemon", and create a large army for them in their capital.
In my imagination, while posing a threat to the surrounding areas, they should have an evenly matched relationship with each other, assuming all other conditions remain the same.
But in testing, whether I create one troop of 100000 people, or ten troops of 10000 people, or one hundred troops of 1000 people for them, in most cases one side can eliminate the other with extremely low losses, and in a few cases, both sides' event troops would be exhausted in the war.
This makes me feel confused. In the test, I generated commanders with the same abilities for them and set their abilities to be the same. I also considered issues such as geographical location, but I didn't expect the result to be like this.
What troops are you giving them? Is it the attacker or defender who wins? Have you watched the battle to see how it plays out (i.e. what tactics get fored)? Does attrition happen?
 
For one troop of 1000 people:
Code:
light_cavalry = { 130 130 }
knights = { 50 50 }
horse_archers = { 90 90 }
light_infantry = { 270 270 }
heavy_infantry = { 120 120 }
pikemen = { 220 220 }
archers = { 120 120 }
AND
Code:
galleys = { 10 10 }
Other numbers of troops also generated according to this ratio, with a total of 100000 troops.(one troop of 100000 people, or ten troops of 10000 people, or one hundred troops of 1000 people)
The attacking and defending forces are the same, each with four commanders who can handle all tactics.
But I haven't watched the combat process, should I use the observe command? Or any other way?
 
Those look like levy numbers, though most levies don't have horse archers and the exact composition is probably off. Levies are notorious for having horrible tactics rolls.

The easiest way to watch a battle is to be playing as one of the participants and selecting the army in combat. It might show the window if you select a fighting army in observer mode.
 
If watching a battle doesn't help, it's worth checking tech levels. Especially if, in the same matchup, it's usually/always the same character who wins. Depending on the locations of their capitals, one "potential hegemon" might have much higher mil tech than the other, which translates to better combat performance.
 
Those look like levy numbers, though most levies don't have horse archers and the exact composition is probably off. Levies are notorious for having horrible tactics rolls.

The easiest way to watch a battle is to be playing as one of the participants and selecting the army in combat. It might show the window if you select a fighting army in observer mode.
May I ask what "look like Levy numbers" means? Are you saying that my troops do not appear to fit the characteristics of the event troops, so it led to some errors?
That's a good idea. I would try to watch how the complete annihilation or annihilation of the enemy occurs
If watching a battle doesn't help, it's worth checking tech levels. Especially if, in the same matchup, it's usually/always the same character who wins. Depending on the locations of their capitals, one "potential hegemon" might have much higher mil tech than the other, which translates to better combat performance.
The winner is not fixed, in order to control variables, I have prepared commanders with the same tactics for both of them. Based on everyone's responses, I suspect that this randomness may be due to tactics. If that's the case, it can also be considered as some kind of 'have an evenly matched relationship with each other'
 
May I ask what "look like Levy numbers" means? Are you saying that my troops do not appear to fit the characteristics of the event troops, so it led to some errors?
I meant that it is a similar mix to what a feudal lord's army will look like if he just has levies to work with. Without special buildings, a maxed castle gives 240 light infantry, 270 archers, 440 heavy infantry, 130 pikes, 315 light cavalry, and 35 heavy cavalry. That is a total of 1430 troops, so about 50% more than your basic unit. Looks like you are heavy on light infantry, pikes, heavy cavalry, and horse archers while being especially light on heavy infantry and archers. Unless you are getting really weird tactic rolls I wouldn't worry too much about the exact composition of your army.

I don't know the cut-off points for various tactics well enough to guess what range of tactics the army you are creating can use, but I'm pretty sure the answer is "yes" (which could lead to very swingy results). You probably want to check out the wiki page on tactics while you are debugging this since what tactics do is not particularly clear in game.
 
I meant that it is a similar mix to what a feudal lord's army will look like if he just has levies to work with. Without special buildings, a maxed castle gives 240 light infantry, 270 archers, 440 heavy infantry, 130 pikes, 315 light cavalry, and 35 heavy cavalry. That is a total of 1430 troops, so about 50% more than your basic unit. Looks like you are heavy on light infantry, pikes, heavy cavalry, and horse archers while being especially light on heavy infantry and archers. Unless you are getting really weird tactic rolls I wouldn't worry too much about the exact composition of your army.

I don't know the cut-off points for various tactics well enough to guess what range of tactics the army you are creating can use, but I'm pretty sure the answer is "yes" (which could lead to very swingy results). You probably want to check out the wiki page on tactics while you are debugging this since what tactics do is not particularly clear in game.
I understand now. It seems that this is very complex, but considering that there have been many war cases in history where the weak have defeated the strong, perhaps this situation is not unacceptable. It's just that I didn't know what rule this was based on before, thank you.
 
The winner is not fixed, in order to control variables, I have prepared commanders with the same tactics for both of them. Based on everyone's responses, I suspect that this randomness may be due to tactics. If that's the case, it can also be considered as some kind of 'have an evenly matched relationship with each other'
If there's a different winner every time you try this, and the commanders/tech/armies are exactly the same, then the "swinginess" is probably caused by something specific to the individual battle - either terrain or tactics.

Major terrain effects (eg. defending in mountains) should be easy to check while the battle is ongoing. Subtle terrain effects (eg. eligibility of tactics based on terrain) will be harder to check.

The army composition you've chosen is likely to cause random mediocre/bad tactics on both sides. There's probably not much you can do about this - it's probably not appropriate to create a metagame-optimised army for AI, especially if you're going to be sending them to fight each other.

But it is worth double-checking that everything other than terrain is exactly the same. For example: Has the AI assigned your newly-generated good-quality commanders to all 3 flanks of these special armies?
  • AI often hand out commander positions to arbitrary vassals, who are often terrible at the job.
  • If you aren't already doing it, it might be a good idea to rearrange your spawn logic so the new good commanders are forced to lead the new units.
    • Best I can manage on short notice is REFERENCE_TO_A_NEW_COMMANDER = { unsafe_give_minor_title = title_commander } + spawn_unit = { ... leader = REFERENCE_TO_A_NEW_COMMANDER ... }.
    • Perhaps: create exactly 3 commander characters, use the unsafe command to force them to be commanders, spawn exactly 3 (probably rather large) units for each hegemon, and use the leader parameter during the spawn to assign the 3 commanders to those specific units, then merge the units together to create a mega-army? But you would probably need to disable attrition for this mega-army, because 100k is unsupportable everywhere.
 
If there's a different winner every time you try this, and the commanders/tech/armies are exactly the same, then the "swinginess" is probably caused by something specific to the individual battle - either terrain or tactics.

Major terrain effects (eg. defending in mountains) should be easy to check while the battle is ongoing. Subtle terrain effects (eg. eligibility of tactics based on terrain) will be harder to check.

The army composition you've chosen is likely to cause random mediocre/bad tactics on both sides. There's probably not much you can do about this - it's probably not appropriate to create a metagame-optimised army for AI, especially if you're going to be sending them to fight each other.

But it is worth double-checking that everything other than terrain is exactly the same. For example: Has the AI assigned your newly-generated good-quality commanders to all 3 flanks of these special armies?
  • AI often hand out commander positions to arbitrary vassals, who are often terrible at the job.
  • If you aren't already doing it, it might be a good idea to rearrange your spawn logic so the new good commanders are forced to lead the new units.
    • Best I can manage on short notice is REFERENCE_TO_A_NEW_COMMANDER = { unsafe_give_minor_title = title_commander } + spawn_unit = { ... leader = REFERENCE_TO_A_NEW_COMMANDER ... }.
    • Perhaps: create exactly 3 commander characters, use the unsafe command to force them to be commanders, spawn exactly 3 (probably rather large) units for each hegemon, and use the leader parameter during the spawn to assign the 3 commanders to those specific units, then merge the units together to create a mega-army? But you would probably need to disable attrition for this mega-army, because 100k is unsupportable everywhere.
Thank you for reminding! In order to observe whether it is related to this, I created a full number of commanders for them through, and now it seems that the terrain and tactics have greatly influenced the battlefield pattern.