Scripted effect
get_popular_revolt_target_effect
get_popular_revolt_target_effect = { FACTION = … }game/common/scripted_effects/00_faction_effects.txt, line 93 (175 lines). Parameters: $FACTION$.
get_popular_revolt_target_effect is a scripted effect in Crusader Kings III, written at line 93 of its file. A call passes 1 parameter: FACTION. The game's script calls it in 3 places, among them setup_populist_leader_effect (scripted effect), Escalated Peasant Faction (factions) and Populist Faction (factions). Patch 1.20.1.2, from game/common/scripted_effects/00_faction_effects.txt.
The comment above it in the file
Get the most appropriate 'target title' we can for a popular revolt (determines the de jure area the war will target, not final titles granted).
What it does
Every line of it is script with no tooltip text: the script is below.
The script as written (120 lines of game script)
get_popular_revolt_target_effect = {
$FACTION$ = {
save_scope_as = faction
faction_target = {
save_scope_as = faction_target
}
# First check if there are any valid kingdoms to target.
if = {
limit = {
# Only large revolts in large realms are eligible to target an entire kingdom.
any_faction_county_member = {
count >= 11
}
scope:faction_target.primary_title.tier >= tier_kingdom
}
every_faction_county_member = {
kingdom = {
if = {
# Do not target titles held by rulers outside of our realm.
limit = {
NOT = { exists = holder }
holder.top_liege = scope:faction_target
}
}
add_to_list = tmp_potential_kingdoms
}
}
# Out of the valid kingdoms (if any), pick the 'best' one
ordered_in_list = {
list = tmp_potential_kingdoms
order_by = {
# First look at the total number of rebels within the kingdom's de jure territory.
value = 0
add = {
value = 0
every_in_de_jure_hierarchy = {
limit = {
tier = tier_county
any_title_joined_faction = {
this = $FACTION$
}
}
add = total_county_levies
}
}
if = {
limit = {
exists = holder
}
if = {
# Prefer targeting titles held by the faction target...
limit = {
holder != scope:faction_target
}
multiply = 0.5
}
else_if = {
#...but not the target's primary title (we don't want to usurp them if we can help it!)
limit = {
this = scope:faction_target.primary_title
}
multiply = 0.5
}
}
}
save_scope_as = tmp_target_title
}
}
# If we were ineligible for kingdom-tier or failed to find a valid one, look for duchies.
if = {
limit = {
NOT = { exists = scope:tmp_target_title}
# Mid-sized or larger revolts in medium realms are eligible for duchy titles.
any_faction_county_member = {
count >= 5
}
faction_target.primary_title.tier >= tier_duchy
}
every_faction_county_member = {
duchy = {
if = {
# Do not target titles held by rulers outside of our realm.
limit = {
NOT = { exists = holder }
holder.top_liege = scope:faction_target
}
}
add_to_list = tmp_potential_duchies
}
}
# Out of the valid duchies (if any), pick the 'best' one
ordered_in_list = {
list = tmp_potential_duchies
order_by = {
value = 0
# First look at the total number of rebels within the duchy's de jure territory.
add = {
value = 0
every_in_de_jure_hierarchy = {
limit = {
tier = tier_county
any_title_joined_faction = {
this = $FACTION$
}
}
add = total_county_levies
}
}
if = {
limit = {As written in game/common/scripted_effects/00_faction_effects.txt.
The first 120 of its 175 lines; the rest is in game/common/scripted_effects/00_faction_effects.txt from line 93.
Where it is used
Every place in common/, events/ and history/ that calls get_popular_revolt_target_effect.
Scripted effects (1)
Factions (2)
- Escalated Peasant Faction
- Populist Faction
Source: game/common/scripted_effects/00_faction_effects.txt and every file of common/, events/ and history/ that calls it, Crusader Kings III 1.20.1.2.