qol_market_md_infantry = {


#######################
###### Infantry  ######	
#######################
	
	
		market_buy_infantry_enable = {

			priority = 10

		icon = generic_form_nation

		allowed = {
				NOT = {
					 has_country_flag = infantry_enable_buy_qol_flag
				}
				has_country_flag = buying_land_qol
		}
		available = {
				NOT = {
					 has_country_flag = infantry_enable_buy_qol_flag
				}
				has_country_flag = buying_land_qol
		}
		visible = {
			 has_country_flag = buying_land_qol
				NOT = {
					 has_country_flag = infantry_enable_buy_qol_flag
				}	 
		}

		cost = 0
		days_re_enable = 0
		ai_will_do = {
			factor = 0
		}
		complete_effect = {
			set_country_flag = infantry_enable_buy_qol_flag
		}			
		}


		market_buy_infantry_disable = {

			priority = 10

		icon = generic_form_nation

		allowed = {
				 has_country_flag = infantry_enable_buy_qol_flag	
				 has_country_flag = buying_land_qol
		}
		available = {
				 has_country_flag = infantry_enable_buy_qol_flag
				 has_country_flag = buying_land_qol
		}
		visible = {
			 has_country_flag = buying_land_qol
			 has_country_flag = infantry_enable_buy_qol_flag			 
		}

		cost = 0
		days_re_enable = 0
		ai_will_do = {
			factor = 0
		}
		complete_effect = {
			clr_country_flag = infantry_enable_buy_qol_flag
		}			
		}
		

market_buy_infantry1 = {

		icon = generic_form_nation
			priority = 9

		allowed = {
		}
		available = {
			 has_country_flag = infantry_enable_buy_qol_flag
			 has_country_flag = buying_land_qol
			FROM = {
				num_of_military_factories > 20
			}
			FROM = { has_country_flag = qol_accept_infantry_orders_flag}
			FROM = {
				has_equipment = {
					infantry_equipment_0 > 1000
				}			
				has_opinion = {
					target = ROOT
					value > 51
				}					
			}			 
		}
		visible = {
			has_country_flag = show_old_qol
			has_country_flag = infantry_enable_buy_qol_flag
			 has_country_flag = buying_land_qol
			FROM = {
				num_of_military_factories > 20
			}
			FROM = { has_country_flag = qol_accept_infantry_orders_flag}
			FROM = {
				has_equipment = {
					infantry_equipment_0 > 1000
				}			
			}			 
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 0.25 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
			}
			FROM = { has_country_flag = qol_accept_infantry_orders_flag}
			FROM = {
				has_equipment = {
					infantry_equipment_0 > 1000
				}
				has_tech = infantry_weapons 
				has_country_flag = qol_accept_infantry_orders_flag				
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = infantry_equipment        
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = infantry_equipment_0 
					amount = -1000
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = infantry_equipment_0 
					amount = 1000
					producer = FROM
				}
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 0.25 }
				FROM = { add_to_variable = { eoc_treasury = 0.25 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }				
			}				
		}
		
	}	

market_buy_infantry2 = {

		icon = generic_form_nation
			priority  = 9

		allowed = {
		}
		available = {
			has_country_flag = infantry_enable_buy_qol_flag
			 has_country_flag = buying_land_qol
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_infantry_orders_flag
				has_equipment = {
					infantry_equipment_1 > 1000
				}
				has_opinion = {
					target = ROOT
					value > 51
				}						
			}			 
		}
		visible = {
			has_country_flag = show_old_qol
			has_country_flag = infantry_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = {
				num_of_military_factories > 20
			}
			FROM = { has_country_flag = qol_accept_infantry_orders_flag}
			FROM = {
				has_equipment = {
					infantry_equipment_1 > 1000
				}
				has_tech = infantry_weapons1 
			}		
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 0.1 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
			
				has_country_flag = qol_accept_infantry_orders_flag
				has_equipment = {
					infantry_equipment_1 > 1000
				}
				has_tech = infantry_weapons1
				has_country_flag = qol_accept_infantry_orders_flag	 				
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = infantry_equipment        
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = infantry_equipment_1 
					amount = -1000
					producer = FROM
				}
			}

		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = infantry_equipment_1
					amount = 1000
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
						add_to_variable = {number_contracts_buy_var = 1 }
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 0.1 }
				FROM = { add_to_variable = { eoc_treasury = 0.1 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }				
			}			
		}
		
	}

market_buy_infantry3 = {

		icon = generic_form_nation
			priority = 9

		allowed = {
		}
		available = {
			has_country_flag = infantry_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_infantry_orders_flag}
			FROM = {
				has_equipment = {
					infantry_equipment_2 > 1000
				}
				has_opinion = {
					target = ROOT
					value > 51
				}						
			}			
		}
		visible = {
			has_country_flag = show_old_qol
			has_country_flag = infantry_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_infantry_orders_flag}
			FROM = {
				has_equipment = {
					infantry_equipment_2 > 1000
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 0.2 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_infantry_orders_flag
				has_equipment = {
					infantry_equipment_2 > 1000
				}
				has_tech = improved_infantry_weapons 
				has_country_flag = qol_accept_infantry_orders_flag	
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = infantry_equipment        
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = infantry_equipment_2
					amount = -1000
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = infantry_equipment_2
					amount = 1000
					producer = FROM
				}
				
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 0.2 }
				FROM = { add_to_variable = { eoc_treasury = 0.2} }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
			}			
		}
		
	}


