on_actions = {
	on_startup = {
		effect = {
			TTI = {
				# pilpres timor leste
				country_event = {
					id = timorevent.1
					days = 871
				}
			}
			INS = {
				set_variable = { 
					var = INS_Papuan_Strength
					value = 28
				}

				
				set_temp_variable = {
					coalition_partner_var_temp = token:social_democrat
				}
				add_to_coalition = yes
				set_temp_variable = {
					coalition_partner_var_temp = token:market_liberal
				}
				add_to_coalition = yes
				set_temp_variable = {
					coalition_partner_var_temp = token:authoritarian_democrat
				}
				add_to_coalition = yes

				# FOUR PILLAR

				set_variable = {
					var = INS_Anies_Power_Value
					value = 0
				}

				set_variable = {
					var = INS_Prabowo_Power_Value
					value = 0
				}

				set_variable = {
					var = INS_Ganjar_Power_Value
					value = 0
				}

				set_variable = {
					var = INS_Jokowi_Power_Value
					value = 0
				}

				# DPR DECISION

				set_variable = {
					var = INS_Total_DPR_Seat
					value = 575
				}
				set_variable = {
					var = INS_Government_Seat
					value = 471
				}
				set_variable = {
					var = INS_Opposition_Seat
					value = 104
				}

				#party seat
				# PSI
				set_variable = { 
					var = INS_Party_PSI_Seat
					value = 0
				}  
				# PDI-P
				set_variable = { 
					var = INS_Party_PDIP_Seat
					value = 128
				}  
				# NasDem
				set_variable = { 
					var = INS_Party_NasDem_Seat
					value = 59
				}  
				# PKB
				set_variable = { 
					var = INS_Party_PKB_Seat
					value = 58
				}  
				# PPP
				set_variable = { 
					var = INS_Party_PPP_Seat
					value = 19
				}  
				# Demokrat
				set_variable = { 
					var = INS_Party_Demokrat_Seat
					value = 54
				}  
				# PAN
				set_variable = { 
					var = INS_Party_PAN_Seat
					value = 44
				}  
				# Golkar
				set_variable = { 
					var = INS_Party_Golkar_Seat
					value = 85
				}  
				# Gerindra
				set_variable = { 
					var = INS_Party_Gerindra_Seat
					value = 78
				}  
				# PKS
				set_variable = { 
					var = INS_Party_PKS_Seat
					value = 50
				}

				#party
				# 1-3: Lowest | 4-6: Low | 7-9: Medium | 10-12: High | 13-15: Dominant 
				# PSI
				set_variable = { 
					var = INS_Party_PSI_Popularity
					value = 3.7
				}  
				# PDI-P
				set_variable = { 
					var = INS_Party_PDIP_Popularity
					value = 79.4
				}  
				# NasDem
				set_variable = { 
					var = INS_Party_NasDem_Popularity
					value = 56.8
				}  
				# PKB
				set_variable = { 
					var = INS_Party_PKB_Popularity
					value = 51.2
				}  
				# PPP
				set_variable = { 
					var = INS_Party_PPP_Popularity
					value = 26.1
				}  
				# Demokrat
				set_variable = { 
					var = INS_Party_Demokrat_Popularity
					value = 45.0
				}  
				# PAN
				set_variable = { 
					var = INS_Party_PAN_Popularity
					value = 38.6
				}  
				# Golkar
				set_variable = { 
					var = INS_Party_Golkar_Popularity
					value = 72.5
				}  
				# Gerindra
				set_variable = { 
					var = INS_Party_Gerindra_Popularity
					value = 67.1
				}  
				# PKS
				set_variable = { 
					var = INS_Party_PKS_Popularity
					value = 54.3
				}

				#popularity group
				# 1-3: Lowest | 4-6: Low | 7-9: Medium | 10-12: High | 13-15: Dominant 
				set_variable = { 
					var = INS_Group_Labor_Popularity
					value = 18.2
				}  
				set_variable = { 
					var = INS_Group_FPI_Popularity
					value = 42.5
				}  
				set_variable = { 
					var = INS_Group_Police_Popularity
					value = 36.7
				}  
				set_variable = { 
					var = INS_Group_Army_Popularity
					value = 58.3
				}

				#loyalty
				# PSI
                set_variable = { 
					var = INS_Party_PSI_Loyalty
					value = 2
				}  
				# PDI-P
                set_variable = { 
					var = INS_Party_PDIP_Loyalty
					value = 1
				}  
				# NasDem
				set_variable = { 
					var = INS_Party_NasDem_Loyalty
					value = 1
				}  
				# PKB
				set_variable = { 
					var = INS_Party_PKB_Loyalty
					value = 1
				}  
				# PPP
				set_variable = { 
					var = INS_Party_PPP_Loyalty
					value = 1
				}  
				# Demokrat
				set_variable = { 
					var = INS_Party_Demokrat_Loyalty
					value = 0
				} 
				# PAN
				set_variable = { 
					var = INS_Party_PAN_Loyalty
					value = 1
				}  
				# Golkar
				set_variable = { 
					var = INS_Party_Golkar_Loyalty
					value = 1
				}  
				# Gerindra
				set_variable = { 
					var = INS_Party_Gerindra_Loyalty
					value = 1
				}  
				# PKS
				set_variable = { 
					var = INS_Party_PKS_Loyalty
					value = 0
				}  

				#government and opposition
				INS_Gov_Opp_Balancing = yes

				#situation
				country_event = {
					id = indonesia.3
					days = 2
				}
				country_event = {
					id = indonesia.22
					days = 21
				}

				#covid
				country_event = {
					id = indonesiacovid.1
					days = 61
				}

				#papua
				country_event = { 
					id = indonesia.51 
					days = 89
				}

				#pemilu
				country_event = {
					id = indonesianfirstelection.12
					days = 1320
				}

				#kanjuruhan
				country_event = {
					id = indonesiaaddon.28
					days = 1004
				}

				#andika perkasa resign
				country_event = {
					id = indonesia.40
					days = 1094
				}

				#sambo
				country_event = {
					id = indonesiaaddon.26
					days = 920
				}
				
			

				# Indonesia Emas
				add_to_array = {
					array = INSArrayStates
					value = 672
				}
				add_to_array = {
					array = INSArrayStates
					value = 335
				}
				add_to_array = {
					array = INSArrayStates
					value = 334
				}
				add_to_array = {
					array = INSArrayStates
					value = 673
				}
				add_to_array = {
					array = INSArrayStates
					value = 667
				}
				add_to_array = {
					array = INSArrayStates
					value = 669
				}
				add_to_array = {
					array = INSArrayStates
					value = 668
				}
				add_to_array = {
					array = INSArrayStates
					value = 738
				}
			}
		}
	}


	on_capitulation = {
		effect = {
			if = {
				# INS defeat UGI
				limit = {
					FROM = {
						original_tag = INS
					}
					ROOT = {
						original_tag = UGI
					}
				}
				FROM = {
					white_peace = ROOT
					clr_country_flag = INS_Civil_War_Federal_flag
					annex_country = {
						target = ROOT
						transfer_troops = no
					}
					335 = {
						add_core_of = INS
						remove_core_of = UGI
						remove_claim_by = INS
					}
					1385 = {
						add_core_of = INS
						remove_core_of = UGI
						remove_claim_by = INS
					}
					country_event = {
						id = indonesiaanies.50
						days = 1
					}
				}
				ROOT = {
					clr_country_flag = UGI_War_flag
				}
				set_global_flag = skip_default_capitulation
			}

			if = {
				# INS defeat MLK
				limit = {
					FROM = {
						original_tag = INS
					}
					ROOT = {
						original_tag = MLK
					}
				}
				FROM = {
					white_peace = ROOT

					if = {
						limit = {
							NOT = {
								country_exists = WSP
							}	
						}
						clr_country_flag = INS_Civil_War_Islamic_flag
					}

					annex_country = {
						target = ROOT
						transfer_troops = no
					}
					668 = {
						add_core_of = INS
						remove_core_of = MLK
						remove_claim_by = INS
					}
					738 = {
						add_core_of = INS
						remove_core_of = MLK
						remove_claim_by = INS
					}
					country_event = {
						id = indonesiaanies.56
						days = 1
					}
				}
				ROOT = {
					clr_country_flag = MLK_War_flag
				}
				set_global_flag = skip_default_capitulation
			}

			if = {
				# INS defeat WSP
				limit = {
					FROM = {
						original_tag = INS
					}
					ROOT = {
						original_tag = WSP
					}
				}
				FROM = {
					white_peace = ROOT

					if = {
						limit = {
							NOT = {
								country_exists = MLK
							}	
						}
						clr_country_flag = INS_Civil_War_Islamic_flag
					}

					annex_country = {
						target = ROOT
						transfer_troops = no
					}
					668 = {
						add_core_of = INS
						remove_core_of = MLK
						remove_claim_by = INS
					}
					738 = {
						add_core_of = INS
						remove_core_of = MLK
						remove_claim_by = INS
					}
					country_event = {
						id = indonesiaanies.57
						days = 1
					}
				}
				ROOT = {
					clr_country_flag = WSP_War_flag
				}
				set_global_flag = skip_default_capitulation
			}

			#CONFRONTATION (ANTI-ABUSE)
			if = {
				limit = {
					FROM = {
						original_tag = INS
						has_country_flag = INS_MAL_war_flag
					}
					ROOT = {
						original_tag = MAL
					}
				}
				FROM = {
					country_event = {
						id = indonesiaaddon.22
						days = 0
					}
				}
				set_global_flag = skip_default_capitulation
			}

			# GAW
			if = {
				# INS defeat EADI/PDTO member
				limit = {
					FROM = {
						original_tag = INS
					}
					ROOT = {
						OR = {
							original_tag = PRC
							original_tag = JAP
							original_tag = AST
							original_tag = RAJ
							original_tag = SIA
							original_tag = VIN
							original_tag = LAO
							original_tag = CAM
							original_tag = BRM
							original_tag = PHI
							original_tag = INS
							original_tag = PNG
							original_tag = NZL
							original_tag = MAL
							original_tag = BAN
							original_tag = NEP
							original_tag = BHU
							original_tag = CHI
							original_tag = PRK
							original_tag = SIG
						}
					}
				}
				FROM = {
					puppet = ROOT
					white_peace = ROOT
				}
				ROOT = {
					load_focus_tree = generic_focus
					if = {
						limit = {	
							NOT = {
								JAP = {
									is_ally_with = PRC
								}
							}
						}
						remove_ideas = PRC_unwilling_ally
					}
					every_country = {
						limit = {
							is_in_faction_with = ROOT
							any_controlled_state = {
								NOT = { is_controlled_by = ROOT }
								is_core_of = ROOT
								NOT = { is_core_of = PREV }
							}
						}
						every_controlled_state = { 
							limit = {
								NOT = { is_controlled_by = ROOT }
								is_core_of = ROOT
								NOT = { is_core_of = PREV }
							}
							transfer_state_to = ROOT
							set_state_owner_to = ROOT
							set_state_controller_to = ROOT
						}
					}
					
					remove_ideas = commonwealth_of_nations_member
					
					if = {
						limit = {
							has_country_flag = eadi_member
						}
						clr_country_flag = eadi_member
						set_country_flag = pdto_member
					}
					else = {
						clr_country_flag = pdto_member
						JAP_leave_PEC = yes
						set_country_flag = eadi_member
					}


					set_politics = {	
						ruling_party = nationalist
						elections_allowed = no
					}

					create_country_leader = {
						name = "TNI Administration"
						picture = "GFX_INS_Admin_TNI"
						ideology = military_junta
					}

					set_popularities = {
						authoritarian_democrat = 0
						social_liberal = 0
						conservative = 0
						market_liberal = 0
						nationalist = 100
					}

					change_economy_type_mixed_economy = yes
					change_government_type_military_dictatorship = yes


					if = {
						limit = {
							INS = {
								has_country_flag = INS_Anies_Federal_flag
							}
						}
						set_cosmetic_tag = INS_Occupation_Federal
					}
					else = {
						set_cosmetic_tag = INS_Occupation
					}
				}
				set_global_flag = skip_default_capitulation
			}
		}
	}
}
