• 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.
Food for thought, thanks! Why not using ROOT_FROM in the second exemple? Would it count as one or two scopes when it comes to PREV?

I don't think I have an alternative to using FROM. I need to script into the ai_defeat_worth section where FROM is the defender as the aim is to make the AI aware that it's fighting multiple wars so it's more willing to accept defeat in unimportant wars to win important one(s) rather than lose all. I call it the Karling dilemma, I got them to eagerly press their claims but when one does it's often targetted by another war so they end up losing their claims and only unifying through inheritance.
 
Last edited:
Food for thought, thanks! Why not using ROOT_FROM in the second exemple?
Very good point, you could use ROOT_FROM in either example. (I find the structure of the first example to be simpler and clearer, so I prefer that one. YMMV.)
Would it count as one or two scopes when it comes to PREV?
I don't know. It's described as a "shortcut", so I suspect it counts as two scopes for PREV, but I'm not sure.

It may be better to use ROOT = { FROM = { ... } }, ie. explicitly two scopes, instead of having to investigate the syntax in detail... As long as this doesn't push you over the 4-PREV limit.
I don't think I have an alternative to using FROM. I need to script into the ai_defeat_worth section where FROM is the defender as the aim is to make the AI aware that it's fighting multiple wars so it's more willing to accept defeat in unimportant wars to win important one(s) rather than lose all. I call it the Karling dilemma, I got them to eagerly press their claims but when one does it's often targetted by another war so they end up losing their claims and only unifying through inheritance.
Sounds like a very good idea - good luck!
 
  • 1
