Seems to work fine, thank you very much.
Another thing I tried to add was to not only allow to target direct vassals but also the indirect ones (vassals of my vassal). I tried changing the line liege = { ai = no } to is_vassal_or_below = ROOT. According to conditions on wiki it should check if targeted character is your direct or indirect vassal but it didn't show the decision at all. What did I do wrong here?
Also, as a follow up to that, I tried to add custom lift excommunication decision and did it like that:
Code:
lift_excommunication_from_vassal = {
ai = no
from_potential = {
religion = catholic
}
}
potential = {
liege = { ai = no }
religion = FROM
}
allow = {
FROM = {
piety >= 25
}
trait = excommunicated
}
effect = {
FROM = { piety = -25 }
remove_trait = excommunicated
}
}
}
So I added the requirements for the player to be catholic and for vassal to be catholic (that worked in the excommunicate decision so I guess it's not wrong here) but for some reason this decision didn't appear in the game either. Any idea what is wrong here?
is_vassal_or_below
checks if the
condition target is the vassal of the
scope. The condition target is what comes after the = sign here. But in a targeted decision, ROOT is the person targeted by the decision. Thus, in this case
is_vassal_or_below = ROOT
is checking whether or not the scope is the vassal of the person you're targeting, which the player won't be in your intended use case.
Inside your
potential
block, you should instead put
is_vassal_or_below = FROM
, because in targeted decisions, FROM is the decision taker, in this case the player. Thus the it pass the potential if the targeted character is your vassal.
For your excommunication-lifting decision, it looks like you have a couple of stray brackets. Brackets should always come in pairs, one to open a segment and one to close it. Extra brackets will cause errors when the game tries to evaluate the code. (So will missing brackets, for that matter.)
You have a stray bracket in your
from_potential
block, alone on the line right below
religion = catholic
.
You have a second stray bracket in your
effect
block, alone on the line right below
remove_trait = excommunicated
.
Remove those stray brackets.
If you're not already, I highly recommend using Notepad++. When your cursor is next to a bracket, it will highlight in red and also highlight its matching bracket (the opening bracket if your cursor is at the closing one, or vice versa), giving you an easy visual cue to check if your brackets are right or if you're missing one or have an extra.
I also recommend downloading the Validator, which is great at catching errors like this. If you're going to be doing a lot of CK2 coding, it's a must. Can't tell you how many times I've pored over code that wasn't working, unable to find the error, only to run Validator and have it find the error immediately.