# Author(s): Angriest Bird, Kal, SWF51, Killerrabit # Millennium Dawn's Influence System: # The influence system is MD's take on using political soft power and pressuring other nations. # It is intended to mock superpower's sphere of influence. # Effect: install_influence_coup_rebel_party # Purpose: copy influence_coup_party onto a civil-war rebel install_influence_coup_rebel_party = { set_variable = { ruling_party = FROM.influence_coup_party } set_temp_variable = { _coup_slot = FROM.influence_coup_party } set_variable = { party_pop_array^_coup_slot = 0.7 } } # Effect: init_influence # Purpose: This is the main effect that is used to initialize the influence array init_influence = { clear_array = influence_array_val clear_array = influence_array } # Effect: update_dirty_influence_var # Purpose: This is the main effect that is used to update the dirty influence variable update_dirty_influence_var = { if = { limit = { check_variable = { global.update_influence_ui < 10000 } } add_to_variable = { global.update_influence_ui = 1 } } else = { set_variable = { global.update_influence_ui = 1 } } } # Effect: recalculate_influence # Purpose: This is the main effect that is used to recalculate the influence recalculate_influence = { hidden_effect = { sort_influence = yes calculate_influence_percentage = yes } } # Effect: sort_influence # Purpose: This is the main effect that is used to sort the influence array sort_influence = { resize_temp_array = { array = influence_array_val_temp size = influence_array_val^num } resize_temp_array = { array = influence_array_temp size = influence_array_val^num } # Sort by largest influencer; write only entries above threshold from existing nations for_loop_effect = { end = influence_array_val^num value = v find_highest_in_array = { array = influence_array_val value = max index = max_index } set_temp_variable = { current_tag = influence_array^max_index } if = { limit = { NOT = { check_variable = { max < 0.01 } } country_exists = var:current_tag } set_temp_variable = { influence_array_val_temp^v = max } set_temp_variable = { influence_array_temp^v = current_tag } } set_variable = { influence_array_val^max_index = -1 } } init_influence = yes # Unfilled temp slots are 0 from resize; skip them on restore set_temp_variable = { influence_total = 0 } for_each_loop = { array = influence_array_val_temp value = v index = i if = { limit = { NOT = { check_variable = { v = 0 } } } add_to_array = { influence_array_val = v } add_to_array = { influence_array = influence_array_temp^i } add_to_temp_variable = { influence_total = v } } } add_to_temp_variable = { influence_total = domestic_influence_amount } clear_temp_array = influence_array_val_temp clear_temp_array = influence_array_temp clamp_temp_variable = { var = influence_total min = 0.01 } set_temp_variable = { new_influence_scalar = { value = 100 divide = influence_total } } set_temp_variable = { foreign_sum = 0 } for_each_loop = { array = influence_array_val value = v index = i multiply_variable = { influence_array_val^i = new_influence_scalar } clamp_variable = { var = influence_array_val^i max = 100 min = 0 } add_to_temp_variable = { foreign_sum = influence_array_val^i } } set_variable = { domestic_influence_amount = 100 } subtract_from_variable = { domestic_influence_amount = foreign_sum } clamp_variable = { var = domestic_influence_amount max = 100 min = 0 } } # Effect: calculate_influence_percentage # Purpose: This is the main effect that is used to calculate the influence drift percentage calculate_influence_percentage = { set_variable = { democratic_drift_influence_var = 0 } set_variable = { neutrality_drift_influence_var = 0 } set_variable = { communism_drift_influence_var = 0 } set_variable = { nationalist_drift_influence_var = 0 } set_variable = { fascism_drift_influence_var = 0 } for_loop_effect = { end = influence_array_val^num if = { limit = { var:influence_array^v = { has_government = democratic } } add_to_variable = { democratic_drift_influence_var = influence_array_val^v } } else_if = { limit = { var:influence_array^v = { has_government = neutrality } } add_to_variable = { neutrality_drift_influence_var = influence_array_val^v } } else_if = { limit = { var:influence_array^v = { has_government = communism } } add_to_variable = { communism_drift_influence_var = influence_array_val^v } } else_if = { limit = { var:influence_array^v = { has_government = nationalist } } add_to_variable = { nationalist_drift_influence_var = influence_array_val^v } } else_if = { limit = { var:influence_array^v = { has_government = fascism } } add_to_variable = { fascism_drift_influence_var = influence_array_val^v } } } if = { limit = { NOT = { has_dynamic_modifier = { modifier = influence_drift_modifier } } } add_dynamic_modifier = { modifier = influence_drift_modifier } } multiply_variable = { nationalist_drift_influence_var = 0.001 } multiply_variable = { fascism_drift_influence_var = 0.001 } multiply_variable = { neutrality_drift_influence_var = 0.001 } multiply_variable = { communism_drift_influence_var = 0.001 } multiply_variable = { democratic_drift_influence_var = 0.001 } } # Influence AI Section: # These are general macro effects used in the influence AI. # Spread Influence: # Corresponds with the general spread influence button. spread_influence = { PREV = { add_political_power = -50 } set_temp_variable = { percent_change = global.percent_change_value } set_temp_variable = { tag_index = PREV.id } change_influence_percentage = yes if = { limit = { economic_aid_available = yes } PREV.PREV = { country_event = influence.0 } } if = { limit = { manipulate_politics_action_available = yes } manipulate_politics_action = yes } if = { limit = { coup_is_available = yes } PREV.PREV = { country_event = influence.44 } } if = { limit = { make_puppet_action_available = yes } make_puppet_action = yes } } # Effect: make_puppet_action # Purpose: This is the main effect that is used to puppet another nation make_puppet_action = { #eventually remove explotation idea (shouldn't double up) for_loop_effect = { end = influence_array^num value = v meta_effect = { text = { remove_ideas = tribute_idea_[THISTAG] } THISTAG = "[?var:influence_array^v.GetTag]" } } PREV = { if = { limit = { has_global_flag = GAME_RULE_allow_colored_puppets } set_autonomy = { target = PREV autonomy_state = autonomy_satellite_state_colored freedom_level = 0.5 } } else = { set_autonomy = { target = PREV autonomy_state = autonomy_satellite_state freedom_level = 0.5 } } add_named_threat = { threat = 2 name = created_puppet_loc } } every_neighbor_country = { add_opinion_modifier = { target = PREV modifier = puppeted_neighbor } } update_dirty_influence_var = yes } # Effect: economic_exploitation_action # Purpose: This is the main effect that is used to economically exploit another nation economic_exploitation_action = { meta_effect = { text = { add_timed_idea = { idea = tribute_idea_[ROOTTAG] days = 90 } } ROOTTAG = "[var:influence_array^0.GetTag]" } # Remove 10% Influence set_temp_variable = { percent_change = -10 } set_temp_variable = { tag_index = PREV.id } change_influence_percentage = yes #Opinion Modifiers add_opinion_modifier = { target = PREV modifier = exploited_us } every_neighbor_country = { add_opinion_modifier = { target = PREV modifier = exploited_neighbor } } every_allied_country = { add_opinion_modifier = { target = PREV modifier = exploited_ally } } } # Effect: manipulate_politics_action # Purpose: This is the main effect that is used to manipulate the politics of another nation. # Runs in the target country's scope (THIS = target, ROOT = influencer). # No parameters. var_pop (the base popularity shift) is derived from political_manipulation_corruption_factor, or 0.08 when no corruption idea is active. # Sets manipulate_politics_pp_cost (temp var) to -100, or -50 for PER+IRQ/AFG and ENG+COL special cases. manipulate_politics_action = { # Corruption raises political-manipulation vulnerability; the modifier carries the per-level base. set_temp_variable = { var_pop = modifier@political_manipulation_corruption_factor } if = { limit = { check_variable = { var_pop = 0 } } set_temp_variable = { var_pop = 0.08 } } # Base PP cost; special cases refund 50. set_temp_variable = { manipulate_politics_pp_cost = -100 } # Scale var_pop by the influencer's foreign influence mod minus the target's defense. set_temp_variable = { influence_defense_change = { value = modifier@foreign_influence_defense_modifier subtract = { value = 1 add = ROOT.modifier@foreign_influence_modifier } } } multiply_temp_variable = { var = var_pop value = { value = 1 add = ROOT.modifier@foreign_influence_modifier clamp = { min = 0.01 max = 0.15 } } } # PER shia-influence focus: stronger manipulation of allied sectarian parties in IRQ/AFG. if = { limit = { ROOT = { original_tag = PER has_completed_focus = PER_puppeteer_iraqi_politcs OR = { emerging_hardline_shiite_are_in_power = yes emerging_moderate_shiite_are_in_power = yes } } } if = { limit = { original_tag = IRQ } add_to_temp_variable = { manipulate_politics_pp_cost = 50 } add_to_temp_variable = { var_pop = -0.05 } set_temp_variable = { party_index = 6 } set_temp_variable = { party_popularity_increase = var_pop } set_temp_variable = { temp_outlook_increase = var_pop } change_relative_party_popularity = yes add_to_temp_variable = { var_pop = -0.02 } set_temp_variable = { party_index = 8 } set_temp_variable = { party_popularity_increase = var_pop } set_temp_variable = { temp_outlook_increase = var_pop } change_relative_party_popularity = yes # Reduce by -5% set_temp_variable = { percent_change = -5 } set_temp_variable = { tag_index = ROOT.id } set_temp_variable = { influence_target = THIS.id } change_influence_percentage = yes } else_if = { limit = { THIS = { original_tag = AFG } } add_to_temp_variable = { manipulate_politics_pp_cost = 50 } add_to_temp_variable = { var_pop = -0.05 } set_temp_variable = { party_index = 8 } set_temp_variable = { party_popularity_increase = var_pop } set_temp_variable = { temp_outlook_increase = var_pop } change_relative_party_popularity = yes add_to_temp_variable = { var_pop = -0.02 } set_temp_variable = { party_index = 9 } set_temp_variable = { party_popularity_increase = var_pop } set_temp_variable = { temp_outlook_increase = var_pop } change_relative_party_popularity = yes # Reduce by -5% set_temp_variable = { percent_change = -5 } set_temp_variable = { tag_index = ROOT.id } set_temp_variable = { influence_target = THIS.id } change_influence_percentage = yes } } # ENG + "macabre alliance" focus: same shia-style two-party push against COL. else_if = { limit = { ROOT = { original_tag = ENG has_idea = ENG_the_macabre_alliance } original_tag = COL } add_to_temp_variable = { manipulate_politics_pp_cost = 50 } add_to_temp_variable = { var_pop = -0.05 } set_temp_variable = { party_index = 8 } set_temp_variable = { party_popularity_increase = var_pop } set_temp_variable = { temp_outlook_increase = var_pop } change_relative_party_popularity = yes add_to_temp_variable = { var_pop = -0.02 } set_temp_variable = { party_index = 9 } set_temp_variable = { party_popularity_increase = var_pop } set_temp_variable = { temp_outlook_increase = var_pop } change_relative_party_popularity = yes # Reduce by -5% set_temp_variable = { percent_change = -5 } set_temp_variable = { tag_index = ROOT.id } set_temp_variable = { influence_target = THIS.id } change_influence_percentage = yes } else = { set_temp_variable = { party_index = ROOT.ruling_party } set_temp_variable = { party_popularity_increase = var_pop } set_temp_variable = { temp_outlook_increase = var_pop } change_relative_party_popularity = yes # Reduce by -10% set_temp_variable = { percent_change = -10 } set_temp_variable = { tag_index = ROOT.id } set_temp_variable = { influence_target = THIS.id } change_influence_percentage = yes } # Reduce Relations if different gov if = { limit = { NOT = { has_government = ROOT } } add_opinion_modifier = { target = ROOT modifier = supported_opposition } } } # MP Enhancements flat Economic Aid transfer. # Runs in the SENDER scope. Requires temp vars: mp_aid_amount, mp_aid_influence. # event_target:influence_sender / influence_recipient must be set by the caller. mp_economic_aid_transfer = { # Hoist the per-option temp vars to globals so they survive the scope switch below. set_variable = { global.mp_aid_amount = mp_aid_amount } set_variable = { global.mp_aid_influence = mp_aid_influence } subtract_from_variable = { treasury = global.mp_aid_amount } # Influence: influencer = sender, influencee = recipient. Effect uses var:influence_target internally. set_temp_variable = { percent_change = global.mp_aid_influence } set_temp_variable = { tag_index = event_target:influence_sender.id } set_temp_variable = { influence_target = event_target:influence_recipient.id } change_influence_percentage = yes event_target:influence_recipient = { add_to_variable = { treasury = global.mp_aid_amount } add_opinion_modifier = { target = event_target:influence_sender modifier = given_economic_aid_mp } event_target:influence_sender = { set_country_flag = { flag = recently_sent_aid@PREV value = 1 days = 30 } } } update_money_dirty_variable = yes update_dirty_influence_var = yes } automation_combat_foreign_influence_execute = { set_country_flag = { flag = automation_combat_foreign_influence_cooldown value = 1 days = 100 } set_temp_variable = { percent_change = 5 } change_domestic_influence_percentage = yes } automation_combat_influencer_attack_complete = { set_temp_variable = { influencer_index = -1 } for_each_loop = { array = influence_array value = current_influencer index = current_influencer_index if = { limit = { check_variable = { current_influencer = combat_influencer_target } } set_temp_variable = { influencer_index = current_influencer_index } } } if = { limit = { check_variable = { combat_influencer_target > 0 } check_variable = { influencer_index > -1 } check_variable = { influence_array_val^influencer_index > 0 } var:combat_influencer_target = { exists = yes } } set_temp_variable = { percent_change = -5 } change_current_influencer_index_percentage = yes } } automation_influence_domestic_action = { if = { limit = { NOT = { has_country_flag = automation_combat_foreign_influence_cooldown } check_variable = { influence_array^0 > 0 } NOT = { has_country_flag = influence_government_lobbied } } set_temp_variable = { automation_available_pp = { value = political_power subtract = automation_pp_reserve } } if = { limit = { check_variable = { var = automation_available_pp value = 100 compare = greater_than_or_equals } } log = "[GetDateText]: [ROOT.GetName]: Automatically combating foreign influence" add_political_power = -100 automation_combat_foreign_influence_execute = yes } } } automation_influence_attack_action = { if = { limit = { NOT = { has_decision = combat_biggest_influencer_decision } NOT = { has_decision = combat_second_influencer_decision } NOT = { has_decision = combat_third_influencer_decision } } set_temp_variable = { automation_available_pp = { value = political_power subtract = automation_pp_reserve } } if = { limit = { check_variable = { var = automation_available_pp value = 125 compare = greater_than_or_equals } } if = { limit = { NOT = { has_country_flag = automation_combat_biggest_influencer_cooldown } check_variable = { influence_array^0 > 0 } var:influence_array^0 = { NOT = { has_country_flag = automation_influence_attack_cooldown_@ROOT } } check_variable = { influence_array_val^0 > 0 } NOT = { check_variable = { influence_array^0 = ROOT.id } } var:influence_array^0 = { exists = yes } NOT = { AND = { has_country_flag = influence_government_lobbied check_variable = { influence_lobbied_by = influence_array^0 } } } } log = "[GetDateText]: [ROOT.GetName]: Automatically attacking influence from [?var:influence_array^0.GetName]" add_political_power = -125 activate_decision = combat_biggest_influencer_decision } else_if = { limit = { NOT = { has_country_flag = automation_combat_second_influencer_cooldown } check_variable = { influence_array^1 > 0 } var:influence_array^1 = { NOT = { has_country_flag = automation_influence_attack_cooldown_@ROOT } } check_variable = { influence_array_val^1 > 0 } NOT = { check_variable = { influence_array^1 = ROOT.id } } var:influence_array^1 = { exists = yes } NOT = { AND = { has_country_flag = influence_government_lobbied check_variable = { influence_lobbied_by = influence_array^1 } } } } log = "[GetDateText]: [ROOT.GetName]: Automatically attacking influence from [?var:influence_array^1.GetName]" add_political_power = -125 activate_decision = combat_second_influencer_decision } else_if = { limit = { NOT = { has_country_flag = automation_combat_third_influencer_cooldown } check_variable = { influence_array^2 > 0 } var:influence_array^2 = { NOT = { has_country_flag = automation_influence_attack_cooldown_@ROOT } } check_variable = { influence_array_val^2 > 0 } NOT = { check_variable = { influence_array^2 = ROOT.id } } var:influence_array^2 = { exists = yes } NOT = { AND = { has_country_flag = influence_government_lobbied check_variable = { influence_lobbied_by = influence_array^2 } } } } log = "[GetDateText]: [ROOT.GetName]: Automatically attacking influence from [?var:influence_array^2.GetName]" add_political_power = -125 activate_decision = combat_third_influencer_decision } } } } automation_influence_daily = { set_temp_variable = { automation_domestic_influence_fee_paid = 0 } set_temp_variable = { automation_influence_attack_fee_paid = 0 } if = { limit = { has_country_flag = automation_combat_foreign_influence } set_temp_variable = { automation_available_pp = { value = political_power subtract = automation_pp_reserve } } if = { limit = { check_variable = { var = automation_available_pp value = 0.05 compare = greater_than_or_equals } } add_political_power = -0.05 set_temp_variable = { automation_domestic_influence_fee_paid = 1 } } } if = { limit = { has_country_flag = automation_attack_foreign_influencers } set_temp_variable = { automation_available_pp = { value = political_power subtract = automation_pp_reserve } } if = { limit = { check_variable = { var = automation_available_pp value = 0.05 compare = greater_than_or_equals } } add_political_power = -0.05 set_temp_variable = { automation_influence_attack_fee_paid = 1 } } } if = { limit = { check_variable = { automation_domestic_influence_fee_paid = 1 } } automation_influence_domestic_action = yes } if = { limit = { check_variable = { automation_influence_attack_fee_paid = 1 } } automation_influence_attack_action = yes } } # Effect: change_domestic_influence_percentage # Purpose: This is the main effect that is used to change the domestic influence percentage # Parameters: # - percent_change: The percentage change to the domestic share change_domestic_influence_percentage = { add_to_variable = { domestic_influence_amount = percent_change } set_temp_variable = { skip_index = -1 } set_temp_variable = { held_value = domestic_influence_amount } set_temp_variable = { scale_domestic = 0 } set_temp_variable = { extra_outlook = 0 } redistribute_influence_pool = yes recalculate_influence = yes custom_effect_tooltip = change_domestic_influence_percentage_tt } # Effect: change_current_influencer_index_percentage # Purpose: This is the main effect that is used to change influence on another nation # Parameters: # - percent_change: The percentage change to the influence # - influencer_index: The index of the influencer nation, supports all native country scopes change_current_influencer_index_percentage = { set_temp_variable = { percent_change_temp = percent_change } add_to_variable = { influence_array_val^influencer_index = percent_change_temp } set_temp_variable = { skip_index = influencer_index } set_temp_variable = { held_value = influence_array_val^influencer_index } set_temp_variable = { scale_domestic = 1 } set_temp_variable = { extra_outlook = 0 } redistribute_influence_pool = yes recalculate_influence = yes set_temp_variable = { percent_change = percent_change_temp } custom_effect_tooltip = change_index_influencer_tt } # Effect: redistribute_influence_pool # Purpose: Rescale the non-locked influence pool so every share sums to 100 after one actor is fixed. # Parameters (temp vars, all required): # - skip_index: array index of the locked actor to exclude from the pool (-1 = exclude none) # - held_value: the locked actor's share; the pool is scaled to fill (100 - held_value) # - scale_domestic: 1 to treat domestic_influence_amount as part of the pool, 0 to leave it untouched # - extra_outlook: extra mass added to the divisor only (e.g. a demoted top influencer's old value) redistribute_influence_pool = { set_temp_variable = { influence_outlook_amount = extra_outlook } if = { limit = { check_variable = { scale_domestic = 1 } } add_to_temp_variable = { influence_outlook_amount = domestic_influence_amount } } for_each_loop = { array = influence_array_val value = v index = i if = { limit = { NOT = { check_variable = { i = skip_index } } } add_to_temp_variable = { influence_outlook_amount = v } } } clamp_temp_variable = { var = influence_outlook_amount min = 0.01 } set_temp_variable = { temp_total = { value = 100 subtract = held_value divide = influence_outlook_amount } } if = { limit = { check_variable = { scale_domestic = 1 } } if = { limit = { check_variable = { domestic_influence_amount < 1 } } set_variable = { domestic_influence_amount = 1 } } multiply_variable = { domestic_influence_amount = temp_total } } for_each_loop = { array = influence_array_val index = i if = { limit = { NOT = { check_variable = { i = skip_index } } } multiply_variable = { influence_array_val^i = temp_total } } } } # Effect: apply_influence_special_modifiers # Purpose: Per-country influence-effectiveness modifiers folded into influence_change before the # final +1 multiplier in change_influence_percentage. Runs in the influence-target scope with # the influencer is held in tag_index; only the matching tag_index / original_tag branch runs. apply_influence_special_modifiers = { # How-to: gate on the influencer (tag_index) or the target (original_tag, = current scope), # then check the target's idea. Add the delta to influence_change. Only the matching branch runs. # -- Influencer-specific (only the matching tag_index branch evaluates) -- if = { limit = { check_variable = { tag_index = ISR } } if = { limit = { has_idea = full_isr_boycotte } add_to_temp_variable = { influence_change = -0.10 } } if = { limit = { has_idea = pol_isr_boycotte } add_to_temp_variable = { influence_change = -0.05 } } } else_if = { limit = { check_variable = { tag_index = USA } } if = { limit = { has_idea = USA_usaid } add_to_temp_variable = { influence_change = 0.05 } } } else_if = { limit = { check_variable = { tag_index = FRA.id } } if = { limit = { OR = { has_idea = cfa_franc has_idea = cfa_franc_2 } } add_to_temp_variable = { influence_change = 0.10 } } if = { limit = { has_idea = the_eco } add_to_temp_variable = { influence_change = 0.12 } } if = { limit = { has_dynamic_modifier = { modifier = AFRICA_idea_nepad_modifier } } add_to_temp_variable = { influence_change = 0.10 } } } else_if = { limit = { check_variable = { tag_index = PER } } if = { limit = { has_idea = IRQ_expulsion_of_iranian_idea } add_to_temp_variable = { influence_change = -0.15 } } } else_if = { limit = { check_variable = { tag_index = CHI } } if = { limit = { has_idea = NKO_china_economic_assistant } add_to_temp_variable = { influence_change = 0.5 } } if = { limit = { OR = { has_idea = SOV_foreign_chinacars_idea has_idea = SOV_foreign_chinacars_idea1 has_idea = SOV_foreign_chinacars_idea2 } } add_to_temp_variable = { influence_change = 0.03 } } } else_if = { limit = { check_variable = { tag_index = SOV } } if = { limit = { OR = { has_idea = PMR_gazprom_gaz has_idea = PMR_ruble_efffect_idea has_idea = PMR_russian_legacy has_idea = SOV_IRQ_base has_idea = SOV_nord_stream_idea has_idea = SOV_nord_stream2_idea has_idea = SOV_blue_stream_idea has_idea = SOV_turkey_stream_idea has_idea = PMR_14_army AND = { has_completed_focus = PMR_sov_invest NOT = { has_country_flag = PMR_sov_invest } } has_idea = USR_parlament_idea has_idea = USR_gos_sovet_idea has_idea = USR_council_ministers_idea has_idea = USR_money_palata_idea has_idea = USR_eternal_commitie_idea has_idea = USR_valute_idea has_idea = USR_civils_idea has_idea = USR_economic_space_idea has_idea = BUL_lukoil_russian_idea has_idea = BUL_lukoil_russian_idea1 } } add_to_temp_variable = { influence_change = 0.15 } } } else_if = { limit = { check_variable = { tag_index = GRE } } if = { limit = { has_idea = GRE_enosis_campaign_idea } add_to_temp_variable = { influence_change = 0.15 } } if = { limit = { has_idea = GRE_enosis_campaign_idea_2 } add_to_temp_variable = { influence_change = 0.20 } } } else_if = { limit = { check_variable = { tag_index = JAP } } if = { limit = { JAP = { has_country_flag = JAP_cool_japan_doctrine } } add_to_temp_variable = { influence_change = 0.10 } } if = { limit = { JAP = { has_completed_focus = JAP_gross_national_cool } } add_to_temp_variable = { influence_change = 0.05 } } } # -- Multi-influencer / influencer-property (independent, always checked) -- if = { limit = { has_idea = IRQ_expulsion_of_foreigners_idea OR = { check_variable = { tag_index = PER } check_variable = { tag_index = USA } } } add_to_temp_variable = { influence_change = -0.25 } } if = { limit = { has_idea = PER_strength_of_our_lobby OR = { check_variable = { tag_index = ISR } check_variable = { tag_index = USA } } } add_to_temp_variable = { influence_change = -0.25 } } if = { limit = { has_idea = sunni var:tag_index = { has_idea = muslim_brotherhood_faction_member } } add_to_temp_variable = { influence_change = 0.10 } } # Intel on Target if = { limit = { has_dlc = "La Resistance" } if = { limit = { var:tag_index = { check_variable = { civilian_intel@PREV > 75 } } } add_to_temp_variable = { influence_change = 0.10 } } } # -- Target-specific (only the matching original_tag block evaluates) -- if = { limit = { original_tag = ARM } if = { limit = { OR = { check_variable = { ARM_econ_grand_tobacco_level > 0 } check_variable = { ARM_econ_masis_tobacco_level > 0 } } check_variable = { tag_index = CAN } } add_to_temp_variable = { influence_change = 0.10 } } if = { limit = { OR = { check_variable = { ARM_econ_hsbc_level > 0 } check_variable = { ARM_econ_education_brit_level > 0 } } check_variable = { tag_index = ENG } } add_to_temp_variable = { influence_change = 0.10 } } if = { limit = { OR = { check_variable = { ARM_econ_ycrdi_level > 0 } has_idea = ARM_Eraz_idea check_variable = { ARM_econ_education_mgu_level > 0 } } check_variable = { tag_index = SOV } } add_to_temp_variable = { influence_change = 0.10 } } if = { limit = { has_idea = CHE_republic_rf check_variable = { tag_index = SOV } } add_to_temp_variable = { influence_change = 0.99 } } if = { limit = { check_variable = { ARM_econ_shoghakn_level = 2 } check_variable = { tag_index = ISR } } add_to_temp_variable = { influence_change = 0.10 } } if = { limit = { check_variable = { ARM_econ_veon_level > 0 } check_variable = { tag_index = HOL } } add_to_temp_variable = { influence_change = 0.10 } } if = { limit = { has_idea = ARM_armbel_trade_center check_variable = { tag_index = BLR } } add_to_temp_variable = { influence_change = 0.10 } } if = { limit = { OR = { check_variable = { ARM_econ_it_level > 1 } check_variable = { ARM_econ_education_aua_level > 0 } has_idea = ARM_usa_embaracy_idea } check_variable = { tag_index = USA } } add_to_temp_variable = { influence_change = 0.10 } } if = { limit = { has_idea = ARM_usa_ngo_leave_idea check_variable = { tag_index = USA } } add_to_temp_variable = { influence_change = -0.15 } } if = { limit = { has_idea = ARM_zhirayr_no_russian_idea check_variable = { tag_index = SOV } } add_to_temp_variable = { influence_change = -0.15 } } if = { limit = { OR = { check_variable = { ARM_econ_education_erasmus_level > 0 } has_idea = ARM_armenian_foreign_legion_idea check_variable = { ARM_econ_education_france_level > 0 } } check_variable = { tag_index = FRA } } add_to_temp_variable = { influence_change = 0.10 } } if = { limit = { check_variable = { ARM_econ_education_erasmus_level > 0 } check_variable = { tag_index = GER } } add_to_temp_variable = { influence_change = 0.10 } } } if = { limit = { original_tag = PMR } if = { limit = { has_completed_focus = PMR_ge_invest NOT = { has_country_flag = PMR_ger_invest } check_variable = { tag_index = GER } } add_to_temp_variable = { influence_change = 0.10 } } if = { limit = { has_completed_focus = PMR_ita_invest NOT = { has_country_flag = PMR_ita_invest } check_variable = { tag_index = ITA } } add_to_temp_variable = { influence_change = 0.10 } } if = { limit = { has_completed_focus = PMR_rom_invest NOT = { has_country_flag = PMR_rom_invest } check_variable = { tag_index = ROM } } add_to_temp_variable = { influence_change = 0.10 } } if = { limit = { has_completed_focus = PMR_aus_invest NOT = { has_country_flag = PMR_aus_invest } check_variable = { tag_index = AUS } } add_to_temp_variable = { influence_change = 0.10 } } if = { limit = { has_completed_focus = PMR_hun_invest NOT = { has_country_flag = PMR_hun_invest } check_variable = { tag_index = HUN } } add_to_temp_variable = { influence_change = 0.10 } } if = { limit = { has_completed_focus = PMR_ukr_invest NOT = { has_country_flag = PMR_ukr_invest } check_variable = { tag_index = UKR } } add_to_temp_variable = { influence_change = 0.10 } } if = { limit = { has_idea = PMR_chinese_economic check_variable = { tag_index = CHI } } add_to_temp_variable = { influence_change = 0.15 } } if = { limit = { has_idea = PMR_inter_rao check_variable = { tag_index = SOV } } add_to_temp_variable = { influence_change = 0.10 } } if = { limit = { OR = { has_idea = PMR_reform_debuff1 has_idea = PMR_annex_efffect_idea1 has_idea = PMR_army_efffect_idea1 } check_variable = { tag_index = MLV } } add_to_temp_variable = { influence_change = 0.15 } } if = { limit = { OR = { has_idea = PMR_ukr_army has_idea = PMR_grivna_efffect_idea } check_variable = { tag_index = UKR } } add_to_temp_variable = { influence_change = 0.15 } } } if = { limit = { OR = { original_tag = BLR original_tag = UKR } has_idea = ARM_zhirayr_in_blr_ukr_idea check_variable = { tag_index = ARM } } add_to_temp_variable = { influence_change = 0.10 } } if = { limit = { original_tag = TAJ } if = { limit = { has_idea = TAJ_tajik_barrier2 check_variable = { tag_index = SOV } } add_to_temp_variable = { influence_change = -0.25 } } if = { limit = { OR = { has_idea = TAJ_201st_base has_idea = TAJ_201st_base_upgrade } check_variable = { tag_index = SOV } } add_to_temp_variable = { influence_change = 0.30 } } if = { limit = { has_idea = TAJ_201st_base_usa check_variable = { tag_index = USA } } add_to_temp_variable = { influence_change = 0.15 } } if = { limit = { has_idea = TAJ_201st_base_raj check_variable = { tag_index = RAJ } } add_to_temp_variable = { influence_change = 0.15 } } if = { limit = { has_idea = TAJ_201st_base_chi check_variable = { tag_index = CHI } } add_to_temp_variable = { influence_change = 0.15 } } if = { limit = { has_idea = TAJ_gulfs_bankroll_idea check_variable = { tag_index = SAU } } add_to_temp_variable = { influence_change = 0.15 } } } if = { limit = { original_tag = PER has_idea = PER_fighting_colonialism OR = { check_variable = { tag_index = SOV } check_variable = { tag_index = USA } check_variable = { tag_index = ENG } } } add_to_temp_variable = { influence_change = -0.25 } } } # Effect: change_influence_percentage # Purpose: This is the main effect that is used to change influence on another nation # Parameters: # - percent_change: The percentage change to the influence # - tag_index: The tag of the influencer nation (defaults to ROOT if not set) # - influence_target: The tag of the influence target nation (defaults to THIS if not set) change_influence_percentage = { if = { limit = { check_variable = { tag_index = 0 } } set_temp_variable = { tag_index = ROOT.id } } if = { limit = { check_variable = { influence_target = 0 } } set_temp_variable = { influence_target = THIS.id } } set_temp_variable = { tg = tag_index } set_temp_variable = { it = influence_target } set_temp_variable = { itd = 0 } # Debugging/Logging Handling in the first section if = { limit = { is_debug = yes } log = "[GetDateText]: [ROOT.GetName]: DEBUG: Influence Change, Influencer: [?var:tg.GetName], Influencee: [?var:it.GetName], Influence Domestic Independence: [?itd]" } if = { limit = { check_variable = { tg = it } } custom_effect_tooltip = change_influencer_tt_error } set_temp_variable = { percent_change_temp = percent_change } var:influence_target = { # DO NOT ADD YOURSELF TO YOUR OWN INFLUENCE ARRAY if = { limit = { check_variable = { tg = it } } log = "[GetDateText]: [ROOT.GetName]: ERROR: Influencer and Influencee are the same. Error Code: 5001. Influencer: [?var:tg.GetName], Influencee: [?var:it.GetName]" } else = { set_temp_variable = { itd = THIS.domestic_influence_amount } set_temp_variable = { influencer_index = -1 } for_each_loop = { array = influence_array value = v index = i if = { limit = { check_variable = { v = var:tag_index } } set_temp_variable = { influencer_index = i } set_temp_variable = { break = 1 } } } set_temp_variable = { break = 0 } if = { limit = { check_variable = { influencer_index = -1 } } set_temp_variable = { influencer_index = influence_array^num } add_to_array = { influence_array = var:tag_index } add_to_array = { influence_array_val = 0 } } # Apply multiplier in positive interaction # You shouldn't lose more because you are a bigger power if = { limit = { check_variable = { percent_change > 0 } } var:tag_index = { set_temp_variable = { influence_change = modifier@foreign_influence_modifier } if = { limit = { is_on_same_continent_as = PREV } add_to_temp_variable = { influence_change = modifier@foreign_influence_home_continent_modifier } } else = { add_to_temp_variable = { influence_change = modifier@foreign_influence_continent_modifier } } } set_temp_variable = { influence_defense_change = modifier@foreign_influence_defense_modifier } subtract_from_temp_variable = { influence_change = influence_defense_change } apply_influence_special_modifiers = yes add_to_temp_variable = { influence_change = 1 } multiply_temp_variable = { percent_change = influence_change } # Cap the gain at the remaining headroom to 100% so the shown value matches the realized share. set_temp_variable = { influence_headroom = 100 } subtract_from_temp_variable = { influence_headroom = influence_array_val^influencer_index } if = { limit = { check_variable = { percent_change > influence_headroom } } set_temp_variable = { percent_change = influence_headroom } } } # Lock this influencer's updated value; rebalance domestic + every other share around it. add_to_variable = { influence_array_val^influencer_index = percent_change } set_temp_variable = { skip_index = influencer_index } set_temp_variable = { held_value = influence_array_val^influencer_index } set_temp_variable = { scale_domestic = 1 } set_temp_variable = { extra_outlook = 0 } redistribute_influence_pool = yes custom_effect_tooltip = change_influencer_tt } recalculate_influence = yes } set_temp_variable = { percent_change = percent_change_temp } update_dirty_influence_var = yes } # Effect: init_auto_influence_array # Purpose: This is the main effect that is used to initialize the auto-influence array init_auto_influence_array = { set_variable = { auto_influence_cap = { value = 3 add = modifier@foreign_influence_auto_influence_cap_modifier } } set_variable = { auto_influence_users = 0 } resize_array = { array = auto_influence_array value = 0 size = 10 } # ONLY 4 MORE SLOTS ARE AVAILABLE } # Effect: update_auto_influence_array # Purpose: This is the main effect that is used to update the auto-influence array update_auto_influence_array = { if = { limit = { is_debug = yes } log = "[GetDateText]: [THIS.GetName]: update_auto_influence_array running" } set_variable = { auto_influence_cap = { value = 3 add = modifier@foreign_influence_auto_influence_cap_modifier } } set_variable = { auto_influence_cost = 0 } for_each_loop = { array = auto_influence_array value = v index = i if = { limit = { check_variable = { i > auto_influence_cap } NOT = { check_variable = { v = 0 } } } if = { limit = { is_debug = yes } log = "[GetDateText]: [THIS.GetName]: Index [?i] is greater than the auto_influence_cap. Removing [?auto_influence_array^i.GetName] from auto influence list" } set_variable = { auto_influence_array^i = 0 } subtract_from_variable = { auto_influence_users = 1 } } if = { limit = { NOT = { check_variable = { v = 0 } } } add_to_variable = { auto_influence_cost = 1.50 } } } if = { limit = { check_variable = { auto_influence_cost > 0 } } if = { limit = { NOT = { has_dynamic_modifier = { modifier = auto_influencer_cost_effect } } } add_dynamic_modifier = { modifier = auto_influencer_cost_effect } } } else = { if = { limit = { has_dynamic_modifier = { modifier = auto_influencer_cost_effect } } remove_dynamic_modifier = { modifier = auto_influencer_cost_effect } } } clamp_variable = { var = auto_influence_users min = 0 max = 10 } update_dirty_influence_var = yes } # Effect: create_new_auto_influencer_request # Purpose: This is the main effect that is used to create a new auto-influencer request create_new_auto_influencer_request = { if = { limit = { is_debug = yes } log = "[GetDateText]: [Root.GetName]: Creation of Auto-Influencer Request. Influencing Nation: [PREV.GetName]" } for_each_loop = { array = auto_influence_array if = { limit = { check_variable = { v = 0 } } set_variable = { new_auto_influencer = i } set_temp_variable = { break = 1 } } } if = { limit = { has_variable = new_auto_influencer } set_variable = { auto_influence_array^new_auto_influencer = PREV.id } add_to_variable = { auto_influence_users = 1 } clamp_variable = { var = auto_influence_users min = 0 max = 10 } clear_variable = new_auto_influencer } custom_effect_tooltip = influence_create_new_auto_request_TT } # Effect: remove_auto_influencer_request # Purpose: This is the main effect that is used to remove an auto-influencer request remove_auto_influencer_request = { if = { limit = { is_debug = yes } log = "[GetDateText]: [Root.GetName]: Removal of Auto-Influencer Request. Influencing Nation: [PREV.GetName]" } set_temp_variable = { index = -1 } set_temp_variable = { found_match = 0 } for_each_loop = { array = auto_influence_array index = i value = v if = { limit = { check_variable = { v = PREV.id } check_variable = { found_match = 0 } } set_temp_variable = { index = i } set_temp_variable = { found_match = 1 } set_temp_variable = { break = 1 } } } if = { limit = { check_variable = { index > -1 } } set_variable = { auto_influence_array^index = 0 } subtract_from_variable = { auto_influence_users = 1 } clamp_variable = { var = auto_influence_users min = 0 max = 10 } } custom_effect_tooltip = influence_remove_auto_request_TT } # Effect: spread_influence_cooldown_effect # Purpose: sets the game rule country flags for spread_influence so we do not copy this code everywhere. spread_influence_cooldown_effect = { if = { limit = { has_game_rule = { rule = rule_spread_influence_cooldown_limits option = spread_influence_14_days } } set_country_flag = { flag = spread_influence@PREV value = 1 days = 14 } } else_if = { limit = { has_game_rule = { rule = rule_spread_influence_cooldown_limits option = spread_influence_30_days } } set_country_flag = { flag = spread_influence@PREV value = 1 days = 30 } } else_if = { limit = { has_game_rule = { rule = rule_spread_influence_cooldown_limits option = spread_influence_60_days } } set_country_flag = { flag = spread_influence@PREV value = 1 days = 60 } } }