scripted_gui = {    	
  finalbattle_gui = {
    window_name = "finalbattle_window"
    context_type = player_context

    visible = {
 has_country_flag = finalbattle	
  }

effects = {
     	batl_button1_click = {
			if = {
				limit = {
					check_variable = { prayer_points > 0 }
				}
				add_to_variable = { prayer_points = -1 }
 				add_to_variable = { bar_var = 12.5 }
				random_list = {
					33 = {
						add_timed_idea = {
							idea = prayer_speed
							days = 100
						}
					}
					33 = {
						add_timed_idea = {
							idea = prayer_defence
							days = 100
						}
					}
					34 = {
						add_timed_idea = {
							idea = prayer_offence
							days = 100
						}
					}
				}
			}
		}
     	batl_button2_click = {
			if = {
				limit = {
					check_variable = { prayer_points > 0 }
				}
				add_to_variable = { prayer_points = -1 }
 				add_to_variable = { bar_var = 12.5 }
add_equipment_to_stockpile = {
    type = motorized_equipment_1
    amount = 22000
 }
 	add_equipment_to_stockpile = {
    type = heavy_tank_equipment_1
    amount = 22500
 }
add_equipment_to_stockpile = {
    type = heavy_tank_chassis_1
    amount = 22500
	variant_name = "PlankTank_2"
 }
  create_equipment_variant = {
    name = "PlankTank_2"
    type = heavy_tank_chassis_1
    parent_version = 1
    modules = {
        main_armament_slot = tank_auto_cannon_2
		turret_type_slot = tank_heavy_two_man_tank_turret
		armor_type_slot = tank_riveted_armor
		engine_type_slot = tank_gasoline_engine
		special_type_slot_1 = secondary_turret_small_cannon
		special_type_slot_2 = secondary_turret_small_cannon
		special_type_slot_3 = secondary_turret_small_cannon
		special_type_slot_4 = tank_radio_3
    }
    upgrades = {
        tank_nsb_engine_upgrade = 1
    }
   
   }
			division_template = {
				name = "Planktank3" 	
				division_names_group = RIR_INF_01

				regiments = {
					heavy_armor = { x = 0 y = 0 }		
					heavy_armor = { x = 0 y = 1 }		
					heavy_armor = { x = 1 y = 0 }		
					heavy_armor = { x = 1 y = 1 }	
					heavy_armor = { x = 2 y = 0 }		
					heavy_armor = { x = 2 y = 1 }		
 					motorized = { x = 2 y = 0 }			
					motorized = { x = 2 y = 1 }
					motorized = { x = 2 y = 2 }
				}
				support = {
					recon = { x = 0 y = 0 }      		
					artillery = { x = 0 y = 1 }
					engineer = { x = 0 y = 2 }
				}
			}
			if = {
				limit = {
					has_dlc = "No Step Back"
				}

				capital_scope = {
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7 force_equipment_variants = { heavy_tank_chassis_1 = { creator = \"RIR\" version_name = \"PlankTank_2\"} }"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7 force_equipment_variants = { heavy_tank_chassis_1 = { creator = \"RIR\" version_name = \"PlankTank_2\"} }"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7 force_equipment_variants = { heavy_tank_chassis_1 = { creator = \"RIR\" version_name = \"PlankTank_2\"} }"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7 force_equipment_variants = { heavy_tank_chassis_1 = { creator = \"RIR\" version_name = \"PlankTank_2\"} }"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7 force_equipment_variants = { heavy_tank_chassis_1 = { creator = \"RIR\" version_name = \"PlankTank_2\"} }"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7 force_equipment_variants = { heavy_tank_chassis_1 = { creator = \"RIR\" version_name = \"PlankTank_2\"} }"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7 force_equipment_variants = { heavy_tank_chassis_1 = { creator = \"RIR\" version_name = \"PlankTank_2\"} }"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7 force_equipment_variants = { heavy_tank_chassis_1 = { creator = \"RIR\" version_name = \"PlankTank_2\"} }"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7 force_equipment_variants = { heavy_tank_chassis_1 = { creator = \"RIR\" version_name = \"PlankTank_2\"} }"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7 force_equipment_variants = { heavy_tank_chassis_1 = { creator = \"RIR\" version_name = \"PlankTank_2\"} }"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7 force_equipment_variants = { heavy_tank_chassis_1 = { creator = \"RIR\" version_name = \"PlankTank_2\"} }"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7 force_equipment_variants = { heavy_tank_chassis_1 = { creator = \"RIR\" version_name = \"PlankTank_2\"} }"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7 force_equipment_variants = { heavy_tank_chassis_1 = { creator = \"RIR\" version_name = \"PlankTank_2\"} }"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7 force_equipment_variants = { heavy_tank_chassis_1 = { creator = \"RIR\" version_name = \"PlankTank_2\"} }"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7 force_equipment_variants = { heavy_tank_chassis_1 = { creator = \"RIR\" version_name = \"PlankTank_2\"} }"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7 force_equipment_variants = { heavy_tank_chassis_1 = { creator = \"RIR\" version_name = \"PlankTank_2\"} }"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7 force_equipment_variants = { heavy_tank_chassis_1 = { creator = \"RIR\" version_name = \"PlankTank_2\"} }"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7 force_equipment_variants = { heavy_tank_chassis_1 = { creator = \"RIR\" version_name = \"PlankTank_2\"} }"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7 force_equipment_variants = { heavy_tank_chassis_1 = { creator = \"RIR\" version_name = \"PlankTank_2\"} }"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7 force_equipment_variants = { heavy_tank_chassis_1 = { creator = \"RIR\" version_name = \"PlankTank_2\"} }"  
						owner = ROOT
					}
				}
			}
			else = {

				capital_scope = {
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7"  
						owner = ROOT
					}
					create_unit = {
						division = "name = \"Planktank3\" division_template = \"Planktank3\" start_experience_factor = 0.7"  
						owner = ROOT
					}
				}
			}
			}
		}
     	batl_button3_click = {
			if = {
				limit = {
					check_variable = { prayer_points > 0 }
				}
				add_to_variable = { prayer_points = -1 }
 				add_to_variable = { bar_var = 12.5 }

if = {
	limit = { has_dlc = "By Blood Alone" }
set_technology = {
    small_plane_airframe_1 = 1
}
 				create_equipment_variant = { 
					name = "PlanktPlane2" 
					type = small_plane_airframe_2
					allow_without_tech = yes
					modules = {
						fixed_main_weapon_slot = heavy_mg_4x
						fixed_auxiliary_weapon_slot_1 = bomb_locks
						fixed_auxiliary_weapon_slot_2 = small_bomb_bay
						engine_type_slot = engine_3_1x
						special_type_slot_1 = armor_plate_small
						special_type_slot_2 = drop_tanks	
					}
				}
	add_equipment_to_stockpile = {
    type = small_plane_airframe_2
    amount = 1000
	variant_name = "PlanktPlane2"
	allow_without_tech = yes
 }
	else = {
		add_equipment_to_stockpile = {
    type = fighter_equipment_2
    amount = 1009
    producer = RIR
}
	}
}
			}
		}
    }	
	 
	    triggers = {
 
 
	}

    dynamic_lists = {
	}

properties = {
    bar = {
        frame = bar_var
    }
}

    ai_enabled = {
		always = no
    }

    ai_test_interval = 290  # The higher, the long it takes the ai to do actions
	ai_test_variance = 0.5

    ai_check = {
    }

    ai_check_scope = {
    }

    ai_weights = {
    }
  }
 

