• 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.

Romulien

Lt. General
19 Badges
Jul 2, 2013
1.404
308
  • Crusader Kings II
  • Major Wiki Contributor
In theory, simple diplomatic actions that do not require a specific UI (like vassal or title selection panel), could be re-implemented as targeted decisions, allowing to customize them further in mods. This could greatly benefit the modding community :)
I wonder if anyone had undertaken such project (or even part of it), and re-coded some hardcoded vanilla diploaction logic ?

I took a shot at the "Demand Religious Conversion" action, in scope of WtWSMS mod.
Feel free to raise any wrong/missing logic compared to vanilla !

Targeted decision:
Code:
	# "Demand Religious Conversion"
	# Note: need to disable DEMAND_RELIGIOUS_CONVERSION_INTERACTION_ENABLED in defines.lua
	# - Split in 2 decisions as there is no ai_target_filter for both direct vassals and courtiers.
	
	demand_courtier_religious_conversion = {
		ai_target_filter = home_court
		from_potential = {
			is_ruler = yes
		}
		potential = {
			NOT = { religion = FROM }
			vassal_of = FROM
			is_ruler = no
		}
		allow = {
			opinion = { who = FROM value = 25}
			FROM = {
				custom_tooltip = { 
					text = TT_NOT_UNREFORMED_PAGAN
					hidden_tooltip = {
						OR = {
							NOT = { religion_group = pagan_group }
							is_reformed_religion = yes
						}
					}
				}
			}
			NOT = { controls_religion = yes }
		}
		effect = {
			# Fire any event that would normally be fired by the on_action on_vassal_accepts_religious_conversion
			custom_tooltip = {
				text = "demand_religious_conversion_tooltip"
				hidden_tooltip = {
					FROM = { 
						character_event = { id = conv.1 }
					}
				}
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
		}
	}
	
	demand_vassal_religious_conversion = {
		ai_target_filter = vassals
		from_potential = {
			is_ruler = yes
		}
		potential = {
			NOT = { religion = FROM }
			vassal_of = FROM
			is_ruler = yes
		}
		allow = {
			opinion = { who = FROM value = 35}
			FROM = {
				custom_tooltip = { 
					text = TT_NOT_UNREFORMED_PAGAN
					hidden_tooltip = {
						OR = {
							NOT = { religion_group = pagan_group }
							is_reformed_religion = yes
						}
					}
				}
			}
			NOT = { controls_religion = yes }
		}
		effect = {
			# Fire any event that would normally be fired by the on_action on_vassal_accepts_religious_conversion
			custom_tooltip = {
				text = "demand_religious_conversion_tooltip"
				hidden_tooltip = {
					FROM = { 
						character_event = { id = conv.1 }
					}
				}
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
		}
	}

Events:
Code:
namespace = conv

#ROOT is the demander, FROM is the vassal
character_event = {
	id = conv.1
	
	is_triggered_only = yes
	hide_window = yes
	
	immediate = {
		FROM = {
			character_event = { id = conv.2 }
		}
	}
}

#ROOT is the vassal, FROM is the demander
character_event = {
	id = conv.2
	
	is_triggered_only = yes
	hide_window = yes
	
	immediate = {
		# Fires for the vassal and each of his courtiers and vassals.
		# Note: needs to fire for vassals/courtier before character
		# FROMFROM is the demander. FROM is the vassal. ROOT is the character.
		any_courtier = {
			character_event = { id = 39700 }
		}
		any_vassal = {
			character_event = { id = 39700 }
		}
		character_event = { id = 39700 }
	}
}

Localization:
Code:
#CODE;ENGLISH;FRENCH;GERMAN;;SPANISH;;;;;;;;;x
demand_vassal_religious_conversion;Demand Religious Conversion;Exiger une conversion religieuse;Religiöse Konversion fordern;;Solicitar conversión religiosa;;;;;;;;;x
demand_vassal_religious_conversion_named;Demand that [Root.GetFirstName] embrace the [From.Religion.GetName] faith.;Exigez que [Root.GetFirstName] se convertisse à la foi [From.Religion.GetName];Fordern, dass [Root.GetFirstName] den [From.Religion.GetName]-Glauben annimmt;;Exige que [Root.GetFirstName] adopte el [From.Religion.GetName].;;;;;;;;;x
demand_vassal_religious_conversion_desc;You can demand that one of your subjects converts to the true faith, but if they refuse their opinion of you will be lowered.;Vous pouvez exiger qu’un de vos sujets se convertisse à la vraie foi, mais s’il refuse, l’opinion qu’il a de vous diminuera.;Ihr könnt von Euren Untertanen fordern, dass sie zum Wahren Glauben übertreten. Wenn sie ablehnen, sinkt jedoch ihre Meinung über Euch.;;Puedes exigir que uno de tus súbditos se convierta a la fe verdadera, pero si se niega, la opinión que tenga de ti bajará.;;;;;;;;;x
demand_vassal_religious_conversion_tooltip;[Root.GetFirstName] and the same faith members of [Root.GetHerHis] court receive an event.\n;;;;;;;;;x
demand_courtier_religious_conversion;Demand Religious Conversion;Exiger une conversion religieuse;Religiöse Konversion fordern;;Solicitar conversión religiosa;;;;;;;;;x
demand_courtier_religious_conversion_named;Demand that [Root.GetFirstName] embrace the [From.Religion.GetName] faith.;Exigez que [Root.GetFirstName] se convertisse à la foi [From.Religion.GetName];Fordern, dass [Root.GetFirstName] den [From.Religion.GetName]-Glauben annimmt;;Exige que [Root.GetFirstName] adopte el [From.Religion.GetName].;;;;;;;;;x
demand_courtier_religious_conversion_desc;You can demand that one of your subjects converts to the true faith, but if they refuse their opinion of you will be lowered.;Vous pouvez exiger qu’un de vos sujets se convertisse à la vraie foi, mais s’il refuse, l’opinion qu’il a de vous diminuera.;Ihr könnt von Euren Untertanen fordern, dass sie zum Wahren Glauben übertreten. Wenn sie ablehnen, sinkt jedoch ihre Meinung über Euch.;;Puedes exigir que uno de tus súbditos se convierta a la fe verdadera, pero si se niega, la opinión que tenga de ti bajará.;;;;;;;;;x
demand_courtier_religious_conversion_tooltip;[Root.GetFirstName] and the same faith members of [Root.GetHerHis] court receive an event.\n;;;;;;;;;x

Defines.lua:
Code:
DEMAND_RELIGIOUS_CONVERSION_INTERACTION_ENABLED = 0
 
Last edited:
Can't the vanilla diploaction be also used with vassals, and not only courtier?

Otherwise, great initiative! Although I suspect the hardcoded actions are faster to cumpute than scripted ones. Also, you might want to look into religion file, there is a definition that states wether the ai will always try to convert, only if ai_zeal (a trait parameter) is high, or never. I think a rwplication of that should be included in the ai_will_do section
 
Can't the vanilla diploaction be also used with vassals, and not only courtier?

Yep, the targeted decision works on both too (vassal_of seem to cover both cases)
Edit: but there may be an issue for ai with ai_target_filter = home_court, not sure there is a filter that targets both court and vassals ?

Also, you might want to look into religion file, there is a definition that states wether the ai will always try to convert, only if ai_zeal (a trait parameter) is high, or never. I think a rwplication of that should be included in the ai_will_do section

Hmm, I think ai_convert_(same|other)_group is to determine if AI will send court chaplain to proselytize.
But yeah maybe it's used for AI logic of the diploaction too ! Unfortunately there's no trigger for these...
 
Last edited:
Does the courtier conversion demand convert their family? What does it mean by their "court"?
 
Does the courtier conversion demand convert their family? What does it mean by their "court"?

I don't think so. Does it in vanilla ?
The localization is a copy/paste from the vassal one, so might need to be adapted :)

Can I add into this that people who have specific traits or titles you cant demand there conversion ?

Yes ! You can add:
- conditions on the demander, inside from_potential (action hidden) or allow (action disabled, with tooltip explaining the conditions for human player)
- conditions on the target, inside potential (action hidden) or allow


I've just noticed I had left some "always = no" that deactivate the decision, I removed them in the OP.
 
Code:
demand_vassal_religious_conversion = {
		ai_target_filter = vassals
		from_potential = {
			is_ruler = yes
		}
		potential = {
			NOT = { religion = FROM }
			vassal_of = FROM
			is_ruler = yes
		}
		allow = {
			opinion = { who = FROM value = 35}
			FROM = {
				custom_tooltip = { 
					text = TT_NOT_UNREFORMED_PAGAN
					hidden_tooltip = {
						OR = {
							NOT = { religion_group = pagan_group }
							is_reformed_religion = yes
							NOT = { trait = coptic_abbot } ### Like This?
						}
					}
				}
			}
			NOT = { controls_religion = yes }
		}
		effect = {
			# Fire any event that would normally be fired by the on_action on_vassal_accepts_religious_conversion
			custom_tooltip = {
				text = "demand_religious_conversion_tooltip"
				hidden_tooltip = {
					FROM = { 
						character_event = { id = conv.1 }
					}
				}
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
		}
	}