market_buy_infantry4 = {

		icon = generic_form_nation
			priority = 9

		allowed = {
		}
		available = {
			has_country_flag = infantry_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_infantry_orders_flag}
			FROM = {
				has_equipment = {
					infantry_equipment_3 > 1000
				}
				has_opinion = {
					target = ROOT
					value > 51
				}						
			}			
		}
		visible = {
			has_country_flag = show_modern_qol
			has_country_flag = infantry_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_infantry_orders_flag}
			FROM = {
				has_equipment = {
					infantry_equipment_3 > 1000
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 0.2 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_infantry_orders_flag
				has_equipment = {
					infantry_equipment_3 > 1000
				}
				has_tech = advanced_infantry_weapons 
				has_country_flag = qol_accept_infantry_orders_flag	
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = infantry_equipment        
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = infantry_equipment_3
					amount = -1000
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = infantry_equipment_3
					amount = 1000
					producer = FROM
				}
				
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 0.2 }
				FROM = { add_to_variable = { eoc_treasury = 0.2} }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
			}			
		}
		
	}
	
market_buy_infantry5 = {

		icon = generic_form_nation
			priority = 9

		allowed = {
		}
		available = {
			has_country_flag = infantry_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_infantry_orders_flag}
			FROM = {
				has_equipment = {
					infantry_equipment_4 > 1000
				}
				has_opinion = {
					target = ROOT
					value > 51
				}						
			}			
		}
		visible = {
			has_country_flag = show_modern_qol
			has_country_flag = infantry_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_infantry_orders_flag}
			FROM = {
				has_equipment = {
					infantry_equipment_4 > 1000
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 1 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_infantry_orders_flag
				has_equipment = {
					infantry_equipment_4 > 1000
				}
				has_tech = infantry_cw1 
				has_country_flag = qol_accept_infantry_orders_flag	
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = infantry_equipment        
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = infantry_equipment_4
					amount = -1000
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = infantry_equipment_4
					amount = 1000
					producer = FROM
				}
				
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 1 }
				FROM = { add_to_variable = { eoc_treasury = 1} }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
			}			
		}
		
	}
	
market_buy_infantry6 = {

		icon = generic_form_nation
			priority = 9

		allowed = {
		}
		available = {
			has_country_flag = infantry_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_infantry_orders_flag}
			FROM = {
				has_equipment = {
					infantry_equipment_5 > 1000
				}
				has_opinion = {
					target = ROOT
					value > 51
				}						
			}			
		}
		visible = {
			has_country_flag = show_advanced_qol
			has_country_flag = infantry_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_infantry_orders_flag}
			FROM = {
				has_equipment = {
					infantry_equipment_5 > 1000
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 1.2 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_infantry_orders_flag
				has_equipment = {
					infantry_equipment_5 > 1000
				}
				has_tech = infantry_cw2 
				has_country_flag = qol_accept_infantry_orders_flag	
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = infantry_equipment        
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = infantry_equipment_5
					amount = -1000
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = infantry_equipment_5
					amount = 1000
					producer = FROM
				}
				
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 1.2 }
				FROM = { add_to_variable = { eoc_treasury = 1.2} }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
			}			
		}
		
	}
	
market_buy_infantry7 = {

		icon = generic_form_nation
			priority = 9

		allowed = {
		}
		available = {
			has_country_flag = infantry_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_infantry_orders_flag}
			FROM = {
				has_equipment = {
					infantry_equipment_6 > 1000
				}
				has_opinion = {
					target = ROOT
					value > 51
				}						
			}			
		}
		visible = {
			has_country_flag = show_advanced_qol
			has_country_flag = infantry_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_infantry_orders_flag}
			FROM = {
				has_equipment = {
					infantry_equipment_6 > 1000
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 1.4 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_infantry_orders_flag
				has_equipment = {
					infantry_equipment_6 > 1000
				}
				has_tech = infantry_cw3 
				has_country_flag = qol_accept_infantry_orders_flag	
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = infantry_equipment        
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = infantry_equipment_6
					amount = -1000
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = infantry_equipment_6
					amount = 1000
					producer = FROM
				}
				
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 1.4 }
				FROM = { add_to_variable = { eoc_treasury = 1.4} }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
			}			
		}
		
	}	
market_buy_infantry8 = {

		icon = generic_form_nation
			priority = 9

		allowed = {
		}
		available = {
			has_country_flag = infantry_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_infantry_orders_flag}
			FROM = {
				has_equipment = {
					infantry_equipment_7 > 1000
				}
				has_opinion = {
					target = ROOT
					value > 51
				}						
			}			
		}
		visible = {
			has_country_flag = show_advanced_qol
			has_country_flag = infantry_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_infantry_orders_flag}
			FROM = {
				has_equipment = {
					infantry_equipment_7 > 1000
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 1.6 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_infantry_orders_flag
				has_equipment = {
					infantry_equipment_7 > 1000
				}
				has_tech = infantry_cw3 
				has_country_flag = qol_accept_infantry_orders_flag	
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = infantry_equipment        
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = infantry_equipment_7
					amount = -1000
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = infantry_equipment_7
					amount = 1000
					producer = FROM
				}
				
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 1.6 }
				FROM = { add_to_variable = { eoc_treasury = 1.6} }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
			}			
		}
		
	}
market_buy_infantry9 = {

		icon = generic_form_nation
			priority = 9

		allowed = {
		}
		available = {
			has_country_flag = infantry_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_infantry_orders_flag}
			FROM = {
				has_equipment = {
					infantry_equipment_8 > 1000
				}
				has_opinion = {
					target = ROOT
					value > 51
				}						
			}			
		}
		visible = {
			has_country_flag = show_advanced_qol
			has_country_flag = infantry_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_infantry_orders_flag}
			FROM = {
				has_equipment = {
					infantry_equipment_8 > 1000
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 2 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_infantry_orders_flag
				has_equipment = {
					infantry_equipment_8 > 1000
				}
				has_tech = infantry_cw3 
				has_country_flag = qol_accept_infantry_orders_flag	
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = infantry_equipment        
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = infantry_equipment_8
					amount = -1000
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = infantry_equipment_8
					amount = 1000
					producer = FROM
				}
				
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 2 }
				FROM = { add_to_variable = { eoc_treasury = 2} }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
			}			
		}
		
	}	
	
