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

Jaol

Kapudan Pasha
56 Badges
Jan 24, 2011
3.755
313
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Third Rome
  • Stellaris: Synthetic Dawn
  • Europa Universalis IV: Pre-order
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Sengoku
  • Semper Fi
  • Crusader Kings II
  • Europa Universalis IV: Res Publica
  • Hearts of Iron III Collection
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • Europa Universalis IV: Call to arms event
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • For the Motherland
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sword of Islam
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Mandate of Heaven
  • Surviving Mars: First Colony Edition
  • Surviving Mars
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Surviving Mars: Digital Deluxe Edition
  • Stellaris: Distant Stars
  • Surviving Mars: First Colony Edition
  • Stellaris: Megacorp
  • Imperator: Rome Deluxe Edition
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Victoria 2 Beta
  • Pride of Nations
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Holy Knight (pre-order)
  • 500k Club
  • Victoria 2
[MINI MOD] Improved Independence CB

Here are two versions of the independence cb that I think work better than vanilla. Both are compatible with 1.04c. Please feel free to incorporate this into any other mods.

Since most people who will be interested in this mini-mod will probably be combining it with another mod, I've just posted the code for each version of the cb. To use them, just overwrite the vanilla bid_for_independence cb.


1. No Free Revoke Title on White Peace

The first version simply removes the traitor modifier after a white peace. This means that the liege does not get a free revoke title unless he enforces demands in the war. So, the three possible outcomes for the war are:
  • Vassal Wins: The vassal becomes independent; the liege loses prestige/crown authority.
  • White Peace: The vassal does not become independent and loses prestige.
  • Liege Wins: The vassal does not become independent, loses prestige, and is imprisoned; the liege gets free revoke title on the vassal.
Code:
bid_for_independence = {
	name = CB_NAME_INDEPENDENCE
	war_name = WAR_NAME_INDEPENDENCE
	sprite = 12
	truce_days = 2190
	
	is_permanent = yes
	is_independence = yes

	can_use = {
		ROOT = {
			de_facto_liege = FROM
		}
		
		FROM = {
			NOT = {
				any_war = {
					attacker = {
						character = FROM
					}
					OR = {
						using_cb = bid_for_independence
						using_cb = depose_liege
					}
				}
			}
		}
	}

	is_valid = {
		ROOT = {
			OR = {
				liege = {
					character = PREV # either independent
				}
				liege = { 
					FROM = { 
						is_liege_or_above = PREV # or have shared liege
					}
				}
			}
		}
		FROM = {
			higher_tier_than = ROOT
		}
	}

	on_success = {
		if = {
			limit = {
				FROM = {
					independent = no
				}
			}
			FROM = {
				liege = {
					ROOT = {
						set_defacto_liege = PREV
					}
				}
			}
		}

		if = {
			limit = {
				FROM = {
					independent = yes
				}
			}
			ROOT = {
				set_defacto_liege = ROOT
			}
		}

		ROOT = {
			prestige = 200
			primary_title = {
				add_pressed_claim = FROM	
			}
		}

		FROM = {
			any_demesne_title = { # All titles
				limit = {
					OR = {
						tier = king
						tier = emperor
					}
					is_titular = no
					NOT = { has_law = centralization_0 }
				}
				if = {
					limit = { has_law = centralization_1 }
					add_law = centralization_0
				}
				if = {
					limit = { has_law = centralization_2 }
					add_law = centralization_1
				}
				if = {
					limit = { has_law = centralization_3 }
					add_law = centralization_2
				}
				if = {
					limit = { has_law = centralization_4 }
					add_law = centralization_3
				}
			}
		}
	}

	on_fail = {
		ROOT = {
			prestige = -100
		}
		FROM = {
			remove_opinion = {
				modifier = opinion_traitor
				who = ROOT
			}
		}
	}

	on_reverse_demand = {
		ROOT = {
			prestige = -200
			prisoner = FROM
		}
	}

	on_attacker_leader_death = {
		any_defender = {
			letter_event = {
				id = 251
			}
		}

		end_war = invalid
	}

	attacker_ai_victory_worth = {
		factor = -1 # always accept
	}
	
	attacker_ai_defeat_worth = {
		factor = 150
	}

	defender_ai_victory_worth = {
		factor = -1 # always accept
	}
	
	defender_ai_defeat_worth = {
		factor = 100
	}
}
2. Independence on White Peace if Liege is not De Jure

