• 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.
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.)
I don't know if this concept would work as well for CBs, but when I've needed to select two different people, in entirely different courts or even realms, for the same decision, I wound up making two decisions. Part 1 is "Select Target 1" which gives them a flag and you a separate flag. With that flag on you, "Select Target 1" is no longer available, but "Select Target 2" is, and then you use that decision on any other target, which gives them a third flag. Then just find the characters by flags, save them as event targets, and do what you like with them.
 
I don't know if this concept would work as well for CBs, but when I've needed to select two different people, in entirely different courts or even realms, for the same decision, I wound up making two decisions. Part 1 is "Select Target 1" which gives them a flag and you a separate flag. With that flag on you, "Select Target 1" is no longer available, but "Select Target 2" is, and then you use that decision on any other target, which gives them a third flag. Then just find the characters by flags, save them as event targets, and do what you like with them.
Yes, that's basically what I meant in my final para. I guess I didn't explain it very well. What I was trying to say is that this kind of design is very easy and comprehensible for humans, but I think it would be very difficult to get the AI to use this system. In other words, if I want the AI to be able to use the feature, I actually have to build and maintain a completely-separate seemingly-identical feature with proper signposting for the AI. I have done this before, occasionally, but I think it will be particularly tricky in this particular circumstance, because it gets into the knotty issue of deciding "when and with whom should I go to war?" Or I could make it a player-only feature, which seems like a waste when already have the AI setting up semi-realistic tributary networks.
 
Yes, that's basically what I meant in my final para. I guess I didn't explain it very well. What I was trying to say is that this kind of design is very easy and comprehensible for humans, but I think it would be very difficult to get the AI to use this system. In other words, if I want the AI to be able to use the feature, I actually have to build and maintain a completely-separate seemingly-identical feature with proper signposting for the AI. I have done this before, occasionally, but I think it will be particularly tricky in this particular circumstance, because it gets into the knotty issue of deciding "when and with whom should I go to war?" Or I could make it a player-only feature, which seems like a waste when already have the AI setting up semi-realistic tributary networks.
I keep failing at basic reading comprehension. Sorry about that.

Not being particularly well practiced with CBs, nothing further comes to mind except just being very thorough with various factors in ai_chance. Sorry that's not very helpful. Perhaps one of the experts will be able to suggest something more.
 
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.)

A third-party targeted decision might be the best solution for what you're trying to do, but then you can't select the target title, if case that's important. The war could be declared in script and it would allow you to select either the tributary or the target, while using the targeted decision on the other of the two.

It's definitely not possible to dynamically set anything in the war screen, and the war name doesn't take custom localisation either, so that possibility is right out.

Could you share what exactly you're trying to do? I've got a decent idea at this point, but a comprehensive overview tends to help a lot. That would make it easier to help figure out a decent way to implement it. You're right that making the AI be able to use a feature sensibly is often the hardest part of both designing and implementing it.
 
I don't see a condition for number of kills a person has.

Since I know the Forge Bloodline ambition checks for murders, I looked into that, and that uses a variable counter that ticks for every on_death and adds to the killer's variable count. That only checks for murders and executions, not duels or anything else, so I'm going to make my own version of the on_death event that fires for the killer every time he kills someone, but I want to double-check here that there's not an easier way I'm missing.
 
I don't see a condition for number of kills a person has.

Since I know the Forge Bloodline ambition checks for murders, I looked into that, and that uses a variable counter that ticks for every on_death and adds to the killer's variable count. That only checks for murders and executions, not duels or anything else, so I'm going to make my own version of the on_death event that fires for the killer every time he kills someone, but I want to double-check here that there's not an easier way I'm missing.

any_kill_list_character = { count = 100 }
 
A third-party targeted decision might be the best solution for what you're trying to do, but then you can't select the target title, if case that's important. The war could be declared in script and it would allow you to select either the tributary or the target, while using the targeted decision on the other of the two.

It's definitely not possible to dynamically set anything in the war screen, and the war name doesn't take custom localisation either, so that possibility is right out.
I suspected that might be the case, but at least now I don't have to explicitly check - thanks!
Could you share what exactly you're trying to do? I've got a decent idea at this point, but a comprehensive overview tends to help a lot. That would make it easier to help figure out a decent way to implement it. You're right that making the AI be able to use a feature sensibly is often the hardest part of both designing and implementing it.
Overall, my goal is to facilitate (what seems to me like) a more-historical playstyle where you have a limited core territory that's directly administered (your demesne and vassals), surrounded by outlying territories which are very loosely controlled - you'll probably help them against existential threats, but you won't step in to solve every little issue they encounter. Basically, I think blobbing beyond ~50 duchies is both boring and unrealistic, and I want to facilitate some kind of "soft power" mechanic - eg. you might help to install your cousin on a faraway throne but then they're mostly on their own. (After all, the game is supposedly about dynastic success, not world conquest.)