######################
###### Support  ######	
######################
	
	
		market_buy_support_enable = {
			priority  = 8


		icon = generic_form_nation

		allowed = {
				NOT = {
					 has_country_flag = support_enable_buy_qol_flag
				}
				has_country_flag = buying_land_qol
		}
		available = {
				NOT = {
					 has_country_flag = support_enable_buy_qol_flag
				}
				has_country_flag = buying_land_qol
		}
		visible = {
			 has_country_flag = buying_land_qol
				NOT = {
					 has_country_flag = support_enable_buy_qol_flag
				}	 
		}

		cost = 0
		days_re_enable = 0
		ai_will_do = {
			factor = 0
		}
		complete_effect = {
			set_country_flag = support_enable_buy_qol_flag
		}			
		}


		market_buy_support_disable = {

			priority = 8

		icon = generic_form_nation

		allowed = {
				 has_country_flag = support_enable_buy_qol_flag	
				 has_country_flag = buying_land_qol
		}
		available = {
				 has_country_flag = support_enable_buy_qol_flag
				 has_country_flag = buying_land_qol
		}
		visible = {
			 has_country_flag = buying_land_qol
			 has_country_flag = support_enable_buy_qol_flag			 
		}

		cost = 0
		days_re_enable = 0
		ai_will_do = {
			factor = 0
		}
		complete_effect = {
			clr_country_flag = support_enable_buy_qol_flag
		}			
		}
		

market_buy_support1 = {

		icon = generic_form_nation
			priority = 7

		allowed = {
		}
		available = {
			 has_country_flag = support_enable_buy_qol_flag
			 has_country_flag = buying_land_qol
			FROM = {
				num_of_military_factories > 20
			}
			FROM = { has_country_flag = qol_accept_support_orders_flag}
			FROM = {
				has_equipment = {
					support_equipment > 300
				}
				has_opinion = {
					target = ROOT
					value > 51
				}		
				has_tech = support_equipment				
			}			 
		}
		visible = {
			has_country_flag = show_old_qol
			has_country_flag = support_enable_buy_qol_flag
			 has_country_flag = buying_land_qol
			FROM = {
				num_of_military_factories > 20
			}
			FROM = { has_country_flag = qol_accept_support_orders_flag}
			FROM = {
				has_equipment = {
					support_equipment > 300
				}			
			}			 
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury = 0.25 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
			}
			FROM = { has_country_flag = qol_accept_support_orders_flag}
			FROM = {
				has_equipment = {
					support_equipment > 300
				}
			has_country_flag = qol_accept_support_orders_flag					
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = support_equipment       
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = support_equipment 
					amount = -300
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = support_equipment 
					amount = 300
					producer = FROM
				}
			
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 0.25 }
				FROM = { add_to_variable = { eoc_treasury = 0.25 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }	
			}
		}
		
	}	


########################	
###### Anti Tank  ######	
########################	
	
	
		market_buy_at_enable = {
			priority  = 6


		icon = generic_form_nation

		allowed = {
				NOT = {
					 has_country_flag = at_enable_buy_qol_flag
				}
				has_country_flag = buying_land_qol
		}
		available = {
				NOT = {
					 has_country_flag = at_enable_buy_qol_flag
				}
				has_country_flag = buying_land_qol
		}
		visible = {
			 has_country_flag = buying_land_qol
				NOT = {
					 has_country_flag = at_enable_buy_qol_flag
				}	 
		}

		cost = 0
		days_re_enable = 0
		ai_will_do = {
			factor = 0
		}
		complete_effect = {
			set_country_flag = at_enable_buy_qol_flag
		}			
		}


		market_buy_at_disable = {

			priority = 6

		icon = generic_form_nation

		allowed = {
				 has_country_flag = at_enable_buy_qol_flag	
				 has_country_flag = buying_land_qol
		}
		available = {
				 has_country_flag = at_enable_buy_qol_flag
				 has_country_flag = buying_land_qol
		}
		visible = {
			 has_country_flag = buying_land_qol
			 has_country_flag = at_enable_buy_qol_flag			 
		}

		cost = 0
		days_re_enable = 0
		ai_will_do = {
			factor = 0
		}
		complete_effect = {
			clr_country_flag = at_enable_buy_qol_flag
		}			
		}
		

market_buy_at1 = {

		icon = generic_form_nation
			priority = 5

		allowed = {
		}
		available = {
			 has_country_flag = at_enable_buy_qol_flag
			 has_country_flag = buying_land_qol
			FROM = {
				num_of_military_factories > 20
			}
			FROM = { has_country_flag = qol_accept_at_orders_flag}
			FROM = {
				has_equipment = {
					anti_tank_equipment_1 > 300
				}
				has_opinion = {
					target = ROOT
					value > 51
				}		
				has_tech = interwar_antitank				
			}			 
		}
		visible = {
			has_country_flag = show_old_qol
			has_country_flag = at_enable_buy_qol_flag
			 has_country_flag = buying_land_qol
			FROM = {
				num_of_military_factories > 20
			}
			FROM = { has_country_flag = qol_accept_at_orders_flag}
			FROM = {
				has_equipment = {
					anti_tank_equipment_1 > 300
				}			
			}			 
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury = 0.2 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
			}
			FROM = { has_country_flag = qol_accept_at_orders_flag}
			FROM = {
				has_equipment = {
					anti_tank_equipment_1 > 300
				}
			has_country_flag = qol_accept_at_orders_flag				
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = anti_tank_equipment         
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = anti_tank_equipment_1 
					amount = -300
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = anti_tank_equipment_1 
					amount = 300
					producer = FROM
				}
			
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 0.2 }
				FROM = { add_to_variable = { eoc_treasury = 0.2 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }				
			}
		}
		
	}	

