﻿###########################
# Trade Events
###########################

add_namespace = rtt_trade

country_event = {
	id = rtt_trade.1
	title = rtt_trade.1.t
	desc = rtt_trade.1.d
	picture = GFX_report_event_german_speech
	
	is_triggered_only = yes
	
 	immediate = {
		while_loop_effect = {
			limit = {
				ROOT = {
					check_variable = {
						rtt_resources_amount_fix1 > 0
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_resource_1 = "oil"
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = oil
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_resource_1 = "alu"
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = aluminium
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_resource_1 = "rub"
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = rubber
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_resource_1 = "tun"
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = tungsten
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_resource_1 = "ste"
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = steel
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_resource_1 = "chr"
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = chromium
							amount = 1
						}
					}
				}
			}
			ROOT = { subtract_from_variable = { rtt_resources_amount_fix1 = 1 }  }
		}

		ROOT = {
			set_variable = { 
				rtt_trade1 = 0
			}
			subtract_from_variable = {
				rtt_trades = 1
			}
		}
 	}
}

country_event = {
	id = rtt_trade.2
	title = rtt_trade.2.t
	desc = rtt_trade.2.d
	picture = GFX_report_event_german_speech
	hidden = no
	is_triggered_only = yes
	
 	immediate = {
		while_loop_effect = {
			limit = {
				ROOT = {
					check_variable = {
						rtt_resources_amount_fix2 > 0
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_oil > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = oil
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_alu > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = aluminium
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_rub > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = rubber
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_tun > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = tungsten
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_ste > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = steel
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_chr > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = chromium
							amount = 1
						}
					}
				}
			}
			ROOT = { subtract_from_variable = { rtt_resources_amount_fix2 = 1 }  }
		}

		ROOT = {
			set_variable = { 
				rtt_trade2 = 0
			}
			subtract_from_variable = {
				rtt_trades = 1
			}
		}
 	}
}

country_event = {
	id = rtt_trade.3
	title = rtt_trade.3.t
	desc = rtt_trade.3.d
	picture = GFX_report_event_german_speech
	
	is_triggered_only = yes
	
 	immediate = {
		while_loop_effect = {
			limit = {
				ROOT = {
					check_variable = {
						rtt_resources_amount_fix3 > 0
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_oil > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = oil
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_alu > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = aluminium
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_rub > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = rubber
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_tun > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = tungsten
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_ste > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = steel
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_chr > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = chromium
							amount = 1
						}
					}
				}
			}
			ROOT = { subtract_from_variable = { rtt_resources_amount_fix3 = 1 }  }
		}
		ROOT = {
			set_variable = { 
				rtt_trade3 = 0
			}
			subtract_from_variable = {
				rtt_trades = 1
			}
		}
 	}
}

country_event = {
	id = rtt_trade.4
	title = rtt_trade.4.t
	desc = rtt_trade.4.d
	picture = GFX_report_event_german_speech
	
	is_triggered_only = yes
	
 	immediate = {
		while_loop_effect = {
			limit = {
				ROOT = {
					check_variable = {
						rtt_resources_amount_fix4 > 0
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_oil > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = oil
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_alu > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = aluminium
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_rub > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = rubber
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_tun > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = tungsten
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_ste > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = steel
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_chr > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = chromium
							amount = 1
						}
					}
				}
			}
			ROOT = { subtract_from_variable = { rtt_resources_amount_fix4 = 1 }  }
		}
		ROOT = {
			set_variable = { 
				rtt_trade4 = 0
			}
			subtract_from_variable = {
				rtt_trades = 1
			}
		}
 	}
}

country_event = {
	id = rtt_trade.5
	title = rtt_trade.5.t
	desc = rtt_trade.5.d
	picture = GFX_report_event_german_speech
	
	is_triggered_only = yes
	
 	immediate = {
		while_loop_effect = {
			limit = {
				ROOT = {
					check_variable = {
						rtt_resources_amount_fix5 > 0
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_oil > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = oil
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_alu > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = aluminium
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_rub > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = rubber
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_tun > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = tungsten
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_ste > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = steel
							amount = 1
						}
					}
				}
			}

			if = {
				limit = { 
					ROOT = {
						check_variable = {
							trade_chr > 0
						}  
					}
				}
				ROOT = {
					random_owned_controlled_state = {
						add_resource = {
							type = chromium
							amount = 1
						}
					}
				}
			}
			ROOT = { subtract_from_variable = { rtt_resources_amount_fix5 = 1 }  }
		}
		ROOT = {
			set_variable = { 
				rtt_trade5 = 0
			}
			subtract_from_variable = {
				rtt_trades = 1
			}
		}
 	}
}

country_event = {
	id = rtt_trade.666
	title = rtt_trade.666.t
	desc = rtt_trade.666.d
	picture = GFX_report_event_german_speech
	hidden = yes

	is_triggered_only = yes
	
 	immediate = {
		FROM = {
			set_variable = { 
				rtt_trader = 0
			}
		}
 	}
}

#####################################################
### Reciever Event
####################################################

