• Crusader Kings III Available Now!

    The realm rejoices as Paradox Interactive announces the launch of Crusader Kings III, the latest entry in the publisher’s grand strategy role-playing game franchise. Advisors may now jockey for positions of influence and adversaries should save their schemes for another day, because on this day Crusader Kings III can be purchased on Steam, the Paradox Store, and other major online retailers.


    Real Strategy Requires Cunning

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:

ngppgn

Field Marshal
18 Badges
Jan 29, 2011
3.510
653
  • Imperator: Rome
  • Imperator: Rome Deluxe Edition
  • Crusader Kings II: Jade Dragon
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Cadet
  • Stellaris Sign-up
  • Stellaris
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Res Publica
  • Heir to the Throne
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Conquest of Paradise
  • Divine Wind
  • Europa Universalis III: Chronicles
  • Europa Universalis III
  • Crusader Kings II: The Old Gods
  • Crusader Kings II
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
 

Romulien

Lt. General
19 Badges
Jul 2, 2013
1.404
308
  • Crusader Kings II
  • Major Wiki Contributor
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:

omega20056

Magnus Imperator
84 Badges
Dec 27, 2012
4.401
1.819
  • Cities: Skylines - Natural Disasters
  • Cities: Skylines - Mass Transit
  • Cities: Skylines - Green Cities
  • March of the Eagles
  • Cities: Skylines - Campus
  • Europa Universalis 4: Emperor
  • Cities: Skylines Industries
  • Europa Universalis IV: Res Publica
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Crusader Kings II
  • Europa Universalis IV: Pre-order
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Mare Nostrum
  • Imperator: Rome Deluxe Edition
  • Stellaris
  • Stellaris - Path to Destruction bundle
  • Imperator: Rome Sign Up
  • Europa Universalis IV: Third Rome
  • Imperator: Rome - Magna Graecia
  • Crusader Kings II: Jade Dragon
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: El Dorado
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Golden Century
  • Europa Universalis IV: Rights of Man
  • Crusader Kings II: Legacy of Rome
  • Stellaris: Leviathans Story Pack
  • Arsenal of Democracy
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Mandate of Heaven
  • 500k Club
  • Stellaris: Ancient Relics
  • Victoria 2
  • Imperator: Rome
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Synthetic Dawn
  • Stellaris: Lithoids
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Stellaris: Digital Anniversary Edition
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sword of Islam
Does the courtier conversion demand convert their family? What does it mean by their "court"?
 

Dhop84

Major
2 Badges
Dec 28, 2012
788
0
  • Crusader Kings II
  • 500k Club
Can I add into this that people who have specific traits or titles you cant demand there conversion ?
 

Romulien

Lt. General
19 Badges
Jul 2, 2013
1.404
308
  • Crusader Kings II
  • Major Wiki Contributor
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.
 

Dhop84

Major
2 Badges
Dec 28, 2012
788
0
  • Crusader Kings II
  • 500k Club
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
		}
	}