market_buy_at2 = {

		icon = generic_form_nation
			priority = 5


		allowed = {
		}
		available = {
			has_country_flag = at_enable_buy_qol_flag
			 has_country_flag = buying_land_qol
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_at_orders_flag
				has_equipment = {
					anti_tank_equipment_3 > 300
				}
				has_opinion = {
					target = ROOT
					value > 51
				}						
			}			 
		}
		visible = {
			has_country_flag = show_old_qol
			has_country_flag = at_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = {
				num_of_military_factories > 20
			}
			FROM = { has_country_flag = qol_accept_at_orders_flag}
			FROM = {
				has_equipment = {
					anti_tank_equipment_3 > 300
				}
				has_tech = antitank2 
			}		
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury >0.4 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
			
				has_country_flag = qol_accept_at_orders_flag
				has_equipment = {
					anti_tank_equipment_3 > 300
				}
				has_tech = antitank5 				
				has_country_flag = qol_accept_at_orders_flag				
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = anti_tank_equipment         
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = anti_tank_equipment_3 
					amount = -300
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = anti_tank_equipment_3
					amount = 300
					producer = FROM
				}
				
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury =0.4 }
				FROM = { add_to_variable = { eoc_treasury =0.4 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
			}			
		}
		
	}

market_buy_at3 = {

		icon = generic_form_nation
			priority = 5

		allowed = {
		}
		available = {
			has_country_flag = at_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_at_orders_flag}
			FROM = {
				has_equipment = {
					anti_tank_equipment_4 > 300
				}
				has_opinion = {
					target = ROOT
					value > 50
				}						
			}			
		}
		visible = {
			has_country_flag = show_modern_qol
			has_country_flag = at_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_at_orders_flag}
			FROM = {
				has_equipment = {
					anti_tank_equipment_4 > 300
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 0.6 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_at_orders_flag
				has_equipment = {
					anti_tank_equipment_4 > 300
				}
				has_tech = antitank6 
				has_country_flag = qol_accept_at_orders_flag				
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = anti_tank_equipment         
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = anti_tank_equipment_4
					amount = -300
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = anti_tank_equipment_4
					amount = 300
					producer = FROM
				}
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 0.6 }
				FROM = { add_to_variable = { eoc_treasury = 0.6 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
				
			}
			
		}
		
	}
market_buy_at4 = {

		icon = generic_form_nation
			priority = 5

		allowed = {
		}
		available = {
			has_country_flag = at_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_at_orders_flag}
			FROM = {
				has_equipment = {
					anti_tank_equipment_5 > 300
				}
				has_opinion = {
					target = ROOT
					value > 50
				}						
			}			
		}
		visible = {
			has_country_flag = show_modern_qol
			has_country_flag = at_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_at_orders_flag}
			FROM = {
				has_equipment = {
					anti_tank_equipment_5 > 300
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 0.8 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_at_orders_flag
				has_equipment = {
					anti_tank_equipment_5 > 300
				}
				has_tech = antitank7 
				has_country_flag = qol_accept_at_orders_flag				
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = anti_tank_equipment         
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = anti_tank_equipment_5
					amount = -300
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = anti_tank_equipment_5
					amount = 300
					producer = FROM
				}
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 0.8 }
				FROM = { add_to_variable = { eoc_treasury = 0.8 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
				
			}
			
		}
		
	}

market_buy_at5 = {

		icon = generic_form_nation
			priority = 5

		allowed = {
		}
		available = {
			has_country_flag = at_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_at_orders_flag}
			FROM = {
				has_equipment = {
					anti_tank_equipment_6 > 300
				}
				has_opinion = {
					target = ROOT
					value > 50
				}						
			}			
		}
		visible = {
			has_country_flag = show_advanced_qol
			has_country_flag = at_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_at_orders_flag}
			FROM = {
				has_equipment = {
					anti_tank_equipment_6 > 300
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 1 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_at_orders_flag
				has_equipment = {
					anti_tank_equipment_6 > 300
				}
				has_tech = antitank8 
				has_country_flag = qol_accept_at_orders_flag				
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = anti_tank_equipment         
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = anti_tank_equipment_6
					amount = -300
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = anti_tank_equipment_6
					amount = 300
					producer = FROM
				}
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 1}
				FROM = { add_to_variable = { eoc_treasury = 1 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
				
			}
			
		}
		
	}

market_buy_at6 = {

		icon = generic_form_nation
			priority = 5

		allowed = {
		}
		available = {
			has_country_flag = at_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_at_orders_flag}
			FROM = {
				has_equipment = {
					anti_tank_equipment_7 > 300
				}
				has_opinion = {
					target = ROOT
					value > 50
				}						
			}			
		}
		visible = {
			has_country_flag = show_advanced_qol
			has_country_flag = at_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_at_orders_flag}
			FROM = {
				has_equipment = {
					anti_tank_equipment_7 > 300
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 1.2 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_at_orders_flag
				has_equipment = {
					anti_tank_equipment_7 > 300
				}
				has_tech = antitank9 
				has_country_flag = qol_accept_at_orders_flag				
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = anti_tank_equipment         
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = anti_tank_equipment_7
					amount = -300
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = anti_tank_equipment_7
					amount = 300
					producer = FROM
				}
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 1.2 }
				FROM = { add_to_variable = { eoc_treasury = 1.2 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
				
			}
			
		}
		
	}

market_buy_at7 = {

		icon = generic_form_nation
			priority = 5

		allowed = {
		}
		available = {
			has_country_flag = at_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_at_orders_flag}
			FROM = {
				has_equipment = {
					anti_tank_equipment_8 > 300
				}
				has_opinion = {
					target = ROOT
					value > 50
				}						
			}			
		}
		visible = {
			has_country_flag = show_advanced_qol
			has_country_flag = at_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_at_orders_flag}
			FROM = {
				has_equipment = {
					anti_tank_equipment_8 > 300
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 1.4 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_at_orders_flag
				has_equipment = {
					anti_tank_equipment_8 > 300
				}
				has_tech = antitank10 
				has_country_flag = qol_accept_at_orders_flag				
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = anti_tank_equipment         
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = anti_tank_equipment_8
					amount = -300
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = anti_tank_equipment_8
					amount = 300
					producer = FROM
				}
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 1.4 }
				FROM = { add_to_variable = { eoc_treasury = 1.4 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
				
			}
			
		}
		
	}