country_event = {
	id = rtt_trade.101
	title = rtt_trade.101.t
	desc = rtt_trade.101.d
	picture = GFX_report_event_german_speech
	
	is_triggered_only = yes
	
 	immediate = {
		while_loop_effect = {
			limit = {
				FROM = {
					check_variable = {
						rtt_resources_amount_fix1_event > 0
					}
				}
			}
			
			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_resource_1 = "oil"
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = oil
							amount > 0
						}
					}
					add_resource = {
						type = oil
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_resource_1 = "alu"
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = aluminium
							amount > 0
						}
					}
					add_resource = {
						type = aluminium
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_resource_1 = "rub"
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = rubber
							amount > 0
						}
					}
					add_resource = {
						type = rubber
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_resource_1 = "tun"
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = tungsten
							amount > 0
						}
					}
					add_resource = {
						type = tungsten
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_resource_1 = "ste"
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = steel
							amount > 0
						}
					}
					add_resource = {
						type = steel
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_resource_1 = "chr"
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = chromium
							amount > 0
						}
					}
					add_resource = {
						type = chromium
						amount = -1
					}
				}
			}
			FROM = { subtract_from_variable = { rtt_resources_amount_fix1_event = 1 } }
		}
 	}
}

country_event = {
	id = rtt_trade.102
	title = rtt_trade.102.t
	desc = rtt_trade.102.d
	picture = GFX_report_event_german_speech
	
	is_triggered_only = yes
	
 	immediate = {
		while_loop_effect = {
			limit = {
				FROM = {
					check_variable = {
						rtt_resources_amount_fix2_event > 0
					}
				}
			}
			
			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_oil > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = oil
							amount > 0
						}
					}
					add_resource = {
						type = oil
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_alu > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = aluminium
							amount > 0
						}
					}
					add_resource = {
						type = aluminium
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_rub > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = rubber
							amount > 0
						}
					}
					add_resource = {
						type = rubber
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_tun > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = tungsten
							amount > 0
						}
					}
					add_resource = {
						type = tungsten
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_ste > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = steel
							amount > 0
						}
					}
					add_resource = {
						type = steel
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_chr > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = chromium
							amount > 0
						}
					}
					add_resource = {
						type = chromium
						amount = -1
					}
				}
			}
			FROM = { subtract_from_variable = { rtt_resources_amount_fix2_event = 1 } }
		}
 	}
}


country_event = {
	id = rtt_trade.103
	title = rtt_trade.103.t
	desc = rtt_trade.103.d
	picture = GFX_report_event_german_speech
	
	is_triggered_only = yes
	
 	immediate = {
		while_loop_effect = {
			limit = {
				FROM = {
					check_variable = {
						rtt_resources_amount_fix3_event > 0
					}
				}
			}
			
			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_oil > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = oil
							amount > 0
						}
					}
					add_resource = {
						type = oil
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_alu > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = aluminium
							amount > 0
						}
					}
					add_resource = {
						type = aluminium
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_rub > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = rubber
							amount > 0
						}
					}
					add_resource = {
						type = rubber
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_tun > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = tungsten
							amount > 0
						}
					}
					add_resource = {
						type = tungsten
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_ste > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = steel
							amount > 0
						}
					}
					add_resource = {
						type = steel
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_chr > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = chromium
							amount > 0
						}
					}
					add_resource = {
						type = chromium
						amount = -1
					}
				}
			}
			FROM = { subtract_from_variable = { rtt_resources_amount_fix3_event = 1 } }
		}
 	}
}

country_event = {
	id = rtt_trade.104
	title = rtt_trade.104.t
	desc = rtt_trade.104.d
	picture = GFX_report_event_german_speech
	
	is_triggered_only = yes
	
 	immediate = {
		while_loop_effect = {
			limit = {
				FROM = {
					check_variable = {
						rtt_resources_amount_fix4_event > 0
					}
				}
			}
			
			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_oil > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = oil
							amount > 0
						}
					}
					add_resource = {
						type = oil
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_alu > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = aluminium
							amount > 0
						}
					}
					add_resource = {
						type = aluminium
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_rub > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = rubber
							amount > 0
						}
					}
					add_resource = {
						type = rubber
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_tun > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = tungsten
							amount > 0
						}
					}
					add_resource = {
						type = tungsten
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_ste > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = steel
							amount > 0
						}
					}
					add_resource = {
						type = steel
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_chr > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = chromium
							amount > 0
						}
					}
					add_resource = {
						type = chromium
						amount = -1
					}
				}
			}
			FROM = { subtract_from_variable = { rtt_resources_amount_fix4_event = 1 } }
		}
 	}
}

country_event = {
	id = rtt_trade.105
	title = rtt_trade.105.t
	desc = rtt_trade.105.d
	picture = GFX_report_event_german_speech
	
	is_triggered_only = yes
	
 	immediate = {
		while_loop_effect = {
			limit = {
				FROM = {
					check_variable = {
						rtt_resources_amount_fix5_event > 0
					}
				}
			}
			
			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_oil > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = oil
							amount > 0
						}
					}
					add_resource = {
						type = oil
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_alu > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = aluminium
							amount > 0
						}
					}
					add_resource = {
						type = aluminium
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_rub > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = rubber
							amount > 0
						}
					}
					add_resource = {
						type = rubber
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_tun > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = tungsten
							amount > 0
						}
					}
					add_resource = {
						type = tungsten
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_ste > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = steel
							amount > 0
						}
					}
					add_resource = {
						type = steel
						amount = -1
					}
				}
			}

			if = {
				limit = { 
					FROM = {
						check_variable = {
							trade_chr > 0
						}  
					}
				}
				random_owned_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = chromium
							amount > 0
						}
					}
					add_resource = {
						type = chromium
						amount = -1
					}
				}
			}
			FROM = { subtract_from_variable = { rtt_resources_amount_fix5_event = 1 } }
		}
 	}
}