####AI Convoy system to supply surrounded provinces

################################
#Spanish Civil War
###############################

####################################
#(AI) Nationalist Spain Convoy Reorganization  (300001-3)
#Lose Vigo to SPR (needed to get right convoy order for SPA), so SPA does not send
#all convoys first to Africa, leaving troops in Iberia starving
#Returned within a week
###################################

event = { 
	id = 300001 
	random = no
	country = SPA
	
	trigger = {
		ai = yes
		#event = 3001
	}

	name = AI_EVENT
	desc = ""
	style = 0
	
	action_a = {
		name = "OK" # Great!
		command = { type = secedeprovince which = SPR value = 959 } #Lose Vigo
	}
}

event = { 
	id = 300002 
	random = no
	country = SPR
	
	trigger = {
		event = 300001
	}

	name = AI_EVENT
	desc = ""
	style = 0
	
	date = { day = 24 month = july year = 1936 }
	offset = 1
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" 
		command = { type = secedeprovince which = SPA value = 959 } #Return Vigo
		command = { type = trigger which = 300003 }
	}
}

event = { 
	id = 300003 
	random = no
	country = SPA
	
	trigger = {
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0
	
	action_a = {
		name = "OK" 
		command = { type = convoy which = 959 value = 988 when = 17 } #Vigo-Sevilla: oil/supplies
		command = { type = convoy which = 959 value = 969 when = 17 } #Vigo-Barcelona: oil/supplies
				
	}
}

##############################################
##Nationalist Spain Supply Convoys to Northern and Eastern Parts of Iberia
##############################################

event = { 
	id = 300021 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 1 month = september year = 1936 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300051 }
		}
}

event = { 
	id = 300022 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 20 month = september year = 1936 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300052 }
		}
}

event = { 
	id = 300023 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 1 month = october year = 1936 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300051 }
		}
}

event = { 
	id = 300024 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 20 month = october year = 1936 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300052 }
		}
}

event = { 
	id = 300025 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 1 month = november year = 1936 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300051 }
		}
}

event = { 
	id = 300026 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 20 month = november year = 1936 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300052 }
		}
}

event = { 
	id = 300027 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 1 month = december year = 1936 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300051 }
		}
}

event = { 
	id = 300028 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 20 month = december year = 1936 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300052 }
		}
}

event = { 
	id = 300029 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 1 month = january year = 1937 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300051 }
		}
}

event = { 
	id = 300030 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 20 month = january year = 1937 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300052 }
		}
}

event = { 
	id = 300031 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 1 month = february year = 1937 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300051 }
		}
}

event = { 
	id = 300032 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 20 month = february year = 1937 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300052 }
		}
}

event = { 
	id = 300033 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 1 month = march year = 1937 }
	offset = 7
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300051 }
		}
}

event = { 
	id = 300034 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 20 month = march year = 1937 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300052 }
		}
}

event = { 
	id = 300035 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 1 month = april year = 1937 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300051 }
		}
}

event = { 
	id = 300036 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 20 month = april year = 1937 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300052 }
		}
}

event = { 
	id = 300037 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 1 month = may year = 1937 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300051 }
		}
}

event = { 
	id = 300038 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 20 month = may year = 1937 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300052 }
		}
}

event = { 
	id = 300039
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 1 month = june year = 1937 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300051 }
		}
}

event = { 
	id = 300040 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 20 month = june year = 1937 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300052 }
		}
}

event = { 
	id = 300041
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes	
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 1 month = july year = 1937 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300051 }
		}
}

event = { 
	id = 300042 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 20 month = july year = 1937 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300052 }
		}
}

event = { 
	id = 300043
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 1 month = august year = 1937 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300051 }
		}
}
event = { 
	id = 300044 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 20 month = august year = 1937 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300052 }
		}
}

event = { 
	id = 300045
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 1 month = september year = 1937 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300051 }
		}
}

event = { 
	id = 300046
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 20 month = september year = 1937 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300052 }
		}
}

event = { 
	id = 300047
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 1 month = october year = 1937 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300051 }
		}
}

event = { 
	id = 300048 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 20 month = october year = 1937 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300052 }
		}
}

event = { 
	id = 300049
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 1 month = november year = 1937 }
	offset = 7
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300051 }
		}
}

event = { 
	id = 300050 
	random = no
	country = SPA

	trigger = {
		exists = SPR
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	date = { day = 20 month = november year = 1937 }
	offset = 3
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "OK" # Great!
		command = { type = trigger which = 300052 }
		}
}

event = { 
	id = 300051 
	random = no
	country = SPA
	persistent = yes
	
	name = AI_EVENT
	desc = ""
	style = 0

	action_a = {
		name = "OK" # Great!
		command = { type = capital which = 957} #Burgos	
		command = { type = setflag which = Burgos_Capital }
		command = { type = convoy which = 959  value = 988 when = 17 } #Vigo-Sevilla
		command = { type = convoy which = 959  value = 969 when = 17 } #Vigo-Barcelona		
		}
}

event = { 
	id = 300052 
	random = no
	country = SPA
	persistent = yes
	
	name = AI_EVENT
	desc = ""
	style = 0

	action_a = {
		name = "OK" # Great!
		command = { type = capital which = 1009} #Ceuta
		command = { type = clrflag which = Burgos_Capital }
		command = { type = convoy which = 1009  value = 988 when = 30 } #Ceuta-Sevilla steel/coal/rubber
		command = { type = convoy which = 1009  value = 959 when = 30 } #Ceuta-Vigo
		command = { type = convoy which = 1009  value = 969 when = 17 } #Ceuta-Barcelona
		command = { type = convoy which = 1009  value = 956 when = 17 } #Ceuta-Gijon
		command = { type = convoy which = 1009  value = 954 when = 17 } #Ceuta-Bilbao
		
		}
}

event = { 
	id = 300053 #Triggered by SPA802101
	random = no
	country = SPA
	
	trigger = {
		ai = yes
	}

	name = AI_EVENT
	desc = ""
	style = 0

	action_a = {
		name = "OK" # Great!
		command = { type = sleepevent which = 300021  } 
		command = { type = sleepevent which = 300022  }
		command = { type = sleepevent which = 300023  } 
		command = { type = sleepevent which = 300024  }
		command = { type = sleepevent which = 300025  } 
		command = { type = sleepevent which = 300026  }
		command = { type = sleepevent which = 300027  } 
		command = { type = sleepevent which = 300028  }
		command = { type = sleepevent which = 300029  } 
		command = { type = sleepevent which = 300030  }
		command = { type = sleepevent which = 300031  } 
		command = { type = sleepevent which = 300032  }
		command = { type = sleepevent which = 300033  } 
		command = { type = sleepevent which = 300034  }
		command = { type = sleepevent which = 300035  } 
		command = { type = sleepevent which = 300036  }
		command = { type = sleepevent which = 300037  } 
		command = { type = sleepevent which = 300038  }
		command = { type = sleepevent which = 300039  } 
		command = { type = sleepevent which = 300040  }
		command = { type = sleepevent which = 300041  } 
		command = { type = sleepevent which = 300042  }
		command = { type = sleepevent which = 300043  } 
		command = { type = sleepevent which = 300044  }
		command = { type = sleepevent which = 300045  } 
		command = { type = sleepevent which = 300046  }
		command = { type = sleepevent which = 300047  } 
		command = { type = sleepevent which = 300048  }
		command = { type = sleepevent which = 300049  } 
		command = { type = sleepevent which = 300050  }
		command = { type = sleepevent which = 300051  } 
		command = { type = sleepevent which = 300052  }
	}
}