00 Marshal Tasks
00 Marshal Tasks
default_task = yes
position = councillor_marshal
task_type = task_type_general
task_progress = task_progress_infinite
effect_desc = {
### Organized levies
desc = task_organize_levies_effect_desc
triggered_desc = {
trigger = {
councillor_liege_has_erudition_legacy_5_perk = yes
}
desc = task_organize_levies_erudition_bonus
}
triggered_desc = {
trigger = {
councillor_liege_has_family_business_bonus = yes
}
desc = task_organize_levies_family_business_bonus
}
triggered_desc = {
trigger = {
councillor_liege_has_consulted_house_bonus = yes
}
desc = task_organize_levies_consulted_house_bonus
}
triggered_desc = {
trigger = {
scope:councillor_liege = {
has_title = title:c_byzantion
title:c_byzantion = { has_county_modifier =
pandidakterion_university_modifier }
}
}
desc = task_organize_levies_pandidakterion_bonus_desc
}
desc = {
desc = council_task_possible_side_effects
triggered_desc = {
trigger = {
scope:councillor_liege = {
any_active_accolade = {
has_accolade_parameter =
accolade_organize_army_bonus
}
}
}
desc =
task_train_commanders_acclaimed_knight_levy_captaincy
}
triggered_desc = {
trigger = {
scope:councillor_liege = {
any_sub_realm_county = {
NOT = { has_county_modifier =
marshal_task_organized_service_modifier }
}
}
martial > mediocre_skill_rating
}
desc = task_organize_levies_well_organized_service
}
triggered_desc = {
trigger = {
scope:councillor_liege = {
any_sub_realm_county = {
NOT = { has_county_modifier =
marshal_task_military_presence_modifier }
}
}
martial > mediocre_skill_rating
}
desc = task_organize_levies_increased_military_presence
}
triggered_desc = {
trigger = {
NOT = {
has_character_modifier =
marshal_task_levy_desertions_modifier
}
martial < high_skill_rating
}
desc = task_organize_levies_levy_desertion
}
triggered_desc = {
trigger = {
scope:councillor_liege = {
any_sub_realm_county = {
NOT = { has_county_modifier =
marshal_task_unused_farmland_modifier }
}
}
martial < high_skill_rating
}
desc = task_organize_levies_unused_farmland
}
triggered_desc = {
trigger = {
scope:councillor_liege = {
any_sub_realm_county = {
marshal_task_1003_county_trigger = yes
}
}
martial < high_skill_rating
}
desc = task_organize_levies_insufficient_guards
}
}
}
council_owner_modifier = {
name = task_organize_levies_modifier
garrison_size = 0.01
levy_reinforcement_rate = 0.01
scale = marshal_organize_levies_modifier_total
}
council_owner_modifier = {
name = task_organize_levies_maintenance_modifier
army_maintenance_mult = -0.01
scale = marshal_organize_levies_maintenance_total
}
monthly_on_action = organize_the_levies_marshal_task_side_effects
ai_will_do = {
value = 1 # Always a good backup
#AI prefers organizing levies over a low boost from Train Commanders if
they are at war or have a negative income
if = {
limit = {
scope:councillor_liege = {
OR = {
monthly_character_income <
monthly_character_expenses
is_at_war = yes
}
}
}
add = 8
}
task_train_commanders = {
position = councillor_marshal
task_type = task_type_general
task_progress = task_progress_infinite
effect_desc = {
### Commander Improvement
desc = task_train_commanders_maa_boost_effect_desc
desc = task_train_commanders_effect_desc
triggered_desc = {
trigger = {
councillor_liege_has_erudition_legacy_5_perk = yes
}
desc = task_train_commanders_commander_erudition_bonus_desc
}
triggered_desc = {
trigger = {
councillor_liege_has_family_business_bonus = yes
}
desc = task_train_commanders_commander_family_business_bonus_desc
}
triggered_desc = {
trigger = {
councillor_liege_has_consulted_house_bonus = yes
}
desc = task_train_commanders_commander_consulted_house_bonus_desc
}
triggered_desc = {
trigger = {
scope:councillor_liege = { has_character_modifier =
employer_booner_master_of_horse_2_modifier }
}
desc = task_train_commanders_master_of_horse_2_bonus_desc
}
triggered_desc = {
trigger = {
scope:councillor_liege = { has_character_modifier =
employer_booner_master_of_horse_3_modifier }
}
desc = task_train_commanders_master_of_horse_3_bonus_desc
}
desc = {
desc = council_task_possible_side_effects
triggered_desc = {
trigger = {
scope:councillor_liege = {
any_active_accolade = {
OR = {
has_accolade_parameter =
accolade_train_commanders_bonus
has_accolade_parameter =
accolade_train_commanders_bonus_high
}
}
}
}
desc =
task_train_commanders_acclaimed_knight_drills_hastiludes
}
triggered_desc = {
trigger = {
martial > mediocre_skill_rating
}
desc =
task_train_commanders_commander_learns_from_commander
}
triggered_desc = {
trigger = {
martial > mediocre_skill_rating
}
desc = task_train_commanders_knight_improved
}
triggered_desc = {
trigger = {
martial < high_skill_rating
}
desc = task_train_commanders_commander_wounded
}
triggered_desc = {
trigger = {
martial < high_skill_rating
}
desc = task_train_commanders_commander_maimed
}
triggered_desc = {
trigger = {
martial < high_skill_rating
}
desc = task_train_commanders_commander_killed
}
}
}
council_owner_modifier = {
name = task_boost_knights_modifier
knight_effectiveness_mult = 1
scale = {
value = marshal_knights_overtime_boost_scale
divide = 100
}
}
council_owner_modifier = {
name = task_boost_maa_modifier
maa_damage_mult = 1
maa_toughness_mult = 1
scale = {
value = marshal_maa_overtime_boost_scale
divide = 100
}
}
on_start_task = {
set_variable = {
name = marshal_maa_overtime_boost
value = 0
}
if = {
limit = {
any_task_contract = {
has_task_contract_type =
laamp_help_train_commanders_contract
NOT = { task_contract_target =
scope:councillor_liege }
}
any_player = {
is_landless_adventurer = yes
is_within_diplo_range = { CHARACTER =
scope:councillor }
any_character_task_contract = {
has_task_contract_type =
laamp_help_train_commanders_contract
count <= council_task_contracts_limit_value
}
can_create_task_contract = {
type_name =
laamp_help_train_commanders_contract
employer = scope:councillor
}
save_temporary_scope_as = player_laamp
}
}
scope:player_laamp = {
create_task_contract = {
task_contract_type =
laamp_help_train_commanders_contract
task_contract_tier =
scope:councillor.task_contract_tier_value
location = scope:councillor.councillor_task_target
task_contract_employer = scope:councillor
target = scope:councillor_liege
}
}
}
}
on_cancel_task = {
remove_variable = marshal_maa_overtime_boost
}
monthly_on_action = train_commanders_monthly_on_action
on_monthly = {
if = {
limit = {
has_variable = marshal_maa_overtime_boost
martial > var:marshal_maa_overtime_boost
}
change_variable = {
name = marshal_maa_overtime_boost
add = 1
}
}
}
ai_will_do = {
value = 0
# AI directive
if = {
limit = {
scope:councillor_liege = {
has_character_flag =
vassal_directive_train_commanders
vassal_is_valid_and_follows_directive_trigger =
{ VASSAL = this LIEGE = liege }
}
}
add = 10000
}
}
}
task_increase_control = {
position = councillor_marshal
task_type = task_type_county
county_target = realm
ai_county_target = domain
task_progress = task_progress_value
task_current_value =
scope:councillor_liege.marshal_increase_control_current_progress
task_max_value = 100 # Highest possible county control
highlight_own_realm = yes
restart_on_finish = yes # If it "finishes" by removing a corruption modifier,
there'll still be control to regain
effect_desc = {
desc = task_increase_control_effect_desc
desc = {
desc = council_task_possible_side_effects
triggered_desc = {
trigger = {
scope:councillor_liege = {
any_active_accolade = {
has_accolade_parameter =
accolade_increase_control_bonus
}
}
}
desc =
task_increase_control_acclaimed_knight_subdues_peasantry
}
triggered_desc = {
trigger = {
martial > mediocre_skill_rating
}
desc = task_increase_control_increase_opinion
}
triggered_desc = {
trigger = {
martial > mediocre_skill_rating
}
desc = task_increase_control_baron_opinion_increase
}
triggered_desc = {
trigger = {
martial < high_skill_rating
}
desc = task_increase_control_lose_opinion
}
triggered_desc = {
trigger = {
martial < high_skill_rating
}
desc = task_increase_control_lose_control
}
triggered_desc = {
trigger = {
martial < high_skill_rating
}
desc = task_increase_control_baron_opinion_loss
}
}
}
# TOTAL PROGRESS MUST MATCH THE TOTAL OF THE COUNTY MODIFIERS BELOW
# Add all new progress values to the script value
marshal_increase_control_total
# Note that for Increase Control, the County Modifiers apply the actual
values, while progress is for player info only
progress = {
value = 0
add = {
value = marshal_increase_control_base
desc = INCREASE_CONTROL_BASE
}
add = {
value =
scope:councillor.marshal_increase_county_control_monthly_change
desc = SCALED_COUNCILLOR_MARTIAL_VALUE
}
# Relation Bonuses/Penalties
if = { # Friend
limit = {
scope:councillor_liege = {
has_relation_friend = scope:councillor
NOT = { has_relation_best_friend = scope:councillor }
}
}
add = {
value =
scope:councillor.marshal_increase_control_monthly_increase_friend_bonus
desc = COUNCILLOR_IS_YOUR_FRIEND
}
}
if = { # Best Friend
limit = {
scope:councillor_liege = {
has_relation_best_friend = scope:councillor
}
}
add = {
value =
scope:councillor.marshal_increase_control_monthly_increase_best_friend_bonus
desc = COUNCILLOR_IS_YOUR_BEST_FRIEND
}
}
if = { # Rival
limit = {
scope:councillor_liege = {
has_relation_rival = scope:councillor
NOT = { has_relation_nemesis = scope:councillor }
}
}
add = {
value =
scope:councillor.marshal_increase_control_monthly_increase_rival_bonus
desc = COUNCILLOR_IS_YOUR_RIVAL
}
}
if = { # Nemesis
limit = {
scope:councillor_liege = {
has_relation_nemesis = scope:councillor
}
}
add = {
value =
scope:councillor.marshal_increase_control_monthly_increase_nemesis_bonus
desc = COUNCILLOR_IS_YOUR_NEMESIS
}
}
if = {
limit = {
scope:councillor_liege = { has_perk =
strict_organization_perk }
}
add = {
value =
scope:councillor.marshal_increase_county_control_perk_bonus_monthly_change
desc = INCREASE_CONTROL_PERK_BONUS_VALUE
}
}
if = {
limit = {
councillor_liege_has_erudition_legacy_5_perk = yes
}
add = {
value =
scope:councillor.marshal_increase_county_control_erudition_bonus_monthly_change
desc = ERUDITION_DYNASTY_PERK_BONUS_VALUE
}
}
if = {
limit = {
councillor_liege_has_family_business_bonus = yes
}
add = {
value =
scope:councillor.marshal_increase_county_control_family_business_bonus_monthly_chan
ge
desc = FAMILY_BUSINESS_BONUS_VALUE
}
}
if = {
limit = {
councillor_liege_has_consulted_house_bonus = yes
}
add = {
value =
scope:councillor.marshal_increase_county_control_consulted_house_bonus_monthly_chan
ge
desc = CONSULTED_HOUSE_BONUS_VALUE
}
}
if = {
limit = {
scope:councillor = { has_character_modifier =
event_bonus_to_county_control }
}
add = {
value =
scope:councillor.marshal_increase_county_control_experience_bonus_monthly_change
desc = INCREASE_COUNTY_CONTROL_EXPERIENCE_BONUS_VALUE
}
}
if = {
limit = { exists = scope:county }
multiply = {
value = scope:county.monthly_county_control_growth_factor
desc = MARSHAL_COUNTY_SPEED_MODIFIERS
}
}
if = {
limit = {
exists = scope:county
scope:county = { has_county_modifier =
petition_liege_county_control_modifier }
}
add = {
value =
scope:councillor.petition_liege_county_control_modifier_value
desc = MARSHAL_INCREASE_CONTROL_LOCAL_COUNTY_MODIFIERS
}
}
#EP3
if = {
limit = {
scope:councillor_liege = {
employs_court_position = court_jester_court_position
court_position:court_jester_court_position = {
has_character_flag = famous_mime_control
}
}
}
add = {
value =
scope:councillor_liege.court_position:court_jester_court_position.marshal_court_jes
ter_contribution_value
desc = MARSHAL_INCREASE_CONTROL_MIME_MODIFIER
}
}
}
full_progress = marshal_increase_control_full_progress
custom_other_loc = MARSHAL_COUNTY_SPEED_OTHER
potential_county = {
scope:county = {
custom_description = {
text = potential_county_control_task_trigger
OR = {
has_county_corruption_trigger = yes
county_control < full_county_control
}
}
# If the growth factor is 0, no amount of trying to control helps
# (happens when the county is under siege/occupied most likely)
monthly_county_control_growth_factor > 0
}
}
county_modifier = {
name = marshal_increase_control_modifier
monthly_county_control_growth_add = 1
scale = marshal_increase_control_total
}
on_start_task_county = {
#spawn a task contract
if = {
limit = {
scope:councillor_liege = {
is_independent_ruler = yes
}
any_player = {
is_landless_adventurer = yes
is_within_diplo_range = { CHARACTER =
scope:councillor }
any_character_task_contract = {
has_task_contract_type =
laamp_help_increase_control_contract
count <= council_task_contracts_limit_value
}
can_create_task_contract = {
type_name =
laamp_help_increase_control_contract
employer = scope:councillor
}
save_temporary_scope_as = player_laamp
}
}
scope:player_laamp = {
create_task_contract = {
task_contract_type =
laamp_help_increase_control_contract
task_contract_tier =
scope:councillor.task_contract_tier_value
location = scope:county.title_province
task_contract_employer = scope:councillor
target = scope:councillor.liege
destination = scope:county.title_province
save_scope_as = task_contract
}
}
}
}
on_finish_task_county = {
if = {
limit = {
scope:county = {
has_county_corruption_trigger = yes
}
}
scope:county = {
marshal_remove_random_county_corruption_modifier_effect =
yes
change_county_control = -25
}
}
}
monthly_on_action = increase_control_monthly_on_action
on_monthly_county = {
random = {
chance = scope:councillor.marshal_remove_county_corruption_chance
scope:county = {
marshal_remove_random_county_corruption_modifier_effect =
yes
}
}
}
ai_will_do = {
value = 1000 # Highest prio
if = { # Keep doing Organize levies if you're at war
limit = {
scope:councillor_liege = {
is_at_war = no
}
}
add = 19000
}
if = { # Keep doing Organize levies if you're at war
limit = {
is_performing_council_task = task_organize_levies
scope:councillor_liege = {
is_at_war = yes
}
}
add = -1000
}
if = { # Stop doing this if Organize levies could help you lose less
gold during a war
limit = {
NOT = {
is_performing_council_task = task_organize_levies
}
scope:councillor_liege = {
is_at_war = yes
monthly_character_income < monthly_character_expenses
}
}
add = -1000
}
}
}
task_manage_guards = {
position = councillor_marshal
task_type = task_type_general
task_progress = task_progress_infinite
effect_desc = {
desc = task_manage_guards_knights_desc
triggered_desc = {
trigger = {
councillor_liege_has_erudition_legacy_5_perk = yes
}
desc = task_manage_guards_erudition_bonus_knights
}
triggered_desc = {
trigger = {
councillor_liege_has_family_business_bonus = yes
}
desc = task_manage_guards_family_business_bonus_knights
}
triggered_desc = {
trigger = {
councillor_liege_has_consulted_house_bonus = yes
}
desc = task_manage_guards_consulted_house_bonus_knights
}
desc = task_manage_guards_scheme_desc
triggered_desc = {
trigger = {
councillor_liege_has_erudition_legacy_5_perk = yes
}
desc = task_manage_guards_erudition_bonus_scheme
}
triggered_desc = {
trigger = {
councillor_liege_has_family_business_bonus = yes
}
desc = task_manage_guards_family_business_bonus_scheme
}
triggered_desc = {
trigger = {
councillor_liege_has_consulted_house_bonus = yes
}
desc = task_manage_guards_consulted_house_bonus_scheme
}
desc = {
desc = council_task_possible_side_effects
triggered_desc = {
trigger = {
martial > mediocre_skill_rating
}
desc = task_manage_guards_knight_improved
}
triggered_desc = {
trigger = {
martial > mediocre_skill_rating
}
desc = task_manage_guards_scheme_disrupted
}
triggered_desc = {
trigger = {
martial < high_skill_rating
}
desc = task_manage_guards_knight_wounded
}
triggered_desc = {
trigger = {
martial < high_skill_rating
}
desc = task_manage_guards_disorganized
}
}
}
is_shown = {
has_dlc_feature = royal_court
}
council_owner_modifier = {
name = task_manage_guards_knight_modifier
knight_effectiveness_mult = 1
scale = {
value = marshal_overtime_boost_scale
divide = 200
}
}
council_owner_modifier = {
name = task_manage_guards_scheme_modifier
enemy_hostile_scheme_success_chance_add = -1
scale = {
value = marshal_overtime_decrease_scale
}
}
is_valid_showing_failures_only = {
scope:councillor_liege = {
court_grandeur_current_level >= 3
}
}
on_start_task = {
liege = {
set_variable = {
name = marshal_overtime_boost
value = 0
}
set_variable = {
name = marshal_overtime_decrease
value = 0
}
}
}
on_cancel_task = {
liege = {
remove_variable = marshal_overtime_boost
remove_variable = marshal_overtime_decrease
}
}
monthly_on_action = manage_guards_marshal_task_side_effects
on_monthly = {
if = {
limit = {
liege = { is_ai = no }
}
if = {
limit = {
liege = {
has_variable = marshal_overtime_boost
var:marshal_overtime_boost <
marshal_overtime_boost_max
}
}
liege = {
change_variable = {
name = marshal_overtime_boost
add =
root.marshal_overtime_boost_monthly_increase
}
}
}
if = {
limit = {
liege = {
has_variable = marshal_overtime_decrease
var:marshal_overtime_decrease >
marshal_overtime_decrease_max
}
}
liege = {
change_variable = {
name = marshal_overtime_decrease
add =
root.marshal_overtime_decrease_monthly_increase
}
}
}
}
else = {
liege = {
set_variable = {
name = marshal_overtime_boost
value = root.marshal_overtime_boost_monthly_increase
}
set_variable = {
name = marshal_overtime_decrease
value =
root.marshal_overtime_decrease_monthly_increase
}
}
}
}
ai_will_do = {
value = 0