# Auto-vote processing for UN Security Council votes # Called from UNSC.100 and recognition.11 when a nation has auto-vote flags set. # Adds the nation to the appropriate vote array based on their flag. process_auto_sc_vote = { if = { limit = { check_variable = { global.current_sc_vote_type = 8 } check_variable = { global.current_sc_vote_nation = THIS.id } } add_to_array = { global.security_council_vote_abstain = THIS } } else_if = { limit = { has_country_flag = auto_accept_all_sc_votes } add_to_array = { global.security_council_vote_yes = THIS } } else_if = { limit = { has_country_flag = auto_reject_all_sc_votes } add_to_array = { global.security_council_vote_no = THIS } #A veto is a flag, not a tally. The manual no-vote sets it; the auto path must too, or a #permanent member on auto-reject can be outvoted on its own veto. if = { limit = { is_in_array = { global.p5_sc_members = THIS } } set_global_flag = security_council_veto } } else_if = { limit = { has_country_flag = auto_abstain_all_sc_votes } add_to_array = { global.security_council_vote_abstain = THIS } } } # Auto-vote processing for UN General Assembly votes # Called from UN.100 and recognition.14 when a nation has auto-vote flags set. # Adds the nation to the appropriate vote array based on their flag. process_auto_ga_vote = { if = { limit = { check_variable = { global.current_ga_vote_type = 22 } check_variable = { global.current_ga_vote_nation = THIS.id } } add_to_array = { global.general_assembly_vote_abstain = THIS } } else_if = { limit = { has_country_flag = auto_accept_all_ga_votes } add_to_array = { global.general_assembly_vote_yes = THIS } } else_if = { limit = { has_country_flag = auto_reject_all_ga_votes } add_to_array = { global.general_assembly_vote_no = THIS } } else_if = { limit = { has_country_flag = auto_abstain_all_ga_votes } add_to_array = { global.general_assembly_vote_abstain = THIS } } } on_startup_international = { if = { limit = { NOT = { has_global_flag = international_systems_initialized } } set_global_flag = international_systems_initialized add_to_array = { global.PMC_Companies = 001 } #Blackwater add_to_array = { global.PMC_Companies = 002 } #Aegis add_to_array = { global.PMC_Companies = 003 } #Constellis add_to_array = { global.PMC_Companies = 004 } #Wagner add_to_array = { global.PMC_Companies = 031 } #MD add_to_array = { global.PMC_Companies = 005 } #MPRI add_to_array = { global.PMC_Companies = 006 } #SADAT add_to_array = { global.PMC_Companies = 007 } #RSB_Group add_to_array = { global.PMC_Companies = 008 } #SandLine add_to_array = { global.PMC_Companies = 009 } #KBR Supply add_to_array = { global.PMC_Companies = 010 } #Nirtal add_to_array = { global.PMC_Companies = 011 } #HALO add_to_array = { global.PMC_Companies = 012 } #Defense Conseil add_to_array = { global.PMC_Companies = 013 } #GardaWorld add_to_array = { global.PMC_Companies = 014 } #European Security Academy add_to_array = { global.PMC_Companies = 015 } #g4s add_to_array = { global.PMC_Companies = 016 } #Asgard add_to_array = { global.PMC_Companies = 017 } #Union of Tribes of Sinai add_to_array = { global.PMC_Companies = 018 } #Gard add_to_array = { global.PMC_Companies = 019 } #Patriot add_to_array = { global.PMC_Companies = 020 } #Dewe Security Services add_to_array = { global.PMC_Companies = 021 } #China OGS add_to_array = { global.PMC_Companies = 022 } #Front add_to_array = { global.PMC_Companies = 023 } #Redut add_to_array = { global.PMC_Companies = 024 } #Gazprom add_to_array = { global.PMC_Companies = 025 } #Iron add_to_array = { global.PMC_Companies = 026 } #Sheriff add_to_array = { global.PMC_Companies = 027 } #Lukoil add_to_array = { global.PMC_Companies = 028 } #Rosneft add_to_array = { global.PMC_Companies = 029 } #Sberbank add_to_array = { global.PMC_Companies = 030 } #VTB add_to_array = { global.PMC_units_major = 001 } add_to_array = { global.PMC_units_major = 002 } add_to_array = { global.PMC_units_major = 003 } add_to_array = { global.PMC_units_major = 004 } add_to_array = { global.PMC_units_major = 031 } add_to_array = { global.PMC_units_minor = 008 } add_to_array = { global.PMC_units_minor = 013 } add_to_array = { global.PMC_units_minor = 015 } add_to_array = { global.PMC_units_minor = 017 } add_to_array = { global.PMC_units_minor = 018 } add_to_array = { global.PMC_units_minor = 019 } add_to_array = { global.PMC_units_minor = 020 } add_to_array = { global.PMC_units_minor = 023 } add_to_array = { global.PMC_units_minor = 024 } add_to_array = { global.PMC_units_minor = 025 } add_to_array = { global.PMC_units_minor = 026 } add_to_array = { global.PMC_units_minor = 027 } add_to_array = { global.PMC_units_minor = 028 } add_to_array = { global.PMC_units_minor = 029 } add_to_array = { global.PMC_units_minor = 030 } add_to_array = { global.PMC_buffs = 005 } add_to_array = { global.PMC_buffs = 006 } add_to_array = { global.PMC_buffs = 007 } add_to_array = { global.PMC_buffs = 009 } add_to_array = { global.PMC_buffs = 010 } add_to_array = { global.PMC_buffs = 011 } add_to_array = { global.PMC_buffs = 012 } add_to_array = { global.PMC_buffs = 014 } add_to_array = { global.PMC_buffs = 016 } add_to_array = { global.PMC_buffs = 021 } add_to_array = { global.PMC_buffs = 022 } add_to_array = { global.PMC_buffs = 024 } add_to_array = { global.PMC_buffs = 026 } add_to_array = { global.PMC_buffs = 027 } add_to_array = { global.PMC_buffs = 028 } add_to_array = { global.PMC_buffs = 029 } add_to_array = { global.PMC_buffs = 030 } add_to_array = { global.p5_sc_members = CHI } add_to_array = { global.p5_sc_members = FRA } add_to_array = { global.p5_sc_members = SOV } add_to_array = { global.p5_sc_members = USA } add_to_array = { global.p5_sc_members = ENG } add_to_array = { global.security_council_members = ARG } #Latin America / Caribbean add_to_array = { global.security_council_members = CAN } #Europe & Others add_to_array = { global.security_council_members = MAY } #Asian & African add_to_array = { global.security_council_members = NAM } #Asian & African add_to_array = { global.security_council_members = HOL } #Europe & Others #Dividing line for doolitle sanity on building this shit add_to_array = { global.security_council_members = UKR } #Europe & Others add_to_array = { global.security_council_members = TUN } #Asian & African add_to_array = { global.security_council_members = MAL } #Asian & African add_to_array = { global.security_council_members = JAM } #Latin America / Caribbean add_to_array = { global.security_council_members = BAN } #Asian & African add_to_array = { global.security_council_members = CHI } #Security Council Permanant Members add_to_array = { global.security_council_members = FRA } add_to_array = { global.security_council_members = SOV } add_to_array = { global.security_council_members = USA } add_to_array = { global.security_council_members = ENG } add_to_array = { global.at_members = ARG } add_to_array = { global.at_members = AUS } add_to_array = { global.at_members = AST } add_to_array = { global.at_members = BEL } add_to_array = { global.at_members = BRA } add_to_array = { global.at_members = BUL } add_to_array = { global.at_members = CAN } add_to_array = { global.at_members = CHL } add_to_array = { global.at_members = CHI } add_to_array = { global.at_members = COL } add_to_array = { global.at_members = CZE } add_to_array = { global.at_members = DEN } add_to_array = { global.at_members = ECU } add_to_array = { global.at_members = ENG } add_to_array = { global.at_members = FIN } add_to_array = { global.at_members = FRA } add_to_array = { global.at_members = GER } add_to_array = { global.at_members = GRE } add_to_array = { global.at_members = GUA } add_to_array = { global.at_members = HUN } add_to_array = { global.at_members = ITA } add_to_array = { global.at_members = JAP } add_to_array = { global.at_members = KOR } add_to_array = { global.at_members = NKO } add_to_array = { global.at_members = NRY } add_to_array = { global.at_members = NZL } add_to_array = { global.at_members = PAP } add_to_array = { global.at_members = POL } add_to_array = { global.at_members = PRU } add_to_array = { global.at_members = RAJ } add_to_array = { global.at_members = ROM } add_to_array = { global.at_members = SAF } add_to_array = { global.at_members = SLO } add_to_array = { global.at_members = SOV } add_to_array = { global.at_members = SPR } add_to_array = { global.at_members = SWE } add_to_array = { global.at_members = SWI } add_to_array = { global.at_members = TUR } add_to_array = { global.at_members = UKR } add_to_array = { global.at_members = URG } add_to_array = { global.at_members = VEN } add_to_array = { global.at_members = HOL } add_to_array = { global.atcp_members = ARG } add_to_array = { global.atcp_members = AST } add_to_array = { global.atcp_members = BEL } add_to_array = { global.atcp_members = BRA } add_to_array = { global.atcp_members = BUL } add_to_array = { global.atcp_members = CHL } add_to_array = { global.atcp_members = CHI } add_to_array = { global.atcp_members = ECU } add_to_array = { global.atcp_members = FIN } add_to_array = { global.atcp_members = FRA } add_to_array = { global.atcp_members = GER } add_to_array = { global.atcp_members = RAJ } add_to_array = { global.atcp_members = ITA } add_to_array = { global.atcp_members = JAP } add_to_array = { global.atcp_members = KOR } add_to_array = { global.atcp_members = HOL } add_to_array = { global.atcp_members = NZL } add_to_array = { global.atcp_members = NRY } add_to_array = { global.atcp_members = PRU } add_to_array = { global.atcp_members = POL } add_to_array = { global.atcp_members = SOV } add_to_array = { global.atcp_members = SAF } add_to_array = { global.atcp_members = SPR } add_to_array = { global.atcp_members = SWE } add_to_array = { global.atcp_members = ENG } add_to_array = { global.atcp_members = USA } add_to_array = { global.atcp_members = URG } for_each_scope_loop = { array = global.atcp_members set_country_flag = is_antarctica_atcp_consultative_member } # Original-owner flags for curated NSAs that ship with lacks_international_recognition. # Drives recognition.1 / recognition.4 events so the parent state is notified when a third # country grants or withdraws recognition of the breakaway. if = { limit = { country_exists = YEM } YEM = { set_country_flag = original_owner_HOU } } if = { limit = { country_exists = SOM } SOM = { set_country_flag = original_owner_AIA } } if = { limit = { country_exists = SYR } SYR = { set_country_flag = original_owner_ROJ } } if = { limit = { country_exists = LEB } LEB = { set_country_flag = original_owner_HEZ } } if = { limit = { country_exists = AFG } AFG = { set_country_flag = original_owner_TAL } } if = { limit = { country_exists = ISR } ISR = { set_country_flag = original_owner_HAM } } if = { limit = { country_exists = UKR } UKR = { set_country_flag = original_owner_DPR set_country_flag = original_owner_LPR } } if = { limit = { country_exists = AZE } AZE = { set_country_flag = original_owner_NKR } } if = { limit = { country_exists = SER } SER = { set_country_flag = original_owner_KOS } } if = { limit = { country_exists = GEO } GEO = { set_country_flag = original_owner_ABK set_country_flag = original_owner_SOO } } # Kurdistan is claimed across four parent states if = { limit = { country_exists = IRQ } IRQ = { set_country_flag = original_owner_KUR } } if = { limit = { country_exists = PER } PER = { set_country_flag = original_owner_KUR } } if = { limit = { country_exists = TUR } TUR = { set_country_flag = original_owner_KUR } } if = { limit = { country_exists = SYR } SYR = { set_country_flag = original_owner_KUR } } # Pre-seeded recognitions reflecting real-world state at the 2000 game start. # Each block adds the breakaway's tag to recognised_countries on the granter side AND bumps # Granted_Recognition on the breakaway side. recognised_countries is a permanent ledger — only an # explicit rescind removes an entry, never a periodic refresh. # Taiwan (ROC) — 21 UN members recognised the ROC in 2000 (later defections happened post-2000) if = { limit = { country_exists = TAI } if = { limit = { country_exists = GUA } GUA = { add_to_array = { recognised_countries = TAI } } } if = { limit = { country_exists = HON } HON = { add_to_array = { recognised_countries = TAI } } } if = { limit = { country_exists = NIC } NIC = { add_to_array = { recognised_countries = TAI } } } if = { limit = { country_exists = PAN } PAN = { add_to_array = { recognised_countries = TAI } } } if = { limit = { country_exists = PAR } PAR = { add_to_array = { recognised_countries = TAI } } } if = { limit = { country_exists = DOM } DOM = { add_to_array = { recognised_countries = TAI } } } if = { limit = { country_exists = ELS } ELS = { add_to_array = { recognised_countries = TAI } } } if = { limit = { country_exists = BLZ } BLZ = { add_to_array = { recognised_countries = TAI } } } if = { limit = { country_exists = HAI } HAI = { add_to_array = { recognised_countries = TAI } } } if = { limit = { country_exists = SEN } SEN = { add_to_array = { recognised_countries = TAI } } } if = { limit = { country_exists = CHA } CHA = { add_to_array = { recognised_countries = TAI } } } if = { limit = { country_exists = GAM } GAM = { add_to_array = { recognised_countries = TAI } } } if = { limit = { country_exists = LIB } LIB = { add_to_array = { recognised_countries = TAI } } } if = { limit = { country_exists = MLW } MLW = { add_to_array = { recognised_countries = TAI } } } if = { limit = { country_exists = SAO } SAO = { add_to_array = { recognised_countries = TAI } } } if = { limit = { country_exists = SWA } SWA = { add_to_array = { recognised_countries = TAI } } } if = { limit = { country_exists = NAU } NAU = { add_to_array = { recognised_countries = TAI } } } if = { limit = { country_exists = PAU } PAU = { add_to_array = { recognised_countries = TAI } } } if = { limit = { country_exists = MAR } MAR = { add_to_array = { recognised_countries = TAI } } } if = { limit = { country_exists = SOL } SOL = { add_to_array = { recognised_countries = TAI } } } if = { limit = { country_exists = TUL } TUL = { add_to_array = { recognised_countries = TAI } } } TAI = { add_to_variable = { Granted_Recognition = 21 } } } # Taliban Afghanistan (TAL) — recognised by Pakistan, Saudi Arabia, UAE in 2000 if = { limit = { country_exists = TAL } if = { limit = { country_exists = PAK } PAK = { add_to_array = { recognised_countries = TAL } } } if = { limit = { country_exists = SAU } SAU = { add_to_array = { recognised_countries = TAL } } } if = { limit = { country_exists = UAE } UAE = { add_to_array = { recognised_countries = TAL } } } TAL = { add_to_variable = { Granted_Recognition = 3 } } } # Abkhazia (ABK) — Russia formally recognised in 2008; pre-seeded for game start so the # breakaway doesn't begin from absolute zero. if = { limit = { country_exists = ABK country_exists = SOV } SOV = { add_to_array = { recognised_countries = ABK } } ABK = { add_to_variable = { Granted_Recognition = 1 } } } # South Ossetia (SOO) — same as ABK, recognised by Russia. if = { limit = { country_exists = SOO country_exists = SOV } SOV = { add_to_array = { recognised_countries = SOO } } SOO = { add_to_variable = { Granted_Recognition = 1 } } } # Stagger initial AI campaign cooldowns so unrecognised states don't all fire on month 1. # random_list spreads each NSA's first action across the opening 9 months. for_each_scope_loop = { array = global.Unrecognised_States random_list = { 25 = { } 25 = { set_country_flag = { flag = recog_ai_cooldown days = 30 value = 1 } } 25 = { set_country_flag = { flag = recog_ai_cooldown days = 120 value = 1 } } 25 = { set_country_flag = { flag = recog_ai_cooldown days = 270 value = 1 } } } } } } international_systems_force_update = { if = { limit = { check_variable = { global.international_systems_updated > 1000000 } } set_variable = { global.international_systems_updated = 1 } } else = { add_to_variable = { global.international_systems_updated = 1 } } } international_systems_update = { # Bump the GUI dirty counter for player paths, or for any path while a GA/SC vote is live so open vote screens refresh; AI idle paths skip it to avoid ~190 wakes per GA cycle. if = { limit = { OR = { is_ai = no has_global_flag = current_ongoing_ga_vote has_global_flag = current_ongoing_sc_vote } } international_systems_force_update = yes } } clr_country_pmc_flag = { clr_country_flag = blackwater_sel clr_country_flag = aegis_sel clr_country_flag = constellis_sel clr_country_flag = wagner_sel clr_country_flag = md_sel } set_sel_pmc_units = { clear_array = selected_units #group these by number of units that can be hired #sorted by country flags #then use the specific country flag in dynamic text / effects to apply if = { limit = { is_major_company = yes } add_to_array = { selected_units = 001 } add_to_array = { selected_units = 002 } add_to_array = { selected_units = 003 } add_to_array = { selected_units = 004 } add_to_array = { selected_units = 005 } add_to_array = { selected_units = 006 } add_to_array = { selected_units = 007 } } if = { limit = { has_country_flag = blackwater_sel } set_variable = { comp_check = 0 } } else_if = { limit = { has_country_flag = aegis_sel } set_variable = { comp_check = 2 } } else_if = { limit = { has_country_flag = constellis_sel } set_variable = { comp_check = 3 } } else_if = { limit = { has_country_flag = wagner_sel } set_variable = { comp_check = 1 } } else_if = { limit = { has_country_flag = md_sel } set_variable = { comp_check = 4 } } } un_recog_setup_check = { if = { limit = { OR = { has_idea = lacks_international_recognition has_idea = non_state_actor } } if = { limit = { NOT = { OR = { is_in_array = { global.Unrecognised_States = THIS } THIS = { has_idea = lacks_international_recognition } } } } add_to_array = { global.Unrecognised_States = THIS } every_collection_element = { input = { input = collection:un_general_assembly_members_collection } if = { limit = { has_country_flag = original_owner_@PREV } set_temp_variable = { spot_tracker = THIS } PREV = { set_variable = { prev_owner = spot_tracker } } } } } else = { if = { limit = { is_in_array = { global.Unrecognised_States = THIS } } remove_from_array = { global.Unrecognised_States = THIS } } add_to_array = { array = global.Unrecognised_States value = THIS index = 0 } every_collection_element = { input = { input = collection:un_general_assembly_members_collection } if = { limit = { has_country_flag = original_owner_@PREV } set_temp_variable = { spot_tracker = THIS } PREV = { set_variable = { prev_owner = spot_tracker } } } } } } else_if = { # SWI is a recognized non-member until the 2002 referendum decision (SWI_join_the_united_nations) limit = { NOT = { original_tag = SWI } NOT = { original_tag = HLS } } add_to_array = { global.UN_general_assembly = THIS } add_dynamic_modifier = { modifier = united_nations_member } if = { limit = { has_global_flag = international_systems_initialized } recompute_un_2_3_number = yes international_systems_force_update = yes } } } un_check_if_valid_for_sanctions = { if = { limit = { check_variable = { has_added_tension_amount > 0 } NOT = { original_tag = ZOM } NOT = { original_tag = ALN } } if = { limit = { NOT = { has_dynamic_modifier = { modifier = united_nations_security_council_sanctions } } } add_to_array = { global.can_be_sc_sanctioned = THIS } } } } un_on_game_start_war_add = { if = { limit = { has_offensive_war = yes } add_to_array = { global.un_sc_pressure_end_war = THIS } } } update_sc_vote = { if = { limit = { OR = { has_global_flag = current_ongoing_sc_vote has_global_flag = un_sc_vote_cooldown check_variable = { global.sc_vote_type_tracker^num > 0 } } } add_to_array = { global.sc_vote_type_tracker = sc_new_vote_type } add_to_array = { global.sc_vote_nation_tracker = sc_new_vote_nation } custom_effect_tooltip = add_vote_to_queue_tt } else = { set_variable = { global.current_sc_vote_type = sc_new_vote_type } set_variable = { global.current_sc_vote_nation = sc_new_vote_nation } recompute_un_sc_required_yes = yes if = { limit = { check_variable = { global.current_sc_vote_type = 5 } } var:global.current_sc_vote_nation = { hidden_effect = { country_event = recognition.10 } } } else = { var:global.current_sc_vote_nation = { hidden_effect = { country_event = UNSC.100 } } } custom_effect_tooltip = start_new_vote_tt recompute_un_2_3_number = yes international_systems_update = yes } } manipulate_sc_vote_front = { remove_from_array = { array = global.sc_vote_nation_tracker index = index_track } remove_from_array = { array = global.sc_vote_type_tracker index = index_track } add_to_array = { array = global.sc_vote_nation_tracker value = nation_hold index = 0 } add_to_array = { array = global.sc_vote_type_tracker value = type_hold index = 0 } } manipulate_sc_vote_rear = { remove_from_array = { array = global.sc_vote_nation_tracker index = index_track } remove_from_array = { array = global.sc_vote_type_tracker index = index_track } add_to_array = { array = global.sc_vote_nation_tracker value = nation_hold } add_to_array = { array = global.sc_vote_type_tracker value = type_hold } } manipulate_ga_vote_rear = { remove_from_array = { array = global.ga_vote_nation_tracker index = index_track } remove_from_array = { array = global.ga_vote_type_tracker index = index_track } add_to_array = { array = global.ga_vote_nation_tracker value = nation_hold } add_to_array = { array = global.ga_vote_type_tracker value = type_hold } } manipulate_ga_vote_front = { remove_from_array = { array = global.ga_vote_nation_tracker index = index_track } remove_from_array = { array = global.ga_vote_type_tracker index = index_track } set_temp_variable = { move_index = global.ga_vote_type_tracker^num } for_each_loop = { array = global.ga_vote_type_tracker value = v index = i break = b if = { limit = { NOT = { check_variable = { v = 6 } } NOT = { check_variable = { v = 7 } } NOT = { check_variable = { v = 22 } } } set_temp_variable = { move_index = i } set_temp_variable = { b = 1 } } } add_to_array = { array = global.ga_vote_nation_tracker value = nation_hold index = move_index } add_to_array = { array = global.ga_vote_type_tracker value = type_hold index = move_index } } update_ga_vote = { if = { limit = { OR = { has_global_flag = current_ongoing_ga_vote has_global_flag = un_ga_vote_cooldown check_variable = { global.ga_vote_type_tracker^num > 0 } } } #if is a new UNSC member vote, permanent-seat vote, or non-binding raid vote, front-load it! if = { limit = { OR = { check_variable = { ga_new_vote_type = 6 } check_variable = { ga_new_vote_type = 7 } check_variable = { ga_new_vote_type = 22 } } } add_to_array = { array = global.ga_vote_type_tracker value = ga_new_vote_type index = 0 } add_to_array = { array = global.ga_vote_nation_tracker value = ga_new_vote_nation index = 0 } } else = { add_to_array = { global.ga_vote_type_tracker = ga_new_vote_type } add_to_array = { global.ga_vote_nation_tracker = ga_new_vote_nation } } custom_effect_tooltip = add_vote_to_queue_tt } else = { set_variable = { global.current_ga_vote_type = ga_new_vote_type } set_variable = { global.current_ga_vote_nation = ga_new_vote_nation } if = { limit = { check_variable = { global.current_ga_vote_type = 5 } } var:global.current_ga_vote_nation = { hidden_effect = { country_event = recognition.13 } } } else = { var:global.current_ga_vote_nation = { hidden_effect = { country_event = UN.100 } } } custom_effect_tooltip = start_new_vote_tt recompute_un_2_3_number = yes international_systems_update = yes } } start_unsc_next_term_voting = { set_global_flag = { flag = electing_new_unsc_members days = 200 value = 1 } clear_variable = global.unsc_reroll_count clear_array = global.new_council_members set_temp_variable = { even_year_checker = global.year } modulo_temp_variable = { even_year_checker = 2 } set_temp_variable = { south_america_seat_tracker = 1 } if = { limit = { check_variable = { even_year_checker = 0 } } set_temp_variable = { aa_seat_tracker = 2 } set_temp_variable = { euro_others_seat_tracker = 2 } } else = { set_temp_variable = { aa_seat_tracker = 3 } set_temp_variable = { euro_others_seat_tracker = 1 } } for_loop_effect = { end = aa_seat_tracker if = { limit = { check_variable = { array_shift < 1 } } random_scope_in_array = { array = global.asian_nations limit = { exists = yes has_capitulated = no is_in_array = { global.UN_general_assembly = THIS } NOT = { is_in_array = { global.security_council_members = THIS } } NOT = { has_idea = lacks_international_recognition } NOT = { has_idea = non_state_actor } } add_to_array = { global.new_council_members = THIS } } } else = { if = { limit = { check_variable = { array_shift < 2 } } random_scope_in_array = { array = global.sub_saharan_nations limit = { exists = yes has_capitulated = no is_in_array = { global.UN_general_assembly = THIS } NOT = { is_in_array = { global.security_council_members = THIS } } NOT = { has_idea = lacks_international_recognition } NOT = { has_idea = non_state_actor } } add_to_array = { global.new_council_members = THIS } } } else = { random_scope_in_array = { array = global.middle_eastern_nations limit = { exists = yes has_capitulated = no is_in_array = { global.UN_general_assembly = THIS } NOT = { is_in_array = { global.security_council_members = THIS } } NOT = { has_idea = lacks_international_recognition } NOT = { has_idea = non_state_actor } } add_to_array = { global.new_council_members = THIS } } } } add_to_temp_variable = { array_shift = 1 } } for_loop_effect = { end = euro_others_seat_tracker random_scope_in_array = { array = global.sc_updates_euro_america limit = { exists = yes has_capitulated = no is_in_array = { global.UN_general_assembly = THIS } NOT = { is_in_array = { global.security_council_members = THIS } } NOT = { has_idea = lacks_international_recognition } NOT = { has_idea = non_state_actor } } add_to_array = { global.new_council_members = THIS } } } for_loop_effect = { end = south_america_seat_tracker random_scope_in_array = { array = global.american_nations limit = { exists = yes has_capitulated = no is_in_array = { global.UN_general_assembly = THIS } NOT = { is_in_array = { global.security_council_members = THIS } } NOT = { has_idea = lacks_international_recognition } NOT = { has_idea = non_state_actor } capital_scope = { is_on_continent = south_america } } add_to_array = { global.new_council_members = THIS } } } #Fallback: if regional pools couldn't fill all 5 seats, pick from any UN member set_temp_variable = { seats_needed = 5 } subtract_from_temp_variable = { seats_needed = global.new_council_members^num } for_loop_effect = { end = seats_needed random_scope_in_array = { array = global.UN_general_assembly limit = { exists = yes has_capitulated = no NOT = { is_in_array = { global.security_council_members = THIS } } NOT = { is_in_array = { global.new_council_members = THIS } } NOT = { is_in_array = { global.p5_sc_members = THIS } } NOT = { has_idea = lacks_international_recognition } NOT = { has_idea = non_state_actor } } add_to_array = { global.new_council_members = THIS } } } #Fires in june, should be faster voting efforts (cycle them faster, bypass the queueing system) set_temp_variable = { ga_new_vote_type = 6 } set_temp_variable = { ga_new_vote_nation = global.new_council_members^0 } update_ga_vote = yes } update_security_council_peeps = { # Confirmed in June but dead or capitulated by January: drop before seating. clear_array = md_valid_confirmed_members for_each_loop = { array = global.confirmed_new_council_members value = v if = { limit = { var:v = { exists = yes has_capitulated = no NOT = { has_idea = lacks_international_recognition } NOT = { has_idea = non_state_actor } } } add_to_array = { md_valid_confirmed_members = v } } } clear_array = global.confirmed_new_council_members for_each_loop = { array = md_valid_confirmed_members value = v add_to_array = { global.confirmed_new_council_members = v } } clear_array = md_valid_confirmed_members # Stash the departing cohort: unfilled tail seats are backfilled from it, otherwise # a short confirmed list leaves the shifted members duplicated in both array halves. clear_array = md_departing_sc_members set_temp_variable = { set = 0 } for_loop_effect = { end = 5 add_to_array = { md_departing_sc_members = global.security_council_members^set } add_to_temp_variable = { set = 1 } } set_temp_variable = { set = 5 } set_temp_variable = { set_index = 0 } #Overwrite the current leaving members with held members #This pushes them forward in the array, so next year they leave for_loop_effect = { end = 5 set_variable = { global.security_council_members^set_index = global.security_council_members^set } add_to_temp_variable = { set = 1 } add_to_temp_variable = { set_index = 1 } } #Add the new members here — only copy entries that actually exist #Reading past the end of confirmed_new_council_members returns 0, which #causes the GUI to display the viewing country's flag instead of a real member set_temp_variable = { set = 0 } set_temp_variable = { set_index = 5 } set_temp_variable = { confirmed_count = global.confirmed_new_council_members^num } if = { limit = { check_variable = { confirmed_count > 5 } } set_temp_variable = { confirmed_count = 5 } } for_loop_effect = { end = confirmed_count set_variable = { global.security_council_members^set_index = global.confirmed_new_council_members^set } add_to_temp_variable = { set = 1 } add_to_temp_variable = { set_index = 1 } } # Seats without a confirmed replacement: departing members serve another term. set_temp_variable = { remaining_seats = 10 } subtract_from_temp_variable = { remaining_seats = set_index } set_temp_variable = { set = 0 } for_loop_effect = { end = remaining_seats set_variable = { global.security_council_members^set_index = md_departing_sc_members^set } add_to_temp_variable = { set = 1 } add_to_temp_variable = { set_index = 1 } } clear_array = md_departing_sc_members clear_array = global.confirmed_new_council_members international_systems_update = yes } un_sc_new_members_step_next = { set_temp_variable = { md_was_election_candidate = 0 } if = { limit = { has_global_flag = electing_new_unsc_members check_variable = { global.new_council_members^0 = global.current_ga_vote_nation } } set_temp_variable = { md_was_election_candidate = 1 } } # The candidate can die or capitulate between nomination and the vote closing. if = { limit = { NOT = { is_in_array = { global.confirmed_new_council_members = global.current_ga_vote_nation } } var:global.current_ga_vote_nation = { exists = yes has_capitulated = no NOT = { has_idea = lacks_international_recognition } NOT = { has_idea = non_state_actor } } } add_to_array = { global.confirmed_new_council_members = global.current_ga_vote_nation } } remove_from_array = { global.new_council_members = global.current_ga_vote_nation } # Standalone type-6 wins (focus rewards) only confirm the seat; the election # chain advances only when its own front candidate was the vote subject. if = { limit = { check_variable = { md_was_election_candidate = 1 } } if = { limit = { check_variable = { global.new_council_members^num > 0 } } set_temp_variable = { ga_new_vote_type = 6 } set_temp_variable = { ga_new_vote_nation = global.new_council_members^0 } update_ga_vote = yes } else = { clr_global_flag = electing_new_unsc_members clear_variable = global.unsc_reroll_count } } } un_sc_new_members_re_roll = { add_to_variable = { global.unsc_reroll_count = 1 } # Drop the candidate that just failed its seat vote so it isn't re-voted forever. remove_from_array = { array = global.new_council_members index = 0 } if = { limit = { check_variable = { global.unsc_reroll_count < 16 } } set_temp_variable = { pre_roll_num = global.new_council_members^num } var:global.current_ga_vote_nation = { if = { limit = { capital_scope = { is_on_continent = south_america } } random_scope_in_array = { array = global.american_nations limit = { exists = yes has_capitulated = no is_in_array = { global.UN_general_assembly = THIS } NOT = { is_in_array = { global.security_council_members = THIS } } NOT = { is_in_array = { global.new_council_members = THIS } } NOT = { has_idea = lacks_international_recognition } NOT = { has_idea = non_state_actor } capital_scope = { is_on_continent = south_america } } add_to_array = { global.new_council_members = THIS } } } else_if = { limit = { capital_scope = { OR = { is_on_continent = north_america is_on_continent = europe } } } random_scope_in_array = { array = global.sc_updates_euro_america limit = { exists = yes has_capitulated = no is_in_array = { global.UN_general_assembly = THIS } NOT = { is_in_array = { global.security_council_members = THIS } } NOT = { is_in_array = { global.new_council_members = THIS } } NOT = { has_idea = lacks_international_recognition } NOT = { has_idea = non_state_actor } } add_to_array = { global.new_council_members = THIS } } } else = { random_scope_in_array = { array = global.sub_saharan_nations limit = { exists = yes has_capitulated = no is_in_array = { global.UN_general_assembly = THIS } NOT = { is_in_array = { global.security_council_members = THIS } } NOT = { is_in_array = { global.new_council_members = THIS } } NOT = { has_idea = lacks_international_recognition } NOT = { has_idea = non_state_actor } } add_to_array = { global.new_council_members = THIS } } } } #Fallback: if the regional re-roll found nobody, try any UN member if = { limit = { check_variable = { global.new_council_members^num = pre_roll_num } } random_scope_in_array = { array = global.UN_general_assembly limit = { exists = yes has_capitulated = no NOT = { is_in_array = { global.security_council_members = THIS } } NOT = { is_in_array = { global.new_council_members = THIS } } NOT = { is_in_array = { global.p5_sc_members = THIS } } NOT = { has_idea = lacks_international_recognition } NOT = { has_idea = non_state_actor } } add_to_array = { global.new_council_members = THIS } } } } if = { limit = { check_variable = { global.new_council_members^num > 0 } } set_temp_variable = { ga_new_vote_type = 6 } set_temp_variable = { ga_new_vote_nation = global.new_council_members^0 } update_ga_vote = yes } else = { clr_global_flag = electing_new_unsc_members clear_variable = global.unsc_reroll_count } } unsc_clear_permanent_seat_lobbying = { for_each_loop = { array = global.p5_sc_members value = v var:v = { clr_country_flag = recognition_campaign_UNSC@PREV } } } unsc_end_permanent_seat_application = { clr_country_flag = unsc_permanent_seat_sc_pending clr_country_flag = unsc_permanent_seat_ga_pending clr_country_flag = unsc_permanent_seat_approved_pending_promotion clr_global_flag = sc_action_against@THIS if = { limit = { check_variable = { global.unsc_permanent_seat_applicant = THIS.id } } clr_global_flag = unsc_permanent_seat_application_active clear_variable = global.unsc_permanent_seat_applicant } } unsc_fail_permanent_seat_application = { set_country_flag = { flag = unsc_permanent_seat_retry_cooldown days = 365 value = 1 } unsc_end_permanent_seat_application = yes } unsc_promote_permanent_member = { if = { limit = { NOT = { has_global_flag = current_ongoing_sc_vote } NOT = { AND = { has_global_flag = current_ongoing_ga_vote check_variable = { global.current_ga_vote_type = 6 } check_variable = { global.current_ga_vote_nation = THIS.id } } } NOT = { has_idea = p5_member } } set_temp_variable = { md_promoted_sc_seat = -1 } for_each_loop = { array = global.security_council_members value = v index = i if = { limit = { check_variable = { v = THIS } check_variable = { i < 10 } } set_temp_variable = { md_promoted_sc_seat = i } } } set_temp_variable = { md_promotion_can_finish = 1 } if = { limit = { check_variable = { md_promoted_sc_seat > -1 } } set_temp_variable = { md_promoted_sc_replacement_found = 0 } random_scope_in_array = { array = global.UN_general_assembly limit = { exists = yes has_capitulated = no NOT = { tag = PREV } NOT = { is_in_array = { global.security_council_members = THIS } } NOT = { is_in_array = { global.p5_sc_members = THIS } } NOT = { is_in_array = { global.new_council_members = THIS } } NOT = { is_in_array = { global.confirmed_new_council_members = THIS } } NOT = { has_idea = lacks_international_recognition } NOT = { has_idea = non_state_actor } } PREV = { set_temp_variable = { md_promoted_sc_replacement = PREV } set_temp_variable = { md_promoted_sc_replacement_found = 1 } } } if = { limit = { check_variable = { md_promoted_sc_replacement_found = 1 } } set_variable = { global.security_council_members^md_promoted_sc_seat = md_promoted_sc_replacement } } else = { set_temp_variable = { md_promotion_can_finish = 0 } } } if = { limit = { check_variable = { md_promotion_can_finish = 1 } } if = { limit = { is_in_array = { global.confirmed_new_council_members = THIS } } remove_from_array = { global.confirmed_new_council_members = THIS } } if = { limit = { is_in_array = { global.new_council_members = THIS } } remove_from_array = { global.new_council_members = THIS } } set_temp_variable = { md_purge_vote_type = 6 } un_purge_queued_ga_votes_for_this = yes unsc_clear_permanent_seat_lobbying = yes add_ideas = p5_member #UNSC.13 is major, so THIS is the viewer; the name must come from a global. set_variable = { global.unsc_last_permanent_admission = THIS.id } news_event = UNSC.13 unsc_end_permanent_seat_application = yes international_systems_update = yes } else = { unsc_fail_permanent_seat_application = yes } } else_if = { limit = { has_idea = p5_member } unsc_end_permanent_seat_application = yes } } recompute_un_2_3_number = { set_variable = { global.un_2_3_number = { value = global.UN_general_assembly^num multiply = 0.66667 add = 0.499 round = yes } } } recompute_un_sc_required_yes = { set_variable = { global.un_sc_eligible_voter_count = 0 } for_each_loop = { array = global.security_council_members value = v var:v = { if = { limit = { is_eligible_current_sc_voter = yes } add_to_variable = { global.un_sc_eligible_voter_count = 1 } } } } set_variable = { global.un_sc_required_yes = { value = global.un_sc_eligible_voter_count multiply = 0.6 add = 0.499 round = yes } } clear_variable = global.un_sc_eligible_voter_count } # Promotion has to wait out any live Council vote; run this wherever one ends. unsc_try_pending_promotion = { if = { limit = { has_global_flag = unsc_permanent_seat_application_active check_variable = { global.unsc_permanent_seat_applicant > 0 } } var:global.unsc_permanent_seat_applicant = { if = { limit = { has_country_flag = unsc_permanent_seat_approved_pending_promotion } unsc_promote_permanent_member = yes } } } } un_check_for_next_queued_vote = { # Self-heal: an annexation path that skips on_annex leaves a dead nation seated in the GA or # Council; run the canonical cleanup it missed. P5 arrays mirror the p5_member on_remove, # which cannot fire on a dead country. clear_array = md_dead_member_sweep for_each_loop = { array = global.UN_general_assembly value = v if = { limit = { NOT = { var:v = { exists = yes } } } add_to_array = { md_dead_member_sweep = v } } } for_each_loop = { array = global.security_council_members value = v if = { limit = { NOT = { var:v = { exists = yes } } NOT = { is_in_array = { md_dead_member_sweep = v } } } add_to_array = { md_dead_member_sweep = v } } } for_each_loop = { array = md_dead_member_sweep value = v if = { limit = { is_in_array = { global.p5_sc_members = v } } remove_from_array = { global.p5_sc_members = v } remove_from_array = { global.security_council_members = v } } var:v = { clear_united_nations_member_state = yes } } clear_array = md_dead_member_sweep if = { limit = { has_global_flag = unsc_permanent_seat_application_active } if = { limit = { var:global.unsc_permanent_seat_applicant = { exists = yes } } var:global.unsc_permanent_seat_applicant = { #No ongoing-vote check: promotion self-guards, and gating it here would drop an #approved applicant into the else branch and cancel the application it won. if = { limit = { has_country_flag = unsc_permanent_seat_approved_pending_promotion } unsc_promote_permanent_member = yes } else_if = { limit = { has_country_flag = unsc_permanent_seat_sc_pending } set_temp_variable = { md_unsc_application_vote_found = 0 } if = { limit = { has_global_flag = current_ongoing_sc_vote check_variable = { global.current_sc_vote_type = 8 } check_variable = { global.current_sc_vote_nation = THIS.id } } set_temp_variable = { md_unsc_application_vote_found = 1 } } for_each_loop = { array = global.sc_vote_nation_tracker value = v index = i if = { limit = { check_variable = { v = THIS } check_variable = { global.sc_vote_type_tracker^i = 8 } } set_temp_variable = { md_unsc_application_vote_found = 1 } } } if = { limit = { check_variable = { md_unsc_application_vote_found = 0 } } unsc_fail_permanent_seat_application = yes } } else_if = { limit = { has_country_flag = unsc_permanent_seat_ga_pending } set_temp_variable = { md_unsc_application_vote_found = 0 } if = { limit = { has_global_flag = current_ongoing_ga_vote check_variable = { global.current_ga_vote_type = 22 } check_variable = { global.current_ga_vote_nation = THIS.id } } set_temp_variable = { md_unsc_application_vote_found = 1 } } for_each_loop = { array = global.ga_vote_nation_tracker value = v index = i if = { limit = { check_variable = { v = THIS } check_variable = { global.ga_vote_type_tracker^i = 22 } } set_temp_variable = { md_unsc_application_vote_found = 1 } } } if = { limit = { check_variable = { md_unsc_application_vote_found = 0 } } unsc_fail_permanent_seat_application = yes } } else = { unsc_end_permanent_seat_application = yes } } } else = { clr_global_flag = unsc_permanent_seat_application_active clear_variable = global.unsc_permanent_seat_applicant } } if = { limit = { NOT = { has_global_flag = current_ongoing_sc_vote } NOT = { has_global_flag = un_sc_vote_cooldown } check_variable = { global.sc_vote_type_tracker^num > 0 } } #start the next queued vote! set_variable = { global.current_sc_vote_type = global.sc_vote_type_tracker^0 } set_variable = { global.current_sc_vote_nation = global.sc_vote_nation_tracker^0 } recompute_un_sc_required_yes = yes remove_from_array = { array = global.sc_vote_type_tracker index = 0 } remove_from_array = { array = global.sc_vote_nation_tracker index = 0 } if = { limit = { check_variable = { global.current_sc_vote_type = 5 } } var:global.current_sc_vote_nation = { country_event = recognition.10 } } else = { var:global.current_sc_vote_nation = { country_event = UNSC.100 } } recompute_un_2_3_number = yes international_systems_update = yes } # Resume a stalled election: its live seat vote was aborted or its queue entry purged. if = { limit = { has_global_flag = electing_new_unsc_members NOT = { has_global_flag = current_ongoing_ga_vote } NOT = { is_in_array = { global.ga_vote_type_tracker = 6 } } } if = { limit = { check_variable = { global.new_council_members^num > 0 } } set_temp_variable = { ga_new_vote_type = 6 } set_temp_variable = { ga_new_vote_nation = global.new_council_members^0 } update_ga_vote = yes } else = { clr_global_flag = electing_new_unsc_members clear_variable = global.unsc_reroll_count } } if = { limit = { OR = { AND = { has_global_flag = electing_new_unsc_members is_in_array = { global.ga_vote_type_tracker = 6 } } is_in_array = { global.ga_vote_type_tracker = 22 } } } clr_global_flag = un_ga_vote_cooldown } if = { limit = { NOT = { has_global_flag = current_ongoing_ga_vote } NOT = { has_global_flag = un_ga_vote_cooldown } check_variable = { global.ga_vote_type_tracker^num > 0 } } #start the next queued vote! set_variable = { global.current_ga_vote_type = global.ga_vote_type_tracker^0 } set_variable = { global.current_ga_vote_nation = global.ga_vote_nation_tracker^0 } remove_from_array = { array = global.ga_vote_type_tracker index = 0 } remove_from_array = { array = global.ga_vote_nation_tracker index = 0 } if = { limit = { check_variable = { global.current_ga_vote_type = 5 } } var:global.current_ga_vote_nation = { country_event = recognition.13 } } else = { var:global.current_ga_vote_nation = { country_event = UN.100 } } recompute_un_2_3_number = yes international_systems_update = yes } } security_council_vote_finished = { set_temp_variable = { ga_new_vote_type = global.current_sc_vote_type } set_temp_variable = { ga_new_vote_nation = global.current_sc_vote_nation } if = { limit = { has_passed_sc_vote = yes } if = { limit = { check_variable = { global.current_sc_vote_type = 5 } } update_ga_vote = yes } else_if = { limit = { check_variable = { global.current_sc_vote_type = 1 } } var:global.current_sc_vote_nation = { set_country_flag = has_end_war_mission activate_mission = UNSC_end_all_offensive_wars } } else_if = { limit = { check_variable = { global.current_sc_vote_type = 2 } } var:global.current_sc_vote_nation = { apply_united_nations_sanctions = yes } } else_if = { limit = { check_variable = { global.current_sc_vote_type = 3 } } var:global.current_sc_vote_nation = { add_ideas = unsc_restricted_volunteers_too } } else_if = { limit = { check_variable = { global.current_sc_vote_type = 4 } } var:global.current_sc_vote_nation = { add_ideas = unsc_arms_embargo } } else_if = { limit = { check_variable = { global.current_sc_vote_type = 6 } } var:global.current_sc_vote_nation = { set_country_flag = unsc_material_breach } } else_if = { limit = { check_variable = { global.current_sc_vote_type = 7 } } var:global.current_sc_vote_nation = { set_country_flag = unsc_extradition_demanded #Sanctions may predate the demand (type 2); only own what this vote created if = { limit = { NOT = { has_dynamic_modifier = { modifier = united_nations_security_council_sanctions } } } set_country_flag = unsc_extradition_sanctions_applied apply_united_nations_sanctions = yes } } } else_if = { limit = { check_variable = { global.current_sc_vote_type = 8 } } var:global.current_sc_vote_nation = { clr_country_flag = unsc_permanent_seat_sc_pending set_country_flag = unsc_permanent_seat_ga_pending } set_temp_variable = { ga_new_vote_type = 22 } update_ga_vote = yes } # Fire result events for types 1-4 and 6-8 (type 5 is handled via update_ga_vote) if = { limit = { NOT = { check_variable = { global.current_sc_vote_type = 5 } } } var:global.current_sc_vote_nation = { set_variable = { sc_last_resolution_type = global.current_sc_vote_type } for_each_loop = { array = global.security_council_members value = v var:v = { country_event = UNSC.10 } } country_event = UNSC.11 } } } else = { if = { limit = { check_variable = { global.current_sc_vote_type = 6 } } var:global.current_sc_vote_nation = { set_country_flag = unsc_disarmament_rejected } } else_if = { limit = { check_variable = { global.current_sc_vote_type = 7 } } var:global.current_sc_vote_nation = { set_country_flag = unsc_extradition_rejected } } else_if = { limit = { check_variable = { global.current_sc_vote_type = 8 } } var:global.current_sc_vote_nation = { unsc_fail_permanent_seat_application = yes } } if = { limit = { check_variable = { global.current_sc_vote_type = 5 } } var:global.current_sc_vote_nation = { news_event = recognition.122 } } else = { var:global.current_sc_vote_nation = { news_event = UNSC.12 } } } var:global.current_sc_vote_nation = { clr_global_flag = sc_action_against@THIS } for_each_loop = { array = global.security_council_members value = v var:v = { clr_country_flag = has_had_current_un_sc_vote_swayed } } international_systems_update = yes #clear all arrays and variables clear_array = global.security_council_vote_yes clear_array = global.security_council_vote_no clear_array = global.security_council_vote_abstain clear_variable = global.current_sc_vote_type clear_variable = global.current_sc_vote_nation clr_global_flag = current_ongoing_sc_vote unsc_try_pending_promotion = yes clr_global_flag = security_council_veto set_global_flag = { flag = un_sc_vote_cooldown days = 20 value = 1 } } general_assembly_vote_finished = { #Do the actions based on the type of vote #Add nation to the UN if = { limit = { check_variable = { global.general_assembly_vote_yes^num > global.general_assembly_vote_no^num } } if = { limit = { check_variable = { global.current_ga_vote_type = 5 } } if = { limit = { un_ga_2_3_required = yes } var:global.current_ga_vote_nation = { country_event = recognition.71 } } else = { var:global.current_ga_vote_nation = { country_event = recognition.72 } } } else_if = { limit = { check_variable = { global.current_ga_vote_type = 6 } } if = { limit = { un_ga_2_3_required = yes } un_sc_new_members_step_next = yes } else_if = { # Standalone type-6 losses (focus votes) must not re-roll the election's candidates limit = { has_global_flag = electing_new_unsc_members check_variable = { global.new_council_members^0 = global.current_ga_vote_nation } } un_sc_new_members_re_roll = yes } } else_if = { limit = { check_variable = { global.current_ga_vote_type = 22 } } if = { limit = { un_ga_2_3_required = yes } var:global.current_ga_vote_nation = { clr_country_flag = unsc_permanent_seat_ga_pending set_country_flag = unsc_permanent_seat_approved_pending_promotion if = { limit = { NOT = { has_global_flag = current_ongoing_sc_vote } } unsc_promote_permanent_member = yes } } } else = { var:global.current_ga_vote_nation = { unsc_fail_permanent_seat_application = yes } } } else_if = { limit = { check_variable = { global.current_ga_vote_type = 7 } } var:global.current_ga_vote_nation = { if = { limit = { NOT = { has_country_flag = refused_payment_got_sanctioned_no_raids } } set_country_flag = { flag = refused_payment_got_sanctioned_no_raids days = 365 value = 1 } } else = { clr_country_flag = refused_payment_got_sanctioned_no_raids set_country_flag = { flag = refused_payment_got_sanctioned_no_raids days = 450 value = 1 } } set_variable = { international_trade_sanctions = { value = global.general_assembly_vote_yes^num multiply = -0.005 clamp = { min = -1.00 max = 0 } } } set_variable = { international_research_sanctions = { value = global.general_assembly_vote_yes^num multiply = -0.001 clamp = { min = -0.50 max = 0 } } } add_dynamic_modifier = { modifier = united_nations_non_binding_sanctions } } } else_if = { limit = { check_variable = { global.current_ga_vote_type = 8 } } if = { limit = { un_ga_2_3_required = yes } add_to_variable = { global.general_operating_budget_contribute_percent = -0.0001 } clamp_variable = { var = global.general_operating_budget_contribute_percent min = 0.0001 max = 0.001 } } } else_if = { limit = { check_variable = { global.current_ga_vote_type = 9 } } if = { limit = { un_ga_2_3_required = yes } add_to_variable = { global.general_operating_budget_contribute_percent = 0.0001 } clamp_variable = { var = global.general_operating_budget_contribute_percent min = 0.0001 max = 0.001 } } } else_if = { limit = { check_variable = { global.current_ga_vote_type > 9 } check_variable = { global.current_ga_vote_type < 22 } } #UNGA Non-Binding Resolutions - apply idea to all yes-voting nations for_each_loop = { array = global.general_assembly_vote_yes value = v var:v = { if = { limit = { check_variable = { global.current_ga_vote_type = 10 } } add_timed_idea = { idea = unga_resolution_poverty_reduction days = 365 } } else_if = { limit = { check_variable = { global.current_ga_vote_type = 11 } } add_timed_idea = { idea = unga_resolution_food_security days = 365 } } else_if = { limit = { check_variable = { global.current_ga_vote_type = 12 } } add_timed_idea = { idea = unga_resolution_global_health days = 365 } } else_if = { limit = { check_variable = { global.current_ga_vote_type = 13 } } add_timed_idea = { idea = unga_resolution_education_initiative days = 365 } } else_if = { limit = { check_variable = { global.current_ga_vote_type = 14 } } add_timed_idea = { idea = unga_resolution_clean_energy days = 365 } } else_if = { limit = { check_variable = { global.current_ga_vote_type = 15 } } add_timed_idea = { idea = unga_resolution_economic_growth days = 365 } } else_if = { limit = { check_variable = { global.current_ga_vote_type = 16 } } add_timed_idea = { idea = unga_resolution_infrastructure days = 365 } } else_if = { limit = { check_variable = { global.current_ga_vote_type = 17 } } add_timed_idea = { idea = unga_resolution_reduced_inequality days = 365 } } else_if = { limit = { check_variable = { global.current_ga_vote_type = 18 } } add_timed_idea = { idea = unga_resolution_climate_action days = 365 } } else_if = { limit = { check_variable = { global.current_ga_vote_type = 19 } } add_timed_idea = { idea = unga_resolution_peace_institutions days = 365 } } else_if = { limit = { check_variable = { global.current_ga_vote_type = 20 } } add_timed_idea = { idea = unga_resolution_trade_partnerships days = 365 } } else_if = { limit = { check_variable = { global.current_ga_vote_type = 21 } } add_timed_idea = { idea = unga_resolution_digital_development days = 365 } } } } #Fire accept/reject event to nations that voted no for_each_loop = { array = global.general_assembly_vote_no value = v var:v = { fire_ga_resolution_result_event = yes } } #Fire accept/reject event to nations that abstained for_each_loop = { array = global.general_assembly_vote_abstain value = v var:v = { fire_ga_resolution_result_event = yes } } } } else = { #anything down here failed to pass if = { limit = { check_variable = { global.current_ga_vote_type = 5 } } var:global.current_ga_vote_nation = { news_event = recognition.73 } } else_if = { limit = { check_variable = { global.current_ga_vote_type = 6 } has_global_flag = electing_new_unsc_members check_variable = { global.new_council_members^0 = global.current_ga_vote_nation } } un_sc_new_members_re_roll = yes } else_if = { limit = { check_variable = { global.current_ga_vote_type = 22 } } var:global.current_ga_vote_nation = { unsc_fail_permanent_seat_application = yes } } } for_each_loop = { array = global.UN_general_assembly value = v var:v = { clr_country_flag = has_had_current_un_ga_vote_swayed } } international_systems_update = yes #clear all arrays and variables clear_array = global.general_assembly_vote_yes clear_array = global.general_assembly_vote_no clear_array = global.general_assembly_vote_abstain clear_variable = global.current_ga_vote_type clear_variable = global.current_ga_vote_nation clr_global_flag = current_ongoing_ga_vote set_global_flag = { flag = un_ga_vote_cooldown days = 50 value = 1 } } # Stores proposer and vote type on the recipient; the global vote state is cleared before UN.410 displays. # Skips recipients still holding an unanswered UN.410 — a second fire would relabel the open window. fire_ga_resolution_result_event = { if = { limit = { NOT = { check_variable = { ga_resolution_vote_type > 0 } } } set_variable = { ga_resolution_proposer = global.current_ga_vote_nation } set_variable = { ga_resolution_vote_type = global.current_ga_vote_type } country_event = { id = UN.410 days = 1 } } } full_satellite_system_access = { custom_effect_tooltip = full_sat_system_access_tt if = { limit = { OR = { check_variable = { FROM.var_GNSS_mil_system_idx = var_GNSS_mil_system_idx } check_variable = { FROM.var_GNSS_mil_system_idx > var_GNSS_mil_system_idx } } check_variable = { FROM.var_GNSS_mil_system_idx > 121 } NOT = { is_in_array = { array = FROM.GNSS_mil_treaty_array value = THIS.id } } } FROM = { add_to_array = { array = THIS.GNSS_mil_treaty_array value = ROOT.id } add_to_array = { array = ROOT.GNSS_mil_access_array value = THIS.id } add_to_array = { array = ROOT.GNSS_mil_access_system_idx_array value = THIS.var_GNSS_mil_system_idx } ROOT = { add_access_GNSS_mil_vars = yes } set_country_flag = { flag = recently_accepted_mil_gnss_@ROOT value = 1 days = 180 } } } if = { limit = { OR = { check_variable = { FROM.var_GNSS_civ_system_idx = var_GNSS_civ_system_idx } check_variable = { FROM.var_GNSS_civ_system_idx > var_GNSS_civ_system_idx } } check_variable = { FROM.var_GNSS_civ_system_idx > 121 } NOT = { is_in_array = { array = FROM.GNSS_civ_treaty_array value = THIS.id } } } FROM = { add_to_array = { array = THIS.GNSS_civ_treaty_array value = ROOT.id } add_to_array = { array = ROOT.GNSS_civ_access_array value = THIS.id } add_to_array = { array = ROOT.GNSS_civ_access_system_idx_array value = THIS.var_GNSS_civ_system_idx } ROOT = { add_access_GNSS_civ_vars = yes } set_country_flag = { flag = recently_accepted_civ_gnss_@ROOT value = 1 days = 180 } } } if = { limit = { OR = { check_variable = { FROM.var_COM_mil_system_idx = var_COM_mil_system_idx } check_variable = { FROM.var_COM_mil_system_idx > var_COM_mil_system_idx } } check_variable = { FROM.var_COM_mil_system_idx > 141 } NOT = { is_in_array = { array = FROM.COM_mil_treaty_array value = THIS.id } } } FROM = { add_to_array = { array = THIS.COM_mil_treaty_array value = ROOT.id } add_to_array = { array = ROOT.COM_mil_access_array value = THIS.id } add_to_array = { array = ROOT.COM_mil_access_system_idx_array value = THIS.var_COM_mil_system_idx } ROOT = { add_access_COM_mil_vars = yes } set_country_flag = { flag = recently_accepted_mil_COM_@ROOT value = 1 days = 180 } } } if = { limit = { OR = { check_variable = { FROM.var_COM_civ_system_idx = var_COM_civ_system_idx } check_variable = { FROM.var_COM_civ_system_idx > var_COM_civ_system_idx } } check_variable = { FROM.var_COM_civ_system_idx > 141 } NOT = { is_in_array = { array = FROM.COM_civ_treaty_array value = THIS.id } } } FROM = { add_to_array = { array = THIS.COM_civ_treaty_array value = ROOT.id } add_to_array = { array = ROOT.COM_civ_access_array value = THIS.id } add_to_array = { array = ROOT.COM_civ_access_system_idx_array value = THIS.var_COM_civ_system_idx } ROOT = { add_access_COM_civ_vars = yes } set_country_flag = { flag = recently_accepted_civ_COM_@ROOT value = 1 days = 180 } } } } #This makes it so that receiving money reduces your benefits from the main UN modifier #While spending a higher percentage will increase your benefits calculate_final_un_benefits = { set_temp_variable = { current_receiving_budget_tracker = 0 } if = { limit = { has_country_flag = is_getting_esco_subsidies } add_to_temp_variable = { var = current_receiving_budget_tracker value = { value = global.unescoe_budget divide = global.esco_recipient_divisor } } } if = { limit = { has_country_flag = is_getting_ido_subsidies } add_to_temp_variable = { var = current_receiving_budget_tracker value = { value = global.undio_budget divide = global.ido_recipient_divisor } } } if = { limit = { has_country_flag = is_getting_cdf_subsidies } add_to_temp_variable = { var = current_receiving_budget_tracker value = { value = global.uncdf_budget divide = global.cdf_recipient_divisor } } } set_temp_variable = { current_receiving_budget_tracker = { value = current_receiving_budget_tracker divide = global.full_aid_budget_calculator multiply = -2 } } #if you receive aid, you begin to lose some of the gains from giving aid set_temp_variable = { contribution_multiplier = 1 } if = { limit = { has_country_flag = is_getting_ido_subsidies } subtract_from_temp_variable = { contribution_multiplier = 0.2 } } if = { limit = { has_country_flag = is_getting_cdf_subsidies } subtract_from_temp_variable = { contribution_multiplier = 0.2 } } if = { limit = { has_country_flag = is_getting_esco_subsidies } subtract_from_temp_variable = { contribution_multiplier = 0.2 } } set_temp_variable = { aid_program_adder = { value = united_nations_aid_program_contribution_percent multiply = contribution_multiplier } } set_variable = { united_nations_political_power_var = { value = aid_program_adder multiply = 0.5 } } set_variable = { united_nations_influence_gain_var = { value = united_nations_contribution_percent add = aid_program_adder add = current_receiving_budget_tracker } } set_variable = { united_nations_influence_defense_var = { value = united_nations_contribution_percent add = aid_program_adder add = current_receiving_budget_tracker } } set_temp_variable = { investment_adder = { value = united_nations_contribution_percent add = aid_program_adder multiply = -0.5 } } set_variable = { united_nations_investment_duration_var = investment_adder } set_variable = { united_nations_investment_cost_var = investment_adder } } remove_un_aid_subsidies_modifier_if_unused = { if = { limit = { has_dynamic_modifier = { modifier = un_aid_subsidies_modifier } NOT = { has_country_flag = is_getting_esco_subsidies } NOT = { has_country_flag = is_getting_ido_subsidies } NOT = { has_country_flag = is_getting_cdf_subsidies } } remove_dynamic_modifier = { modifier = un_aid_subsidies_modifier } } } revoke_un_esco_subsidies = { clr_country_flag = is_getting_esco_subsidies if = { limit = { is_in_array = { global.unesco_recipients = THIS } } remove_from_array = { global.unesco_recipients = THIS } } clear_variable = un_esco_political_power_var clear_variable = un_esco_research_speed_var remove_un_aid_subsidies_modifier_if_unused = yes } revoke_un_ido_subsidies = { clr_country_flag = is_getting_ido_subsidies if = { limit = { is_in_array = { global.unido_recipients = THIS } } remove_from_array = { global.unido_recipients = THIS } } if = { limit = { check_variable = { un_ido_old_building_count > 0 } } set_temp_variable = { un_ido_buildings_to_remove = { value = un_ido_old_building_count multiply = -1 } } add_offsite_building = { type = industrial_complex level = un_ido_buildings_to_remove } } clear_variable = un_ido_current_building_count clear_variable = un_ido_construction_speed_var clear_variable = un_ido_investment_speed_var clear_variable = un_ido_old_building_count remove_un_aid_subsidies_modifier_if_unused = yes } revoke_un_cdf_subsidies = { clr_country_flag = is_getting_cdf_subsidies if = { limit = { is_in_array = { global.uncdf_recipients = THIS } } remove_from_array = { global.uncdf_recipients = THIS } } clear_variable = un_cdf_productivity_var clear_variable = un_cdf_construction_cost_var remove_un_aid_subsidies_modifier_if_unused = yes } check_for_subsidy_expiration = { set_temp_variable = { research_check = modifier@research_speed_factor } subtract_from_temp_variable = { research_check = un_esco_research_speed_var } set_temp_variable = { unsubsidized_political_power_daily = political_power_daily } set_temp_variable = { political_power_factor_with_esco = { value = modifier@political_power_factor add = 1 } } if = { limit = { check_variable = { political_power_factor_with_esco > 0 } } set_temp_variable = { political_power_factor_without_esco = political_power_factor_with_esco } subtract_from_temp_variable = { political_power_factor_without_esco = un_esco_political_power_var } multiply_temp_variable = { unsubsidized_political_power_daily = political_power_factor_without_esco } divide_temp_variable = { unsubsidized_political_power_daily = political_power_factor_with_esco } } if = { limit = { has_country_flag = is_getting_esco_subsidies OR = { check_variable = { research_check > global.target_research_speed_mod } check_variable = { unsubsidized_political_power_daily > 6.999 } } } revoke_un_esco_subsidies = yes if = { limit = { NOT = { has_global_flag = un_initial_subsidy_pass } } country_event = UN.300 } } set_temp_variable = { construction_check = modifier@production_speed_buildings_factor } subtract_from_temp_variable = { construction_check = un_ido_construction_speed_var } set_temp_variable = { unsubsidized_civ_count = industrial_complex_total } subtract_from_temp_variable = { unsubsidized_civ_count = un_ido_old_building_count } if = { limit = { has_country_flag = is_getting_ido_subsidies OR = { check_variable = { construction_check > global.target_const_speed_mod } check_variable = { unsubsidized_civ_count > global.target_civ_count } } } revoke_un_ido_subsidies = yes if = { limit = { NOT = { has_global_flag = un_initial_subsidy_pass } } country_event = UN.301 } } if = { limit = { has_country_flag = is_getting_cdf_subsidies OR = { check_variable = { gdp_total > 1000 } check_variable = { overall_productivity > global.world_productivity_target } } } revoke_un_cdf_subsidies = yes if = { limit = { NOT = { has_global_flag = un_initial_subsidy_pass } } country_event = UN.302 } } remove_un_aid_subsidies_modifier_if_unused = yes } # ------------------------------------------------------------ # UN AI System # Called from on_monthly in MD_on_actions.txt # Picks one random SC member and one random GA member each month # to evaluate whether to propose UN actions, without using the GUI # ------------------------------------------------------------ rebuild_ga_ai_active_pool = { set_global_flag = { flag = ga_ai_pool_rebuild_cooldown days = 60 value = 1 } clear_array = global.ga_ai_active_pool every_collection_element = { input = { input = collection:un_general_assembly_members_collection } if = { limit = { is_ai = yes has_political_power > 250 } add_to_array = { global.ga_ai_active_pool = THIS } } } } un_ai_evaluate_actions = { # ---- SECURITY COUNCIL AI ---- # Guard: Don't run if SC vote queue is full if = { limit = { check_variable = { global.sc_vote_type_tracker^num < 3 } } # Pick one random SC member to evaluate proposing an action random_scope_in_array = { array = global.security_council_members limit = { is_ai = yes NOT = { has_country_flag = un_ai_sc_cooldown } } set_country_flag = { flag = un_ai_sc_cooldown days = 90 value = 1 } un_ai_sc_consider_action = yes } } # ---- GENERAL ASSEMBLY AI ---- # Guard: Don't run if GA vote queue is full if = { limit = { check_variable = { global.ga_vote_type_tracker^num < 3 } } # Use shuffle-deck pool: rebuild from eligible GA nations when empty if = { limit = { check_variable = { global.ga_ai_active_pool^num < 1 } NOT = { has_global_flag = ga_ai_pool_rebuild_cooldown } } rebuild_ga_ai_active_pool = yes } if = { limit = { check_variable = { global.ga_ai_active_pool^num > 0 } } random_scope_in_array = { array = global.ga_ai_active_pool remove_from_array = { global.ga_ai_active_pool = THIS } if = { limit = { has_political_power > 150 } un_ai_ga_consider_resolution = yes } } } } } # ------------------------------------------------------------ # SC AI: Evaluate whether to propose a Security Council action # Scope: the SC member nation (ROOT) # ------------------------------------------------------------ un_ai_sc_consider_action = { if = { limit = { check_variable = { global.can_be_sc_sanctioned^num > 0 } NOT = { has_global_flag = current_ongoing_sc_vote } } # Pick a random sanctionable nation random_scope_in_array = { array = global.can_be_sc_sanctioned limit = { NOT = { has_global_flag = sc_action_against@THIS } } ROOT = { set_temp_variable = { sc_ai_target = PREV.id } } } if = { limit = { check_variable = { sc_ai_target > 0 } } # Determine action type based on target's situation var:sc_ai_target = { # Priority 1: Pressure to end war (type 1) if = { limit = { has_offensive_war = yes is_in_array = { global.un_sc_pressure_end_war = THIS } } ROOT = { set_temp_variable = { sc_ai_action_type = 1 } } } # Priority 2: Sanctions for tension (type 2) else_if = { limit = { check_variable = { has_added_tension_amount > 10 } } ROOT = { set_temp_variable = { sc_ai_action_type = 2 } } } # Priority 3: Arms embargo (type 4) else_if = { limit = { check_variable = { has_added_tension_amount > 20 } NOT = { has_idea = unsc_arms_embargo } } ROOT = { set_temp_variable = { sc_ai_action_type = 4 } } } } # Weighted random - don't always propose if = { limit = { check_variable = { sc_ai_action_type > 0 } } random = { chance = 40 set_temp_variable = { sc_new_vote_type = sc_ai_action_type } set_temp_variable = { sc_new_vote_nation = sc_ai_target } var:sc_ai_target = { set_global_flag = sc_action_against@THIS } update_sc_vote = yes } } } } } # ------------------------------------------------------------ # GA AI: Evaluate whether to propose a General Assembly resolution # Scope: the GA member nation (ROOT) # ------------------------------------------------------------ un_ai_ga_consider_resolution = { if = { limit = { has_dynamic_modifier = { modifier = united_nations_member } NOT = { has_global_flag = current_ongoing_ga_vote } } random_list = { # Type 10: Poverty Reduction 10 = { modifier = { factor = 0 has_global_flag = proposed_ga_resolution_10 } modifier = { factor = 3 check_variable = { gdp_per_capita < 10 } } set_temp_variable = { ga_ai_resolution_type = 10 } } # Type 11: Food Security 10 = { modifier = { factor = 0 has_global_flag = proposed_ga_resolution_11 } modifier = { factor = 2 check_variable = { gdp_per_capita < 15 } } set_temp_variable = { ga_ai_resolution_type = 11 } } # Type 12: Global Health 10 = { modifier = { factor = 0 has_global_flag = proposed_ga_resolution_12 } set_temp_variable = { ga_ai_resolution_type = 12 } } # Type 13: Education Initiative 10 = { modifier = { factor = 0 has_global_flag = proposed_ga_resolution_13 } set_temp_variable = { ga_ai_resolution_type = 13 } } # Type 14: Clean Energy 8 = { modifier = { factor = 0 has_global_flag = proposed_ga_resolution_14 } modifier = { factor = 2 is_in_faction_with = USA } set_temp_variable = { ga_ai_resolution_type = 14 } } # Type 15: Economic Growth 12 = { modifier = { factor = 0 has_global_flag = proposed_ga_resolution_15 } modifier = { factor = 2 check_variable = { gdp_per_capita > 20 } } set_temp_variable = { ga_ai_resolution_type = 15 } } # Type 16: Infrastructure Development 10 = { modifier = { factor = 0 has_global_flag = proposed_ga_resolution_16 } modifier = { factor = 3 check_variable = { gdp_per_capita < 10 } } set_temp_variable = { ga_ai_resolution_type = 16 } } # Type 17: Reduced Inequality 8 = { modifier = { factor = 0 has_global_flag = proposed_ga_resolution_17 } set_temp_variable = { ga_ai_resolution_type = 17 } } # Type 18: Climate Action 6 = { modifier = { factor = 0 has_global_flag = proposed_ga_resolution_18 } set_temp_variable = { ga_ai_resolution_type = 18 } } # Type 19: Peace and Institutions 8 = { modifier = { factor = 0 has_global_flag = proposed_ga_resolution_19 } modifier = { factor = 3 has_war = no } set_temp_variable = { ga_ai_resolution_type = 19 } } # Type 20: Trade Partnerships 10 = { modifier = { factor = 0 has_global_flag = proposed_ga_resolution_20 } modifier = { factor = 2 check_variable = { gdp_per_capita > 15 } } set_temp_variable = { ga_ai_resolution_type = 20 } } # Type 21: Digital Development 6 = { modifier = { factor = 0 has_global_flag = proposed_ga_resolution_21 } modifier = { factor = 2 check_variable = { gdp_per_capita > 25 } } set_temp_variable = { ga_ai_resolution_type = 21 } } # Do nothing - most months the AI shouldn't propose 60 = { } } if = { limit = { check_variable = { ga_ai_resolution_type > 0 } } add_political_power = -150 set_temp_variable = { ga_new_vote_type = ga_ai_resolution_type } set_temp_variable = { ga_new_vote_nation = THIS } update_ga_vote = yes meta_effect = { text = { set_global_flag = { flag = proposed_ga_resolution_[TYPE] days = 365 value = 1 } } TYPE = "[?ga_ai_resolution_type]" } } } } # Sanctions Effects apply_united_nations_sanctions = { set_temp_variable = { un_member_count = { value = 0 every_collection = { named_collection = un_general_assembly_members_collection add = 1 } } } set_variable = { security_council_trade_sanctions_var = { value = un_member_count multiply = -0.005 clamp = { min = -1.00 max = 0 } } } set_variable = { security_council_research_sanctions_var = { value = un_member_count multiply = -0.003 clamp = { min = -0.50 max = 0 } } } add_dynamic_modifier = { modifier = united_nations_security_council_sanctions } } un_sway_direction_effect = { # A pending sway accepted after the vote ended would write into the cleared tallies. if = { limit = { has_global_flag = current_ongoing_ga_vote } set_country_flag = has_had_current_un_ga_vote_swayed if = { limit = { is_in_array = { global.general_assembly_vote_yes = THIS } } remove_from_array = { global.general_assembly_vote_yes = THIS } } else_if = { limit = { is_in_array = { global.general_assembly_vote_no = THIS } } remove_from_array = { global.general_assembly_vote_no = THIS } } else = { remove_from_array = { global.general_assembly_vote_abstain = THIS } } if = { limit = { check_variable = { current_sway_direction = 1 } } add_to_array = { global.general_assembly_vote_yes = THIS } } else_if = { limit = { check_variable = { current_sway_direction = 2 } } add_to_array = { global.general_assembly_vote_no = THIS } } else = { add_to_array = { global.general_assembly_vote_abstain = THIS } } } } sc_sway_direction_effect = { if = { limit = { has_global_flag = current_ongoing_sc_vote } set_country_flag = has_had_current_un_sc_vote_swayed if = { limit = { is_in_array = { global.security_council_vote_yes = THIS } } remove_from_array = { global.security_council_vote_yes = THIS } } else_if = { limit = { is_in_array = { global.security_council_vote_no = THIS } } remove_from_array = { global.security_council_vote_no = THIS } } else = { remove_from_array = { global.security_council_vote_abstain = THIS } } if = { limit = { check_variable = { current_sway_direction = 1 } } add_to_array = { global.security_council_vote_yes = THIS } } else_if = { limit = { check_variable = { current_sway_direction = 2 } } add_to_array = { global.security_council_vote_no = THIS } } else = { add_to_array = { global.security_council_vote_abstain = THIS } } clr_global_flag = security_council_veto for_each_loop = { array = global.p5_sc_members value = v var:v = { if = { limit = { is_in_array = { global.security_council_vote_no = THIS } } set_global_flag = security_council_veto } } } } } # Scales PP gain/loss by FROM's power tier; apply_recognition_pp = { if = { limit = { FROM = { has_idea = non_power } } set_temp_variable = { pp_delta = 5 } } else_if = { limit = { FROM = { has_idea = minor_power } } set_temp_variable = { pp_delta = 10 } } else_if = { limit = { FROM = { has_idea = regional_power } } set_temp_variable = { pp_delta = 15 } } else_if = { limit = { FROM = { has_idea = large_power } } set_temp_variable = { pp_delta = 25 } } else_if = { limit = { FROM = { has_idea = great_power } } set_temp_variable = { pp_delta = 50 } } else_if = { limit = { FROM = { has_idea = super_power } } set_temp_variable = { pp_delta = 100 } } else = { set_temp_variable = { pp_delta = 0 } } add_political_power = pp_delta } # Runs on THIS (the breakaway) when it gains one recognition. PREV must be the recognising # country. Bumps Granted_Recognition, grants political power scaled by the recogniser's power # tier, and fires milestone news events when crossing 25 / 50 / 100 recognising states. # Equality-on-bump-by-1 is the milestone gate. recognition_grant_increment = { add_to_variable = { Granted_Recognition = 1 } if = { limit = { PREV = { has_idea = non_power } } add_political_power = 5 } else_if = { limit = { PREV = { has_idea = minor_power } } add_political_power = 10 } else_if = { limit = { PREV = { has_idea = regional_power } } add_political_power = 15 } else_if = { limit = { PREV = { has_idea = large_power } } add_political_power = 25 } else_if = { limit = { PREV = { has_idea = great_power } } add_political_power = 50 } else_if = { limit = { PREV = { has_idea = super_power } } add_political_power = 100 } # One-time notification when recognition first reaches the UN-ascension threshold (40% of GA) if = { limit = { NOT = { has_country_flag = un_ascension_eligible_notified } } set_temp_variable = { recog_threshold = { value = 0 every_collection = { named_collection = un_general_assembly_members_collection add = 1 } } } multiply_temp_variable = { recog_threshold = 0.4 } if = { limit = { check_variable = { Granted_Recognition > recog_threshold } } set_country_flag = un_ascension_eligible_notified country_event = recognition.45 } } international_systems_update = yes } un_abort_ga_vote = { if = { limit = { check_variable = { global.current_ga_vote_type = 22 } check_variable = { global.current_ga_vote_nation > 0 } } var:global.current_ga_vote_nation = { unsc_fail_permanent_seat_application = yes } } # Disarm any surviving mission holder or its stale mission finishes the next live vote early. random_scope_in_array = { array = global.UN_general_assembly limit = { has_country_flag = has_ga_mission } clr_country_flag = has_ga_mission } for_each_loop = { array = global.UN_general_assembly value = v var:v = { clr_country_flag = has_had_current_un_ga_vote_swayed } } clear_array = global.general_assembly_vote_yes clear_array = global.general_assembly_vote_no clear_array = global.general_assembly_vote_abstain clear_variable = global.current_ga_vote_type clear_variable = global.current_ga_vote_nation international_systems_update = yes clr_global_flag = current_ongoing_ga_vote } un_abort_sc_vote = { if = { limit = { check_variable = { global.current_sc_vote_type = 8 } check_variable = { global.current_sc_vote_nation > 0 } } var:global.current_sc_vote_nation = { unsc_fail_permanent_seat_application = yes } } #Must run before current_sc_vote_nation is cleared below, or the subject stays immune to every #future Security Council proposal for the rest of the campaign. if = { limit = { check_variable = { global.current_sc_vote_nation > 0 } } var:global.current_sc_vote_nation = { clr_global_flag = sc_action_against@THIS } } random_scope_in_array = { array = global.security_council_members limit = { has_country_flag = has_sc_mission } clr_country_flag = has_sc_mission } for_each_loop = { array = global.security_council_members value = v var:v = { clr_country_flag = has_had_current_un_sc_vote_swayed } } clear_array = global.security_council_vote_yes clear_array = global.security_council_vote_no clear_array = global.security_council_vote_abstain clear_variable = global.current_sc_vote_type clear_variable = global.current_sc_vote_nation international_systems_update = yes clr_global_flag = current_ongoing_sc_vote clr_global_flag = security_council_veto unsc_try_pending_promotion = yes } # In-place removal would desync the parallel type/nation queue arrays, so rebuild via scratch arrays. # md_purge_vote_type = 0 drops every queued vote about THIS, otherwise only that one type. un_purge_queued_ga_votes_for_this = { clear_array = md_rebuild_vote_type clear_array = md_rebuild_vote_nation for_each_loop = { array = global.ga_vote_nation_tracker value = v index = i if = { limit = { OR = { NOT = { check_variable = { v = THIS } } AND = { check_variable = { md_purge_vote_type > 0 } NOT = { check_variable = { global.ga_vote_type_tracker^i = md_purge_vote_type } } } } } add_to_array = { md_rebuild_vote_type = global.ga_vote_type_tracker^i } add_to_array = { md_rebuild_vote_nation = v } } } clear_array = global.ga_vote_type_tracker clear_array = global.ga_vote_nation_tracker for_each_loop = { array = md_rebuild_vote_nation value = v index = i add_to_array = { global.ga_vote_type_tracker = md_rebuild_vote_type^i } add_to_array = { global.ga_vote_nation_tracker = v } } clear_array = md_rebuild_vote_type clear_array = md_rebuild_vote_nation } un_purge_queued_sc_votes_for_this = { clear_array = md_rebuild_vote_type clear_array = md_rebuild_vote_nation for_each_loop = { array = global.sc_vote_nation_tracker value = v index = i if = { limit = { OR = { NOT = { check_variable = { v = THIS } } AND = { check_variable = { md_purge_vote_type > 0 } NOT = { check_variable = { global.sc_vote_type_tracker^i = md_purge_vote_type } } } } } add_to_array = { md_rebuild_vote_type = global.sc_vote_type_tracker^i } add_to_array = { md_rebuild_vote_nation = v } } } clear_array = global.sc_vote_type_tracker clear_array = global.sc_vote_nation_tracker for_each_loop = { array = md_rebuild_vote_nation value = v index = i add_to_array = { global.sc_vote_type_tracker = md_rebuild_vote_type^i } add_to_array = { global.sc_vote_nation_tracker = v } } clear_array = md_rebuild_vote_type clear_array = md_rebuild_vote_nation } un_remove_dying_nation_queued_votes = { set_temp_variable = { md_purge_vote_type = 0 } un_purge_queued_ga_votes_for_this = yes un_purge_queued_sc_votes_for_this = yes } # Drops queued type-5 admission votes about THIS so a nation that just joined isn't voted on again. remove_stale_ga_membership_votes_for_this = { set_temp_variable = { md_purge_vote_type = 5 } un_purge_queued_ga_votes_for_this = yes un_purge_queued_sc_votes_for_this = yes } clear_united_nations_member_state = { revoke_un_esco_subsidies = yes revoke_un_ido_subsidies = yes revoke_un_cdf_subsidies = yes if = { limit = { check_variable = { global.unsc_permanent_seat_applicant = THIS.id } } unsc_clear_permanent_seat_lobbying = yes unsc_end_permanent_seat_application = yes } # GA voting-mission holder is dying: hand the mission to another member, else abort the vote. if = { limit = { has_country_flag = has_ga_mission } clr_country_flag = has_ga_mission set_temp_variable = { md_vote_mission_reassigned = 0 } random_scope_in_array = { array = global.UN_general_assembly limit = { exists = yes NOT = { tag = PREV } } set_country_flag = has_ga_mission activate_mission = UN_GA_voting_mission PREV = { set_temp_variable = { md_vote_mission_reassigned = 1 } } } if = { limit = { check_variable = { md_vote_mission_reassigned = 0 } } un_abort_ga_vote = yes } } if = { limit = { has_country_flag = has_sc_mission } clr_country_flag = has_sc_mission set_temp_variable = { md_vote_mission_reassigned = 0 } random_scope_in_array = { array = global.security_council_members limit = { exists = yes NOT = { tag = PREV } } set_country_flag = has_sc_mission activate_mission = UN_SC_voting_mission PREV = { set_temp_variable = { md_vote_mission_reassigned = 1 } } } if = { limit = { check_variable = { md_vote_mission_reassigned = 0 } } un_abort_sc_vote = yes } } # The nation the live vote is about is dying: no vote can resolve, so abort and idle the queue. if = { limit = { check_variable = { global.current_ga_vote_nation = THIS.id } } un_abort_ga_vote = yes set_global_flag = { flag = un_ga_vote_cooldown days = 50 value = 1 } } if = { limit = { check_variable = { global.current_sc_vote_nation = THIS.id } } un_abort_sc_vote = yes set_global_flag = { flag = un_sc_vote_cooldown days = 20 value = 1 } } un_remove_dying_nation_queued_votes = yes clr_global_flag = sc_action_against@THIS if = { limit = { is_in_array = { global.security_council_members = THIS } } # The council array is positional (elected seats 0-9, P5 from 10); removing by value # shifts every later seat and desyncs the January rotation, so fill the slot instead. for_each_loop = { array = global.security_council_members value = v index = i if = { limit = { check_variable = { v = THIS } } set_temp_variable = { md_dead_sc_seat = i } } } set_temp_variable = { md_sc_seat_filled = 0 } random_scope_in_array = { array = global.UN_general_assembly limit = { exists = yes has_capitulated = no NOT = { tag = PREV } NOT = { is_in_array = { global.security_council_members = THIS } } NOT = { is_in_array = { global.p5_sc_members = THIS } } NOT = { is_in_array = { global.new_council_members = THIS } } NOT = { is_in_array = { global.confirmed_new_council_members = THIS } } NOT = { has_idea = lacks_international_recognition } NOT = { has_idea = non_state_actor } } PREV = { set_temp_variable = { md_sc_replacement = PREV } set_temp_variable = { md_sc_seat_filled = 1 } } } if = { limit = { check_variable = { md_sc_seat_filled = 1 } } set_variable = { global.security_council_members^md_dead_sc_seat = md_sc_replacement } } else = { remove_from_array = { global.security_council_members = THIS } } } if = { limit = { is_in_array = { global.confirmed_new_council_members = THIS } } remove_from_array = { global.confirmed_new_council_members = THIS } } if = { limit = { is_in_array = { global.new_council_members = THIS } } remove_from_array = { global.new_council_members = THIS } } if = { limit = { is_in_array = { global.UN_general_assembly = THIS } } remove_from_array = { global.UN_general_assembly = THIS } recompute_un_2_3_number = yes international_systems_force_update = yes } if = { limit = { is_in_array = { global.general_assembly_vote_yes = THIS } } remove_from_array = { global.general_assembly_vote_yes = THIS } } if = { limit = { is_in_array = { global.general_assembly_vote_no = THIS } } remove_from_array = { global.general_assembly_vote_no = THIS } } if = { limit = { is_in_array = { global.general_assembly_vote_abstain = THIS } } remove_from_array = { global.general_assembly_vote_abstain = THIS } } if = { limit = { is_in_array = { global.security_council_vote_yes = THIS } } remove_from_array = { global.security_council_vote_yes = THIS } } if = { limit = { is_in_array = { global.security_council_vote_no = THIS } } remove_from_array = { global.security_council_vote_no = THIS } } if = { limit = { is_in_array = { global.security_council_vote_abstain = THIS } } remove_from_array = { global.security_council_vote_abstain = THIS } } if = { limit = { is_in_array = { global.p5_sc_members = THIS } } remove_from_array = { global.p5_sc_members = THIS } } if = { limit = { has_idea = p5_member } remove_ideas = p5_member } if = { limit = { has_dynamic_modifier = { modifier = united_nations_member } } remove_dynamic_modifier = { modifier = united_nations_member } } } remove_from_bloc_membership_arrays = { if = { limit = { is_in_array = { global.nato_members = THIS } } remove_from_array = { global.nato_members = THIS } } if = { limit = { is_in_array = { global.EU_member = THIS } } remove_from_array = { global.EU_member = THIS } } if = { limit = { is_in_array = { global.CSTO_member = THIS } } remove_from_array = { global.CSTO_member = THIS } } if = { limit = { is_in_array = { global.AU_member = THIS } } remove_from_array = { global.AU_member = THIS } } if = { limit = { is_in_array = { global.arab_league_members = THIS } } remove_from_array = { global.arab_league_members = THIS } } if = { limit = { is_in_array = { global.OAU_member = THIS } } remove_from_array = { global.OAU_member = THIS } } if = { limit = { is_in_array = { global.ECOWAS_member = THIS } } remove_from_array = { global.ECOWAS_member = THIS } } if = { limit = { is_in_array = { global.WARSAW_PACT_member = THIS.id } } remove_from_array = { global.WARSAW_PACT_member = THIS.id } } if = { limit = { is_in_array = { global.gcc_member_state = THIS } } remove_from_array = { global.gcc_member_state = THIS } } if = { limit = { is_in_array = { global.fossil_energy_pact_members = THIS } } remove_from_array = { global.fossil_energy_pact_members = THIS } } if = { limit = { is_in_array = { global.BRICS_member = THIS.id } } remove_from_array = { global.BRICS_member = THIS.id } } if = { limit = { is_in_array = { global.BRICS_full_members = THIS.id } } remove_from_array = { global.BRICS_full_members = THIS.id } } if = { limit = { is_in_array = { global.BRICS_associates = THIS.id } } remove_from_array = { global.BRICS_associates = THIS.id } } if = { limit = { is_in_array = { global.BRICS_observers = THIS.id } } remove_from_array = { global.BRICS_observers = THIS.id } } } # Non-bloc membership arrays: UN aid programs, unrecognised-state tracking, and other idea-tied # lists that would otherwise leave a stale annexed-country entry for their loop consumers. remove_from_secondary_membership_arrays = { revoke_un_esco_subsidies = yes revoke_un_ido_subsidies = yes revoke_un_cdf_subsidies = yes if = { limit = { is_in_array = { global.non_EU_EDU_ally = THIS } } remove_from_array = { global.non_EU_EDU_ally = THIS } } if = { limit = { is_in_array = { global.SWE_royal_cultural_institute = THIS.id } } remove_from_array = { global.SWE_royal_cultural_institute = THIS.id } } if = { limit = { is_in_array = { global.un_aid_esco_contributor = THIS } } remove_from_array = { global.un_aid_esco_contributor = THIS } } if = { limit = { is_in_array = { global.un_aid_ido_contributor = THIS } } remove_from_array = { global.un_aid_ido_contributor = THIS } } if = { limit = { is_in_array = { global.un_aid_cdf_contributor = THIS } } remove_from_array = { global.un_aid_cdf_contributor = THIS } } if = { limit = { is_in_array = { global.Unrecognised_States = THIS } } remove_from_array = { global.Unrecognised_States = THIS } } }