dofile("Scripts/mission.lua");
dofile("Scripts/msl.lua");

function PostCreate()
	mission_lua.BasicMissionInitialize()
	AIparts:AddPeriodic("s1", 100, func_s1, 0 + RandomHalf(100))
	AIparts:AddPeriodic("s2", 100, func_s2, 0 + RandomHalf(100))
	AIparts:AddPeriodic("s3", 100, func_s3, 0 + RandomHalf(100))
	AIparts:AddPeriodic("s4", 100, func_s4, 0 + RandomHalf(100))
	AIparts:AddPeriodic("s5", 100, func_s5, 0 + RandomHalf(100))
	AIparts:AddPeriodic("s6", 100, func_s6, 0 + RandomHalf(100))
	AIparts:AddPeriodic("s7", 100, func_s7, 0 + RandomHalf(100))
	AIparts:AddPeriodic("s8", 100, func_s8, 0 + RandomHalf(100))
	AIparts:AddPeriodic("s9", 100, func_s9, 0 + RandomHalf(100))
	AIparts:AddPeriodic("s10", 100, func_s10, 0 + RandomHalf(100))
	AIparts:AddPeriodic("s11", 100, func_s11, 0 + RandomHalf(100))
	AIparts:AddPeriodic("s12", 100, func_s12, 0 + RandomHalf(100))
	AIparts:AddPeriodic("s13", 100, func_s13, 0 + RandomHalf(100))
	AIparts:AddPeriodic("s14", 100, func_s14, 0 + RandomHalf(100))
	AIparts:AddPeriodic("s15", 100, func_s15, 0 + RandomHalf(100))
	AIparts:AddPeriodic("s16", 100, func_s16, 0 + RandomHalf(100))
	AIparts:AddPeriodic("s17", 100, func_s17, 0 + RandomHalf(100))
	AIparts:AddPeriodic("s18", 100, func_s18, 0 + RandomHalf(100))
	AIparts:AddPeriodic("s19", 100, func_s19, 0 + RandomHalf(100))
	AIparts:AddPeriodic("s20", 100, func_s20, 0 + RandomHalf(100))
	AIparts:AddPeriodic("Flieger Start", 10, func_Flieger_Start, 0 + RandomHalf(10))
	AIparts:AddPeriodic("Start", 1, func_Start, 0 + RandomHalf(1))
	AIparts:AddPeriodic("Zentrum", 100, func_Zentrum, 0 + RandomHalf(100))
	AIparts:AddPeriodic("Zentrum erobert", 100, func_Zentrum_erobert, 0 + RandomHalf(100))
	AIparts:AddPeriodic("Niederlage", 100, func_Niederlage, 0 + RandomHalf(100))
	AIparts:AddPeriodic("3Armee", 100, func_3Armee, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Stadt unter Kontrolle", 100, func_Stadt_unter_Kontrolle, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("f1", 100, func_f1, 0 + RandomHalf(100))
	AIparts:AddPeriodic("f2", 100, func_f2, 0 + RandomHalf(100))
	AIparts:AddPeriodic("f4", 100, func_f4, 0 + RandomHalf(100))
	AIparts:AddPeriodic("f5", 100, func_f5, 0 + RandomHalf(100))
	AIparts:AddPeriodic("f3", 10, func_f3, 0 + RandomHalf(10))
	AIparts:AddPeriodic("f6", 100, func_f6, 0 + RandomHalf(100))
	AIparts:AddPeriodic("f7", 100, func_f7, 0 + RandomHalf(100))
	AIparts:AddPeriodic("f8", 100, func_f8, 0 + RandomHalf(100))
	AIparts:AddPeriodic("f9", 100, func_f9, 0 + RandomHalf(100))
	AIparts:AddPeriodic("f10", 100, func_f10, 0 + RandomHalf(100))
	AIparts:AddPeriodic("Fallis Zentrum", 100, func_Fallis_Zentrum, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Angriff Zentrum", 100, func_Angriff_Zentrum, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Spieler Sieg", 100, func_Spieler_Sieg, 2000 + RandomHalf(100))
	AIparts:AddPeriodic("Spieler Niederlage Zentrum", 100, func_Spieler_Niederlage_Zentrum, 2000 + RandomHalf(100))
	AIparts:AddPeriodic("Industrie1", 100, func_Industrie1, 100 + RandomHalf(100))
	AIparts:AddPeriodic("Industrie2", 100, func_Industrie2, 500 + RandomHalf(100))
	AIparts:AddPeriodic("Dorf1", 100, func_Dorf1, 100 + RandomHalf(100))
	AIparts:AddPeriodic("Dorf2", 100, func_Dorf2, 100 + RandomHalf(100))
	AIparts:AddPeriodic("Verst", 100, func_Verst, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Sound", 20000, func_Sound, 3000 + RandomHalf(100))
	msd_vars = {
		armee = false,
		bedingung = false,
		Verst = false,
		Zentrum = false,
		Zentrum1 = false,
	}
end

function func_s1()
	if NumPlayerUnitsInZone("Player", "s01") > 0 then
		RunSpawn("Enemy", {"Stadtteil1", }, "Spawn_00", "s01", "", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  MoveGroupToZone("s01", "s01", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  MoveGroupToZone("s01", "s01", false, false) end)
		AIparts:RemovePeriodic("s1")
	end
end

function func_s2()
	if NumPlayerUnitsInZone("Player", "s02") > 0 then
		RunSpawn("Enemy", {"Stadtteil2", }, "Spawn_00", "s02", "", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  MoveGroupToZone("s02", "s02", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  MoveGroupToZone("s02", "s02", false, false) end)
		AIparts:RemovePeriodic("s2")
	end
end

function func_s3()
	if NumPlayerUnitsInZone("Player", "s03") > 0 then
		RunSpawn("Enemy", {"Stadtteil1", }, "Spawn_00", "s03", "", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  MoveGroupToZone("s03", "s03", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  MoveGroupToZone("s03", "s03", false, false) end)
		AIparts:RemovePeriodic("s3")
	end
end

function func_s4()
	if NumPlayerUnitsInZone("Player", "s04") > 0 then
		RunSpawn("Enemy", {"Stadtteil2", }, "Spawn_00", "s04", "", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  MoveGroupToZone("s04", "s04", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  MoveGroupToZone("s04", "s04", false, false) end)
		AIparts:RemovePeriodic("s4")
	end
end

function func_s5()
	if NumPlayerUnitsInZone("Player", "s05") > 0 then
		RunSpawn("Enemy", {"Stadtteil1", }, "Spawn_00", "s05", "", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  MoveGroupToZone("s05", "s05", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  MoveGroupToZone("s05", "s05", false, false) end)
		AIparts:RemovePeriodic("s5")
	end
end

function func_s6()
	if NumPlayerUnitsInZone("Player", "s06") > 0 then
		RunSpawn("Enemy", {"Stadtteil2", }, "Spawn_00", "s06", "", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  MoveGroupToZone("s06", "s06", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  MoveGroupToZone("s06", "s06", false, false) end)
		AIparts:RemovePeriodic("s6")
	end
end

function func_s7()
	if NumPlayerUnitsInZone("Player", "s07") > 0 then
		RunSpawn("Enemy", {"Stadtteil1", }, "Spawn_00", "s07", "", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  MoveGroupToZone("s07", "s07", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  MoveGroupToZone("s07", "s07", false, false) end)
		AIparts:RemovePeriodic("s7")
	end
end

function func_s8()
	if NumPlayerUnitsInZone("Player", "s08") > 0 then
		RunSpawn("Enemy", {"Stadtteil2", }, "Spawn_00", "s08", "", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  MoveGroupToZone("s08", "s08", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  MoveGroupToZone("s08", "s08", false, false) end)
		AIparts:RemovePeriodic("s8")
	end
end

function func_s9()
	if NumPlayerUnitsInZone("Player", "s09") > 0 then
		RunSpawn("Enemy", {"Stadtteil1", }, "Spawn_00", "s09", "", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  MoveGroupToZone("s09", "s09", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  MoveGroupToZone("s09", "s09", false, false) end)
		AIparts:RemovePeriodic("s9")
	end
end

function func_s10()
	if NumPlayerUnitsInZone("Player", "s10") > 0 then
		RunSpawn("Enemy", {"Stadtteil2", }, "Spawn_00", "s10", "", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  MoveGroupToZone("s10", "s10", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  MoveGroupToZone("s10", "s10", false, false) end)
		AIparts:RemovePeriodic("s10")
	end
end

function func_s11()
	if NumPlayerUnitsInZone("Player", "s11") > 0 then
		RunSpawn("Enemy", {"Stadtteil1", }, "Spawn_00", "s11", "", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  MoveGroupToZone("s11", "s11", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  MoveGroupToZone("s11", "s11", false, false) end)
		AIparts:RemovePeriodic("s11")
	end
end

function func_s12()
	if NumPlayerUnitsInZone("Player", "s12") > 0 then
		RunSpawn("Enemy", {"Stadtteil2", }, "Spawn_00", "s12", "", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  MoveGroupToZone("s12", "s12", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  MoveGroupToZone("s12", "s12", false, false) end)
		AIparts:RemovePeriodic("s12")
	end
end

function func_s13()
	if NumPlayerUnitsInZone("Player", "s13") > 0 then
		RunSpawn("Enemy", {"Stadtteil1", }, "Spawn_00", "s13", "", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  MoveGroupToZone("s13", "s13", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  MoveGroupToZone("s13", "s13", false, false) end)
		AIparts:RemovePeriodic("s13")
	end
end

function func_s14()
	if NumPlayerUnitsInZone("Player", "s14") > 0 then
		RunSpawn("Enemy", {"Stadtteil2", }, "Spawn_00", "s14", "", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  MoveGroupToZone("s14", "s14", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  MoveGroupToZone("s14", "s14", false, false) end)
		AIparts:RemovePeriodic("s14")
	end
end

function func_s15()
	if NumPlayerUnitsInZone("Player", "s15") > 0 then
		RunSpawn("Enemy", {"Stadtteil1", }, "Spawn_00", "s15", "", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  MoveGroupToZone("s15", "s15", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  MoveGroupToZone("s15", "s15", false, false) end)
		AIparts:RemovePeriodic("s15")
	end
end

function func_s16()
	if NumPlayerUnitsInZone("Player", "s16") > 0 then
		RunSpawn("Enemy", {"Stadtteil2", }, "Spawn_00", "s16", "", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  MoveGroupToZone("s16", "s16", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  MoveGroupToZone("s16", "s16", false, false) end)
		AIparts:RemovePeriodic("s16")
	end
end

function func_s17()
	if NumPlayerUnitsInZone("Player", "s17") > 0 then
		RunSpawn("Enemy", {"Stadtteil1", }, "Spawn_00", "s17", "", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  MoveGroupToZone("s17", "s17", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  MoveGroupToZone("s17", "s17", false, false) end)
		AIparts:RemovePeriodic("s17")
	end
end

function func_s18()
	if NumPlayerUnitsInZone("Player", "s18") > 0 then
		RunSpawn("Enemy", {"Stadtteil2", }, "Spawn_00", "s18", "", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  MoveGroupToZone("s18", "s18", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  MoveGroupToZone("s18", "s18", false, false) end)
		AIparts:RemovePeriodic("s18")
	end
end

function func_s19()
	if NumPlayerUnitsInZone("Player", "s19") > 0 then
		RunSpawn("Enemy", {"Stadtteil1", }, "Spawn_00", "s19", "", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  MoveGroupToZone("s19", "s19", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  MoveGroupToZone("s19", "s19", false, false) end)
		AIparts:RemovePeriodic("s19")
	end
end

function func_s20()
	if NumPlayerUnitsInZone("Player", "s20") > 0 then
		RunSpawn("Enemy", {"Stadtteil2", }, "Spawn_00", "s20", "", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  MoveGroupToZone("s20", "s20", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  MoveGroupToZone("s20", "s20", false, false) end)
		AIparts:RemovePeriodic("s20")
	end
end

function func_Flieger_Start()
	if NumPlayerUnitsInZone("Player", "Flieger_Start") > 0 then
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 10*10, function()  SendPlane("Enemy", "ari1", "strike_fighter", "W", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 20*10, function()  SendPlane("Enemy", "ari2", "strike_fighter", "W", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "ari3", "strike_fighter", "W", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 40*10, function()  SendPlane("Enemy", "ari4", "strike_fighter", "W", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 50*10, function()  SendPlane("Enemy", "ari5", "strike_fighter", "W", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  SendPlane("Enemy", "ari6", "strike_fighter", "W", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 80*10, function()  Bombardment("ari1", 1, 2, 100, 30) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 90*10, function()  Bombardment("ari2", 1, 2, 100, 30) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 100*10, function()  Bombardment("ari3", 1, 2, 100, 30) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 110*10, function()  Bombardment("ari4", 1, 2, 100, 30) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 120*10, function()  Bombardment("ari5", 1, 2, 100, 30) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 130*10, function()  Bombardment("ari6", 1, 2, 100, 30) end)
		RunSpawn("Enemy", {"Stadt1", }, "Spawn_01", "Stadt1", "", true, true, {}, false, 60)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 300*10, function()  UnloadTransports("Stadt1") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 150*10, function()  RunSpawn("Player", {"Verstaerkung1", }, "Spawn_00", "", "", true, true, {}, false, 50) end)
		AIparts:RemovePeriodic("Flieger Start")
		mission.OutScreenMessage(100011, 20, "0xFFFFFF00")
	end
end

function func_Start()
	do
		mission.OutScreenMessage(100012, 30, "0xFFFFFF00")
		MoveGroupToZone("Start_M", "Start_M", false, false)
		MoveGroupToZone("Start_N", "Start_N", false, false)
		MoveGroupToZone("Start_S", "Start_S", false, false)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 5*10, function()  mission.OutScreenMessage(100004, 30, "0xFFFFFF00") end)
		mission.CameraLock(true)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 20*10, function()  mission.CameraAt({922.566040, 24.717684, 28.981136}, 30.000000, 90.000000, 55.827686, 10.00) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  mission.CameraLock(false) end)
		SetPlaneSide(1, "E")
		AIparts:RemovePeriodic("Start")
	end
end

function func_Zentrum()
	if NumPlayerUnitsInZone("Player", "Zentrum") > 0 then
		SendPlane("Enemy", "zen1", "transport", "NW", 15, 4, "Zentrum")
		SendPlane("Enemy", "zen4", "transport", "SW", 15, 4, "Zentrum")
		SendPlane("Enemy", "zen2", "transport", "NW", 15, 0, "Zentrum")
		SendPlane("Enemy", "zen3", "transport", "SW", 15, 0, "Zentrum")
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 180*10, function()  MoveGroupToZone("Zentrum", "Zentrum", true, false) end)
		RunSpawn("Player", {"Verstaerkung2", }, "Spawn_00", "", "", true, true, {}, false, 50)
		AIparts:RemovePeriodic("Zentrum")
	end
end

function func_Zentrum_erobert()
	if NumPlayerUnitsInZone("Player", "Zentrum") > 0 and NumPlayerUnitsInZone("Enemy", "Zentrum") < 2 then
		SendPlane("Enemy", "z1", "strike_fighter", "SW", 5, -1, "")
		SendPlane("Enemy", "z2", "strike_fighter", "SW", 5, -1, "")
		SendPlane("Enemy", "z3", "strike_fighter", "NW", 5, -1, "")
		SendPlane("Enemy", "z4", "strike_fighter", "NW", 5, -1, "")
		RunSpawn("Player", {"Verstaerkung3", }, "Spawn_00", "", "", true, true, {}, false, 50)
		AddBonus(1, 1, 3, -1, -1)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 300*10, function()  msd_vars.armee = true end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 20*10, function()  mission.OutScreenMessage(100006, 20, "0xFFFFFF00") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 100*10, function()  SendPlane("Enemy", "z1", "transport", "W", 15, 3, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 150*10, function()  SendPlane("Enemy", "z2", "transport", "W", 15, 3, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 200*10, function()  SendPlane("Enemy", "z3", "transport", "W", 15, 3, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 250*10, function()  SendPlane("Enemy", "z4", "transport", "W", 15, 3, "") end)
		AIparts:RemovePeriodic("Zentrum erobert")
	end
end

function func_Niederlage()
	if NumPlayerUnits("Player") < 10 then
		mission.OutScreenMessage(100005, 20, "0xFFFFFF00")
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  PlayerDefeat("Player") end)
		AIparts:RemovePeriodic("Niederlage")
	end
end

function func_3Armee()
	if msd_vars.armee then
		mission.OutScreenMessage(100002, 20, "0xFFFFFF00")
		RunSpawn("Enemy", {"3Armee", }, "Spawn_02", "3Armee", "3Armee", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 300*10, function()  MoveGroupToZone("3Armee", "Stadt", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 600*10, function()  MoveGroupToZone("3Armee", "Zentrum", true, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 660*10, function()  UnloadTransports("3Armee") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 700*10, function()  MoveGroupToZone("3Armee", "Zentrum", true, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 600*10, function()  msd_vars.bedingung = true end)
		AIparts:RemovePeriodic("3Armee")
	end
end

function func_Stadt_unter_Kontrolle()
	if NumPlayerUnitsInZones("Enemy", {"Zentrum", "Stadt", "s01", "s02", "s03", "s04", "s05", "s06", "s07", "s08", "s09", "s10", "s11", "s12", "s13", "s14", "s15", "s16", "s17", "s18", }) < 10 and msd_vars.bedingung then
		mission.OutScreenMessage(100003, 20, "0xFFFFFF00")
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 200*10, function()  msd_vars.Zentrum = true end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  DisableObjective("Start") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 50*10, function()  AcivateObjective("Zentrum") end)
		RunSpawn("Enemy", {"Zentrum_Franz", }, "Spawn_03", "Zentrum", "Zentrum", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 80*10, function()  SendPlane("Enemy", "zen1", "bomber", "W", 50, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 100*10, function()  SendPlane("Enemy", "zen4", "bomber", "W", 50, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 120*10, function()  SendPlane("Enemy", "zen3", "bomber", "W", 50, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 140*10, function()  SendPlane("Enemy", "zen2", "bomber", "W", 50, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 90*10, function()  SendPlane("Enemy", "z1", "strike_fighter", "NW", 50, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 110*10, function()  SendPlane("Enemy", "z2", "strike_fighter", "NW", 50, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 130*10, function()  SendPlane("Enemy", "z3", "strike_fighter", "SW", 50, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 150*10, function()  SendPlane("Enemy", "z4", "strike_fighter", "SW", 50, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  RunSpawn("Player", {"Verstaerkung4", }, "Spawn_01", "", "", true, true, {}, false, 50) end)
		AIparts:RemovePeriodic("Stadt unter Kontrolle")
	end
end

function func_f1()
	if NumPlayerUnitsInZone("Player", "f1") > 1 then
		SendPlane("Enemy", "f1", "scout", "W", 5, -1, "")
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "f1", "strike_fighter", "NW", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "f1", "strike_fighter", "SW", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  SendPlane("Enemy", "f1", "transport", "W", 15, 0, "") end)
		AIparts:RemovePeriodic("f1")
	end
end

function func_f2()
	if NumPlayerUnitsInZone("Player", "f2") > 1 then
		SendPlane("Enemy", "f2", "scout", "W", 5, -1, "")
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "f2", "strike_fighter", "NW", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "f2", "strike_fighter", "SW", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  SendPlane("Enemy", "f2", "transport", "W", 15, 0, "") end)
		AIparts:RemovePeriodic("f2")
	end
end

function func_f4()
	if NumPlayerUnitsInZone("Player", "f4") > 1 then
		SendPlane("Enemy", "f4", "scout", "W", 5, -1, "")
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "f4", "strike_fighter", "NW", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "f4", "strike_fighter", "SW", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  SendPlane("Enemy", "f4", "transport", "W", 15, 0, "") end)
		AIparts:RemovePeriodic("f4")
	end
end

function func_f5()
	if NumPlayerUnitsInZone("Player", "f5") > 1 then
		SendPlane("Enemy", "f5", "scout", "W", 5, -1, "")
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "f5", "strike_fighter", "NW", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "f5", "strike_fighter", "SW", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  SendPlane("Enemy", "f5", "transport", "W", 15, 0, "") end)
		AIparts:RemovePeriodic("f5")
	end
end

function func_f3()
	
end

function func_f6()
	if NumPlayerUnitsInZone("Player", "f6") > 1 then
		SendPlane("Enemy", "f6", "scout", "W", 5, -1, "")
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "f6", "strike_fighter", "NW", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "f6", "strike_fighter", "SW", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  SendPlane("Enemy", "f6", "transport", "W", 15, 0, "") end)
		AIparts:RemovePeriodic("f6")
	end
end

function func_f7()
	if NumPlayerUnitsInZone("Player", "f7") > 1 then
		SendPlane("Enemy", "f7", "scout", "W", 5, -1, "")
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "f7", "strike_fighter", "NW", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "f7", "strike_fighter", "SW", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  SendPlane("Enemy", "f7", "transport", "W", 15, 0, "") end)
		AIparts:RemovePeriodic("f7")
	end
end

function func_f8()
	if NumPlayerUnitsInZone("Player", "f8") > 1 then
		SendPlane("Enemy", "f8", "scout", "W", 5, -1, "")
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "f8", "strike_fighter", "NW", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "f8", "strike_fighter", "SW", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  SendPlane("Enemy", "f8", "transport", "W", 15, 0, "") end)
		AIparts:RemovePeriodic("f8")
	end
end

function func_f9()
	if NumPlayerUnitsInZone("Player", "f9") > 1 then
		SendPlane("Enemy", "f9", "scout", "W", 5, -1, "")
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "f9", "strike_fighter", "NW", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "f9", "strike_fighter", "SW", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  SendPlane("Enemy", "f9", "transport", "W", 15, 0, "") end)
		AIparts:RemovePeriodic("f9")
	end
end

function func_f10()
	if NumPlayerUnitsInZone("Player", "f10") > 1 then
		SendPlane("Enemy", "f10", "scout", "W", 5, -1, "")
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "f10", "strike_fighter", "NW", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "f10", "strike_fighter", "SW", 5, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  SendPlane("Enemy", "f10", "transport", "W", 15, 0, "") end)
		AIparts:RemovePeriodic("f10")
	end
end

function func_Fallis_Zentrum()
	if msd_vars.Zentrum then
		MoveGroupToZone("Zentrum", "Zentrum", true, false)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 10*10, function()  SendPlane("Enemy", "f1", "strike_fighter", "W", 15, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "f2", "strike_fighter", "NW", 15, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 50*10, function()  SendPlane("Enemy", "f3", "strike_fighter", "SW", 15, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 70*10, function()  SendPlane("Enemy", "f6", "strike_fighter", "W", 15, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 90*10, function()  SendPlane("Enemy", "f7", "strike_fighter", "NW", 15, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 110*10, function()  SendPlane("Enemy", "f8", "strike_fighter", "SW", 15, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 130*10, function()  SendPlane("Enemy", "f9", "strike_fighter", "W", 15, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 10*10, function()  SendPlane("Enemy", "f10", "bomber", "W", 15, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 20*10, function()  SendPlane("Enemy", "f1", "transport", "W", 15, 4, "Zentrum") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 20*10, function()  SendPlane("Enemy", "f1", "transport", "W", 15, 4, "Zentrum") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 40*10, function()  SendPlane("Enemy", "f2", "transport", "W", 15, 4, "Zentrum") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  SendPlane("Enemy", "f3", "transport", "W", 15, 4, "Zentrum") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 80*10, function()  SendPlane("Enemy", "f6", "transport", "W", 15, 4, "Zentrum") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 100*10, function()  SendPlane("Enemy", "f7", "transport", "W", 15, 4, "Zentrum") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 120*10, function()  SendPlane("Enemy", "f8", "transport", "W", 15, 4, "Zentrum") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 140*10, function()  SendPlane("Enemy", "f9", "transport", "W", 15, 4, "Zentrum") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  SendPlane("Enemy", "f10", "transport", "W", 15, 4, "Zentrum") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  SendPlane("Enemy", "f4", "transport", "W", 15, 4, "Zentrum") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  SendPlane("Enemy", "f5", "transport", "W", 15, 4, "Zentrum") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 180*10, function()  msd_vars.Zentrum1 = true end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 260*10, function()  SendPlane("Enemy", "i3", "transport", "W", 15, 4, "Zentrum") end)
		AIparts:RemovePeriodic("Fallis Zentrum")
	end
end

function func_Angriff_Zentrum()
	if msd_vars.Zentrum1 then
		MoveGroupToZone("Zentrum", "Zentrum", false, false)
		DisableObjective("Zentrum")
		AcivateObjective("Zentrum1")
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 10*10, function()  ProceedObjective("Zentrum1", "Player") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 180*10, function()  MoveGroupToZone("Zentrum", "Zentrum", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 180*10, function()  SendPlane("Enemy", "f1", "transport", "W", 15, 4, "Zentrum") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 200*10, function()  SendPlane("Enemy", "f2", "transport", "W", 15, 4, "Zentrum") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 220*10, function()  SendPlane("Enemy", "f3", "transport", "W", 15, 4, "Zentrum") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 240*10, function()  SendPlane("Enemy", "f4", "transport", "W", 15, 4, "Zentrum") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 260*10, function()  SendPlane("Enemy", "f5", "transport", "W", 15, 4, "Zentrum") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 360*10, function()  MoveGroupToZone("Zentrum", "Zentrum", false, false) end)
		AIparts:RemovePeriodic("Angriff Zentrum")
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 10*10, function()  SendPlane("Enemy", "i1", "bomber", "W", 15, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 20*10, function()  SendPlane("Enemy", "i4", "bomber", "W", 15, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "i2", "bomber", "W", 15, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 800*10, function()  msd_vars.Verst = true end)
	end
end

function func_Spieler_Sieg()
	if IsObjectiveCompleted("Zentrum1", "Player") and NumPlayerUnitsInZone("Enemy", "Zentrum") < 2 then
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 5*10, function()  mission.OutScreenMessage(100009, 20, "0xFFFFFF00") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 25*10, function()  PlayerWin("Player") end)
		AIparts:RemovePeriodic("Spieler Sieg")
	end
end

function func_Spieler_Niederlage_Zentrum()
	if IsObjectiveCompleted("Zentrum1", "Player") and NumPlayerUnitsInZone("Enemy", "Zentrum") > 1 then
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 5*10, function()  mission.OutScreenMessage(100010, 20, "0xFFFFFF00") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 5*10, function()  FailObjective("Zentrum1") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  PlayerDefeat("Player") end)
		AIparts:RemovePeriodic("Spieler Niederlage Zentrum")
	end
end

function func_Industrie1()
	if NumPlayerUnitsInZone("Player", "Industrie") > 2 then
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 10*10, function()  SendPlane("Enemy", "i1", "transport", "NW", 15, 4, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "i2", "transport", "NW", 15, 4, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  SendPlane("Enemy", "i3", "transport", "NW", 15, 4, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 90*10, function()  SendPlane("Enemy", "i4", "transport", "NW", 15, 4, "") end)
		SendPlane("Enemy", "i3", "scout", "W", 15, -1, "")
		AIparts:RemovePeriodic("Industrie1")
	end
end

function func_Industrie2()
	if NumPlayerUnitsInZone("Enemy", "Industrie") < 2 then
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 10*10, function()  SendPlane("Enemy", "i1", "transport", "NW", 15, 4, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "i2", "transport", "NW", 15, 4, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  SendPlane("Enemy", "i3", "transport", "NW", 15, 4, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 90*10, function()  SendPlane("Enemy", "i4", "transport", "NW", 15, 4, "") end)
		SendPlane("Enemy", "i3", "scout", "W", 15, -1, "")
		AIparts:RemovePeriodic("Industrie2")
	end
end

function func_Dorf1()
	if NumPlayerUnitsInZone("Player", "Dorf1") > 4 then
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 5*10, function()  SendPlane("Enemy", "Dorf1", "scout", "W", 15, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "Dorf1", "transport", "W", 15, 0, "Zentrum") end)
		AIparts:RemovePeriodic("Dorf1")
	end
end

function func_Dorf2()
	if NumPlayerUnitsInZone("Player", "Dorf2") > 4 then
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 5*10, function()  SendPlane("Enemy", "Dorf2", "scout", "W", 15, -1, "") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  SendPlane("Enemy", "Dorf2", "transport", "W", 15, 0, "Zentrum") end)
		AIparts:RemovePeriodic("Dorf2")
	end
end

function func_Verst()
	if msd_vars.Verst then
		RunSpawn("Friend", {"Verst", }, "Spawn_00", "", "", true, true, {}, false, 0)
		AIparts:RemovePeriodic("Verst")
	end
end

function func_Sound()
	do
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 1*10, function()  mission.OutScreenMessage(100013, 30, "0xFFFFFF00") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 999*10, function()  mission.OutScreenMessage(100014, 30, "0xFFFFFF00") end)
	end
end