#######################
###### Anti Air  ######	
#######################
	
	
		market_buy_antiair_enable = {
			priority  = 4


		icon = generic_form_nation

		allowed = {
				NOT = {
					 has_country_flag = antiair_enable_buy_qol_flag
				}
				has_country_flag = buying_land_qol
		}
		available = {
				NOT = {
					 has_country_flag = antiair_enable_buy_qol_flag
				}
				has_country_flag = buying_land_qol
		}
		visible = {
			 has_country_flag = buying_land_qol
				NOT = {
					 has_country_flag = antiair_enable_buy_qol_flag
				}	 
		}

		cost = 0
		days_re_enable = 0
		ai_will_do = {
			factor = 0
		}
		complete_effect = {
			set_country_flag = antiair_enable_buy_qol_flag
		}			
		}


		market_buy_antiair_disable = {

			priority = 4

		icon = generic_form_nation

		allowed = {
				 has_country_flag = antiair_enable_buy_qol_flag	
				 has_country_flag = buying_land_qol
		}
		available = {
				 has_country_flag = antiair_enable_buy_qol_flag
				 has_country_flag = buying_land_qol
		}
		visible = {
			 has_country_flag = buying_land_qol
			 has_country_flag = antiair_enable_buy_qol_flag			 
		}

		cost = 0
		days_re_enable = 0
		ai_will_do = {
			factor = 0
		}
		complete_effect = {
			clr_country_flag = antiair_enable_buy_qol_flag
		}			
		}
		

market_buy_antiair1 = {

		icon = generic_form_nation
			priority = 3

		allowed = {
		}
		available = {
			 has_country_flag = antiair_enable_buy_qol_flag
			 has_country_flag = buying_land_qol
			FROM = {
				num_of_military_factories > 20
			}
			FROM = { has_country_flag = qol_accept_antiair_orders_flag}
			FROM = {
				has_equipment = {
					anti_air_equipment_1  > 0.25
				}
				has_opinion = {
					target = ROOT
					value > 51
				}		
				has_tech = interwar_antiair 				
			}			 
		}
		visible = {
			has_country_flag = show_old_qol
			has_country_flag = antiair_enable_buy_qol_flag
			 has_country_flag = buying_land_qol
			FROM = {
				num_of_military_factories > 20
			}
			FROM = { has_country_flag = qol_accept_antiair_orders_flag}
			FROM = {
				has_equipment = {
					anti_air_equipment_1  > 0.25
				}			
			}			 
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury = 0.2 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
			}
			FROM = { has_country_flag = qol_accept_antiair_orders_flag}
			FROM = {
				has_equipment = {
					anti_air_equipment_1  > 0.25
				}
				has_country_flag = qol_accept_antiair_orders_flag				
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = anti_air_equipment         
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = anti_air_equipment_1  
					amount = -0.25
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = anti_air_equipment_1  
					amount = 0.25
					producer = FROM
				}
			
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 0.2 }
				FROM = { add_to_variable = { eoc_treasury = 0.2 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
			}
		}
		
	}	

market_buy_antiair2 = {

		icon = generic_form_nation
			priority = 3


		allowed = {
		}
		available = {
			has_country_flag = antiair_enable_buy_qol_flag
			 has_country_flag = buying_land_qol
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_antiair_orders_flag
				has_equipment = {
					anti_air_equipment_2 > 0.25
				}
				has_opinion = {
					target = ROOT
					value > 51
				}						
			}			 
		}
		visible = {
			has_country_flag = show_old_qol
			has_country_flag = antiair_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = {
				num_of_military_factories > 20
			}
			FROM = { has_country_flag = qol_accept_antiair_orders_flag}
			FROM = {
				has_equipment = {
					anti_air_equipment_2 > 0.25
				}
				has_tech = antiair2 
			}		
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 0.4 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
			
				has_country_flag = qol_accept_antiair_orders_flag
				has_equipment = {
					anti_air_equipment_2 > 0.25
				}
				has_tech = Anti_Air_1 				
				has_country_flag = qol_accept_antiair_orders_flag			
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = anti_air_equipment        
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = anti_air_equipment_2 
					amount = -0.25
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = anti_air_equipment_2
					amount = 0.25
					producer = FROM
				}
				
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 0.4 }
				FROM = { add_to_variable = { eoc_treasury = 0.4 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
			}			
		}
		
	}

market_buy_antiair3 = {

		icon = generic_form_nation
			priority = 3

		allowed = {
		}
		available = {
			has_country_flag = antiair_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_antiair_orders_flag}
			FROM = {
				has_equipment = {
					anti_air_equipment_3 > 0.25
				}
				has_opinion = {
					target = ROOT
					value > 50
				}						
			}			
		}
		visible = {
			has_country_flag = show_modern_qol
			has_country_flag = antiair_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_antiair_orders_flag}
			FROM = {
				has_equipment = {
					anti_air_equipment_3 > 0.25
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 0.6 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_antiair_orders_flag
				has_equipment = {
					anti_air_equipment_3 > 0.25
				}
				has_tech = antiair5 
				has_country_flag = qol_accept_antiair_orders_flag			
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = anti_air_equipment        
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = anti_air_equipment_3
					amount = -0.25
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = anti_air_equipment_3
					amount = 0.25
					producer = FROM
				}
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 0.6 }
				FROM = { add_to_variable = { eoc_treasury = 0.6 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
				
			}
			
		}
		
	}


market_buy_antiair4 = {

		icon = generic_form_nation
			priority = 3

		allowed = {
		}
		available = {
			has_country_flag = antiair_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_antiair_orders_flag}
			FROM = {
				has_equipment = {
					anti_air_equipment_4 > 0.25
				}
				has_opinion = {
					target = ROOT
					value > 50
				}						
			}			
		}
		visible = {
			has_country_flag = show_modern_qol
			has_country_flag = antiair_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_antiair_orders_flag}
			FROM = {
				has_equipment = {
					anti_air_equipment_4 > 0.25
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 0.8 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_antiair_orders_flag
				has_equipment = {
					anti_air_equipment_4 > 0.25
				}
				has_tech = antiair5 
				has_country_flag = qol_accept_antiair_orders_flag			
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = anti_air_equipment        
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = anti_air_equipment_4
					amount = -0.25
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = anti_air_equipment_4
					amount = 0.25
					producer = FROM
				}
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 0.8 }
				FROM = { add_to_variable = { eoc_treasury = 0.8 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
				
			}
			
		}
		
	}

market_buy_antiair5 = {

		icon = generic_form_nation
			priority = 3

		allowed = {
		}
		available = {
			has_country_flag = antiair_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_antiair_orders_flag}
			FROM = {
				has_equipment = {
					anti_air_equipment_5 > 0.25
				}
				has_opinion = {
					target = ROOT
					value > 50
				}						
			}			
		}
		visible = {
			has_country_flag = show_advanced_qol
			has_country_flag = antiair_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_antiair_orders_flag}
			FROM = {
				has_equipment = {
					anti_air_equipment_5 > 0.25
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 1 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_antiair_orders_flag
				has_equipment = {
					anti_air_equipment_5 > 0.25
				}
				has_tech = antiair5 
				has_country_flag = qol_accept_antiair_orders_flag			
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = anti_air_equipment        
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = anti_air_equipment_5
					amount = -0.25
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = anti_air_equipment_5
					amount = 0.25
					producer = FROM
				}
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 1 }
				FROM = { add_to_variable = { eoc_treasury = 1 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
				
			}
			
		}
		
	}

market_buy_antiair6 = {

		icon = generic_form_nation
			priority = 3

		allowed = {
		}
		available = {
			has_country_flag = antiair_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_antiair_orders_flag}
			FROM = {
				has_equipment = {
					anti_air_equipment_6 > 0.25
				}
				has_opinion = {
					target = ROOT
					value > 50
				}						
			}			
		}
		visible = {
			has_country_flag = show_advanced_qol
			has_country_flag = antiair_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_antiair_orders_flag}
			FROM = {
				has_equipment = {
					anti_air_equipment_6 > 0.25
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 1.2 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_antiair_orders_flag
				has_equipment = {
					anti_air_equipment_6 > 0.25
				}
				has_tech = antiair5 
				has_country_flag = qol_accept_antiair_orders_flag			
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = anti_air_equipment        
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = anti_air_equipment_6
					amount = -0.25
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = anti_air_equipment_6
					amount = 0.25
					producer = FROM
				}
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 1.2 }
				FROM = { add_to_variable = { eoc_treasury = 1.2 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
				
			}
			
		}
		
	}


market_buy_antiair7 = {

		icon = generic_form_nation
			priority = 3

		allowed = {
		}
		available = {
			has_country_flag = antiair_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_antiair_orders_flag}
			FROM = {
				has_equipment = {
					anti_air_equipment_7 > 0.25
				}
				has_opinion = {
					target = ROOT
					value > 50
				}						
			}			
		}
		visible = {
			has_country_flag = show_advanced_qol
			has_country_flag = antiair_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_antiair_orders_flag}
			FROM = {
				has_equipment = {
					anti_air_equipment_7 > 0.25
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 1.4 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_antiair_orders_flag
				has_equipment = {
					anti_air_equipment_7 > 0.25
				}
				has_tech = antiair5 
				has_country_flag = qol_accept_antiair_orders_flag			
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = anti_air_equipment        
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = anti_air_equipment_7
					amount = -0.25
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = anti_air_equipment_7
					amount = 0.25
					producer = FROM
				}
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 1.4 }
				FROM = { add_to_variable = { eoc_treasury = 1.4 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
				
			}
			
		}
		
	}

market_buy_antiair8 = {

		icon = generic_form_nation
			priority = 3

		allowed = {
		}
		available = {
			has_country_flag = antiair_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_antiair_orders_flag}
			FROM = {
				has_equipment = {
					anti_air_equipment_8 > 0.25
				}
				has_opinion = {
					target = ROOT
					value > 50
				}						
			}			
		}
		visible = {
			has_country_flag = show_advanced_qol
			has_country_flag = antiair_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_antiair_orders_flag}
			FROM = {
				has_equipment = {
					anti_air_equipment_8 > 0.25
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 1.6 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_antiair_orders_flag
				has_equipment = {
					anti_air_equipment_8 > 0.25
				}
				has_tech = antiair5 
				has_country_flag = qol_accept_antiair_orders_flag			
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = anti_air_equipment        
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = anti_air_equipment_8
					amount = -0.25
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = anti_air_equipment_8
					amount = 0.25
					producer = FROM
				}
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 1.6 }
				FROM = { add_to_variable = { eoc_treasury = 1.6 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
				
			}
			
		}
		
	}


########################
###### Artillery  ######	
########################
	
	
		market_buy_artillery_enable = {
			priority  = 2


		icon = generic_form_nation

		allowed = {
				NOT = {
					 has_country_flag = artillery_enable_buy_qol_flag
				}
				has_country_flag = buying_land_qol
		}
		available = {
				NOT = {
					 has_country_flag = artillery_enable_buy_qol_flag
				}
				has_country_flag = buying_land_qol
		}
		visible = {
			 has_country_flag = buying_land_qol
				NOT = {
					 has_country_flag = artillery_enable_buy_qol_flag
				}	 
		}

		cost = 0
		days_re_enable = 0
		ai_will_do = {
			factor = 0
		}
		complete_effect = {
			set_country_flag = artillery_enable_buy_qol_flag
		}			
		}


		market_buy_artillery_disable = {

			priority = 2

		icon = generic_form_nation

		allowed = {
				 has_country_flag = artillery_enable_buy_qol_flag	
				 has_country_flag = buying_land_qol
		}
		available = {
				 has_country_flag = artillery_enable_buy_qol_flag
				 has_country_flag = buying_land_qol
		}
		visible = {
			 has_country_flag = buying_land_qol
			 has_country_flag = artillery_enable_buy_qol_flag			 
		}

		cost = 0
		days_re_enable = 0
		ai_will_do = {
			factor = 0
		}
		complete_effect = {
			clr_country_flag = artillery_enable_buy_qol_flag
		}			
		}
		

market_buy_artillery1 = {

		icon = generic_form_nation
			priority = 1

		allowed = {
		}
		available = {
			 has_country_flag = artillery_enable_buy_qol_flag
			 has_country_flag = buying_land_qol
			FROM = {
				num_of_military_factories > 20
			}
			FROM = { has_country_flag = qol_accept_artillery_orders_flag}
			FROM = {
				has_equipment = {
					artillery_equipment_1  > 100
				}
				has_opinion = {
					target = ROOT
					value > 51
				}		
				has_tech = gw_artillery 				
			}			 
		}
		visible = {
			has_country_flag = show_old_qol
			has_country_flag = artillery_enable_buy_qol_flag
			 has_country_flag = buying_land_qol
			FROM = {
				num_of_military_factories > 20
			}
			FROM = { has_country_flag = qol_accept_artillery_orders_flag}
			FROM = {
				has_equipment = {
					artillery_equipment_1  > 100
				}			
			}			 
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury = 0.25 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
			}
			FROM = { has_country_flag = qol_accept_artillery_orders_flag}
			FROM = {
				has_equipment = {
					artillery_equipment_1  > 100
				}		
				has_country_flag = qol_accept_artillery_orders_flag				
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = artillery_equipment          
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = artillery_equipment_1  
					amount = -100
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = artillery_equipment_1  
					amount = 100
					producer = FROM
				}
			
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 0.25 }
				FROM = { add_to_variable = { eoc_treasury = 0.25 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
			}
		}
		
	}	

market_buy_artillery2 = {

		icon = generic_form_nation
			priority = 1


		allowed = {
		}
		available = {
			has_country_flag = artillery_enable_buy_qol_flag
			 has_country_flag = buying_land_qol
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_artillery_orders_flag
				has_equipment = {
					artillery_equipment_2 > 100
				}
				has_opinion = {
					target = ROOT
					value > 51
				}						
			}			 
		}
		visible = {
			has_country_flag = show_old_qol
			has_country_flag = artillery_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = {
				num_of_military_factories > 20
			}
			FROM = { has_country_flag = qol_accept_artillery_orders_flag}
			FROM = {
				has_equipment = {
					artillery_equipment_2 > 100
				}
				has_tech = artillery1 
			}		
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 0.1 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
			
				has_country_flag = qol_accept_artillery_orders_flag
				has_equipment = {
					artillery_equipment_2 > 100
				}
				has_tech = artillery1 				
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = artillery_equipment          
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = artillery_equipment_2 
					amount = -100
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = artillery_equipment_2
					amount = 100
					producer = FROM
				}
				
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 0.1 }
				FROM = { add_to_variable = { eoc_treasury = 0.1 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
			}			
		}
		
	}

market_buy_artillery3 = {

		icon = generic_form_nation
			priority = 1

		allowed = {
		}
		available = {
			has_country_flag = artillery_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_artillery_orders_flag}
			FROM = {
				has_equipment = {
					artillery_equipment_3 > 100
				}
				has_opinion = {
					target = ROOT
					value > 50
				}						
			}			
		}
		visible = {
			has_country_flag = show_modern_qol
			has_country_flag = artillery_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_artillery_orders_flag}
			FROM = {
				has_equipment = {
					artillery_equipment_3 > 100
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 0.2 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_artillery_orders_flag
				has_equipment = {
					artillery_equipment_3 > 100
				}
				has_tech = artillery4
				has_country_flag = qol_accept_artillery_orders_flag	
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = artillery_equipment          
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = artillery_equipment_3
					amount = -100
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = artillery_equipment_3
					amount = 100
					producer = FROM
				}
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 0.2 }
				FROM = { add_to_variable = { eoc_treasury = 0.2 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
				
			}
			
		}
		
	}

market_buy_artillery4 = {

		icon = generic_form_nation
			priority = 1

		allowed = {
		}
		available = {
			has_country_flag = artillery_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_artillery_orders_flag}
			FROM = {
				has_equipment = {
					artillery_equipment_3 > 100
				}
				has_opinion = {
					target = ROOT
					value > 50
				}						
			}			
		}
		visible = {
			has_country_flag = show_modern_qol
			has_country_flag = artillery_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_artillery_orders_flag}
			FROM = {
				has_equipment = {
					artillery_equipment_3 > 100
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 0.2 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_artillery_orders_flag
				has_equipment = {
					artillery_equipment_3 > 100
				}
				has_tech = artillery4
				has_country_flag = qol_accept_artillery_orders_flag	
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = artillery_equipment          
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = artillery_equipment_3
					amount = -100
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = artillery_equipment_3
					amount = 100
					producer = FROM
				}
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 0.2 }
				FROM = { add_to_variable = { eoc_treasury = 0.2 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
				
			}
			
		}
		
	}