So far, I've made a lot of progress by customising the tributary mechanics - it's not fully complete to my satisfaction, but it's working surprisingly well IMO, including for powerful AI suzerains. At the moment, this system helps me remain interested in a game for approx 100 years beyond my usual stopping-point-due-to-boredom, and I have started to realise some extensions which would make it even better. (Sure, I can force them for myself with the console, but I think it would be much better if they happened naturally without "cheating".)

For this particular development, I want to declare war on behalf of my tributaries. (As you've probably gathered!)

There are several reasons for this: (1) clean up bordergore; (2) have an occasional fun/challenging war; (3) expand my religion (for zealous characters); (4) prompt my tributaries to "do something", because they often seem to feel that they can't declare on anyone (if they declare on my other tributaries, they'll have to fight me, and I'm Very Scary; and their neighbours are also often quite large, so they don't want to fight them either). And then, of course, all of this applies to the AI as well - I want strong suzerain AI to create buffer states around themselves, and also to consider propping up their isolated co-religionists (eg. Crusader states).

Eventually, I want to be able to support my tributaries in all kinds of major wars - kingdom/duchy claims, holy wars, de jure county/duchy wars, maybe even invasions. However, initially I want to keep it simple and just get one type of war working properly (holy war), and get it working in such a way that it can act as a template that's easily expanded to other types of war.

After a lot of reflection, I'm pretty sure the only way to make this work for AI suzerains is to create CBs that suzerains can use to declare war directly. (I do not know exactly how AI decide when and where to go to war, and I'm not sure anyone does apart form maybe some of the devs, and I don't think it's practical to fully recreate all of that logic inside a targeted decision. So, the only real choice is to create a CB, because this means that the AI will use the same black-box logic to evaluate "should I declare war" as they use for every other CB.) And, as per the previous para, whatever method I end up with needs to be easily expanded to another 4-5 CBs.
 
Is there a way to set the perceived father of an unborn child?
 
Perhaps using set_father for one man and set_real_father for another?

A more indirect method might be impregnate_cuckoo, since it doesn't reveal the father, but if the woman is married, would it make the perceived father her husband?

Unsure if either approach would work for the potential use case I have in mind (an Ambitious/Lustful wife/concubine of a recently deceased ruler sleeping with someone with the intent of claiming any resulting child is the child of the deceased ruler) as any husband/consort at the time of the "I am pregnant!" event would be the wrong character and set_father on birth might spoil things based on the event/notification that fires for the mother's host.
 
Unsure if either approach would work for the potential use case I have in mind (an Ambitious/Lustful wife/concubine of a recently deceased ruler sleeping with someone with the intent of claiming any resulting child is the child of the deceased ruler) as any husband/consort at the time of the "I am pregnant!" event would be the wrong character and set_father on birth might spoil things based on the event/notification that fires for the mother's host.
I think a combination of both of @GodModder's suggestions might work, with some additional steps:
  • Block the start of the event chain for women who are married, concubine, or have consorts.
    • Historically speaking, I suspect that any child born 9 months into a marriage would by default be considered the legitimate child of the husband. For the wife to claim it was her dead husband's in this situation seems... unlikely.
    • Also block it for all the usual suspects: 0 fertility, graphical age over 45, imprisoned, incapable, etc.
  • impregnate_cuckoo between the woman and the real father
  • Immediately set "will not marry" on the woman, so that she can't acquire a new husband.
    • See previous argument: Any child born 8.5 months into a marriage would probably by default be assumed to be the husband's.
    • So, if a woman really wanted to claim to have a child by her dead husband, I think it's unlikely that she would willingly remarry until the child was born.
  • Consider immediately setting "in hiding" on the woman, so she can't become a concubine.
    • Historically speaking, I think it's just about possible that a woman in this situation might go into hiding for the whole duration of her pregnancy, which would be a way to avoid becoming a concubine (which is the other main way to mess up the event chain).
    • Even if it's not actually historical, it's definitely in line with historical romance tropes...
    • For added spice, she could go into hiding with her lover... um, I mean, dedicated friend and protector.
  • Child is born of an unknown father (but their traits/genetics/etc are based on their real father)
  • Immediately after birth, fire an event for the mother where she (or her host) can perform a set_father operation for her child.
    • I'm not sure exactly what you think might "spoil things" on birth.
    • One workaround would be to wait a few days to avoid conflicting with vanilla events. And it's relatively easy to write flavour text for this: "X is telling everyone that her newborn child was sired by her dead husband, do I accept?"
  • Don't forget to clean up "will not marry" and/or "in hiding"
 
Last edited:
So I created an event and triggered it by adding it to the character's history, how do you also make sure said character had chosen one of the decisions that the event offered? once again by the character's history.
 
Hello! I was wondering if anyone knows how to force a ruler to use a certain succession law? I have made a dynastic law and made the change in history title use it but the ai will switch to prim instead. Any way to stop this?

Also I was wondering if there is a command for mat betrothal rather then regular? I am trying to get the ai to make smart marriages.
 
