# INFO: The file is a series of other effects to interact with the money system flat_productivity_change_effect = { every_controlled_state = { add_to_variable = { productivity_state_var = temp_productivity_change } clamp_variable = { var = productivity_state_var min = 100 } custom_effect_tooltip = flat_productivity_change_effect_TT } ingame_update_setup = yes } state_flat_productivity_change_effect = { custom_effect_tooltip = flat_productivity_change_effect_TT add_to_variable = { productivity_state_var = temp_productivity_change } clamp_variable = { var = productivity_state_var min = 100 } hidden_effect = { CONTROLLER = { ingame_update_setup = yes } } } setup_starting_world_productivity = { add_dynamic_modifier = { modifier = productivity_and_employment_modifier } update_employment_productivity_output_dynamic_modifier = yes } # Effect: automated debt taker # Purpose: Per week when you take too much debt out automated_debt_taker = { # Checks to see if treasury is negative at the same time as weekly balance adds or removes from treasury, borrowing debt automatically if treasury is negative (to make it positive). if = { limit = { check_variable = { treasury < 0 } } set_temp_variable = { treasury_temp = treasury } multiply_temp_variable = { treasury_temp = -1.25 } set_temp_variable = { gdp_adder = gdp_total } multiply_temp_variable = { gdp_adder = 0.01 } # 1% of GDP add_to_temp_variable = { treasury_temp = gdp_adder } set_temp_variable = { debt_temp = treasury_temp } multiply_temp_variable = { debt_temp = 1.01 } # adding 1% fee to debt autmoatically taken out (manual borrowing also has this) add_to_variable = { treasury = treasury_temp } add_to_variable = { debt = debt_temp } calculate_interest_rate = yes } } # Effect: ai_repay_debt # Purpose: Weekly AI-only principal repayment from the treasury stockpile above an operating reserve ai_repay_debt = { if = { limit = { check_variable = { debt > 0 } check_variable = { treasury > 0 } check_variable = { debt_ratio > 0.3 } NOT = { has_active_mission = cheap_loan_from_the_imf_mission } NOT = { has_country_flag = paused_debt_repayment } } set_temp_variable = { ai_debt_reserve = { value = display_expense multiply = 8 } } set_temp_variable = { ai_debt_reserve_min = { value = gdp_total multiply = 0.02 } } # Absolute floor, or a collapsed economy with near-zero GDP and expenses empties its whole treasury if = { limit = { check_variable = { ai_debt_reserve_min < 1 } } set_temp_variable = { ai_debt_reserve_min = 1 } } if = { limit = { check_variable = { ai_debt_reserve < ai_debt_reserve_min } } set_temp_variable = { ai_debt_reserve = ai_debt_reserve_min } } # A year of runway; automated_debt_taker borrows >=1% of GDP with a 1% fee on any dip below zero if = { limit = { check_variable = { treasury_rate < 0 } } set_temp_variable = { ai_debt_deficit_runway = { value = treasury_rate multiply = -52 } } add_to_temp_variable = { ai_debt_reserve = ai_debt_deficit_runway } } set_temp_variable = { ai_debt_payment = { value = treasury subtract = ai_debt_reserve } } if = { limit = { check_variable = { ai_debt_payment > debt } } set_temp_variable = { ai_debt_payment = debt } } set_temp_variable = { ai_debt_payment_min = { value = gdp_total multiply = 0.005 } } if = { limit = { check_variable = { ai_debt_payment_min < 0.01 } } set_temp_variable = { ai_debt_payment_min = 0.01 } } # Collapsing the threshold to the remainder lets the final instalment clear the debt if = { limit = { check_variable = { ai_debt_payment_min > debt } } set_temp_variable = { ai_debt_payment_min = debt } } if = { limit = { check_variable = { var = ai_debt_payment value = ai_debt_payment_min compare = greater_than_or_equals } } subtract_from_variable = { treasury = ai_debt_payment } subtract_from_variable = { debt = ai_debt_payment } if = { limit = { check_variable = { debt < 0.001 } } set_variable = { debt = 0 } } if = { limit = { is_debug = yes } log = "[GetDateText]: [Root.GetName]: AI repaid [?ai_debt_payment]b debt (Reserve: [?ai_debt_reserve]b, Treasury: [?treasury]b, Debt: [?debt]b, Interest Rate: [?interest_rate]%, Treasury Rate: [?treasury_rate]b)" } } } } # Effect: resync_economic_project_flag # Purpose: Re-derives active_economic_project from the ten hidden project ideas; corrects the flag/idea desync left by a mid-save mod upgrade or a civil-war split-off (ideas are inherited, country flags are not) resync_economic_project_flag = { if = { limit = { OR = { has_idea = industrial_projects_idea has_idea = service_constructions_idea has_idea = infrastructure_investiture_idea has_idea = arms_industry_stipends_idea has_idea = retool_shipyards_idea has_idea = agro_industrial_expansion_idea has_idea = advanced_manufacturing_idea has_idea = energy_grid_modernization_idea has_idea = strategic_defense_infrastructure_idea has_idea = strategic_rd_sites_idea } } set_country_flag = active_economic_project } else = { clr_country_flag = active_economic_project } } # Enable/Disable Personal Tax Rate Change disable_personal_tax_rate_change = { set_country_flag = { flag = no_personal_tax_rate_change days = 365 value = 1 } custom_effect_tooltip = disables_personal_tax_rate_change } enable_personal_tax_rate_change = { clr_country_flag = no_personal_tax_rate_change custom_effect_tooltip = enables_personal_tax_rate_change } # Enable/Disable Corporate Tax Rate Change disable_corporate_tax_rate_change = { set_country_flag = { flag = no_corporate_tax_rate_change days = 365 value = 1 } custom_effect_tooltip = disables_corporate_tax_rate_change } enable_corporate_tax_rate_change = { clr_country_flag = no_corporate_tax_rate_change custom_effect_tooltip = enables_corporate_tax_rate_change } set_static_state_modifier_on_game_start = { every_owned_state = { limit = { check_variable = { THIS.state_renewable_capacity_factor_modifier_var > 0 } } meta_effect = { text = { add_state_modifier = { modifier = { state_renewable_capacity_factor_modifier = [NUM] } } } NUM = "[?state_renewable_capacity_factor_modifier_var]" } } } enable_automatic_debt_repayment_effect = { if = { limit = { NOT = { has_country_flag = automatically_pay_off_debt_enabled } } set_country_flag = automatically_pay_off_debt_enabled } else = { clr_country_flag = automatically_pay_off_debt_enabled } ingame_update_setup = yes } increment_global_reserve_currency = { if = { limit = { has_idea = us_dollar } add_to_variable = { global.usd_reserve_adoption_count = 1 } } else_if = { limit = { has_idea = euro } add_to_variable = { global.eur_reserve_adoption_count = 1 } } else_if = { limit = { OR = { has_idea = chinese_yuan has_idea = chinese_yuan_2 has_idea = chinese_yuan_3 } } add_to_variable = { global.cny_reserve_adoption_count = 1 } } else_if = { limit = { has_idea = russia_rouble } add_to_variable = { global.rub_reserve_adoption_count = 1 } } else_if = { limit = { has_idea = japanese_yen } add_to_variable = { global.jpy_reserve_adoption_count = 1 } } else_if = { limit = { has_idea = british_pound } add_to_variable = { global.gbp_reserve_adoption_count = 1 } } else_if = { limit = { has_idea = swiss_frank } add_to_variable = { global.chf_reserve_adoption_count = 1 } } else_if = { limit = { has_idea = gulden } add_to_variable = { global.nlg_reserve_adoption_count = 1 } } } # Resync against live holders. on_add/on_remove drifts when a holder is annexed or a law slot changes hands outside swap_ideas. recount_global_reserve_currency = { set_variable = { global.usd_reserve_adoption_count = 0 } set_variable = { global.eur_reserve_adoption_count = 0 } set_variable = { global.cny_reserve_adoption_count = 0 } set_variable = { global.rub_reserve_adoption_count = 0 } set_variable = { global.jpy_reserve_adoption_count = 0 } set_variable = { global.gbp_reserve_adoption_count = 0 } set_variable = { global.chf_reserve_adoption_count = 0 } set_variable = { global.nlg_reserve_adoption_count = 0 } every_country = { increment_global_reserve_currency = yes } }