market_buy_artillery5 = {

		icon = generic_form_nation
			priority = 1

		allowed = {
		}
		available = {
			has_country_flag = artillery_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_artillery_orders_flag}
			FROM = {
				has_equipment = {
					artillery_equipment_4 > 100
				}
				has_opinion = {
					target = ROOT
					value > 50
				}						
			}			
		}
		visible = {
			has_country_flag = show_modern_qol
			has_country_flag = artillery_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_artillery_orders_flag}
			FROM = {
				has_equipment = {
					artillery_equipment_4 > 100
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 0.2 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_artillery_orders_flag
				has_equipment = {
					artillery_equipment_4 > 100
				}
				has_tech = cwart1
				has_country_flag = qol_accept_artillery_orders_flag	
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = artillery_equipment          
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = artillery_equipment_4
					amount = -100
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = artillery_equipment_4
					amount = 100
					producer = FROM
				}
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 0.2 }
				FROM = { add_to_variable = { eoc_treasury = 0.2 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
				
			}
			
		}
		
	}

market_buy_artillery6 = {

		icon = generic_form_nation
			priority = 1

		allowed = {
		}
		available = {
			has_country_flag = artillery_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_artillery_orders_flag}
			FROM = {
				has_equipment = {
					artillery_equipment_5 > 100
				}
				has_opinion = {
					target = ROOT
					value > 50
				}						
			}			
		}
		visible = {
			has_country_flag = show_advanced_qol
			has_country_flag = artillery_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_artillery_orders_flag}
			FROM = {
				has_equipment = {
					artillery_equipment_5 > 100
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 0.2 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_artillery_orders_flag
				has_equipment = {
					artillery_equipment_5 > 100
				}
				has_tech = cwart2
				has_country_flag = qol_accept_artillery_orders_flag	
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = artillery_equipment          
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = artillery_equipment_5
					amount = -100
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = artillery_equipment_5
					amount = 100
					producer = FROM
				}
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 0.2 }
				FROM = { add_to_variable = { eoc_treasury = 0.2 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
				
			}
			
		}
		
	}


market_buy_artillery7 = {

		icon = generic_form_nation
			priority = 1

		allowed = {
		}
		available = {
			has_country_flag = artillery_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_artillery_orders_flag}
			FROM = {
				has_equipment = {
					artillery_equipment_6 > 100
				}
				has_opinion = {
					target = ROOT
					value > 50
				}						
			}			
		}
		visible = {
			has_country_flag = show_advanced_qol
			has_country_flag = artillery_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_artillery_orders_flag}
			FROM = {
				has_equipment = {
					artillery_equipment_6 > 100
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 0.2 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_artillery_orders_flag
				has_equipment = {
					artillery_equipment_6 > 100
				}
				has_tech = cwart3
				has_country_flag = qol_accept_artillery_orders_flag	
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = artillery_equipment          
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = artillery_equipment_6
					amount = -100
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = artillery_equipment_6
					amount = 100
					producer = FROM
				}
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 0.2 }
				FROM = { add_to_variable = { eoc_treasury = 0.2 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
				
			}
			
		}
		
	}

market_buy_artillery8 = {

		icon = generic_form_nation
			priority = 1

		allowed = {
		}
		available = {
			has_country_flag = artillery_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_artillery_orders_flag}
			FROM = {
				has_equipment = {
					artillery_equipment_7 > 100
				}
				has_opinion = {
					target = ROOT
					value > 50
				}						
			}			
		}
		visible = {
			has_country_flag = show_advanced_qol
			has_country_flag = artillery_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_artillery_orders_flag}
			FROM = {
				has_equipment = {
					artillery_equipment_7 > 100
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 0.2 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_artillery_orders_flag
				has_equipment = {
					artillery_equipment_7 > 100
				}
				has_tech = cwart4
				has_country_flag = qol_accept_artillery_orders_flag	
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = artillery_equipment          
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = artillery_equipment_7
					amount = -100
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = artillery_equipment_7
					amount = 100
					producer = FROM
				}
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 0.2 }
				FROM = { add_to_variable = { eoc_treasury = 0.2 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
				
			}
			
		}
		
	}

market_buy_artillery9 = {

		icon = generic_form_nation
			priority = 1

		allowed = {
		}
		available = {
			has_country_flag = artillery_enable_buy_qol_flag
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_artillery_orders_flag}
			FROM = {
				has_equipment = {
					artillery_equipment_8 > 100
				}
				has_opinion = {
					target = ROOT
					value > 50
				}						
			}			
		}
		visible = {
			has_country_flag = show_advanced_qol
			has_country_flag = artillery_enable_buy_qol_flag		
			has_country_flag = buying_land_qol
			FROM = { has_country_flag = qol_accept_artillery_orders_flag}
			FROM = {
				has_equipment = {
					artillery_equipment_8 > 100
				}			
			}			
		}
		custom_cost_trigger = {
			check_variable = { eoc_treasury > 0.2 }
		}
		target_trigger = {
			FROM = {
				num_of_military_factories > 20
				has_country_flag = qol_accept_artillery_orders_flag
				has_equipment = {
					artillery_equipment_8 > 100
				}
				has_tech = cwart5
				has_country_flag = qol_accept_artillery_orders_flag	
			}
		}
		cost = 10
		days_remove = 30
		days_re_enable = 0
		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				has_war = yes
				enemies_strength_ratio > 1 #strength
				#num_of_military_factories < 25 #factories 
			}
			modifier = {
				add = 100
				stockpile_ratio = {
					archetype = artillery_equipment          
					ratio < 0.25
				} 
			}
		}
		complete_effect = {
			FROM = {
				add_equipment_to_stockpile = {
					type = artillery_equipment_8
					amount = -100
					producer = FROM
				}
				add_to_variable = {number_contracts_sell_var = 1 }
			}
			add_to_variable = {number_contracts_buy_var = 1 }
		}
		remove_effect = {
			ROOT = {
				add_equipment_to_stockpile = {
					type = artillery_equipment_8
					amount = 100
					producer = FROM
				}
			}
			hidden_effect = {
				subtract_from_variable = { eoc_treasury = 0.2 }
				FROM = { add_to_variable = { eoc_treasury = 0.2 } }
				FROM = { subtract_from_variable = { number_contracts_sell_var = 1 } }
				subtract_from_variable = { number_contracts_buy_var = 1 }
				
			}
			
		}
		
	}

}