Reactions:
I tested and ROOT_FROM counts as only one scope ie.
Code:
job_chancellor = { ROOT_FROM = { spouse = { add_rival = PREVPREV
makes a rival of the chancellor.
 
I want to use
Code:
is_tributary = {
    type = imperial
    suzerain = FROM
}

Now, if I search the tributary file, I don't find mention of imperial (the exemple on the wiki), so I don't know where to look for the type of tributary I want. Where can I find it?
 
I want to use
Now, if I search the tributary file, I don't find mention of imperial (the exemple on the wiki), so I don't know where to look for the type of tributary I want. Where can I find it?
...\common\tributary_types

Chinese tributaries are offmap.
 
  • 1
Reactions:
Ensure that your .mod file has CleanSlate included in its dependency = { ... } block.

Then, my approach depends on the proportion of events in a file I'm changing:
--- If changing a large proportion of the events in a file: probably best to replace the entire file. (Copy the file to your mod, and make the relevant changes in it.)
--- If changing a small proportion of the events in a file: probably best to only replace those specific events. (Create a new events file in your mod, named "zzz_whatever.txt" - the "zzz_" means it's loaded after the base mod's events files, which means any duplicate events in this file will override the base mod's events. Copy the events you wish to change into this file - don't forget the namespace! Make your changes.)
Wait you can really override a single event by creating a new event file? So you declare the same namespace as vanilla, set the event name and prepend zzz to the filename?
 
For a part of a mod, I want numerous characters (both landed and not, both AI and not) from the same culture and religion to avoid marriage for a number of years (no more than a decade). I've been using a custom trait that has cannot_marry = yes, but this also prevents them from receiving any titles, which is annoying and inconvenient.

Is there a way to keep an AI character from marrying, without making them unable to be granted titles?
 
For a part of a mod, I want numerous characters (both landed and not, both AI and not) from the same culture and religion to avoid marriage for a number of years (no more than a decade). I've been using a custom trait that has cannot_marry = yes, but this also prevents them from receiving any titles, which is annoying and inconvenient.

Is there a way to keep an AI character from marrying, without making them unable to be granted titles?

Can't think of a way. It's a little sad that can_hold_titles exists, and yet Paradox couldn't be bothered to untangle that property from cannot_marry.
 
  • 1
Reactions:
Is there a way to keep an AI character from marrying, without making them unable to be granted titles?
Try giving them a trait with massive negative fertility. AI won't agree to marriage if the two are "unlikely to have children". And I don't think negative fertility blocks title grants.
 
  • 1
Reactions:
Would this stop a negative-fertility ruler from taking a non-landed courtier as their spouse?

Do AI rulers ever even bother to take courtiers as their spouses? Or are they always looking for a marriage alliance no matter what?

If that courtier is also low fertility, then perhaps, but otherwise no. Courtiers can't refuse a marriage their liege wants.
 
Of course, messing with fertility has plenty of other side effects, such as impacting whether all of these characters can get someone pregnant or become pregnant.
 
Would this stop a negative-fertility ruler from taking a non-landed courtier as their spouse?

Do AI rulers ever even bother to take courtiers as their spouses? Or are they always looking for a marriage alliance no matter what?
If you're worried about it, write an additional event which removes the negative-fertility trait when the AI character inherits/usurps/gains the title. (on_new_holder_inheritance, etc.)

Of course, messing with fertility has plenty of other side effects, such as impacting whether all of these characters can get someone pregnant or become pregnant.
Either that's an acceptable side-effect, or it can be worked-around. (Eg: on_yearly_pulse, if a character {has the trait} and {has a lover/spouse or is a consort/concubine} then remove the trait.)
 
Do you have some guidelines on what is/isn't savegame compatible?
 
If that courtier is also low fertility, then perhaps, but otherwise no. Courtiers can't refuse a marriage their liege wants.

Of course, messing with fertility has plenty of other side effects, such as impacting whether all of these characters can get someone pregnant or become pregnant.

If you're worried about it, write an additional event which removes the negative-fertility trait when the AI character inherits/usurps/gains the title. (on_new_holder_inheritance, etc.)


Either that's an acceptable side-effect, or it can be worked-around. (Eg: on_yearly_pulse, if a character {has the trait} and {has a lover/spouse or is a consort/concubine} then remove the trait.)

It's part of a religious/cultural event chain that everyone of the religion and culture go through in my mod, AI and non-AI included. It can happen to non-rulers, but is mainly intended for rulers. When hitting adulthood, everyone of this religion and culture must decide whether to piously undertake the rituals and trials of several years before getting married, or to impiously reject that path.

If they (whether AI or player) reject it, they lose piety but can marry as normal. Otherwise they can't marry for several years until they finish a particular event chain, which does things such as reward piety and gives whoever they end up marrying better traits and stats.

So what I'm trying to do is set a way to actively prevent such pious AI (of the appropriate religion/culture) from marrying until the event chain is completed. I've been using a custom trait with cannot_marry - yes which is given to them if they choose to be pious, and then removed at the end of the event chain (and replaced with another custom trait that gives high opinion with those of the same culture/religion, and does not block marriage).

Of course, the problem here is that, while unable to marry, they can't be granted titles, which is particularly problematic for me as a player who wants to award land to my vassals when either I have too many demesne titles, or I'm trying to give a duke one of his de jure counties that I'm currently holding.

Hence I will try the suggestion of using -10 fertility (equates to -1000%, same as the celibate trait I think) so that AI rulers won't get any other AI rulers agreeing to marriages with them due to low fertility.

But if negative-fertility AI rulers will just take wives from their court anyway, then that that's pointless.

Hence I'm asking: will they do that? Or does this negative fertility impact their behavior so that they decide not to take any courtiers as wives either?
 
Look at the Robin Hood events. There is one where you recruit Robin and his bride, but they aren't married yet. There is logic that prevents their getting married to other people, but I don't remember exactly what it is.

Alternatively, look at betrothing them to a random courtier for the duration. If you gave the courtier in an inaccessible location or in the court of someone who is at war, then they cannot get married. This doesn't work if they are already betrothed in their minority.
 
  • 1Like
Reactions:
Look at the Robin Hood events. There is one where you recruit Robin and his bride, but they aren't married yet. There is logic that prevents their getting married to other people, but I don't remember exactly what it is.

Alternatively, look at betrothing them to a random courtier for the duration. If you gave the courtier in an inaccessible location or in the court of someone who is at war, then they cannot get married. This doesn't work if they are already betrothed in their minority.
The events are in legends_events.txt but I don't see any logic for preventing them from marrying.

Betrothing may work? Perhaps if I give the betrothed a trait with cannot_marry = yes? And have an on_death event to check for someone who has that trait, so that a new betrothed can be created at that point.

A bit messy, but it could work.

But does anyone have confirmation whether or not a negative-fertility ruler will, or won't, refrain from marrying a courtier? I know a courtier can't refuse, but will the ruler even bother if he himself has negative fertility?