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

function PostCreate()
	mission_lua.BasicMissionInitialize()
	AIparts:AddOneTime("Start", 5, func_Start)
	AIparts:AddPeriodic("Pass1", 100, func_Pass1, 0 + RandomHalf(100))
	AIparts:AddPeriodic("Pass2", 100, func_Pass2, 0 + RandomHalf(100))
	AIparts:AddPeriodic("Player an Pass1", 100, func_Player_an_Pass1, 0 + RandomHalf(100))
	AIparts:AddPeriodic("Player an Pass2", 100, func_Player_an_Pass2, 0 + RandomHalf(100))
	AIparts:AddPeriodic("Pass komplett", 100, func_Pass_komplett, 0 + RandomHalf(100))
	AIparts:AddPeriodic("Spieler im Lager", 100, func_Spieler_im_Lager, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Lager erobert", 100, func_Lager_erobert, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Spieler vor Kreuzung", 100, func_Spieler_vor_Kreuzung, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Kreuzung1 erobert", 100, func_Kreuzung1_erobert, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Spieler in Kreuzung1", 100, func_Spieler_in_Kreuzung1, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Ari_Stellung", 100, func_Ari_Stellung, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Ari_Beschuss", 100, func_Ari_Beschuss, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Ari_Auftrag", 100, func_Ari_Auftrag, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Ari_Beschuss_Ost", 100, func_Ari_Beschuss_Ost, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Spieler in Kreuzung2", 100, func_Spieler_in_Kreuzung2, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Kreuzung2 erobert", 100, func_Kreuzung2_erobert, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Spieler in Kreuzung3", 100, func_Spieler_in_Kreuzung3, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Kreuzung3 erobert", 100, func_Kreuzung3_erobert, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Ueberfall1", 100, func_Ueberfall1, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Ueberfall2", 100, func_Ueberfall2, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Ueberfall3", 100, func_Ueberfall3, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Ueberfall4", 100, func_Ueberfall4, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Ueberfall5", 100, func_Ueberfall5, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Hoehe1", 100, func_Hoehe1, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Hoehe2", 100, func_Hoehe2, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Nachschub_Kreuzung", 100, func_Nachschub_Kreuzung, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Spieler in Malmedy", 100, func_Spieler_in_Malmedy, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Spieler in Waimes", 100, func_Spieler_in_Waimes, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Malmedy erobert", 100, func_Malmedy_erobert, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Waimes erobert", 100, func_Waimes_erobert, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Spieler gewinnt", 100, func_Spieler_gewinnt, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Spieler verliert", 100, func_Spieler_verliert, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Nachschub Dorf", 100, func_Nachschub_Dorf, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Auftrag Dorf", 100, func_Auftrag_Dorf, 2000 + RandomHalf(100))
	AIparts:AddPeriodic("Spieler grösser 15 in Malmedy", 100, func_Spieler_gr_sser_15_in_Malmedy, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Spieler grösser 10 in Waimes", 100, func_Spieler_gr_sser_10_in_Waimes, 1000 + RandomHalf(100))
	AIparts:AddPeriodic("Sound", 20000, func_Sound, 600 + RandomHalf(100))
	msd_vars = {
		Ari_aktiv = true,
		Ari_Counter = 0,
		Dorf_Counter = 0,
		Kreuzung_Counter = 0,
		Versorgungslager = false,
	}
end

function func_Start()
	do
		DisableObjective("Start")
		mission.CameraAt({163.266220, 2.852671, -937.968872}, 39.183083, 167.881195, 86.294701, 0.00)
		mission.CameraLock(true)
		RunSpawn("Player", {"Start_Player", }, "Spawn_02", "", "", true, true, {}, false, 0)
		RunSpawn("Enemy", {"Inf_Pass", }, "Spawn_00", "Inf_PassA", "", true, true, {}, false, 20)
		RunSpawn("Enemy", {"Inf_Pass", }, "Spawn_00", "Inf_PassB", "", true, true, {}, false, 20)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 5*10, function()  mission.CameraAt({163.266205, 2.852668, -937.968750}, 59.999996, -164.610031, 60.459217, 10.00) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 20*10, function()  mission.OutScreenMessage(100005, 20, "0xFFE0E0E0") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 45*10, function()  mission.CameraAt({175.916901, 3.916440, -931.816711}, 30.000000, 90.000000, 114.966736, 10.00) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 50*10, function()  mission.CameraLock(false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  AcivateObjective("Pass1") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  AcivateObjective("Pass2") end)
	end
end

function func_Pass1()
	if NumPlayerUnitsInZone("Enemy", "Pass1") < 3 then
		ProceedObjective("Pass1", "Player")
		MoveGroupToZone("Inf_PassA", "Pass1", false, false)
		RunSpawn("Player", {"Panther", }, "Spawn_00", "", "", true, true, {}, false, 10)
		AIparts:RemovePeriodic("Pass1")
	end
end

function func_Pass2()
	if NumPlayerUnitsInZone("Enemy", "Pass2") < 3 then
		ProceedObjective("Pass2", "Player")
		MoveGroupToZone("Inf_PassB", "Pass2", false, false)
		RunSpawn("Player", {"Panther", }, "Spawn_01", "", "", true, true, {}, false, 10)
		AIparts:RemovePeriodic("Pass2")
	end
end

function func_Player_an_Pass1()
	if NumPlayerUnitsInZone("Player", "Pass1") > 3 then
		RunSpawn("Player", {"Panther", }, "Spawn_00", "", "", true, true, {}, false, 10)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 180*10, function()  MoveGroupToZone("Inf_PassA", "Pass1", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 190*10, function()  RunSpawn("Enemy", {"Inf_Pass", }, "Spawn_00", "Inf_PassA", "", true, true, {}, false, 20) end)
		AIparts:RemovePeriodic("Player an Pass1")
	end
end

function func_Player_an_Pass2()
	if NumPlayerUnitsInZone("Player", "Pass2") > 3 then
		RunSpawn("Player", {"Panther", }, "Spawn_01", "", "", true, true, {}, false, 10)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 180*10, function()  MoveGroupToZone("Inf_PassB", "Pass2", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 190*10, function()  RunSpawn("Enemy", {"Inf_Pass", }, "Spawn_00", "Inf_PassB", "", true, true, {}, false, 20) end)
		AIparts:RemovePeriodic("Player an Pass2")
	end
end

function func_Pass_komplett()
	if IsObjectiveCompleted("Pass1", "Player") and IsObjectiveCompleted("Pass2", "Player") then
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 20*10, function()  mission.OutScreenMessage(100006, 20, "0xFFE0E0E0") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 20*10, function()  AcivateObjective("Versorgungslager") end)
		AIparts:RemovePeriodic("Pass komplett")
	end
