# steal_from_party: helper for steal_popularity_from_* effects # Parameters: steal_party_index (0-23) # Steals 1% popularity from the given party and gives it to the ruling party steal_from_party = { if = { limit = { check_variable = { party_pop_array^steal_party_index > 0.01 } } hidden_effect = { set_temp_variable = { outlook_party_index = steal_party_index } set_outlook_from_party_index = yes set_current_outlook_id = yes if = { limit = { NOT = { check_variable = { outlook_id = current_outlook_id } } } set_temp_variable = { outlook_popularity_change = -0.01 } change_outlook_popularity = yes } set_temp_variable = { temp_outlook_increase = 0 } set_temp_variable = { party_index = steal_party_index } set_temp_variable = { party_popularity_increase = -0.01 } change_relative_party_popularity = yes set_party_index_to_ruling_party = yes set_temp_variable = { party_popularity_increase = 0.01 } change_relative_party_popularity = yes } meta_effect = { text = { custom_effect_tooltip = attract_voters_pos.[INDEX] } INDEX = "[?steal_party_index|.0]" } } } steal_popularity_from_fiscal_liberals = { clear_temp_array = _steal_indices add_to_temp_array = { _steal_indices = 1 } add_to_temp_array = { _steal_indices = 2 } add_to_temp_array = { _steal_indices = 14 } add_to_temp_array = { _steal_indices = 16 } for_each_loop = { array = _steal_indices value = _steal_idx set_temp_variable = { steal_party_index = _steal_idx } steal_from_party = yes } } steal_popularity_from_socialists = { clear_temp_array = _steal_indices add_to_temp_array = { _steal_indices = 3 } add_to_temp_array = { _steal_indices = 4 } add_to_temp_array = { _steal_indices = 5 } add_to_temp_array = { _steal_indices = 17 } add_to_temp_array = { _steal_indices = 18 } add_to_temp_array = { _steal_indices = 19 } for_each_loop = { array = _steal_indices value = _steal_idx set_temp_variable = { steal_party_index = _steal_idx } steal_from_party = yes } } steal_popularity_from_patriots = { clear_temp_array = _steal_indices add_to_temp_array = { _steal_indices = 0 } add_to_temp_array = { _steal_indices = 6 } add_to_temp_array = { _steal_indices = 7 } add_to_temp_array = { _steal_indices = 13 } add_to_temp_array = { _steal_indices = 20 } add_to_temp_array = { _steal_indices = 21 } add_to_temp_array = { _steal_indices = 22 } add_to_temp_array = { _steal_indices = 23 } for_each_loop = { array = _steal_indices value = _steal_idx set_temp_variable = { steal_party_index = _steal_idx } steal_from_party = yes } } steal_popularity_from_enviromentalists = { clear_temp_array = _steal_indices add_to_temp_array = { _steal_indices = 5 } add_to_temp_array = { _steal_indices = 17 } for_each_loop = { array = _steal_indices value = _steal_idx set_temp_variable = { steal_party_index = _steal_idx } steal_from_party = yes } } steal_popularity_from_conservatives = { clear_temp_array = _steal_indices add_to_temp_array = { _steal_indices = 0 } add_to_temp_array = { _steal_indices = 1 } add_to_temp_array = { _steal_indices = 6 } add_to_temp_array = { _steal_indices = 7 } add_to_temp_array = { _steal_indices = 8 } add_to_temp_array = { _steal_indices = 9 } add_to_temp_array = { _steal_indices = 10 } add_to_temp_array = { _steal_indices = 11 } add_to_temp_array = { _steal_indices = 12 } add_to_temp_array = { _steal_indices = 13 } add_to_temp_array = { _steal_indices = 14 } add_to_temp_array = { _steal_indices = 15 } add_to_temp_array = { _steal_indices = 20 } add_to_temp_array = { _steal_indices = 22 } add_to_temp_array = { _steal_indices = 23 } for_each_loop = { array = _steal_indices value = _steal_idx set_temp_variable = { steal_party_index = _steal_idx } steal_from_party = yes } } steal_popularity_from_progressives = { clear_temp_array = _steal_indices add_to_temp_array = { _steal_indices = 2 } add_to_temp_array = { _steal_indices = 3 } add_to_temp_array = { _steal_indices = 5 } add_to_temp_array = { _steal_indices = 15 } add_to_temp_array = { _steal_indices = 16 } add_to_temp_array = { _steal_indices = 17 } add_to_temp_array = { _steal_indices = 18 } add_to_temp_array = { _steal_indices = 19 } for_each_loop = { array = _steal_indices value = _steal_idx set_temp_variable = { steal_party_index = _steal_idx } steal_from_party = yes } } add_ruling_outlook_popularity = { add_popularity = { ideology = ROOT popularity = arg_popularity } recalculate_party = yes } # Adjust Election Threshold # set_temp_variable = { threshold_change = +- } modify_election_threshold = { add_to_variable = { election_threshold = threshold_change } custom_effect_tooltip = modify_election_threshold_TT clamp_variable = { var = election_threshold min = 0 max = 0.10 } update_dirty_politicsview_expanded = yes } set_party_index_to_ruling_party = { if = { limit = { western_autocrats_are_in_power = yes has_country_leader_with_trait = western_technocrat } for_each_loop = { array = gov_coalition_array if = { limit = { check_variable = { party_pop_array^v > biggest_party_in_coalition_popularity } } set_temp_variable = { biggest_party_in_coalition_popularity = party_pop_array^v } set_temp_variable = { biggest_party_in_coalition = v } } } set_temp_variable = { party_index = biggest_party_in_coalition } } else = { set_temp_variable = { party_index = ruling_party } } } # Maps a party slot (0-23) to its numeric outlook ID. # Parameters: # set_temp_variable = { outlook_party_index = X } # set_outlook_from_party_index = yes set_outlook_from_party_index = { set_temp_variable = { outlook_id = { value = { value = outlook_party_index greater_than = 3 } add = { value = outlook_party_index greater_than = 9 } add = { value = outlook_party_index greater_than = 11 } add = { value = outlook_party_index greater_than = 19 } } } } set_current_outlook_id = { set_temp_variable = { current_outlook_id = -1 } if = { limit = { has_government = democratic } set_temp_variable = { current_outlook_id = 0 } } else_if = { limit = { has_government = communism } set_temp_variable = { current_outlook_id = 1 } } else_if = { limit = { has_government = fascism } set_temp_variable = { current_outlook_id = 2 } } else_if = { limit = { has_government = neutrality } set_temp_variable = { current_outlook_id = 3 } } else_if = { limit = { has_government = nationalist } set_temp_variable = { current_outlook_id = 4 } } } set_outlook_popularity_array = { resize_temp_array = { array = outlook_popularity_by_id size = 5 } set_temp_variable = { outlook_popularity_by_id^0 = party_popularity@democratic } set_temp_variable = { outlook_popularity_by_id^1 = party_popularity@communism } set_temp_variable = { outlook_popularity_by_id^2 = party_popularity@fascism } set_temp_variable = { outlook_popularity_by_id^3 = party_popularity@neutrality } set_temp_variable = { outlook_popularity_by_id^4 = party_popularity@nationalist } } set_outlook_popularity_from_id = { set_outlook_popularity_array = yes set_temp_variable = { outlook_popularity = outlook_popularity_by_id^outlook_id } } change_outlook_popularity = { if = { limit = { check_variable = { outlook_id = 0 } } add_popularity = { ideology = democratic popularity = outlook_popularity_change } } else_if = { limit = { check_variable = { outlook_id = 1 } } add_popularity = { ideology = communism popularity = outlook_popularity_change } } else_if = { limit = { check_variable = { outlook_id = 2 } } add_popularity = { ideology = fascism popularity = outlook_popularity_change } } else_if = { limit = { check_variable = { outlook_id = 3 } } add_popularity = { ideology = neutrality popularity = outlook_popularity_change } } else = { add_popularity = { ideology = nationalist popularity = outlook_popularity_change } } } # Change Relative Party Popularity: # # This scripted effect adds (or substracts) relative party popularity. How to use: # # 2022/04/30 - Added a additional parameter Z to allow you to increase the outlook within the script # # set_temp_variable = { party_index = X } #OPTIONAL -- Index of party to be changed 0-23. Defaults to ruling party if not set. # set_temp_variable = { party_popularity_increase = Y } #How much party popularity is changed, must be in decimals so 2% is 0.02 # set_temp_variable = { temp_outlook_increase = Z } #OPTIONAL PARAMETER -- Must be in decimals so 2% is 0.02 # change_relative_party_popularity = yes # #NOTE! The temp variable names must be the same as above! change_relative_party_popularity = { if = { limit = { NOT = { has_variable = party_index } } set_party_index_to_ruling_party = yes } custom_effect_tooltip = TT_ADD_RELATIVE_PARTY_POPULARITY set_temp_variable = { outlook_party_index = party_index } set_outlook_from_party_index = yes # If you have the optional parameter. First ADD the new outlook percentage. if = { limit = { NOT = { check_variable = { temp_outlook_increase = 0 } } } set_temp_variable = { outlook_popularity_change = temp_outlook_increase } hidden_effect = { change_outlook_popularity = yes } add_to_variable = { party_pop_array^party_index = party_popularity_increase } } else = { set_outlook_popularity_from_id = yes #Set the old remainder Outlook based on non-boosted parties set_temp_variable = { old_outlook_remainder = outlook_popularity } subtract_from_temp_variable = { old_outlook_remainder = party_pop_array^party_index } if = { limit = { check_variable = { old_outlook_remainder > 0 } check_variable = { party_popularity_increase > old_outlook_remainder } } set_temp_variable = { party_popularity_increase = old_outlook_remainder } } #Add X% to party popularity, this is the popularity we want the party to retain! add_to_variable = { party_pop_array^party_index = party_popularity_increase } if = { limit = { check_variable = { old_outlook_remainder > 0 } } #Set the new remainder Outlook set_temp_variable = { outlook_remainder = outlook_popularity } subtract_from_temp_variable = { outlook_remainder = party_pop_array^party_index } #Scale all non-boosted parties divide_temp_variable = { outlook_remainder = old_outlook_remainder } set_temp_variable = { outlook_start = { value = { value = outlook_party_index greater_than = 3 multiply = 4 } add = { value = outlook_party_index greater_than = 9 multiply = 6 } add = { value = outlook_party_index greater_than = 11 multiply = 2 } add = { value = outlook_party_index greater_than = 19 multiply = 8 } } } set_temp_variable = { outlook_end = { value = 4 add = { value = outlook_party_index greater_than = 3 multiply = 6 } add = { value = outlook_party_index greater_than = 9 multiply = 2 } add = { value = outlook_party_index greater_than = 11 multiply = 8 } add = { value = outlook_party_index greater_than = 19 multiply = 4 } } } for_loop_effect = { start = outlook_start end = outlook_end value = i if = { limit = { NOT = { check_variable = { i = party_index } } } multiply_variable = { party_pop_array^i = outlook_remainder } } } } } recalculate_party = yes } # Move popularity from one party to another. The funder loses party_popularity_fraction of # its own popularity and the beneficiary gains the same amount. # # set_temp_variable = { party_index = 0-23 } # funder, loses popularity # set_temp_variable = { target_party_index = 0-23 } # beneficiary, gains popularity # set_temp_variable = { party_popularity_fraction = F } # 0.5 moves half of the funder's popularity move_party_popularity = { set_temp_variable = { temp_outlook_increase = 0 } set_temp_variable = { _party_pop_delta = party_pop_array^party_index } multiply_temp_variable = { _party_pop_delta = party_popularity_fraction } set_temp_variable = { party_popularity_increase = { value = _party_pop_delta multiply = -1 } } change_relative_party_popularity = yes set_temp_variable = { party_index = target_party_index } set_temp_variable = { party_popularity_increase = _party_pop_delta } change_relative_party_popularity = yes } # Boost one party by party_popularity_fraction of its own popularity, with the funder paying # for it. The measured party gains, the funder loses the same amount. # # set_temp_variable = { party_index = 0-23 } # beneficiary, measured and boosted # set_temp_variable = { funder_party_index = 0-23 } # party funding the boost # set_temp_variable = { party_popularity_fraction = F } # 0.5 boosts by half of the beneficiary's popularity boost_party_popularity = { set_temp_variable = { temp_outlook_increase = 0 } set_temp_variable = { _party_pop_delta = party_pop_array^party_index } multiply_temp_variable = { _party_pop_delta = party_popularity_fraction } set_temp_variable = { _party_pop_beneficiary = party_index } set_temp_variable = { party_index = funder_party_index } set_temp_variable = { party_popularity_increase = { value = _party_pop_delta multiply = -1 } } change_relative_party_popularity = yes set_temp_variable = { party_index = _party_pop_beneficiary } set_temp_variable = { party_popularity_increase = _party_pop_delta } change_relative_party_popularity = yes } # Scale one party's popularity directly, then rescale its outlook to preserve the total. # # set_temp_variable = { party_index = 0-23 } # party to scale # set_temp_variable = { party_popularity_multiplier = M } # 0.5 halves, 1.5 boosts by half, 0 clears scale_party_popularity = { multiply_variable = { party_pop_array^party_index = party_popularity_multiplier } recalculate_party = yes } # Effect: effect_puppet_match_ruling_party_to_overlord # Purpose: Sets the outlook of a nation when being puppetted to the outlook of the overlord. # Parameter: # - overlord_to_match: id of the overlord whose ruling party the subject adopts effect_puppet_match_ruling_party_to_overlord = { #Used in target scope var:overlord_to_match = { set_temp_variable = { temp = ruling_party } } set_temp_variable = { rul_party_temp = temp } set_temp_variable = { disable_elections = 1 } if = { limit = { var:overlord_to_match = { has_elections = yes } } set_temp_variable = { disable_elections = 0 } } change_ruling_party_effect = yes #add_up_party_totals rescales every party back to its outlook's real popularity, so the imposed party needs support behind it or it is scaled straight out again set_temp_variable = { puppet_outlook_swing = 0.60 } set_temp_variable = { outlook_party_index = rul_party_temp } set_outlook_from_party_index = yes set_outlook_popularity_from_id = yes subtract_from_temp_variable = { puppet_outlook_swing = outlook_popularity } clamp_temp_variable = { var = puppet_outlook_swing min = 0 } set_temp_variable = { outlook_popularity_change = puppet_outlook_swing } change_outlook_popularity = yes set_temp_variable = { party_index = rul_party_temp } set_temp_variable = { party_popularity_increase = 0.40 } change_relative_party_popularity = yes recalculate_party = yes } #### New Coalition stuff #### # Self-heal only. Does not touch coalitions or set_* flags. seed_ruling_party_if_unset = { if = { limit = { NOT = { has_variable = ruling_party } } set_temp_variable = { rp_lo = 0 } set_temp_variable = { rp_hi = 4 } if = { limit = { has_government = communism } set_temp_variable = { rp_lo = 4 } set_temp_variable = { rp_hi = 10 } } else_if = { limit = { has_government = fascism } set_temp_variable = { rp_lo = 10 } set_temp_variable = { rp_hi = 12 } } else_if = { limit = { has_government = neutrality } set_temp_variable = { rp_lo = 12 } set_temp_variable = { rp_hi = 20 } } else_if = { limit = { has_government = nationalist } set_temp_variable = { rp_lo = 20 } set_temp_variable = { rp_hi = 24 } } set_temp_variable = { rp_best = -1 } set_temp_variable = { rp_best_i = rp_lo } for_loop_effect = { start = rp_lo end = rp_hi value = rp_i if = { limit = { check_variable = { party_pop_array^rp_i > rp_best } } set_temp_variable = { rp_best = party_pop_array^rp_i } set_temp_variable = { rp_best_i = rp_i } } } set_variable = { ruling_party = rp_best_i } } } startup_politics = { set_failsafe_values = yes #adds needed values if missing seed_ruling_party_if_unset = yes add_up_party_totals = yes set_party_positions = yes if = { limit = { NOT = { has_variable = election_threshold } } set_variable = { election_threshold = 0.05 } #5% used as default } store_election_values = yes #add to election array update_majority_threshold = yes update_government_coalition_strength = yes gov_pop_calculation = yes update_party_name = yes reset_coalition_ideas = yes find_two_highest_parties = yes if = { limit = { is_debug = yes } log = "[GetDateText]: [This.GetName]: startup_politics executed" } } start_politics_input = { clear_array = party_pop_array clear_array = party_pop_elect_array clear_array = pos_array clear_variable = ruling_party clear_array = gov_coalition_array resize_array = { array = party_pop_array size = 24 } resize_array = { array = party_pop_elect_array size = 24 value = -1 } resize_array = { array = pos_array size = 24 } resize_array = { array = party_banned_array size = 24 value = 0 } update_dirty_politicsview_expanded = yes } recalculate_party = { hidden_effect = { add_up_party_totals = yes if = { limit = { is_ai = no } set_party_positions = yes } update_government_coalition_strength = yes update_dirty_politicsview_expanded = yes } } # stores the info of popularities. modified version of store_election_values = yes hold_elections = { # Technocrat Trait if = { limit = { has_country_leader_with_trait = western_technocrat } set_variable = { party_pop_array^0 = 0 } #technocrats don't participate in elections } add_up_party_totals = yes set_party_positions = yes if = { limit = { NOT = { has_country_flag = partyall_banned } } for_loop_effect = { end = party_pop_array^num value = v if = { limit = { # normal popularity entry is over threshold check_variable = { party_pop_array^v > election_threshold } } set_variable = { party_pop_elect_array^v = party_pop_array^v } } else = { set_variable = { party_pop_elect_array^v = 0 } } } } else = { # Should set the main election value and ignore the election threshold if = { limit = { has_variable = ruling_party } set_variable = { party_pop_elect_array^ruling_party = party_pop_array^ruling_party } } } calculate_banned_parties = yes update_majority_threshold = yes find_two_highest_parties = yes update_government_coalition_strength = yes update_dirty_politicsview_expanded = yes } recalculate_party_strength = { add_up_party_totals = yes set_party_positions = yes if = { limit = { NOT = { has_country_flag = partyall_banned } } for_loop_effect = { end = party_pop_array^num value = v if = { limit = { # normal popularity entry is over threshold check_variable = { party_pop_array^v > election_threshold } } set_variable = { party_pop_elect_array^v = party_pop_array^v } } else = { set_variable = { party_pop_elect_array^v = 0 } } } } else = { # Should set the main election value and ignore the election threshold if = { limit = { has_variable = ruling_party } set_variable = { party_pop_elect_array^ruling_party = party_pop_array^ruling_party } } } update_majority_threshold = yes } add_up_party_totals = { clear_temp_array = pop_total_temp resize_temp_array = { array = pop_total_temp size = 5 } #Outlook popularity based on party popularities for_loop_effect = { end = party_pop_array^num value = current_id set_temp_variable = { outlook_party_index = current_id } set_outlook_from_party_index = yes add_to_temp_variable = { pop_total_temp^outlook_id = party_pop_array^current_id } } set_outlook_popularity_array = yes #Scale party popularity totals to match actual Outlook popularity for_loop_effect = { end = party_pop_array^num value = current_id multiply_variable = { party_pop_array^current_id = 1000 } set_temp_variable = { outlook_party_index = current_id } set_outlook_from_party_index = yes if = { limit = { check_variable = { pop_total_temp^outlook_id > 0 } } divide_variable = { party_pop_array^current_id = pop_total_temp^outlook_id } multiply_variable = { party_pop_array^current_id = outlook_popularity_by_id^outlook_id } } else = { set_variable = { party_pop_array^current_id = 0 } } multiply_variable = { party_pop_array^current_id = 0.001 } clamp_variable = { var = party_pop_array^current_id min = 0 max = 1 } } #Make sure there are no Outlooks with popularity without any party popularities #Make 1% the limit, as smaller than that isn't visible on the chart if = { limit = { democratic > 0.01 check_variable = { pop_total_temp^0 < 0.01 } } random_list = { 10 = { add_to_variable = { party_pop_array^0 = 0.01 } } 10 = { add_to_variable = { party_pop_array^1 = 0.01 } } 10 = { add_to_variable = { party_pop_array^2 = 0.01 } } 10 = { add_to_variable = { party_pop_array^3 = 0.01 } } } } if = { limit = { communism > 0.01 check_variable = { pop_total_temp^1 < 0.01 } } random_list = { 10 = { add_to_variable = { party_pop_array^4 = 0.01 } } 10 = { add_to_variable = { party_pop_array^5 = 0.01 } } 10 = { add_to_variable = { party_pop_array^6 = 0.01 } } 10 = { add_to_variable = { party_pop_array^7 = 0.01 } } 10 = { modifier = { factor = 0 NOT = { has_idea = shia } } add_to_variable = { party_pop_array^8 = 0.01 } } 10 = { modifier = { factor = 0 NOT = { has_idea = shia } } add_to_variable = { party_pop_array^9 = 0.01 } } } } if = { limit = { fascism > 0.01 check_variable = { pop_total_temp^2 < 0.01 } } if = { limit = { Is_Muslim_Country = yes } random_list = { 10 = { add_to_variable = { party_pop_array^10 = 0.01 } } 10 = { add_to_variable = { party_pop_array^11 = 0.01 } } } } } if = { limit = { neutrality > 0.01 check_variable = { pop_total_temp^3 < 0.01 } } random_list = { 10 = { add_to_variable = { party_pop_array^12 = 0.01 } } 10 = { add_to_variable = { party_pop_array^13 = 0.01 } } 10 = { add_to_variable = { party_pop_array^14 = 0.01 } } 10 = { add_to_variable = { party_pop_array^15 = 0.01 } } 10 = { add_to_variable = { party_pop_array^16 = 0.01 } } 10 = { add_to_variable = { party_pop_array^17 = 0.01 } } 10 = { add_to_variable = { party_pop_array^18 = 0.01 } } 10 = { add_to_variable = { party_pop_array^19 = 0.01 } } } } if = { limit = { nationalist > 0.01 check_variable = { pop_total_temp^4 < 0.01 } } random_list = { 10 = { add_to_variable = { party_pop_array^20 = 0.01 } } 10 = { add_to_variable = { party_pop_array^21 = 0.01 } } 10 = { add_to_variable = { party_pop_array^22 = 0.01 } } 10 = { add_to_variable = { party_pop_array^23 = 0.01 } } } } } set_party_positions = { resize_temp_array = { array = party_pop_array_temp size = 24 } for_loop_effect = { end = pos_array^num find_highest_in_array = { array = party_pop_array value = max index = max_index } set_variable = { pos_array^v = max_index } set_variable = { party_pop_array^max_index = -1 } set_temp_variable = { party_pop_array_temp^max_index = max } } clear_array = party_pop_array for_each_loop = { array = party_pop_array_temp add_to_array = { party_pop_array = v } } clear_temp_array = party_pop_array_temp } find_two_highest_parties = { find_highest_in_array = { array = party_pop_elect_array value = max_1_tmp index = max_index_1_tmp } set_variable = { max_index_1 = max_index_1_tmp } set_variable = { party_pop_elect_array^max_index_1 = -1 } find_highest_in_array = { array = party_pop_elect_array value = max_2_tmp index = max_index_2_tmp } set_variable = { max_index_2 = max_index_2_tmp } set_variable = { party_pop_elect_array^max_index_1 = max_1_tmp } } # function: update_party_name # Purpose: Updates the political ideology update_party_name = { if = { limit = { has_variable = ruling_party } meta_effect = { text = { set_party_name = { ideology = THIS name = "[SUBIDEOLOGY_NAME]" long_name = "[SUBIDEOLOGY_NAME]" } } SUBIDEOLOGY_NAME = "[show_ruling_party]" } } } # Function: gov_pop_calculation # Purpose: The gov pop calculation is to calculate the penalty from your government popularity swinging # from -100% to 100% of their current popularity # How-to Adjust: Adjust the penalty by changing line 1904 from 0.002 to 0.005 gov_pop_calculation = { if = { limit = { NOT = { has_dynamic_modifier = { modifier = government_popularity_modifier } } } add_dynamic_modifier = { modifier = government_popularity_modifier } } set_variable = { gov_pop_stability_factor = { value = government_coalition_differential multiply = 100 clamp = { min = -100 max = 100 } multiply = 0.002 } } set_variable = { gov_pop_political_power_factor = { value = government_coalition_differential multiply = 100 clamp = { min = -100 max = 100 } multiply = 0.002 } } set_variable = { gov_pop_drift_defence_factor = { value = government_coalition_differential multiply = 100 clamp = { min = -100 max = 100 } multiply = 0.002 } } } set_coalition_drift = { #Each coalition partner popularity gets added to their own Outlook clear_temp_array = coalition_count_temp resize_temp_array = { array = coalition_count_temp size = 5 } for_each_loop = { array = gov_coalition_array value = v set_temp_variable = { outlook_party_index = v } set_outlook_from_party_index = yes add_to_temp_variable = { coalition_count_temp^outlook_id = party_pop_elect_array^v } } #Don't get bonuses to ruling Outlook set_current_outlook_id = yes if = { limit = { check_variable = { current_outlook_id > -1 } } set_temp_variable = { coalition_count_temp^current_outlook_id = 0 } } set_variable = { coalition_democratic = coalition_count_temp^0 } set_variable = { coalition_communism = coalition_count_temp^1 } set_variable = { coalition_fascism = coalition_count_temp^2 } set_variable = { coalition_neutrality = coalition_count_temp^3 } set_variable = { coalition_nationalist = coalition_count_temp^4 } reset_coalition_ideas = yes } update_government_coalition_strength = { if = { limit = { is_debug = yes } log = "[GetDateText]: [THIS.GetName]: DEBUG: update_government_coalition_strength has triggered for [THIS.GetName]." } set_temp_variable = { sum = 0 } set_temp_variable = { sum_elect = 0 } for_each_loop = { array = gov_coalition_array value = v add_to_temp_variable = { sum = party_pop_array^v } add_to_temp_variable = { sum_elect = party_pop_elect_array^v } } set_variable = { government_coalition_strength = sum } set_variable = { government_coalition_strength_elect = sum_elect } #strength of ruling_party is separate set_temp_variable = { sum = 0 } set_temp_variable = { sum_elect = 0 } if = { limit = { has_variable = ruling_party } add_to_temp_variable = { sum = party_pop_array^ruling_party } add_to_temp_variable = { sum_elect = party_pop_elect_array^ruling_party } } add_to_variable = { government_coalition_strength = sum } add_to_variable = { government_coalition_strength_elect = sum_elect } #find the differentials set_variable = { government_coalition_differential = government_coalition_strength } subtract_from_variable = { government_coalition_differential = government_coalition_strength_elect } set_coalition_drift = yes # opposition strenght set_variable = { opposition_strength = 1 } subtract_from_variable = { opposition_strength = government_coalition_strength } if = { limit = { original_tag = HOL } HOL_evaluate_coalition_focus_loops = yes } } # Transfers coalition leadership to the largest coalition member if they outrank the ruling party. # Rebuilds the government via change_ruling_party_effect to ensure leader/ideology swap. # Called after coalition re-election (MD4_election.2). update_coalition_leader = { if = { limit = { check_variable = { gov_coalition_array^num > 0 } } # Build temp array of all coalition members (ruling party + partners) clear_temp_array = full_coalition_temp add_to_temp_array = { full_coalition_temp = ruling_party } for_each_loop = { array = gov_coalition_array value = v add_to_temp_array = { full_coalition_temp = v } } # Find the strongest member by electoral popularity set_temp_variable = { best_coalition_pop = 0 } set_temp_variable = { best_coalition_index = ruling_party } for_each_loop = { array = full_coalition_temp value = v if = { limit = { check_variable = { party_pop_elect_array^v > best_coalition_pop } } set_temp_variable = { best_coalition_pop = party_pop_elect_array^v } set_temp_variable = { best_coalition_index = v } } } # Only swap if a different party is now strongest if = { limit = { NOT = { check_variable = { ruling_party = best_coalition_index } } NOT = { has_country_leader_with_trait = roman_senate_trait } } # Set up change_ruling_party_effect parameters set_temp_variable = { rul_party_temp = best_coalition_index } set_temp_variable = { disable_elections = 0 } # Assign remaining coalition members to col slots set_temp_variable = { coalition_slot = 0 } for_each_loop = { array = full_coalition_temp value = v if = { limit = { NOT = { check_variable = { v = best_coalition_index } } check_variable = { party_pop_elect_array^v > election_threshold } } if = { limit = { check_variable = { coalition_slot = 0 } } set_temp_variable = { col_one = v } } else_if = { limit = { check_variable = { coalition_slot = 1 } } set_temp_variable = { col_two = v } } else_if = { limit = { check_variable = { coalition_slot = 2 } } set_temp_variable = { col_three = v } } else_if = { limit = { check_variable = { coalition_slot = 3 } } set_temp_variable = { col_four = v } } else_if = { limit = { check_variable = { coalition_slot = 4 } } set_temp_variable = { col_five = v } } add_to_temp_variable = { coalition_slot = 1 } } } change_ruling_party_effect = yes } } } refund_government_coalition = { set_temp_variable = { sum_factor = 0 } for_each_loop = { array = gov_coalition_array value = v index = i set_temp_variable = { pol_dist_target_index = v } set_temp_variable = { pol_dist_source_index = ruling_party } get_pol_distance = yes add_to_temp_variable = { var = sum_factor value = { value = party_pop_elect_array^v multiply = pol_distance_current } } } set_temp_variable = { pp_cost_to_invite = sum_factor } multiply_temp_variable = { pp_cost_to_invite = 1500 } add_political_power = pp_cost_to_invite } store_election_values = { for_loop_effect = { end = party_pop_array^num value = v if = { limit = { check_variable = { party_pop_elect_array^v = -1 } } if = { limit = { check_variable = { party_pop_array^v > election_threshold } } set_variable = { party_pop_elect_array^v = party_pop_array^v } } else_if = { limit = { check_variable = { party_pop_elect_array^v = -1 } } set_variable = { party_pop_elect_array^v = 0 } } } } calculate_banned_parties = yes } calculate_banned_parties = { for_loop_effect = { start = 0 end = 24 value = v if = { limit = { check_variable = { party_banned_array^v = 1 } } set_variable = { party_pop_elect_array^v = 0 } } } } #only needed for elections update_majority_threshold = { set_temp_variable = { sum = 0 } for_each_loop = { array = party_pop_elect_array add_to_temp_variable = { sum = v } } set_variable = { majority_threshold = sum } multiply_variable = { majority_threshold = 0.5 } } campaign_spending_initial = { # ads_budget_effect = campaign_funding_count * 0.04 + 0.60, clamped to [0.60, 1.24] set_variable = { ads_budget_effect = campaign_funding_count } clamp_variable = { var = ads_budget_effect min = 0 max = 16 } multiply_variable = { ads_budget_effect = 0.04 } add_to_variable = { ads_budget_effect = 0.60 } # floor for low funding if = { limit = { check_variable = { campaign_funding_count < 3 } } set_variable = { ads_budget_effect = 0.60 } } else_if = { limit = { check_variable = { campaign_funding_count = 10 } } random_list = { 50 = { set_variable = { ads_budget_effect = 0.96 } } 50 = { set_variable = { ads_budget_effect = 1.04 } } } } } # AI create coalition AI_setup_government = { if = { limit = { is_debug = yes } log = "[GetDateText]: [Root.GetName]: AI started setup government [?political_power]" } # hold_elections = yes #add values to election array etc clear_array = gov_coalition_array set_temp_variable = { majority_threshold_1 = majority_threshold } #need one that does not include biggest party subtract_from_temp_variable = { majority_threshold_1 = party_pop_elect_array^max_index_1 } set_temp_variable = { majority_threshold_2 = majority_threshold } #need one that does not include second biggest party subtract_from_temp_variable = { majority_threshold_2 = party_pop_elect_array^max_index_2 } make_affinity_arrays = yes reduce_affinity_array_party_1 = yes reduce_affinity_array_party_2 = yes if = { limit = { #coalition 1 is prefered - lowest check_variable = { var = cost1 value = cost2 compare = less_than_or_equals } } set_variable = { ruling_party = max_index_1 } for_each_loop = { array = party_pop_elect_array index = i1 if = { limit = { check_variable = { party_1_affinity_array^i1 > 0 } } add_to_array = { gov_coalition_array = i1 } } } } else_if = { limit = { check_variable = { cost1 > cost2 } #coalition 2 is prefered - lowest } set_variable = { ruling_party = max_index_2 } for_each_loop = { array = party_pop_elect_array index = i2 if = { limit = { check_variable = { party_2_affinity_array^i2 > 0 } } add_to_array = { gov_coalition_array = i2 } } } } update_government_coalition_strength = yes if = { limit = { tag = ITA } reforme_expectance_government_change_update = yes calculate_abandon_coalition_threshold = yes remove_gov_crisis_ai_flags = yes } if = { limit = { #leader has subideology_trait = ruling party NOT = { OR = { AND = { has_country_leader_with_trait = western_Western_Autocracy western_autocrats_are_in_power = yes } AND = { has_country_leader_with_trait = western_technocrat western_autocrats_are_in_power = yes } AND = { has_country_leader_with_trait = western_conservatism check_variable = { ruling_party = 1 } } AND = { has_country_leader_with_trait = western_liberalism check_variable = { ruling_party = 2 } } AND = { has_country_leader_with_trait = western_socialism check_variable = { ruling_party = 3 } } AND = { has_country_leader_with_trait = emerging_Communist-State check_variable = { ruling_party = 4 } } AND = { has_country_leader_with_trait = emerging_anarchist_communism check_variable = { ruling_party = 5 } } AND = { has_country_leader_with_trait = emerging_Conservative check_variable = { ruling_party = 6 } } AND = { has_country_leader_with_trait = emerging_Autocracy check_variable = { ruling_party = 7 } } AND = { has_country_leader_with_trait = emerging_Mod_Vilayat_e_Faqih check_variable = { ruling_party = 8 } } AND = { has_country_leader_with_trait = emerging_Vilayat_e_Faqih check_variable = { ruling_party = 9 } } AND = { has_country_leader_with_trait = salafist_Kingdom check_variable = { ruling_party = 10 } } AND = { has_country_leader_with_trait = salafist_Caliphate check_variable = { ruling_party = 11 } } AND = { has_country_leader_with_trait = neutrality_Neutral_Muslim_Brotherhood check_variable = { ruling_party = 12 } } AND = { has_country_leader_with_trait = neutrality_Neutral_Autocracy check_variable = { ruling_party = 13 } } AND = { has_country_leader_with_trait = neutrality_Neutral_conservatism check_variable = { ruling_party = 14 } } AND = { has_country_leader_with_trait = neutrality_oligarchism check_variable = { ruling_party = 15 } } AND = { has_country_leader_with_trait = neutrality_Neutral_Libertarian check_variable = { ruling_party = 16 } } AND = { has_country_leader_with_trait = neutrality_Neutral_green check_variable = { ruling_party = 17 } } AND = { has_country_leader_with_trait = neutrality_neutral_Social check_variable = { ruling_party = 18 } } AND = { has_country_leader_with_trait = neutrality_Neutral_Communism check_variable = { ruling_party = 19 } } AND = { has_country_leader_with_trait = nationalist_Nat_Populism check_variable = { ruling_party = 20 } } AND = { has_country_leader_with_trait = nationalist_Nat_Fascism check_variable = { ruling_party = 21 } } AND = { has_country_leader_with_trait = nationalist_Nat_Autocracy check_variable = { ruling_party = 22 } } AND = { has_country_leader_with_trait = nationalist_Monarchist check_variable = { ruling_party = 23 } } } } } #switch to ruling hidden_effect = { set_leader = yes } } # Logs the AI Setup_government if = { limit = { is_debug = yes } log = "[GetDateText]: [Root.GetName]: AI finished setup government [?political_power]" } } make_affinity_arrays = { resize_temp_array = { array = party_1_affinity_array size = party_pop_array^num } resize_temp_array = { array = party_2_affinity_array size = party_pop_array^num } for_loop_effect = { end = party_pop_array^num value = v if = { limit = { NOT = { OR = { check_variable = { max_index_1 = v } check_variable = { max_index_2 = v } } } } if = { limit = { check_variable = { party_pop_elect_array^v > 0 } } set_temp_variable = { pol_dist_target_index = v } set_temp_variable = { pol_dist_source_index = max_index_1 } get_pol_distance = yes set_temp_variable = { party_1_affinity_array^v = pol_distance_current } set_temp_variable = { pol_dist_source_index = max_index_2 } get_pol_distance = yes set_temp_variable = { party_2_affinity_array^v = pol_distance_current } } } } } reduce_affinity_array_party_1 = { for_loop_effect = { end = party_pop_array^num value = a1 break = break_1 set_temp_variable = { sum_coalition_1 = 0 } #current temp coalition1 strength for_each_loop = { array = party_pop_elect_array value = b1 index = e1 if = { limit = { check_variable = { party_1_affinity_array^e1 > 0 } } add_to_temp_variable = { sum_coalition_1 = b1 } } } if = { limit = { check_variable = { sum_coalition_1 > majority_threshold_1 } } find_highest_in_array = { array = party_1_affinity_array value = max1 index = max1_index } subtract_from_temp_variable = { sum_coalition_1 = party_pop_elect_array^max1_index } set_temp_variable = { party_1_affinity_array^max1_index = 0 } if = { limit = { check_variable = { sum_coalition_1 < majority_threshold_1 } } set_temp_variable = { party_1_affinity_array^max1_index = max1 } add_to_temp_variable = { sum_coalition_1 = party_pop_elect_array^max1_index } set_temp_variable = { break_1 = 1 } } } } #find total cost1 set_temp_variable = { cost1 = 0 } for_each_loop = { array = party_pop_elect_array value = d1 index = g1 if = { limit = { check_variable = { party_1_affinity_array^g1 > 0 } } add_to_temp_variable = { var = cost1 value = { value = party_1_affinity_array^g1 multiply = d1 } } } } } reduce_affinity_array_party_2 = { for_loop_effect = { end = party_pop_array^num value = a2 break = break_2 set_temp_variable = { sum_coalition_2 = 0 } #current temp coalition2 strength for_each_loop = { array = party_pop_elect_array value = b2 index = e2 if = { limit = { check_variable = { party_2_affinity_array^e2 > 0 } } add_to_temp_variable = { sum_coalition_2 = b2 } } } if = { limit = { check_variable = { sum_coalition_2 > majority_threshold_2 } } find_highest_in_array = { array = party_2_affinity_array value = max2 index = max2_index } subtract_from_temp_variable = { sum_coalition_2 = party_pop_elect_array^max2_index } set_temp_variable = { party_2_affinity_array^max2_index = 0 } if = { limit = { check_variable = { sum_coalition_2 < majority_threshold_2 } } set_temp_variable = { party_2_affinity_array^max2_index = max2 } add_to_temp_variable = { sum_coalition_2 = party_pop_elect_array^max2_index } set_temp_variable = { break_2 = 1 } } } } #find total cost2 set_temp_variable = { cost2 = 0 } for_each_loop = { array = party_pop_elect_array value = d2 index = g2 if = { limit = { check_variable = { party_2_affinity_array^g2 > 0 } } add_to_temp_variable = { var = cost2 value = { value = party_2_affinity_array^g2 multiply = d2 } } } } } #### Political Distance Matrix #### # Flat array lookup replacing 24 individual pol_distance_X effects. # Indexed as: global.pol_dist_matrix^(target * 24 + source) init_pol_distance_matrix = { resize_array = { array = global.pol_dist_matrix size = 576 } #Western_Autocracy (target 0) set_variable = { global.pol_dist_matrix^1 = 0.2 } set_variable = { global.pol_dist_matrix^2 = 0.4 } set_variable = { global.pol_dist_matrix^3 = 0.4 } set_variable = { global.pol_dist_matrix^4 = 1.0 } set_variable = { global.pol_dist_matrix^5 = 0.9 } set_variable = { global.pol_dist_matrix^6 = 0.5 } set_variable = { global.pol_dist_matrix^7 = 0.4 } set_variable = { global.pol_dist_matrix^8 = 1.0 } set_variable = { global.pol_dist_matrix^9 = 1.0 } set_variable = { global.pol_dist_matrix^10 = 1.0 } set_variable = { global.pol_dist_matrix^11 = 1.0 } set_variable = { global.pol_dist_matrix^12 = 0.5 } set_variable = { global.pol_dist_matrix^13 = 0.2 } set_variable = { global.pol_dist_matrix^14 = 0.4 } set_variable = { global.pol_dist_matrix^15 = 0.4 } set_variable = { global.pol_dist_matrix^16 = 1.0 } set_variable = { global.pol_dist_matrix^17 = 0.9 } set_variable = { global.pol_dist_matrix^18 = 0.9 } set_variable = { global.pol_dist_matrix^19 = 1.0 } set_variable = { global.pol_dist_matrix^20 = 0.3 } set_variable = { global.pol_dist_matrix^21 = 0.5 } set_variable = { global.pol_dist_matrix^22 = 0.2 } set_variable = { global.pol_dist_matrix^23 = 0.2 } #conservatism (target 1) set_variable = { global.pol_dist_matrix^24 = 0.3 } set_variable = { global.pol_dist_matrix^26 = 0.2 } set_variable = { global.pol_dist_matrix^27 = 0.6 } set_variable = { global.pol_dist_matrix^28 = 1.0 } set_variable = { global.pol_dist_matrix^29 = 0.9 } set_variable = { global.pol_dist_matrix^30 = 0.5 } set_variable = { global.pol_dist_matrix^31 = 0.6 } set_variable = { global.pol_dist_matrix^32 = 1.0 } set_variable = { global.pol_dist_matrix^33 = 1.0 } set_variable = { global.pol_dist_matrix^34 = 1.0 } set_variable = { global.pol_dist_matrix^35 = 1.0 } set_variable = { global.pol_dist_matrix^36 = 0.5 } set_variable = { global.pol_dist_matrix^37 = 0.4 } set_variable = { global.pol_dist_matrix^38 = 0.1 } set_variable = { global.pol_dist_matrix^39 = 0.3 } set_variable = { global.pol_dist_matrix^40 = 0.4 } set_variable = { global.pol_dist_matrix^41 = 0.5 } set_variable = { global.pol_dist_matrix^42 = 0.9 } set_variable = { global.pol_dist_matrix^43 = 1.0 } set_variable = { global.pol_dist_matrix^44 = 0.3 } set_variable = { global.pol_dist_matrix^45 = 0.8 } set_variable = { global.pol_dist_matrix^46 = 0.5 } set_variable = { global.pol_dist_matrix^47 = 0.5 } #liberalism (target 2) set_variable = { global.pol_dist_matrix^48 = 0.4 } set_variable = { global.pol_dist_matrix^49 = 0.2 } set_variable = { global.pol_dist_matrix^51 = 0.5 } set_variable = { global.pol_dist_matrix^52 = 1.0 } set_variable = { global.pol_dist_matrix^53 = 0.9 } set_variable = { global.pol_dist_matrix^54 = 0.9 } set_variable = { global.pol_dist_matrix^55 = 0.9 } set_variable = { global.pol_dist_matrix^56 = 1.0 } set_variable = { global.pol_dist_matrix^57 = 1.0 } set_variable = { global.pol_dist_matrix^58 = 1.0 } set_variable = { global.pol_dist_matrix^59 = 1.0 } set_variable = { global.pol_dist_matrix^60 = 0.5 } set_variable = { global.pol_dist_matrix^61 = 0.8 } set_variable = { global.pol_dist_matrix^62 = 0.2 } set_variable = { global.pol_dist_matrix^63 = 0.4 } set_variable = { global.pol_dist_matrix^64 = 0.2 } set_variable = { global.pol_dist_matrix^65 = 0.3 } set_variable = { global.pol_dist_matrix^66 = 0.6 } set_variable = { global.pol_dist_matrix^67 = 1.0 } set_variable = { global.pol_dist_matrix^68 = 0.4 } set_variable = { global.pol_dist_matrix^69 = 1.0 } set_variable = { global.pol_dist_matrix^70 = 1.0 } set_variable = { global.pol_dist_matrix^71 = 1.0 } #socialism (target 3) set_variable = { global.pol_dist_matrix^72 = 0.4 } set_variable = { global.pol_dist_matrix^73 = 0.6 } set_variable = { global.pol_dist_matrix^74 = 0.5 } set_variable = { global.pol_dist_matrix^76 = 0.7 } set_variable = { global.pol_dist_matrix^77 = 0.4 } set_variable = { global.pol_dist_matrix^78 = 1.0 } set_variable = { global.pol_dist_matrix^79 = 1.0 } set_variable = { global.pol_dist_matrix^80 = 1.0 } set_variable = { global.pol_dist_matrix^81 = 1.0 } set_variable = { global.pol_dist_matrix^82 = 1.0 } set_variable = { global.pol_dist_matrix^83 = 1.0 } set_variable = { global.pol_dist_matrix^84 = 0.5 } set_variable = { global.pol_dist_matrix^85 = 0.8 } set_variable = { global.pol_dist_matrix^86 = 0.6 } set_variable = { global.pol_dist_matrix^87 = 0.3 } set_variable = { global.pol_dist_matrix^88 = 0.7 } set_variable = { global.pol_dist_matrix^89 = 0.3 } set_variable = { global.pol_dist_matrix^90 = 0.1 } set_variable = { global.pol_dist_matrix^91 = 0.7 } set_variable = { global.pol_dist_matrix^92 = 1.0 } set_variable = { global.pol_dist_matrix^93 = 1.0 } set_variable = { global.pol_dist_matrix^94 = 1.0 } set_variable = { global.pol_dist_matrix^95 = 1.0 } #Communist-State (target 4) set_variable = { global.pol_dist_matrix^96 = 1.0 } set_variable = { global.pol_dist_matrix^97 = 1.0 } set_variable = { global.pol_dist_matrix^98 = 1.0 } set_variable = { global.pol_dist_matrix^99 = 0.7 } set_variable = { global.pol_dist_matrix^101 = 0.1 } set_variable = { global.pol_dist_matrix^102 = 0.9 } set_variable = { global.pol_dist_matrix^103 = 0.5 } set_variable = { global.pol_dist_matrix^104 = 0.9 } set_variable = { global.pol_dist_matrix^105 = 0.9 } set_variable = { global.pol_dist_matrix^106 = 1.0 } set_variable = { global.pol_dist_matrix^107 = 1.0 } set_variable = { global.pol_dist_matrix^108 = 0.9 } set_variable = { global.pol_dist_matrix^109 = 0.7 } set_variable = { global.pol_dist_matrix^110 = 1.0 } set_variable = { global.pol_dist_matrix^111 = 0.5 } set_variable = { global.pol_dist_matrix^112 = 1.0 } set_variable = { global.pol_dist_matrix^113 = 0.5 } set_variable = { global.pol_dist_matrix^114 = 0.3 } set_variable = { global.pol_dist_matrix^115 = 0.1 } set_variable = { global.pol_dist_matrix^116 = 1.0 } set_variable = { global.pol_dist_matrix^117 = 1.0 } set_variable = { global.pol_dist_matrix^118 = 0.5 } set_variable = { global.pol_dist_matrix^119 = 1.0 } #anarchist_communism (target 5) set_variable = { global.pol_dist_matrix^120 = 1.0 } set_variable = { global.pol_dist_matrix^121 = 1.0 } set_variable = { global.pol_dist_matrix^122 = 1.0 } set_variable = { global.pol_dist_matrix^123 = 0.4 } set_variable = { global.pol_dist_matrix^124 = 0.1 } set_variable = { global.pol_dist_matrix^126 = 0.8 } set_variable = { global.pol_dist_matrix^127 = 0.5 } set_variable = { global.pol_dist_matrix^128 = 0.8 } set_variable = { global.pol_dist_matrix^129 = 0.8 } set_variable = { global.pol_dist_matrix^130 = 1.0 } set_variable = { global.pol_dist_matrix^131 = 1.0 } set_variable = { global.pol_dist_matrix^132 = 0.5 } set_variable = { global.pol_dist_matrix^133 = 0.7 } set_variable = { global.pol_dist_matrix^134 = 0.9 } set_variable = { global.pol_dist_matrix^135 = 0.3 } set_variable = { global.pol_dist_matrix^136 = 1.0 } set_variable = { global.pol_dist_matrix^137 = 0.3 } set_variable = { global.pol_dist_matrix^138 = 0.1 } set_variable = { global.pol_dist_matrix^139 = 0.2 } set_variable = { global.pol_dist_matrix^140 = 1.0 } set_variable = { global.pol_dist_matrix^141 = 1.0 } set_variable = { global.pol_dist_matrix^142 = 0.8 } set_variable = { global.pol_dist_matrix^143 = 1.0 } #Conservative (target 6) set_variable = { global.pol_dist_matrix^144 = 0.7 } set_variable = { global.pol_dist_matrix^145 = 0.9 } set_variable = { global.pol_dist_matrix^146 = 0.9 } set_variable = { global.pol_dist_matrix^147 = 0.9 } set_variable = { global.pol_dist_matrix^148 = 0.5 } set_variable = { global.pol_dist_matrix^149 = 0.5 } set_variable = { global.pol_dist_matrix^150 = 0.1 } set_variable = { global.pol_dist_matrix^152 = 0.4 } set_variable = { global.pol_dist_matrix^153 = 0.4 } set_variable = { global.pol_dist_matrix^154 = 1.0 } set_variable = { global.pol_dist_matrix^155 = 1.0 } set_variable = { global.pol_dist_matrix^156 = 0.5 } set_variable = { global.pol_dist_matrix^157 = 0.5 } set_variable = { global.pol_dist_matrix^158 = 0.5 } set_variable = { global.pol_dist_matrix^159 = 0.4 } set_variable = { global.pol_dist_matrix^160 = 0.9 } set_variable = { global.pol_dist_matrix^161 = 0.6 } set_variable = { global.pol_dist_matrix^162 = 0.6 } set_variable = { global.pol_dist_matrix^163 = 0.6 } set_variable = { global.pol_dist_matrix^164 = 0.4 } set_variable = { global.pol_dist_matrix^165 = 0.6 } set_variable = { global.pol_dist_matrix^166 = 0.2 } set_variable = { global.pol_dist_matrix^167 = 0.8 } #Autocracy (target 7) set_variable = { global.pol_dist_matrix^168 = 0.7 } set_variable = { global.pol_dist_matrix^169 = 0.5 } set_variable = { global.pol_dist_matrix^170 = 0.9 } set_variable = { global.pol_dist_matrix^171 = 0.9 } set_variable = { global.pol_dist_matrix^172 = 0.7 } set_variable = { global.pol_dist_matrix^173 = 0.6 } set_variable = { global.pol_dist_matrix^175 = 0.1 } set_variable = { global.pol_dist_matrix^176 = 0.4 } set_variable = { global.pol_dist_matrix^177 = 0.4 } set_variable = { global.pol_dist_matrix^178 = 1.0 } set_variable = { global.pol_dist_matrix^179 = 1.0 } set_variable = { global.pol_dist_matrix^180 = 0.6 } set_variable = { global.pol_dist_matrix^181 = 0.5 } set_variable = { global.pol_dist_matrix^182 = 0.5 } set_variable = { global.pol_dist_matrix^183 = 0.5 } set_variable = { global.pol_dist_matrix^184 = 1.0 } set_variable = { global.pol_dist_matrix^185 = 0.7 } set_variable = { global.pol_dist_matrix^186 = 0.8 } set_variable = { global.pol_dist_matrix^187 = 0.9 } set_variable = { global.pol_dist_matrix^188 = 0.4 } set_variable = { global.pol_dist_matrix^189 = 0.6 } set_variable = { global.pol_dist_matrix^190 = 0.5 } set_variable = { global.pol_dist_matrix^191 = 0.5 } #Mod_Vilayat_e_Faqih (target 8) set_variable = { global.pol_dist_matrix^192 = 0.7 } set_variable = { global.pol_dist_matrix^193 = 0.9 } set_variable = { global.pol_dist_matrix^194 = 0.9 } set_variable = { global.pol_dist_matrix^195 = 0.9 } set_variable = { global.pol_dist_matrix^196 = 0.8 } set_variable = { global.pol_dist_matrix^197 = 0.5 } set_variable = { global.pol_dist_matrix^198 = 0.4 } set_variable = { global.pol_dist_matrix^199 = 0.5 } set_variable = { global.pol_dist_matrix^201 = 0.2 } set_variable = { global.pol_dist_matrix^202 = 1.0 } set_variable = { global.pol_dist_matrix^203 = 1.0 } set_variable = { global.pol_dist_matrix^204 = 0.3 } set_variable = { global.pol_dist_matrix^205 = 0.5 } set_variable = { global.pol_dist_matrix^206 = 0.5 } set_variable = { global.pol_dist_matrix^207 = 0.4 } set_variable = { global.pol_dist_matrix^208 = 0.9 } set_variable = { global.pol_dist_matrix^209 = 0.5 } set_variable = { global.pol_dist_matrix^210 = 0.6 } set_variable = { global.pol_dist_matrix^211 = 0.9 } set_variable = { global.pol_dist_matrix^212 = 0.4 } set_variable = { global.pol_dist_matrix^213 = 0.6 } set_variable = { global.pol_dist_matrix^214 = 0.2 } set_variable = { global.pol_dist_matrix^215 = 1.0 } #Vilayat_e_Faqih (target 9) set_variable = { global.pol_dist_matrix^216 = 0.8 } set_variable = { global.pol_dist_matrix^217 = 1.0 } set_variable = { global.pol_dist_matrix^218 = 1.0 } set_variable = { global.pol_dist_matrix^219 = 0.9 } set_variable = { global.pol_dist_matrix^220 = 0.8 } set_variable = { global.pol_dist_matrix^221 = 0.5 } set_variable = { global.pol_dist_matrix^222 = 0.4 } set_variable = { global.pol_dist_matrix^223 = 0.5 } set_variable = { global.pol_dist_matrix^224 = 0.2 } set_variable = { global.pol_dist_matrix^226 = 1.0 } set_variable = { global.pol_dist_matrix^227 = 1.0 } set_variable = { global.pol_dist_matrix^228 = 0.3 } set_variable = { global.pol_dist_matrix^229 = 0.5 } set_variable = { global.pol_dist_matrix^230 = 0.5 } set_variable = { global.pol_dist_matrix^231 = 0.4 } set_variable = { global.pol_dist_matrix^232 = 0.9 } set_variable = { global.pol_dist_matrix^233 = 0.5 } set_variable = { global.pol_dist_matrix^234 = 0.6 } set_variable = { global.pol_dist_matrix^235 = 0.9 } set_variable = { global.pol_dist_matrix^236 = 0.4 } set_variable = { global.pol_dist_matrix^237 = 0.6 } set_variable = { global.pol_dist_matrix^238 = 0.2 } set_variable = { global.pol_dist_matrix^239 = 1.0 } #Kingdom (target 10) set_variable = { global.pol_dist_matrix^240 = 0.6 } set_variable = { global.pol_dist_matrix^241 = 0.9 } set_variable = { global.pol_dist_matrix^242 = 0.9 } set_variable = { global.pol_dist_matrix^243 = 0.9 } set_variable = { global.pol_dist_matrix^244 = 1.0 } set_variable = { global.pol_dist_matrix^245 = 1.0 } set_variable = { global.pol_dist_matrix^246 = 1.0 } set_variable = { global.pol_dist_matrix^247 = 1.0 } set_variable = { global.pol_dist_matrix^248 = 1.0 } set_variable = { global.pol_dist_matrix^249 = 1.0 } set_variable = { global.pol_dist_matrix^251 = 0.5 } set_variable = { global.pol_dist_matrix^252 = 1.0 } set_variable = { global.pol_dist_matrix^253 = 0.6 } set_variable = { global.pol_dist_matrix^254 = 1.0 } set_variable = { global.pol_dist_matrix^255 = 1.0 } set_variable = { global.pol_dist_matrix^256 = 1.0 } set_variable = { global.pol_dist_matrix^257 = 1.0 } set_variable = { global.pol_dist_matrix^258 = 1.0 } set_variable = { global.pol_dist_matrix^259 = 1.0 } set_variable = { global.pol_dist_matrix^260 = 0.7 } set_variable = { global.pol_dist_matrix^261 = 0.5 } set_variable = { global.pol_dist_matrix^262 = 0.2 } set_variable = { global.pol_dist_matrix^263 = 0.2 } #Caliphate (target 11) set_variable = { global.pol_dist_matrix^264 = 0.7 } set_variable = { global.pol_dist_matrix^265 = 1.0 } set_variable = { global.pol_dist_matrix^266 = 1.0 } set_variable = { global.pol_dist_matrix^267 = 1.0 } set_variable = { global.pol_dist_matrix^268 = 1.0 } set_variable = { global.pol_dist_matrix^269 = 1.0 } set_variable = { global.pol_dist_matrix^270 = 1.0 } set_variable = { global.pol_dist_matrix^271 = 1.0 } set_variable = { global.pol_dist_matrix^272 = 1.0 } set_variable = { global.pol_dist_matrix^273 = 1.0 } set_variable = { global.pol_dist_matrix^274 = 0.4 } set_variable = { global.pol_dist_matrix^276 = 1.0 } set_variable = { global.pol_dist_matrix^277 = 0.7 } set_variable = { global.pol_dist_matrix^278 = 1.0 } set_variable = { global.pol_dist_matrix^279 = 1.0 } set_variable = { global.pol_dist_matrix^280 = 1.0 } set_variable = { global.pol_dist_matrix^281 = 1.0 } set_variable = { global.pol_dist_matrix^282 = 1.0 } set_variable = { global.pol_dist_matrix^283 = 1.0 } set_variable = { global.pol_dist_matrix^284 = 1.0 } set_variable = { global.pol_dist_matrix^285 = 0.3 } set_variable = { global.pol_dist_matrix^286 = 0.2 } set_variable = { global.pol_dist_matrix^287 = 1.0 } #Neutral_Muslim_Brotherhood (target 12) set_variable = { global.pol_dist_matrix^288 = 0.6 } set_variable = { global.pol_dist_matrix^289 = 0.4 } set_variable = { global.pol_dist_matrix^290 = 0.9 } set_variable = { global.pol_dist_matrix^291 = 0.8 } set_variable = { global.pol_dist_matrix^292 = 0.8 } set_variable = { global.pol_dist_matrix^293 = 0.6 } set_variable = { global.pol_dist_matrix^294 = 0.3 } set_variable = { global.pol_dist_matrix^295 = 0.5 } set_variable = { global.pol_dist_matrix^296 = 0.3 } set_variable = { global.pol_dist_matrix^297 = 0.3 } set_variable = { global.pol_dist_matrix^298 = 1.0 } set_variable = { global.pol_dist_matrix^299 = 1.0 } set_variable = { global.pol_dist_matrix^301 = 0.6 } set_variable = { global.pol_dist_matrix^302 = 0.4 } set_variable = { global.pol_dist_matrix^303 = 0.6 } set_variable = { global.pol_dist_matrix^304 = 0.6 } set_variable = { global.pol_dist_matrix^305 = 0.5 } set_variable = { global.pol_dist_matrix^306 = 0.6 } set_variable = { global.pol_dist_matrix^307 = 0.8 } set_variable = { global.pol_dist_matrix^308 = 0.4 } set_variable = { global.pol_dist_matrix^309 = 0.8 } set_variable = { global.pol_dist_matrix^310 = 0.9 } set_variable = { global.pol_dist_matrix^311 = 0.9 } #Neutral_Autocracy (target 13) set_variable = { global.pol_dist_matrix^312 = 0.5 } set_variable = { global.pol_dist_matrix^313 = 0.6 } set_variable = { global.pol_dist_matrix^314 = 1.0 } set_variable = { global.pol_dist_matrix^315 = 0.9 } set_variable = { global.pol_dist_matrix^316 = 0.9 } set_variable = { global.pol_dist_matrix^317 = 0.8 } set_variable = { global.pol_dist_matrix^318 = 0.3 } set_variable = { global.pol_dist_matrix^319 = 0.5 } set_variable = { global.pol_dist_matrix^320 = 0.8 } set_variable = { global.pol_dist_matrix^321 = 0.8 } set_variable = { global.pol_dist_matrix^322 = 1.0 } set_variable = { global.pol_dist_matrix^323 = 1.0 } set_variable = { global.pol_dist_matrix^324 = 0.8 } set_variable = { global.pol_dist_matrix^326 = 0.4 } set_variable = { global.pol_dist_matrix^327 = 0.6 } set_variable = { global.pol_dist_matrix^328 = 0.9 } set_variable = { global.pol_dist_matrix^329 = 0.7 } set_variable = { global.pol_dist_matrix^330 = 0.7 } set_variable = { global.pol_dist_matrix^331 = 0.8 } set_variable = { global.pol_dist_matrix^332 = 0.5 } set_variable = { global.pol_dist_matrix^333 = 0.8 } set_variable = { global.pol_dist_matrix^334 = 0.2 } set_variable = { global.pol_dist_matrix^335 = 0.7 } #Neutral_conservatism (target 14) set_variable = { global.pol_dist_matrix^336 = 0.5 } set_variable = { global.pol_dist_matrix^337 = 0.1 } set_variable = { global.pol_dist_matrix^338 = 0.3 } set_variable = { global.pol_dist_matrix^339 = 0.7 } set_variable = { global.pol_dist_matrix^340 = 1.0 } set_variable = { global.pol_dist_matrix^341 = 0.9 } set_variable = { global.pol_dist_matrix^342 = 0.4 } set_variable = { global.pol_dist_matrix^343 = 0.6 } set_variable = { global.pol_dist_matrix^344 = 0.5 } set_variable = { global.pol_dist_matrix^345 = 0.5 } set_variable = { global.pol_dist_matrix^346 = 1.0 } set_variable = { global.pol_dist_matrix^347 = 1.0 } set_variable = { global.pol_dist_matrix^348 = 0.7 } set_variable = { global.pol_dist_matrix^349 = 0.6 } set_variable = { global.pol_dist_matrix^351 = 0.5 } set_variable = { global.pol_dist_matrix^352 = 0.4 } set_variable = { global.pol_dist_matrix^353 = 0.8 } set_variable = { global.pol_dist_matrix^354 = 0.9 } set_variable = { global.pol_dist_matrix^355 = 1.0 } set_variable = { global.pol_dist_matrix^356 = 0.6 } set_variable = { global.pol_dist_matrix^357 = 1.0 } set_variable = { global.pol_dist_matrix^358 = 1.0 } set_variable = { global.pol_dist_matrix^359 = 1.0 } #oligarchism (target 15) set_variable = { global.pol_dist_matrix^360 = 0.8 } set_variable = { global.pol_dist_matrix^361 = 0.5 } set_variable = { global.pol_dist_matrix^362 = 0.5 } set_variable = { global.pol_dist_matrix^363 = 0.4 } set_variable = { global.pol_dist_matrix^364 = 1.0 } set_variable = { global.pol_dist_matrix^365 = 0.8 } set_variable = { global.pol_dist_matrix^366 = 0.7 } set_variable = { global.pol_dist_matrix^367 = 0.7 } set_variable = { global.pol_dist_matrix^368 = 0.9 } set_variable = { global.pol_dist_matrix^369 = 0.9 } set_variable = { global.pol_dist_matrix^370 = 1.0 } set_variable = { global.pol_dist_matrix^371 = 1.0 } set_variable = { global.pol_dist_matrix^372 = 0.9 } set_variable = { global.pol_dist_matrix^373 = 0.7 } set_variable = { global.pol_dist_matrix^374 = 0.4 } set_variable = { global.pol_dist_matrix^376 = 0.8 } set_variable = { global.pol_dist_matrix^377 = 0.6 } set_variable = { global.pol_dist_matrix^378 = 0.7 } set_variable = { global.pol_dist_matrix^379 = 0.6 } set_variable = { global.pol_dist_matrix^380 = 0.8 } set_variable = { global.pol_dist_matrix^381 = 1.0 } set_variable = { global.pol_dist_matrix^382 = 1.0 } set_variable = { global.pol_dist_matrix^383 = 1.0 } #Neutral_Libertarian (target 16) set_variable = { global.pol_dist_matrix^384 = 1.0 } set_variable = { global.pol_dist_matrix^385 = 0.4 } set_variable = { global.pol_dist_matrix^386 = 0.4 } set_variable = { global.pol_dist_matrix^387 = 1.0 } set_variable = { global.pol_dist_matrix^388 = 1.0 } set_variable = { global.pol_dist_matrix^389 = 1.0 } set_variable = { global.pol_dist_matrix^390 = 0.7 } set_variable = { global.pol_dist_matrix^391 = 1.0 } set_variable = { global.pol_dist_matrix^392 = 0.9 } set_variable = { global.pol_dist_matrix^393 = 0.9 } set_variable = { global.pol_dist_matrix^394 = 1.0 } set_variable = { global.pol_dist_matrix^395 = 1.0 } set_variable = { global.pol_dist_matrix^396 = 0.8 } set_variable = { global.pol_dist_matrix^397 = 0.9 } set_variable = { global.pol_dist_matrix^398 = 0.4 } set_variable = { global.pol_dist_matrix^399 = 0.9 } set_variable = { global.pol_dist_matrix^401 = 0.6 } set_variable = { global.pol_dist_matrix^402 = 1.0 } set_variable = { global.pol_dist_matrix^403 = 1.0 } set_variable = { global.pol_dist_matrix^404 = 0.5 } set_variable = { global.pol_dist_matrix^405 = 1.0 } set_variable = { global.pol_dist_matrix^406 = 1.0 } set_variable = { global.pol_dist_matrix^407 = 1.0 } #Neutral_green (target 17) set_variable = { global.pol_dist_matrix^408 = 1.0 } set_variable = { global.pol_dist_matrix^409 = 0.6 } set_variable = { global.pol_dist_matrix^410 = 0.4 } set_variable = { global.pol_dist_matrix^411 = 0.5 } set_variable = { global.pol_dist_matrix^412 = 1.0 } set_variable = { global.pol_dist_matrix^413 = 0.5 } set_variable = { global.pol_dist_matrix^414 = 1.0 } set_variable = { global.pol_dist_matrix^415 = 1.0 } set_variable = { global.pol_dist_matrix^416 = 0.9 } set_variable = { global.pol_dist_matrix^417 = 0.9 } set_variable = { global.pol_dist_matrix^418 = 1.0 } set_variable = { global.pol_dist_matrix^419 = 1.0 } set_variable = { global.pol_dist_matrix^420 = 0.8 } set_variable = { global.pol_dist_matrix^421 = 1.0 } set_variable = { global.pol_dist_matrix^422 = 0.6 } set_variable = { global.pol_dist_matrix^423 = 0.9 } set_variable = { global.pol_dist_matrix^424 = 0.5 } set_variable = { global.pol_dist_matrix^426 = 0.4 } set_variable = { global.pol_dist_matrix^427 = 1.0 } set_variable = { global.pol_dist_matrix^428 = 1.0 } set_variable = { global.pol_dist_matrix^429 = 1.0 } set_variable = { global.pol_dist_matrix^430 = 1.0 } set_variable = { global.pol_dist_matrix^431 = 1.0 } #neutral_Social (target 18) set_variable = { global.pol_dist_matrix^432 = 1.0 } set_variable = { global.pol_dist_matrix^433 = 1.0 } set_variable = { global.pol_dist_matrix^434 = 0.6 } set_variable = { global.pol_dist_matrix^435 = 0.3 } set_variable = { global.pol_dist_matrix^436 = 0.7 } set_variable = { global.pol_dist_matrix^437 = 0.3 } set_variable = { global.pol_dist_matrix^438 = 1.0 } set_variable = { global.pol_dist_matrix^439 = 1.0 } set_variable = { global.pol_dist_matrix^440 = 0.7 } set_variable = { global.pol_dist_matrix^441 = 0.7 } set_variable = { global.pol_dist_matrix^442 = 1.0 } set_variable = { global.pol_dist_matrix^443 = 1.0 } set_variable = { global.pol_dist_matrix^444 = 0.6 } set_variable = { global.pol_dist_matrix^445 = 1.0 } set_variable = { global.pol_dist_matrix^446 = 1.0 } set_variable = { global.pol_dist_matrix^447 = 0.6 } set_variable = { global.pol_dist_matrix^448 = 0.5 } set_variable = { global.pol_dist_matrix^449 = 0.3 } set_variable = { global.pol_dist_matrix^451 = 0.6 } set_variable = { global.pol_dist_matrix^452 = 1.0 } set_variable = { global.pol_dist_matrix^453 = 1.0 } set_variable = { global.pol_dist_matrix^454 = 1.0 } set_variable = { global.pol_dist_matrix^455 = 1.0 } #Neutral_Communism (target 19) set_variable = { global.pol_dist_matrix^456 = 1.0 } set_variable = { global.pol_dist_matrix^457 = 1.0 } set_variable = { global.pol_dist_matrix^458 = 1.0 } set_variable = { global.pol_dist_matrix^459 = 0.7 } set_variable = { global.pol_dist_matrix^460 = 0.3 } set_variable = { global.pol_dist_matrix^461 = 0.4 } set_variable = { global.pol_dist_matrix^462 = 0.8 } set_variable = { global.pol_dist_matrix^463 = 1.0 } set_variable = { global.pol_dist_matrix^464 = 1.0 } set_variable = { global.pol_dist_matrix^465 = 1.0 } set_variable = { global.pol_dist_matrix^466 = 1.0 } set_variable = { global.pol_dist_matrix^467 = 1.0 } set_variable = { global.pol_dist_matrix^468 = 1.0 } set_variable = { global.pol_dist_matrix^469 = 1.0 } set_variable = { global.pol_dist_matrix^470 = 1.0 } set_variable = { global.pol_dist_matrix^471 = 0.8 } set_variable = { global.pol_dist_matrix^472 = 1.0 } set_variable = { global.pol_dist_matrix^473 = 0.8 } set_variable = { global.pol_dist_matrix^474 = 0.4 } set_variable = { global.pol_dist_matrix^476 = 1.0 } set_variable = { global.pol_dist_matrix^477 = 1.0 } set_variable = { global.pol_dist_matrix^478 = 1.0 } set_variable = { global.pol_dist_matrix^479 = 1.0 } #Nat_Populism (target 20) set_variable = { global.pol_dist_matrix^480 = 0.7 } set_variable = { global.pol_dist_matrix^481 = 0.5 } set_variable = { global.pol_dist_matrix^482 = 0.7 } set_variable = { global.pol_dist_matrix^483 = 1.0 } set_variable = { global.pol_dist_matrix^484 = 1.0 } set_variable = { global.pol_dist_matrix^485 = 1.0 } set_variable = { global.pol_dist_matrix^486 = 0.4 } set_variable = { global.pol_dist_matrix^487 = 0.7 } set_variable = { global.pol_dist_matrix^488 = 1.0 } set_variable = { global.pol_dist_matrix^489 = 1.0 } set_variable = { global.pol_dist_matrix^490 = 1.0 } set_variable = { global.pol_dist_matrix^491 = 1.0 } set_variable = { global.pol_dist_matrix^492 = 1.0 } set_variable = { global.pol_dist_matrix^493 = 0.5 } set_variable = { global.pol_dist_matrix^494 = 0.5 } set_variable = { global.pol_dist_matrix^495 = 0.6 } set_variable = { global.pol_dist_matrix^496 = 0.5 } set_variable = { global.pol_dist_matrix^497 = 1.0 } set_variable = { global.pol_dist_matrix^498 = 1.0 } set_variable = { global.pol_dist_matrix^499 = 1.0 } set_variable = { global.pol_dist_matrix^501 = 0.5 } set_variable = { global.pol_dist_matrix^502 = 0.4 } set_variable = { global.pol_dist_matrix^503 = 0.4 } #Nat_Fascism (target 21) set_variable = { global.pol_dist_matrix^504 = 0.8 } set_variable = { global.pol_dist_matrix^505 = 1.0 } set_variable = { global.pol_dist_matrix^506 = 1.0 } set_variable = { global.pol_dist_matrix^507 = 1.0 } set_variable = { global.pol_dist_matrix^508 = 1.0 } set_variable = { global.pol_dist_matrix^509 = 1.0 } set_variable = { global.pol_dist_matrix^510 = 0.6 } set_variable = { global.pol_dist_matrix^511 = 0.7 } set_variable = { global.pol_dist_matrix^512 = 1.0 } set_variable = { global.pol_dist_matrix^513 = 1.0 } set_variable = { global.pol_dist_matrix^514 = 1.0 } set_variable = { global.pol_dist_matrix^515 = 1.0 } set_variable = { global.pol_dist_matrix^516 = 1.0 } set_variable = { global.pol_dist_matrix^517 = 0.8 } set_variable = { global.pol_dist_matrix^518 = 0.9 } set_variable = { global.pol_dist_matrix^519 = 0.9 } set_variable = { global.pol_dist_matrix^520 = 0.8 } set_variable = { global.pol_dist_matrix^521 = 1.0 } set_variable = { global.pol_dist_matrix^522 = 1.0 } set_variable = { global.pol_dist_matrix^523 = 1.0 } set_variable = { global.pol_dist_matrix^524 = 0.5 } set_variable = { global.pol_dist_matrix^526 = 0.3 } set_variable = { global.pol_dist_matrix^527 = 0.8 } #Nat_Autocracy (target 22) set_variable = { global.pol_dist_matrix^528 = 0.5 } set_variable = { global.pol_dist_matrix^529 = 0.8 } set_variable = { global.pol_dist_matrix^530 = 1.0 } set_variable = { global.pol_dist_matrix^531 = 1.0 } set_variable = { global.pol_dist_matrix^532 = 1.0 } set_variable = { global.pol_dist_matrix^533 = 1.0 } set_variable = { global.pol_dist_matrix^534 = 0.6 } set_variable = { global.pol_dist_matrix^535 = 0.5 } set_variable = { global.pol_dist_matrix^536 = 0.6 } set_variable = { global.pol_dist_matrix^537 = 0.6 } set_variable = { global.pol_dist_matrix^538 = 1.0 } set_variable = { global.pol_dist_matrix^539 = 1.0 } set_variable = { global.pol_dist_matrix^540 = 1.0 } set_variable = { global.pol_dist_matrix^541 = 0.5 } set_variable = { global.pol_dist_matrix^542 = 0.9 } set_variable = { global.pol_dist_matrix^543 = 0.8 } set_variable = { global.pol_dist_matrix^544 = 1.0 } set_variable = { global.pol_dist_matrix^545 = 1.0 } set_variable = { global.pol_dist_matrix^546 = 1.0 } set_variable = { global.pol_dist_matrix^547 = 0.9 } set_variable = { global.pol_dist_matrix^548 = 0.4 } set_variable = { global.pol_dist_matrix^549 = 0.3 } set_variable = { global.pol_dist_matrix^551 = 0.3 } #Monarchist (target 23) set_variable = { global.pol_dist_matrix^552 = 0.4 } set_variable = { global.pol_dist_matrix^553 = 0.7 } set_variable = { global.pol_dist_matrix^554 = 1.0 } set_variable = { global.pol_dist_matrix^555 = 1.0 } set_variable = { global.pol_dist_matrix^556 = 1.0 } set_variable = { global.pol_dist_matrix^557 = 1.0 } set_variable = { global.pol_dist_matrix^558 = 0.7 } set_variable = { global.pol_dist_matrix^559 = 0.7 } set_variable = { global.pol_dist_matrix^560 = 1.0 } set_variable = { global.pol_dist_matrix^561 = 1.0 } set_variable = { global.pol_dist_matrix^562 = 0.7 } set_variable = { global.pol_dist_matrix^563 = 1.0 } set_variable = { global.pol_dist_matrix^564 = 1.0 } set_variable = { global.pol_dist_matrix^565 = 0.5 } set_variable = { global.pol_dist_matrix^566 = 0.9 } set_variable = { global.pol_dist_matrix^567 = 0.8 } set_variable = { global.pol_dist_matrix^568 = 1.0 } set_variable = { global.pol_dist_matrix^569 = 1.0 } set_variable = { global.pol_dist_matrix^570 = 1.0 } set_variable = { global.pol_dist_matrix^571 = 0.9 } set_variable = { global.pol_dist_matrix^572 = 0.4 } set_variable = { global.pol_dist_matrix^573 = 0.4 } set_variable = { global.pol_dist_matrix^574 = 0.3 } set_variable = { global.pol_dist_initialized = 1 } } # get_pol_distance: replaces all pol_distance_X effects # Parameters: pol_dist_target_index (0-23), pol_dist_source_index (0-23) # Output: pol_distance_current get_pol_distance = { if = { limit = { NOT = { check_variable = { global.pol_dist_initialized = 1 } } } init_pol_distance_matrix = yes } set_temp_variable = { _pd_idx = { value = pol_dist_target_index multiply = 24 add = pol_dist_source_index } } set_variable = { pol_distance_current = global.pol_dist_matrix^_pd_idx } } # Add Coalition Member # set_temp_variable = { add_col_one = 0-23 } -- Required add_coalition_members_effect = { if = { limit = { NOT = { is_in_array = { gov_coalition_array = add_col_one } } } custom_effect_tooltip = add_coalition_members_effect_TT add_to_array = { gov_coalition_array = add_col_one } hidden_effect = { update_government_coalition_strength = yes } } } # Function: Remove Coalition Member # Parameters: set_temp_variable = { remove_col_one = 0-23 } remove_coalition_members_effect = { if = { limit = { is_in_array = { gov_coalition_array = remove_col_one } } custom_effect_tooltip = remove_coalition_members_effect_TT remove_from_array = { gov_coalition_array = remove_col_one } hidden_effect = { update_government_coalition_strength = yes } } } # Function: Change Party Command # Parameters: # set_temp_variable = { rul_party_temp = 0-23 } # set_temp_variable = { col_one = 0 - 23 } -- Optional # set_temp_variable = { col_two = 0 - 23 } -- Optional # set_temp_variable = { col_three = 0 - 23 } -- Optional # set_temp_variable = { col_four = 0 - 23 } -- Optional # set_temp_variable = { col_five = 0 - 23 } -- Optional # set_temp_variable = { change_leader_temp = 0-1 } -- Optional # set_temp_variable = { disable_elections = 0-1 } -- Optional change_ruling_party_effect = { # Do Not Retire Section if = { limit = { check_variable = { change_leader_temp = 1 } } set_country_flag = do_not_retire } # Clears the Parameters clear_array = gov_coalition_array # Rul Party Addition custom_effect_tooltip = ruling_party_changed_tt set_variable = { ruling_party = rul_party_temp } # Coalition Array Parameters if = { limit = { has_variable = col_one } set_temp_variable = { add_col_one = col_one } custom_effect_tooltip = add_coalition_members_effect_TT add_to_array = { gov_coalition_array = add_col_one } } if = { limit = { has_variable = col_two } set_temp_variable = { add_col_one = col_two } custom_effect_tooltip = add_coalition_members_effect_TT add_to_array = { gov_coalition_array = add_col_one } } if = { limit = { has_variable = col_three } set_temp_variable = { add_col_one = col_three } custom_effect_tooltip = add_coalition_members_effect_TT add_to_array = { gov_coalition_array = add_col_one } } if = { limit = { has_variable = col_four } set_temp_variable = { add_col_one = col_four } custom_effect_tooltip = add_coalition_members_effect_TT add_to_array = { gov_coalition_array = add_col_one } } if = { limit = { has_variable = col_five } set_temp_variable = { add_col_one = col_five } custom_effect_tooltip = add_coalition_members_effect_TT add_to_array = { gov_coalition_array = add_col_one } } # Disable Elections of 0 means that they have elections if = { limit = { check_variable = { disable_elections = 0 } } custom_effect_tooltip = ruling_party_changed_elections_tt } else = { custom_effect_tooltip = ruling_party_changed_no_elections_tt } if = { limit = { check_variable = { rul_party_temp > -1 } check_variable = { rul_party_temp < 24 } } hidden_effect = { if = { limit = { check_variable = { disable_elections = 0 } } set_politics = { ruling_party = THIS elections_allowed = yes } } else = { set_politics = { ruling_party = THIS elections_allowed = no } } } } hidden_effect = { update_government_coalition_strength = yes set_leader = yes # INFO: This is here to offload from the weekly tick and instead call it whenever this is called. IP_idea_configuration = yes mb_refresh_relations_effect = yes # Subideology swaps keep the same ideology group, so on_government_change cannot carry these. if = { limit = { original_tag = FRA } FRA_update_party_programmes = yes } if = { limit = { original_tag = HOL } HOL_update_party_programmes = yes } if = { limit = { original_tag = TAT } TAT_update_party_modifiers = yes } if = { limit = { original_tag = BSH } BSH_update_party_modifiers = yes } if = { limit = { original_tag = SOV } SOV_update_political_modifiers = yes } } if = { limit = { check_variable = { change_leader_temp = 1 } } clr_country_flag = do_not_retire } force_update_map_mode = { mapmode = subideology_map_mode } } # Function: update_dirty_politicsview_expanded # Purpose: updates the politicsview_expanded dirty variable to ensure the UI is up-to-date update_dirty_politicsview_expanded = { if = { limit = { has_country_flag = MD_politicsview_expanded_open is_ai = no } generete_politics_pie_chart = yes calculate_all_propaganda_costs = yes if = { limit = { check_variable = { THIS.politicsview_expanded_dirty < 100000 } } add_to_variable = { THIS.politicsview_expanded_dirty = 1 } } else = { set_variable = { THIS.politicsview_expanded_dirty = 0 } } } } # ban_party_scripted_call # Parameters: party_index - 0-23 # Purpose: Bans the provided party index from elections ban_party_scripted_call = { custom_effect_tooltip = ban_party_effect_tt hidden_effect = { set_variable = { party_banned_array^party_index = 1 } update_dirty_politicsview_expanded = yes } } # unban_party_scripted_call # Parameters: party_index - 0-23 # Purpose: Allows the provided party index for elections unban_party_scripted_call = { custom_effect_tooltip = unban_party_effect_tt hidden_effect = { set_variable = { party_banned_array^party_index = 0 } update_dirty_politicsview_expanded = yes } } # Leaves slots in ban_except_array unbanned. Tallies pp_cost (10 per newly banned slot) for the caller to spend. No partyall_banned flag. ban_all_parties_except_array = { hidden_effect = { for_loop_effect = { start = 0 end = 24 value = ban_i if = { limit = { NOT = { is_in_array = { ban_except_array = ban_i } } } if = { limit = { NOT = { check_variable = { party_banned_array^ban_i = 1 } } } add_to_temp_variable = { pp_cost = 10 } set_variable = { party_banned_array^ban_i = 1 } } } } clear_temp_array = ban_except_array update_dirty_politicsview_expanded = yes } } set_partyall_banned = { set_country_flag = partyall_banned if = { limit = { has_variable = ruling_party } add_to_temp_array = { ban_except_array = ruling_party } } for_each_loop = { array = gov_coalition_array value = v add_to_temp_array = { ban_except_array = v } } set_temp_variable = { pp_cost = 0 } ban_all_parties_except_array = yes if = { limit = { NOT = { has_country_flag = free_ban_parties } } multiply_temp_variable = { pp_cost = -1 } add_political_power = pp_cost } clr_country_flag = free_ban_parties custom_effect_tooltip = set_partyall_banned_tt } set_partyall_allowed = { clr_country_flag = partyall_banned set_temp_variable = { pp_cost = 0 } for_loop_effect = { end = 24 value = unban_i if = { limit = { check_variable = { party_banned_array^unban_i = 1 } } add_to_temp_variable = { pp_cost = 10 } set_variable = { party_banned_array^unban_i = 0 } } } if = { limit = { NOT = { has_country_flag = free_allow_parties } } multiply_temp_variable = { pp_cost = -1 } add_political_power = pp_cost } clr_country_flag = free_allow_parties custom_effect_tooltip = set_partyall_allowed_tt update_dirty_politicsview_expanded = yes } # set_elections_with_frequency: parameterized election setup # Parameters: election_freq (48/60/72), uses global.year and global.month set_elections_with_frequency = { set_country_flag = no_leader_change meta_effect = { text = { set_politics = { ruling_party = ROOT elections_allowed = yes last_election = "[YEAR].[MONTH].1" election_frequency = [FREQ] } } YEAR = "[?election_year_param]" MONTH = "[?election_month_param|0]" FREQ = "[?election_freq|.0]" } clr_country_flag = no_leader_change } set_election_year_60_months = { set_temp_variable = { election_year_param = global.year } subtract_from_temp_variable = { election_year_param = year_change } set_temp_variable = { election_month_param = global.month } set_temp_variable = { election_freq = 60 } set_elections_with_frequency = yes } set_elections_72_months = { set_temp_variable = { election_year_param = global.year } set_temp_variable = { election_month_param = global.month } set_temp_variable = { election_freq = 72 } set_elections_with_frequency = yes } set_elections_60_months = { set_temp_variable = { election_year_param = global.year } set_temp_variable = { election_month_param = global.month } set_temp_variable = { election_freq = 60 } set_elections_with_frequency = yes } set_elections_48_months = { set_temp_variable = { election_year_param = global.year } set_temp_variable = { election_month_param = global.month } set_temp_variable = { election_freq = 48 } set_elections_with_frequency = yes } build_ip_active_policy_groups = { resize_temp_array = { ip_active_policy_groups = 0 } if = { limit = { check_variable = { ruling_party = 0 } } if = { limit = { NOT = { has_country_leader_with_trait = western_technocrat } NOT = { original_tag = HOL } } add_to_temp_array = { ip_active_policy_groups = 7 } } } else = { add_to_temp_array = { ip_active_policy_groups = global.ip_party_policy_group^ruling_party } } if = { limit = { has_country_leader_with_trait = western_technocrat NOT = { is_in_array = { ip_active_policy_groups = 6 } } } add_to_temp_array = { ip_active_policy_groups = 6 } } if = { limit = { check_variable = { ruling_party = 0 } original_tag = HOL } add_to_temp_array = { ip_active_policy_groups = 10 } } if = { limit = { has_country_flag = PER_backbone_front NOT = { is_in_array = { ip_active_policy_groups = 2 } } } add_to_temp_array = { ip_active_policy_groups = 2 } } if = { limit = { has_country_flag = PER_access_to_this NOT = { is_in_array = { ip_active_policy_groups = 7 } } } add_to_temp_array = { ip_active_policy_groups = 7 } } } IP_idea_configuration = { build_ip_active_policy_groups = yes resize_temp_array = { ip_all_policy_ideas = 0 } resize_temp_array = { ip_desired_policy_ideas = 0 } for_each_loop = { array = global.ip_policy_idea_tokens value = ip_policy_token index = ip_policy_token_index if = { limit = { NOT = { is_in_array = { ip_all_policy_ideas = ip_policy_token } } } add_to_temp_array = { ip_all_policy_ideas = ip_policy_token } } if = { limit = { is_in_array = { ip_active_policy_groups = global.ip_policy_idea_groups^ip_policy_token_index } NOT = { is_in_array = { ip_desired_policy_ideas = ip_policy_token } } } add_to_temp_array = { ip_desired_policy_ideas = ip_policy_token } } } for_each_loop = { array = ip_all_policy_ideas value = ip_policy_token if = { limit = { is_in_array = { ip_desired_policy_ideas = ip_policy_token } } add_ideas = var:ip_policy_token } else = { remove_ideas = var:ip_policy_token } } IP_idea_construction_update = yes IP_idea_corruption_update = yes } IP_idea_construction_update = { hidden_effect = { if = { limit = { has_ip_socialist_policy = yes } update_construction_bonus_from_interventionism_green = yes } } } IP_idea_corruption_update = { hidden_effect = { if = { limit = { has_ip_autocrat_policy = yes } update_pp_bonus_from_corruption = yes } else = { remove_current_corruption_pp_bonus = yes } } } # Effect: enable_elections_with_no_leader_change # Purpose: Enable elections with no leader change enable_elections_with_no_leader_change = { set_country_flag = no_leader_change # Set national term limit if there is such a system for your nation if = { limit = { check_variable = { term_limit > 0 } } set_variable = { current_term = 1 } } set_politics = { ruling_party = ROOT elections_allowed = yes } clr_country_flag = no_leader_change } # Effect: disable_elections_with_no_leader_change # Purpose: Disable elections with no leader change disable_elections_with_no_leader_change = { set_country_flag = no_leader_change set_politics = { ruling_party = ROOT elections_allowed = no } clr_country_flag = no_leader_change } # Effect: start_civil_war_with_no_leader_change # Purpose: Start a civil war with no leader change start_civil_war_with_no_leader_change = { set_country_flag = no_leader_change start_civil_war = { ideology = ROOT size = 0.5 } clr_country_flag = no_leader_change } # Effect: copy_subideolgy_leader_throughput # Purpose: Copy the leader throughput from a nation to the current nation # Parameters: # - nation_to_copy_from - the nation to copy the leader throughput from copy_subideolgy_leader_throughput = { set_variable = { Western_Autocracy_leader = nation_to_copy_from.Western_Autocracy_leader?0 } set_variable = { conservatism_leader = nation_to_copy_from.conservatism_leader?0 } set_variable = { liberalism_leader = nation_to_copy_from.liberalism_leader?0 } set_variable = { socialism_leader = nation_to_copy_from.socialism_leader?0 } set_variable = { Communist-State_leader = nation_to_copy_from.Communist-State_leader?0 } set_variable = { anarchist_communism_leader = nation_to_copy_from.anarchist_communism_leader?0 } set_variable = { Conservative_leader = nation_to_copy_from.Conservative_leader?0 } set_variable = { Autocracy_leader = nation_to_copy_from.Autocracy_leader?0 } set_variable = { Mod_Vilayat_e_Faqih_leader = nation_to_copy_from.Mod_Vilayat_e_Faqih_leader?0 } set_variable = { Vilayat_e_Faqih_leader = nation_to_copy_from.Vilayat_e_Faqih_leader?0 } set_variable = { Kingdom_leader = nation_to_copy_from.Kingdom_leader?0 } set_variable = { Caliphate_leader = nation_to_copy_from.Caliphate_leader?0 } set_variable = { Neutral_Muslim_Brotherhood_leader = nation_to_copy_from.Neutral_Muslim_Brotherhood_leader?0 } set_variable = { Neutral_Autocracy_leader = nation_to_copy_from.Neutral_Autocracy_leader?0 } set_variable = { Neutral_conservatism_leader = nation_to_copy_from.Neutral_conservatism_leader?0 } set_variable = { oligarchism_leader = nation_to_copy_from.oligarchism_leader?0 } set_variable = { Neutral_Libertarian_leader = nation_to_copy_from.Neutral_Libertarian_leader?0 } set_variable = { Neutral_green_leader = nation_to_copy_from.Neutral_green_leader?0 } set_variable = { neutral_Social_leader = nation_to_copy_from.neutral_Social_leader?0 } set_variable = { Neutral_Communism_leader = nation_to_copy_from.Neutral_Communism_leader?0 } set_variable = { Nat_Populism_leader = nation_to_copy_from.Nat_Populism_leader?0 } set_variable = { Nat_Fascism_leader = nation_to_copy_from.Nat_Fascism_leader?0 } set_variable = { Nat_Autocracy_leader = nation_to_copy_from.Nat_Autocracy_leader?0 } set_variable = { Monarchist_leader = nation_to_copy_from.Monarchist_leader?0 } } # Effect: replicate_configure_politics # Purpose: Replicates and configure politics # Parameters: # - nation_to_copy_from - the nation to copy the configure politics replicate_configure_politics = { set_temp_variable = { temp_democratic = { value = nation_to_copy_from.party_popularity@democratic multiply = 100 } } set_temp_variable = { temp_communism = { value = nation_to_copy_from.party_popularity@communism multiply = 100 } } set_temp_variable = { temp_neutrality = { value = nation_to_copy_from.party_popularity@neutrality multiply = 100 } } set_temp_variable = { temp_fascism = { value = nation_to_copy_from.party_popularity@fascism multiply = 100 } } set_temp_variable = { temp_nationalist = { value = nation_to_copy_from.party_popularity@nationalist multiply = 100 } } set_temp_variable = { temp_total = { value = temp_democratic add = temp_communism add = temp_neutrality add = temp_fascism add = temp_nationalist subtract = 100 multiply = -1 } } add_to_temp_variable = { temp_nationalist = temp_total } set_popularities = { democratic = temp_democratic communism = temp_communism neutrality = temp_neutrality fascism = temp_fascism nationalist = temp_nationalist } add_popularity = { ideology = neutrality popularity = -0.2 } start_politics_input = yes #copy politics var:nation_to_copy_from = { for_loop_effect = { end = party_pop_array^num value = v set_variable = { PREV.party_pop_array^v = party_pop_array^v } } if = { limit = { has_variable = ruling_party } set_variable = { PREV.ruling_party = ruling_party } } for_each_loop = { array = gov_coalition_array value = v add_to_array = { PREV.gov_coalition_array = v } } } set_variable = { party_pop_array^19 = 0.01 } #all moved to fight ;) set_variable = { party_pop_elect_array^19 = 0 } #made illegal add_up_party_totals = yes set_party_positions = yes startup_politics = yes } generete_politics_pie_chart = { set_temp_variable = { popularity = 1000 } set_variable = { politics_pie_chart^0 = 1000 } set_temp_variable = { chart_idx = 1 } for_loop_effect = { start = 0 end = 24 value = v set_temp_variable = { party_popularity = party_pop_array^v } multiply_temp_variable = { party_popularity = 1000 } clamp_temp_variable = { var = party_popularity min = 0 max = 1000 } subtract_from_temp_variable = { popularity = party_popularity } set_variable = { politics_pie_chart^chart_idx = popularity } add_to_temp_variable = { chart_idx = 1 } } } calculate_all_propaganda_costs = { calculate_prowestern_propaganda_cost = yes calculate_emerging_propaganda_cost = yes calculate_nonaligned_propaganda_cost = yes calculate_nationalist_propaganda_cost = yes calculate_salafist_propaganda_cost = yes } calculate_prowestern_propaganda_cost = { set_temp_variable = { propaganda_cost_mult = 1 } add_to_temp_variable = { propaganda_cost_mult = modifier@propaganda_campaign_cost_modifier } add_to_temp_variable = { propaganda_cost_mult = modifier@western_outlook_campaign_cost_modifier } set_variable = { promote_outlook_western_costs = { value = gdp_total multiply = 0.001 multiply = propaganda_cost_mult } } } calculate_emerging_propaganda_cost = { set_temp_variable = { propaganda_cost_mult = 1 } add_to_temp_variable = { propaganda_cost_mult = modifier@propaganda_campaign_cost_modifier } add_to_temp_variable = { propaganda_cost_mult = modifier@emerging_outlook_campaign_cost_modifier } set_variable = { promote_outlook_emerging_costs = { value = gdp_total multiply = 0.001 multiply = propaganda_cost_mult } } } calculate_nonaligned_propaganda_cost = { set_temp_variable = { propaganda_cost_mult = 1 } add_to_temp_variable = { propaganda_cost_mult = modifier@propaganda_campaign_cost_modifier } add_to_temp_variable = { propaganda_cost_mult = modifier@nonaligned_outlook_campaign_cost_modifier } set_variable = { promote_outlook_nonaligned_costs = { value = gdp_total multiply = 0.001 multiply = propaganda_cost_mult } } } calculate_nationalist_propaganda_cost = { set_temp_variable = { propaganda_cost_mult = 1 } add_to_temp_variable = { propaganda_cost_mult = modifier@propaganda_campaign_cost_modifier } add_to_temp_variable = { propaganda_cost_mult = modifier@nationalist_outlook_campaign_cost_modifier } set_variable = { promote_outlook_nationalist_costs = { value = gdp_total multiply = 0.001 multiply = propaganda_cost_mult } } } calculate_salafist_propaganda_cost = { set_temp_variable = { propaganda_cost_mult = 1 } add_to_temp_variable = { propaganda_cost_mult = modifier@propaganda_campaign_cost_modifier } add_to_temp_variable = { propaganda_cost_mult = modifier@salafist_outlook_campaign_cost_modifier } set_variable = { promote_outlook_salafist_costs = { value = gdp_total multiply = 0.001 multiply = propaganda_cost_mult } } }