So I created an event and triggered it by adding it to the character's history, how do you also make sure said character had chosen one of the decisions that the event offered? once again by the character's history.
I don't know how adding events to history works, but in general you can decide which option in an event an AI chooses by using ai_chance, described on the Events modding page of the wiki: https://ck2.paradoxwikis.com/Event_modding#AI_chance
Hello! I was wondering if anyone knows how to force a ruler to use a certain succession law? I have made a dynastic law and made the change in history title use it but the ai will switch to prim instead. Any way to stop this?

Also I was wondering if there is a command for mat betrothal rather then regular? I am trying to get the ai to make smart marriages.
Most likely the ruler does not meet the requirements of the succession law's potential or allow blocks in \common\laws\succession_laws.txt. You will have to change the ruler to meet the qualifications, or mod that text file.

As far as I can tell there is no command for matrilineal betrothal, only matrilineal marriage. There isn't a lot of support for enatic-based marriages and successions in the game, as that was a pretty late addition with Holy Fury I believe.
 
So I created an event and triggered it by adding it to the character's history, how do you also make sure said character had chosen one of the decisions that the event offered? once again by the character's history.
I don't know how adding events to history works, but in general you can decide which option in an event an AI chooses by using ai_chance, described on the Events modding page of the wiki: https://ck2.paradoxwikis.com/Event_modding#AI_chance
Are you trying to make the AI characters take different options in a future event based on their past history, or are you trying to configure a character history file so that those options will already have been chosen in the past when play begins?

Because if it's the latter, you can probably skip all references to the actual decision or event, and skip straight to the consequences. For example, the Faerûn mod that I am working on features some characters who are vampires and can convert others. Rather than trying to call that decision in a character history file, I instead edit the character file entry for the victim, and put something like this:
Code:
1467.1.1 = {
        add_trait = vampire_spawn
        effect_even_if_dead = {
            opinion = {
                modifier = vampiric_spawn
                who = c_49749
                years = 9999
            }
        }
    }
That's the consequences of the decision, as applied to the person targeted. If you start on a date before 1467, it won't have happened (and probably won't happen in the future) but if you start after 1467, that historical event will have occurred, and if you play as the targeted character, you'll be able to see that you have the trait, and your relationship with the other vampire will be affected by the given opinion modifier. Similarly if the decision sets a global flag, just set the flag in an on_actions event on startup, and so on.

nd
 
Hello!
I am new in here and in ck2 modding too. I am trying to run Validator on my mod (it doesn't work), but I always get this:
validator-problem.png

Probably I am only dumb or blind. I am using NET framework 4.8.1 currenly, I suppose this is not a problem, but now I am not so sure.

What should I do for validate the mod? - The mod is adding only one culture group with one culture, nothing else.

I will be glad for every help, thanks!
 
Hello!
I am new in here and in ck2 modding too. I am trying to run Validator on my mod (it doesn't work), but I always get this:View attachment 1099912
Probably I am only dumb or blind. I am using NET framework 4.8.1 currenly, I suppose this is not a problem, but now I am not so sure.

What should I do for validate the mod? - The mod is adding only one culture group with one culture, nothing else.

I will be glad for every help, thanks!
Don't type the whole path, just the name of the mod file. Eg: "Projekt_M" (without quote marks).

(The second line of the validator error message is telling you the names of the 3 mods it detected in your system. Use one of those!)
 
so i have a question. What would you do in an event in order to write an event that will effectively make tribal vassals have two choices under their liege upon their liege death under elective Gavelkind:

First option will be the "Stay a vassal" option which will effectively do nothing and just have the vassal remain a vassal of their liege.

Second option: Will be the independent option which will make the vassal independent of their liege.

i got it working (sort of) when i tried to apply a similar code to the On-death on action event code written more in line for the player instead of the AI making the decision.

but i can't seem to get it working for the On-action on_elective_gavelkind_succession = { } onaction event.

i'm trying to base it off the other events in the game files which does exactly that but for Vassal limit calculations or even the other one which does it for the junior heir in the elective gavelkind succession upon the ruler's death.
#Regular Tribal Vassals can declare independence upon succession of the ruler. character_event = { id = EGS.100 desc = EVTDESC_EGS100 picture = GFX_evt_throne_room border = GFX_event_normal_frame_intrigue is_triggered_only = yes trigger = { top_liege = { OR = { tier = DUKE tier = KING tier = EMPEROR } OR = { has_law = tribal_organization_0 has_law = tribal_organization_1 } has_law = succ_elective_gavelkind is_tribal = yes } is_tribal = yes } immediate = { sound_effect = pagan_reformation } option = { name = EVTOPTB_EGS100 ai_chance = { factor = 100 modifier = { factor = 2 opinion = { who = FROM value = 25 } } modifier = { factor = 2 opinion = { who = FROM value = 50 } } modifier = { factor = 4 trait = content } } } option = { name = EVTOPTA_EGS100 ai_chance = { factor = 100 modifier = { factor = 2 NOT = { opinion = { who = FROM value = -25 } } } modifier = { factor = 2 NOT = { opinion = { who = FROM value = -50 } } } modifier = { factor = 4 trait = ambitious } } set_defacto_liege = THIS } }