end

function func_Spieler_im_Lager()
	if NumPlayerUnitsInZone("Player", "Versorgungslager") > 1 then
		RunSpawn("Player", {"Mech+Gun", }, "Spawn_03", "", "", true, true, {}, false, 0)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  RunSpawn("Enemy", {"Inf_Pass", }, "Spawn_01", "", "", true, true, {}, false, 20) end)
		AIparts:RemovePeriodic("Spieler im Lager")
	end
end

function func_Lager_erobert()
	if NumPlayerUnitsInZone("Enemy", "Versorgungslager") < 2 then
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 10*10, function()  ProceedObjective("Versorgungslager", "Player") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 80*10, function()  msd_vars.Versorgungslager = true end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 100*10, function()  mission.OutScreenMessage(100012, 20, "0xFFE0E0E0") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 100*10, function()  AcivateObjective("Kreuzung 1") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 100*10, function()  MoveGroupToZone("Angriff_Lager", "Versorgungslager", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 180*10, function()  RunSpawn("Player", {"6 x LKW", }, "Spawn_02", "", "", true, true, {}, false, 10) end)
		AIparts:RemovePeriodic("Lager erobert")
	end
end

function func_Spieler_vor_Kreuzung()
	if msd_vars.Versorgungslager and NumPlayerUnitsInZone("Player", "Vor_Kreuzung1") > 0 then
		RunSpawn("Player", {"Verstärkung_Ost1", }, "Spawn_04", "", "", true, true, {}, false, 10)
		Bombardment("Vor_Kreuzung1", 50, 15, 20, 500)
		AIparts:RemovePeriodic("Spieler vor Kreuzung")
	end
end

function func_Kreuzung1_erobert()
	if NumPlayerUnitsInZone("Enemy", "Kreuzung1") < 2 and IsObjectiveActive("Kreuzung 1") then
		ProceedObjective("Kreuzung 1", "Player")
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  mission.OutScreenMessage(100013, 20, "0xFFE0E0E0") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  AcivateObjective("Kreuzung 2") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 70*10, function()  AcivateObjective("Kreuzung 3") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  RunSpawn("Enemy", {"Kreuzung", }, "Spawn_02", "Kreuzung", "", true, true, {}, false, 20) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 240*10, function()  MoveGroupToZone("Kreuzung", "Kreuzung1", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 240*10, function()  RunSpawn("Player", {"Verstärkung_Süd1", }, "Spawn_05", "", "", true, true, {}, false, 20) end)
		AIparts:RemovePeriodic("Kreuzung1 erobert")
	end
end

function func_Spieler_in_Kreuzung1()
	if NumPlayerUnitsInZone("Player", "Kreuzung1") > 4 and msd_vars.Versorgungslager then
		MoveGroupToZone("Kreuzung", "Vor_Kreuzung2", false, false)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 300*10, function()  MoveGroupToZone("Kreuzung2", "Vor_Kreuzung2", false, false) end)
		AIparts:RemovePeriodic("Spieler in Kreuzung1")
	end
end

function func_Ari_Stellung()
	if NumPlayerUnitsInZone("Enemy", "Ari") < 2 then
		msd_vars.Ari_aktiv = false
		SetObjectiveComplete("Ari", "Player")
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  mission.OutScreenMessage(100017, 20, "0xFFE0E0E0") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  AddBonus(1, 3, 3, -1, -1) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  MoveGroupToZone("Kreuzung1", "Kreuzung1", false, false) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 120*10, function()  RunSpawn("Player", {"Verstärkung_Ost2", }, "Spawn_06", "", "", true, true, {}, false, 30) end)
		AIparts:RemovePeriodic("Ari_Stellung")
	end
end

function func_Ari_Beschuss()
	if not msd_vars.Ari_aktiv then
		AIparts:RemovePeriodic("Ari_Beschuss")
	end
	if msd_vars.Ari_aktiv and NumPlayerUnitsInZone("Player", "Beschuss_West") > 0 then
		Bombardment("Beschuss1", 60, 10, 6, 10)
		Bombardment("Beschuss1", 60, 10, 6, 50)
		Bombardment("Beschuss1", 60, 10, 6, 90)
		Bombardment("Beschuss1", 60, 10, 6, 130)
		msd_vars.Ari_Counter = msd_vars.Ari_Counter + 1
	end
end

function func_Ari_Auftrag()
	if msd_vars.Ari_Counter > 2 and msd_vars.Ari_aktiv then
		mission.OutScreenMessage(100016, 20, "0xFFE0E0E0")
		AcivateObjective("Ari")
		AIparts:RemovePeriodic("Ari_Auftrag")
	end
end

function func_Ari_Beschuss_Ost()
	if not msd_vars.Ari_aktiv then
		AIparts:RemovePeriodic("Ari_Beschuss_Ost")
	end
	if msd_vars.Ari_aktiv and NumPlayerUnitsInZone("Player", "Beschuss_Ost") > 0 then
		Bombardment("Beschuss5", 60, 10, 6, 10)
		AIparts:RemovePeriodic("Ari_Beschuss_Ost")
	end
end

function func_Spieler_in_Kreuzung2()
	if NumPlayerUnitsInZone("Player", "Kreuzung2") > 2 and msd_vars.Versorgungslager then
		RunSpawn("Enemy", {"Kreuzung", }, "Spawn_03", "", "", true, true, {}, false, 50)
		AIparts:RemovePeriodic("Spieler in Kreuzung2")
	end
end

function func_Kreuzung2_erobert()
	if NumPlayerUnitsInZone("Enemy", "Kreuzung2") < 2 and IsObjectiveActive("Kreuzung 2") then
		ProceedObjective("Kreuzung 2", "Player")
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  mission.OutScreenMessage(100018, 20, "0xFFE0E0E0") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  RunSpawn("Enemy", {"Kreuzung", }, "Spawn_04", "", "", true, true, {}, false, 40) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 600*10, function()  RunSpawn("Enemy", {"Hellcat", }, "Spawn_05", "", "", true, true, {}, false, 60) end)
		msd_vars.Kreuzung_Counter = msd_vars.Kreuzung_Counter + 1
		AIparts:RemovePeriodic("Kreuzung2 erobert")
	end
end

function func_Spieler_in_Kreuzung3()
	if NumPlayerUnitsInZone("Player", "Kreuzung3") > 0 and msd_vars.Versorgungslager then
		RunSpawn("Enemy", {"Kreuzung", }, "Spawn_06", "", "", true, true, {}, false, 50)
		AIparts:RemovePeriodic("Spieler in Kreuzung3")
	end
end

function func_Kreuzung3_erobert()
	if NumPlayerUnitsInZone("Enemy", "Kreuzung3") < 2 and IsObjectiveActive("Kreuzung 3") then
		ProceedObjective("Kreuzung 3", "Player")
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  mission.OutScreenMessage(100018, 20, "0xFFE0E0E0") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 160*10, function()  RunSpawn("Enemy", {"Kreuzung", }, "Spawn_07", "", "", true, true, {}, false, 40) end)
		msd_vars.Kreuzung_Counter = msd_vars.Kreuzung_Counter + 1
		AIparts:RemovePeriodic("Kreuzung3 erobert")
	end
end

function func_Ueberfall1()
	if NumPlayerUnitsInZone("Player", "Ueberfall1") > 1 then
		MoveGroupToZone("Ueberfall1", "Ueberfall1", true, false)
		AIparts:RemovePeriodic("Ueberfall1")
	end
end

function func_Ueberfall2()
	if NumPlayerUnitsInZone("Player", "Ueberfall2") > 1 then
		MoveGroupToZone("Ueberfall2", "Ueberfall2", true, false)
		AIparts:RemovePeriodic("Ueberfall2")
	end
end

function func_Ueberfall3()
	if NumPlayerUnitsInZone("Player", "Ueberfall3") > 1 then
		MoveGroupToZone("Ueberfall3", "Ueberfall3", true, false)
		AIparts:RemovePeriodic("Ueberfall3")
	end
end

function func_Ueberfall4()
	if NumPlayerUnitsInZone("Player", "Ueberfall4") > 1 then
		MoveGroupToZone("Ueberfall4", "Ueberfall4", true, false)
		RunSpawn("Enemy", {"Hellcat", }, "Spawn_06", "", "", true, true, {}, false, 50)
		AIparts:RemovePeriodic("Ueberfall4")
	end
end

function func_Ueberfall5()
	if NumPlayerUnitsInZone("Player", "Ueberfall5") > 3 then
		MoveGroupToZone("Ueberfall5", "Ueberfall5", true, false)
		RunSpawn("Enemy", {"Hellcat", }, "Spawn_04", "", "", true, true, {}, false, 50)
		AIparts:RemovePeriodic("Ueberfall5")
	end
end

function func_Hoehe1()
	if NumPlayerUnitsInZone("Player", "Ausloeser_Hoehe1") > 1 then
		MoveGroupToZone("Pass1", "Hoehe1", false, false)
		AIparts:RemovePeriodic("Hoehe1")
	end
end

function func_Hoehe2()
	if NumPlayerUnitsInZone("Player", "Ausloeser_Hoehe2") > 1 then
		MoveGroupToZone("Pass2", "Hoehe2", false, false)
		AIparts:RemovePeriodic("Hoehe2")
	end
end

function func_Nachschub_Kreuzung()
	if msd_vars.Kreuzung_Counter > 0 then
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 240*10, function()  RunSpawn("Player", {"Verstärkung_Süd2", }, "Spawn_07", "", "", true, true, {}, false, 20) end)
		AIparts:RemovePeriodic("Nachschub_Kreuzung")
	end
end

function func_Spieler_in_Malmedy()
	if NumPlayerUnitsInZone("Player", "Malmedy") > 0 and IsObjectiveActive("Malmedy") then
		RunSpawn("Enemy", {"Panzer_Dorf", }, "Spawn_08", "", "", true, true, {}, false, 50)
		RunSpawn("Enemy", {"Infanterie_Dorf", }, "Spawn_09", "", "", true, true, {}, false, 100)
		RunSpawn("Enemy", {"Inf_Pass", }, "Spawn_06", "", "", true, true, {}, false, 100)
		AIparts:RemovePeriodic("Spieler in Malmedy")
	end
end

function func_Spieler_in_Waimes()
	if NumPlayerUnitsInZone("Player", "Waimes") > 0 and IsObjectiveActive("Waimes") then
		RunSpawn("Enemy", {"Panzer_Dorf", }, "Spawn_10", "", "", true, true, {}, false, 50)
		RunSpawn("Enemy", {"Infanterie_Dorf", }, "Spawn_11", "", "", true, true, {}, false, 100)
		RunSpawn("Enemy", {"Inf_Pass", }, "Spawn_07", "", "", true, true, {}, false, 100)
		AIparts:RemovePeriodic("Spieler in Waimes")
	end
end

function func_Malmedy_erobert()
	if NumPlayerUnitsInZone("Enemy", "Malmedy") < 3 then
		ProceedObjective("Malmedy", "Player")
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  mission.OutScreenMessage(100026, 20, "0xFFE0E0E0") end)
		msd_vars.Dorf_Counter = msd_vars.Dorf_Counter + 1
		AIparts:RemovePeriodic("Malmedy erobert")
	end
end

function func_Waimes_erobert()
	if NumPlayerUnitsInZone("Enemy", "Waimes") < 3 then
		ProceedObjective("Waimes", "Player")
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  mission.OutScreenMessage(100027, 20, "0xFFE0E0E0") end)
		msd_vars.Dorf_Counter = msd_vars.Dorf_Counter + 1
		AIparts:RemovePeriodic("Waimes erobert")
	end
end

function func_Spieler_gewinnt()
	if IsObjectiveCompleted("Malmedy", "Player") and IsObjectiveCompleted("Waimes", "Player") then
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  mission.OutScreenMessage(100028, 20, "0xFFE0E0E0") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  PlayerWin("Player") end)
		AIparts:RemovePeriodic("Spieler gewinnt")
	end
end

function func_Spieler_verliert()
	if NumPlayerUnits("Player") < 15 then
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 1*10, function()  mission.OutScreenMessage(100029, 20, "0xFFE0E0E0") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 30*10, function()  PlayerDefeat("Player") end)
		AIparts:RemovePeriodic("Spieler verliert")
	end
end

function func_Nachschub_Dorf()
	if msd_vars.Dorf_Counter > 0 then
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  RunSpawn("Player", {"Verstärkung_Süd1", }, "Spawn_05", "", "", true, true, {}, false, 20) end)
		AIparts:RemovePeriodic("Nachschub Dorf")
	end
end

function func_Auftrag_Dorf()
	if IsObjectiveCompleted("Kreuzung 1", "Player") and IsObjectiveCompleted("Kreuzung 2", "Player") and IsObjectiveCompleted("Kreuzung 3", "Player") then
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  mission.OutScreenMessage(100025, 20, "0xFFE0E0E0") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  AcivateObjective("Waimes") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 60*10, function()  AcivateObjective("Malmedy") end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 180*10, function()  RunSpawn("Player", {"Sturm_Dorf", }, "Spawn_08", "", "", true, true, {}, false, 40) end)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 300*10, function()  RunSpawn("Player", {"Sturm_Dorf", }, "Spawn_09", "", "", true, true, {}, false, 40) end)
		AIparts:RemovePeriodic("Auftrag Dorf")
	end
end

function func_Spieler_gr_sser_15_in_Malmedy()
	if NumPlayerUnitsInZone("Player", "Malmedy") > 15 then
		RunSpawn("Enemy", {"Panzer_Malmedy", }, "Spawn_09", "", "", true, true, {}, false, 30)
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 180*10, function()  MoveGroupToZone("Ueberfall_Malmedy", "Malmedy", false, false) end)
		AIparts:RemovePeriodic("Spieler grösser 15 in Malmedy")
	end
end

function func_Spieler_gr_sser_10_in_Waimes()
	if NumPlayerUnitsInZone("Player", "Waimes") > 10 then
		AIparts:AddOneTime(AIparts:GetUniqueId("TIMER_DO_"), 180*10, function()  MoveGroupToZone("Ueberfall_Waimes", "Waimes", true, false) end)
		AIparts:RemovePeriodic("Spieler grösser 10 in Waimes")
	end
end

function func_Sound()
	do
		mission.OutScreenMessage(100030, 20, "0xFFE0E0E0")
	end
end