The second version includes the first, but it also checks if the war is between a vassal and his de jure liege or not. If it is, then a white peace works normally (i.e. the vassal is no longer independent). If however, the vassal is rebelling against a merely de facto liege, then a white peace gives the vassal independence. This makes having a de facto title over your vassals more important, and encourages the break-up of non de jure blobs.

With this version of the cb, the six possible outcomes for a war are:
  • Vassal Wins vs De Jure Liege: The vassal becomes independent; the liege loses prestige/crown authority and gets a claim on the vassal's primary title.
  • White Peace vs De Jure Liege: The vassal does not become independent and loses prestige.
  • De Jure Liege Wins: The vassal does not become independent, loses prestige, and is imprisoned; the liege gets free revoke title on the vassal.

  • Vassal Wins vs De Facto Liege: The vassal becomes independent; the liege loses prestige/crown authority and gets a claim on the vassal's primary title.
  • White Peace vs De Facto Liege: The vassal becomes independent but loses prestige; liege gets a claim on the vassal's primary title.
  • De Facto Liege Wins: The vassal does not become independent, loses prestige, and is imprisoned; the liege gets free revoke title on the vassal.
Code:
bid_for_independence = {
	name = CB_NAME_INDEPENDENCE
	war_name = WAR_NAME_INDEPENDENCE
	sprite = 12
	truce_days = 2190
	
	is_permanent = yes
	is_independence = yes

	can_use = {
		ROOT = {
			de_facto_liege = FROM
		}
		
		FROM = {
			NOT = {
				any_war = {
					attacker = {
						character = FROM
					}
					OR = {
						using_cb = bid_for_independence
						using_cb = depose_liege
					}
				}
			}
		}
	}

	is_valid = {
		ROOT = {
			OR = {
				liege = {
					character = PREV # either independent
				}
				liege = { 
					FROM = { 
						is_liege_or_above = PREV # or have shared liege
					}
				}
			}
		}
		FROM = {
			higher_tier_than = ROOT
		}
	}

	on_success = {
		if = {
			limit = {
				FROM = {
					independent = no
				}
			}
			FROM = {
				liege = {
					ROOT = {
						set_defacto_liege = PREV
					}
				}
			}
		}

		if = {
			limit = {
				FROM = {
					independent = yes
				}
			}
			ROOT = {
				set_defacto_liege = ROOT
			}
		}

		ROOT = {
			prestige = 200
			primary_title = {
				add_pressed_claim = FROM	
			}
		}

		FROM = {
			any_demesne_title = { # All titles
				limit = {
					OR = {
						tier = king
						tier = emperor
					}
					is_titular = no
					NOT = { has_law = centralization_0 }
				}
				if = {
					limit = { has_law = centralization_1 }
					add_law = centralization_0
				}
				if = {
					limit = { has_law = centralization_2 }
					add_law = centralization_1
				}
				if = {
					limit = { has_law = centralization_3 }
					add_law = centralization_2
				}
				if = {
					limit = { has_law = centralization_4 }
					add_law = centralization_3
				}
			}
		}
	}

	on_fail = {
		if = {
			limit = {
				ROOT = {
					NOT = { de_jure_liege = FROM }
				}
			}
			ROOT = {
				set_defacto_liege = ROOT
				primary_title = {
					add_pressed_claim = FROM	
				}
			}
		}
		ROOT = {
			prestige = -100
		}
		FROM = {
			remove_opinion = {
				modifier = opinion_traitor
				who = ROOT
			}
		}
	}

	on_reverse_demand = {
		ROOT = {
			prestige = -200
			prisoner = FROM
		}
	}

	on_attacker_leader_death = {
		any_defender = {
			letter_event = {
				id = 251
			}
		}

		end_war = invalid
	}

	attacker_ai_victory_worth = {
		factor = -1 # always accept
	}
	
	attacker_ai_defeat_worth = {
		factor = 150
	}

	defender_ai_victory_worth = {
		factor = -1 # always accept
	}
	
	defender_ai_defeat_worth = {
		factor = 100
	}
}

EDIT: added a claim on vassal titles lost via white peace for defacto lieges.
 
Last edited: