
AllieunitsConditions = function()
	AllieInfDelayTimemin = 2
	AllieInfDelayTimemax = 3
	AllieInfUnit = { "e1", "e1" }
	AllieInfantryIncome()
	Trigger.AfterDelay(DateTime.Seconds(15), function()
		AllieInfUnit = { "e1", "e1", "e1", "e3" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(1), function()
		AllieInfUnit = { "e1", "e1", "e1", "e3", "e3", "medi" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(2), function()
		AllieVehDelayTimemin = 7
		AllieVehDelayTimemax = 10

		AllieVehUnit = { "1tnk", "jeep" }
		AllieVehicleIncome()
	end)
	Trigger.AfterDelay(DateTime.Minutes(3), function()
		AllieInfDelayTimemin = 1


		AllieVehDelayTimemin = 6
	end)
	Trigger.AfterDelay(DateTime.Minutes(4), function()
		AllieVehDelayTimemin = 5
		AllieVehUnit = { "1tnk", "1tnk", "jeep" }
		AllieTnkDelayTimemin = 12
		AllieTnkDelayTimemax = 14
		AllieTnkUnit = { "2tnk", "2tnk" }
		AllieTnkIncome()
	end)
	Trigger.AfterDelay(DateTime.Minutes(5), function()
		AllieInfUnit = { "e1", "e1", "e1", "e3", "e3", "medi", "mech" }
		AllieHeliDelayTimemin = 12
		AllieHeliDelayTimemax = 14
		AllieHeliUnit = { "mh60", "mh60" }
		AllieArtyDelayTimemin = 15
		AllieArtyDelayTimemax = 17
		AllieArtyUnit = { "arty", "arty" }
		AllieArtyIncome()
		AllieHeliIncome()
	end)
	Trigger.AfterDelay(DateTime.Minutes(6), function()

		AllieHeliUnit = { "heli", "mh60", "mh60" }
		AllieTnkUnit = { "2tnk", "2tnk", "ctnk", "2tnk" }
		AllieTnkDelayTimemin = 10
		AllieArtyDelayTimemin = 14
	end)
	Trigger.AfterDelay(DateTime.Minutes(7), function()
		AllieArtyDelayTimemin = 13


	end)
	Trigger.AfterDelay(DateTime.Minutes(8), function()
		AllieHeliUnit = { "heli", "mh60" }
		AllieTnkUnit = { "2tnk", "2tnk", "ctnk", "2tnk", "2tnk", "2tnk" }

	end)
	Trigger.AfterDelay(DateTime.Minutes(9), function()
		AllieVehUnit = { "1tnk", "1tnk", "1tnk", "jeep" }
		AllieVehDelayTimemin = 4
	end)
	Trigger.AfterDelay(DateTime.Minutes(10), function()
		AllieTnkDelayTimemin = 7
		AllieArtyDelayTimemin = 12
		AllieHeliUnit = { "heli", "heli", "heli", "mh60", "mh60" }
		AllieTnkUnit = { "2tnk", "2tnk", "ctnk", "ctnk", "2tnk", "2tnk" }
	end)
end


SovietunitsConditions = function()
	SovietInfDelayTimemin = 1
	SovietInfDelayTimemax = 3
	SovietInfUnit = { "dog", "dog" }
	SovietInfantryIncome()
	Trigger.AfterDelay(DateTime.Seconds(15), function()
		SovietInfDelayTimemin = 2
		SovietInfUnit = { "e1", "dog", "dog", "dog" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(1), function()
		SovietInfUnit = { "e1", "e1", "e2", "e3", "dog", "dog" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(2), function()
		SovietVehDelayTimemin = 7
		SovietVehDelayTimemax = 10
		SovietInfUnit = { "e1", "e1", "e1", "e1", "e2", "e3", "e4", "dog" }
		SovietVehUnit = { "apc", "ftrk" }
		SovietVehicleIncome()
	end)
	Trigger.AfterDelay(DateTime.Minutes(3), function()
		SovietInfDelayTimemin = 1

		SovietVehDelayTimemin = 6
	end)
	Trigger.AfterDelay(DateTime.Minutes(4), function()
		SovietInfUnit = { "e1", "e1", "e1", "e2", "e3", "e4", "dog" }
		SovietVehDelayTimemin = 5

		SovietTnkDelayTimemin = 12
		SovietTnkDelayTimemax = 14
		SovietTnkUnit = { "3tnk", "3tnk" }
		SovietTnkIncome()
	end)
	Trigger.AfterDelay(DateTime.Minutes(5), function()
		SovietVehUnit = { "apc", "ftrk", "ftrk" }
		SovietHeliDelayTimemin = 12
		SovietHeliDelayTimemax = 14
		SovietHeliUnit = { "yak", "yak" }
		SovietArtyDelayTimemin = 15
		SovietArtyDelayTimemax = 17
		SovietArtyUnit = { "v2rl", "arty" }
		SovietArtyIncome()
		SovietHeliIncome()
	end)
	Trigger.AfterDelay(DateTime.Minutes(6), function()
		SovietInfUnit = { "e1", "e1", "shok", "e2", "e3", "e4", "dog" }

		SovietTnkUnit = { "3tnk", "3tnk", "3tnk", "ttnk", "4tnk" }
		SovietTnkDelayTimemin = 10
		SovietArtyDelayTimemin = 14
	end)
	Trigger.AfterDelay(DateTime.Minutes(7), function()
		SovietArtyDelayTimemin = 13
		SovietHeliUnit = { "yak", "yak", "yak", "mig" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(8), function()
		SovietTnkUnit = { "3tnk", "3tnk", "ttnk", "4tnk" }
		SovietVehUnit = { "apc", "ftrk", "ftrk", "ftrk" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(9), function()
		SovietInfUnit = { "e1", "shok", "e2", "e3", "e4", "dog" }
		SovietHeliUnit = { "yak", "yak", "mig" }
		SovietVehDelayTimemin = 4
	end)
	Trigger.AfterDelay(DateTime.Minutes(10), function()
		SovietTnkDelayTimemin = 7
		SovietArtyDelayTimemin = 12
		SovietTnkUnit = { "3tnk", "ttnk", "4tnk" }
	end)
end


GdiunitsConditions = function()
	GdiInfDelayTimemin = 2
	GdiInfDelayTimemax = 3
	GdiInfUnit = { "e1cnc", "e2cnc" }
	GdiInfantryIncome()
	Trigger.AfterDelay(DateTime.Seconds(15), function()
		GdiInfUnit = { "e1cnc", "e1cnc", "e1cnc", "e2cnc", "e3cnc" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(1), function()
		GdiInfUnit = { "e1cnc", "e1cnc", "e2cnc", "e3cnc" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(2), function()
		GdiVehDelayTimemin = 7
		GdiVehDelayTimemax = 10

		GdiVehUnit = { "humv", "humv", "humv", "apccnc" }
		GdiVehicleIncome()
	end)
	Trigger.AfterDelay(DateTime.Minutes(3), function()
		GdiInfDelayTimemin = 1
		GdiInfUnit = { "e1cnc", "e2cnc", "e3cnc" }
		GdiVehUnit = { "humv", "humv", "apccnc" }
		GdiVehDelayTimemin = 6
	end)
	Trigger.AfterDelay(DateTime.Minutes(4), function()
		GdiVehDelayTimemin = 5
		GdiVehUnit = { "humv", "apccnc" }
		GdiTnkDelayTimemin = 12
		GdiTnkDelayTimemax = 14
		GdiTnkUnit = { "mtnk", "mtnk" }
		GdiTnkIncome()
	end)
	Trigger.AfterDelay(DateTime.Minutes(5), function()
		GdiInfUnit = { "e1cnc", "e2cnc", "e3cnc", "e1cnc", "e2cnc", "e3cnc", "rmbo" }
		GdiVehUnit = { "humv", "apccnc", "apccnc" }
		GdiHeliDelayTimemin = 12
		GdiHeliDelayTimemax = 14
		GdiHeliUnit = { "orca", "orca" }
		GdiArtyDelayTimemin = 15
		GdiArtyDelayTimemax = 17
		GdiArtyUnit = { "msam", "msam" }
		GdiArtyIncome()
		GdiHeliIncome()
	end)
	Trigger.AfterDelay(DateTime.Minutes(6), function()
		GdiInfUnit = { "e1cnc", "e2cnc", "e3cnc", "e2cnc", "e3cnc", "rmbo" }

		GdiTnkUnit = { "mtnk", "mtnk", "mtnk", "htnk" }
		GdiTnkDelayTimemin = 10
		GdiArtyDelayTimemin = 14
	end)
	Trigger.AfterDelay(DateTime.Minutes(7), function()
		GdiArtyDelayTimemin = 13
		GdiInfUnit = { "e1cnc", "e2cnc", "e3cnc", "e3cnc", "rmbo" }
		GdiTnkUnit = { "mtnk", "mtnk", "htnk" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(8), function()
		GdiInfUnit = { "e1cnc", "e2cnc", "e3cnc", "rmbo" }
		GdiTnkUnit = { "mtnk", "htnk" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(9), function()
		GdiVehUnit = { "humv", "apccnc", "apccnc", "apccnc" }
		GdiVehDelayTimemin = 4
		GdiTnkUnit = { "mtnk", "htnk", "htnk" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(10), function()
		GdiTnkDelayTimemin = 7
		GdiArtyDelayTimemin = 12
		GdiInfUnit = { "e1cnc", "e2cnc", "e3cnc", "rmbo", "rmbo" }

		GdiTnkUnit = { "mtnk", "htnk", "htnk", "htnk" }
	end)
end

NodunitsConditions = function()
	NodInfDelayTimemin = 2
	NodInfDelayTimemax = 3
	NodInfUnit = { "e1cnc", "e4cnc" }
	NodInfantryIncome()
	Trigger.AfterDelay(DateTime.Seconds(15), function()
		NodInfUnit = { "e1cnc", "e1cnc", "e1cnc", "e1cnc", "e3cnc", "e4cnc" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(1), function()
		NodInfUnit = { "e1cnc", "e1cnc", "e1cnc", "e3cnc", "e4cnc" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(2), function()
		NodVehDelayTimemin = 7
		NodVehDelayTimemax = 10

		NodVehUnit = { "bike", "bggy" }
		NodVehicleIncome()
	end)
	Trigger.AfterDelay(DateTime.Minutes(3), function()
		NodInfDelayTimemin = 1
		NodInfUnit = { "e1cnc", "e1cnc", "e3cnc", "e4cnc" }
		NodVehUnit = { "bike", "bggy", "ftnkcnc" }
		NodVehDelayTimemin = 6
	end)
	Trigger.AfterDelay(DateTime.Minutes(4), function()
		NodVehDelayTimemin = 5
		NodInfUnit = { "e1cnc", "e3cnc", "e4cnc" }

		NodTnkDelayTimemin = 12
		NodTnkDelayTimemax = 14
		NodTnkUnit = { "ltnk", "ltnk" }
		NodTnkIncome()
	end)
	Trigger.AfterDelay(DateTime.Minutes(5), function()
		NodInfUnit = { "e1cnc", "e1cnc", "e3cnc", "e3cnc", "e4cnc", "e5cnc" }
		NodVehUnit = { "bike", "bggy", "ftnkcnc", "mlrs" }
		NodHeliDelayTimemin = 12
		NodHeliDelayTimemax = 14
		NodHeliUnit = { "apache", "apache" }
		NodArtyDelayTimemin = 15
		NodArtyDelayTimemax = 17
		NodArtyUnit = { "artycnc", "artycnc" }
		NodArtyIncome()
		NodHeliIncome()
	end)
	Trigger.AfterDelay(DateTime.Minutes(6), function()
		NodInfUnit = { "e1cnc", "e3cnc", "e3cnc", "e4cnc", "e5cnc" }

		NodTnkUnit = { "ltnk", "ltnk", "stnkcnc" }
		NodTnkDelayTimemin = 10
		NodArtyDelayTimemin = 14
	end)
	Trigger.AfterDelay(DateTime.Minutes(7), function()
		NodArtyDelayTimemin = 13
		NodInfUnit = { "e1cnc", "e3cnc", "e4cnc", "e5cnc" }
		NodTnkUnit = { "ltnk", "stnkcnc" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(8), function()
		NodInfUnit = { "e1cnc", "e3cnc", "e4cnc", "e4cnc", "e5cnc" }
		NodTnkUnit = { "ltnk", "stnkcnc", "stnkcnc" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(9), function()
		NodInfUnit = { "e1cnc", "e3cnc", "e4cnc", "e4cnc", "e5cnc", "e5cnc" }

		NodVehDelayTimemin = 4
	end)
	Trigger.AfterDelay(DateTime.Minutes(10), function()
		NodTnkDelayTimemin = 7
		NodTnkUnit = { "ltnk", "stnkcnc", "stnkcnc", "stnkcnc" }
		NodArtyDelayTimemin = 12

		
	end)
end

-- &&

SneakattackConditions = function()
	Trigger.AfterDelay(DateTime.Minutes(2), function()
		if SneakattackLevel == "unfair" then
			SpecialminTime = 20
			SpecialmaxTime = 50
			AnySpecialattack = { 1, 2, 3, 4 }
			SpecialAttack()
		end
	end)
	Trigger.AfterDelay(DateTime.Minutes(3), function()
		if SneakattackLevel == "unfair" then
			SpecialminTime = 15
			SpecialmaxTime = 45
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8 }
		end
	end)
	Trigger.AfterDelay(DateTime.Minutes(4), function()
		if SneakattackLevel == "unfair" then
			SpecialminTime = 15
			SpecialmaxTime = 45
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 6, 7, 8 }
		elseif SneakattackLevel == "heavy" then
			SpecialminTime = 45
			SpecialmaxTime = 55
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8 }
			SpecialAttack()
		end
	end)
	Trigger.AfterDelay(DateTime.Minutes(5), function()
		if SneakattackLevel == "unfair" then
			SpecialminTime = 10
			SpecialmaxTime = 40
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 6, 7, 8, 9, 10, 11 }
		elseif SneakattackLevel == "heavy" then
			SpecialminTime = 20
			SpecialmaxTime = 40
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 6, 7, 8 }
		elseif SneakattackLevel == "normal" then
			SpecialminTime = 35
			SpecialmaxTime = 55
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 6, 7, 8 }
			SpecialAttack()
		end
	end)
	Trigger.AfterDelay(DateTime.Minutes(6), function()
		if SneakattackLevel == "unfair" then
			SpecialmaxTime = 30
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 6, 7, 8, 9, 10, 11 }
		elseif SneakattackLevel == "heavy" then
			SpecialminTime = 15
			SpecialmaxTime = 35
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 6, 7, 8, 9, 10, 11 }
		elseif SneakattackLevel == "normal" then
			SpecialminTime = 30
			SpecialmaxTime = 50
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 6, 7, 8 }
		elseif SneakattackLevel == "low" then
			SpecialminTime = 45
			SpecialmaxTime = 55
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8 }
			SpecialAttack()
		end
	end)
	Trigger.AfterDelay(DateTime.Minutes(7), function()
		if SneakattackLevel == "unfair" then
			SpecialminTime = 8
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 6, 7, 8, 9, 10, 11, 6, 7, 8, 6, 7, 8, 9, 10, 11, 1, 2, 3, 4, 6, 7, 8, 6, 7, 8, 9, 10, 11, 5 }
		elseif SneakattackLevel == "heavy" then
			SpecialminTime = 12
			SpecialmaxTime = 32
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 6, 7, 8, 9, 10, 11 }
		elseif SneakattackLevel == "normal" then
			SpecialmaxTime = 45
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 6, 7, 8, 9, 10, 11 }
		elseif SneakattackLevel == "low" then
			SpecialminTime = 35
			SpecialmaxTime = 45
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8 }
		end
	end)
	Trigger.AfterDelay(DateTime.Minutes(8), function()
		if SneakattackLevel == "unfair" then
			SpecialmaxTime = 25
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 6, 7, 8, 9, 10, 11, 6, 7, 8, 6, 7, 8, 9, 10, 11, 1, 2, 3, 4, 6, 7, 8, 6, 7, 8, 9, 10, 11, 5 }
		elseif SneakattackLevel == "heavy" then
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 6, 7, 8, 9, 10, 11, 6, 7, 8, 6, 7, 8, 9, 10, 11, 1, 2, 3, 4, 6, 7, 8, 6, 7, 8, 9, 10, 11, 5 }
		elseif SneakattackLevel == "normal" then
			SpecialminTime = 25
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 6, 7, 8, 9, 10, 11 }
		elseif SneakattackLevel == "low" then
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11 }
		end
	end)
	Trigger.AfterDelay(DateTime.Minutes(9), function()
		if SneakattackLevel == "unfair" then
			SpecialmaxTime = 22
		elseif SneakattackLevel == "heavy" then
			SpecialminTime = 10
			SpecialmaxTime = 30
		elseif SneakattackLevel == "normal" then
			SpecialmaxTime = 40
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 6, 7, 8, 9, 10, 11 }
		elseif SneakattackLevel == "low" then
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11 }
		end
	end)
	Trigger.AfterDelay(DateTime.Minutes(10), function()
		if SneakattackLevel == "unfair" then
			SpecialmaxTime = 20
			AnySpecialattack = { 1, 2, 3, 6, 7, 8, 6, 7, 8, 9, 10, 11, 6, 7, 8, 6, 7, 8, 9, 10, 11, 6, 7, 8, 6, 7, 8, 9, 10, 11, 1, 2, 3, 4, 6, 7, 8, 6, 7, 8, 9, 10, 11, 5 }
		elseif SneakattackLevel == "heavy" then
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 6, 7, 8, 6, 7, 8, 9, 10, 11, 6, 7, 8, 6, 7, 8, 9, 10, 11, 6, 7, 8, 6, 7, 8, 9, 10, 11, 1, 2, 3, 4, 6, 7, 8, 6, 7, 8, 9, 10, 11, 5 }
		elseif SneakattackLevel == "normal" then
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 6, 7, 6, 7, 8, 6, 7, 8, 9, 10, 11 }
		elseif SneakattackLevel == "low" then
			AnySpecialattack = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 6, 7, 6, 7, 8, 9, 10, 11 }
		end
	end)
end

MonsterConditions = function()
	MonsterDelayTimemin = 5
	MonsterDelayTimemax = 7
	EnemyMonsterUnit = { "PVICE", "zombie" }
	EnemyMonsterIncome()
	Trigger.AfterDelay(DateTime.Minutes(1), function()
		MonsterDelayTimemin = 6
		EnemyMonsterUnit = { "PVICE", "BSPI", "zombie" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(2), function()
		MonsterDelayTimemin = 7
		EnemyMonsterUnit = { "PVICE", "IMP", "BSPI", "BSPI", "zombie" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(3), function()
		MonsterDelayTimemin = 8
		EnemyMonsterUnit = { "PVICE", "IMP", "IMP", "BSPI", "BSPI", "REVE", "zombie" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(4), function()
		MonsterDelayTimemin = 9
		EnemyMonsterUnit = { "PVICE", "IMP", "IMP", "BSPI", "BSPI", "REVE", "REVE", "zombie" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(5), function()

		EnemyMonsterUnit = { "PVICE", "IMP", "IMP", "BSPI", "BSPI", "REVE", "REVE" }
		CustomHeliDelayTimemin = 15
		CustomHeliDelayTimemax = 17
		EnemyCustomHeliUnit = { "lynx", "cobra", "huey" }
		EnemyCustomHeliIncome()
	end)
	Trigger.AfterDelay(DateTime.Minutes(6), function()

		EnemyMonsterUnit = { "PVICE", "IMP", "IMP", "IMP", "REVE", "REVE", "BSPI", "BSPI", "PINKY" }
		EnemyCustomHeliUnit = { "lynx", "cobra", "huey", "UFO.Beamer", "UFO.LASER" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(7), function()
		EnemyMonsterUnit = { "PVICE", "IMP", "IMP", "IMP", "REVE", "REVE", "BSPI", "BSPI", "PINKY", "MANC" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(8), function()
		EnemyCustomHeliUnit = { "lynx", "cobra", "huey", "UFO.Beamer", "UFO.LASER", "UFO" }

		CustomHeavyDelayTimemin = 25
		CustomHeavyDelayTimemax = 27
		EnemyCustomHeavyUnit = { "godzilla", "godzilla" }
		EnemyCustomHeavyIncome()
	end)
	Trigger.AfterDelay(DateTime.Minutes(9), function()
		EnemyMonsterUnit = { "IMP", "IMP", "IMP", "REVE", "REVE", "BSPI", "BSPI", "BSPI", "PINKY", "MANC" }
		EnemyCustomHeavyUnit = { "godzilla", "kingkong" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(10), function()
		EnemyCustomHeavyUnit = { "godzilla", "kingkong", "superman" }
		MonsterDelayTimemin = 8
	end)
end

AntConditions = function()
	AntDelayTimemin = 3
	AntDelayTimemax = 5
	EnemyAntUnit = { "ant", "scoutant" }
	EnemyAntIncome()
	Trigger.AfterDelay(DateTime.Minutes(1), function()
		EnemyAntUnit = { "ant", "scoutant", "warriorant" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(2), function()
		EnemyAntUnit = { "ant", "scoutant", "warriorant", "warriorant" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(3), function()
		AntDelayTimemin = 4
		BurningConditioner()
		EnemyAntUnit = { "ant", "scoutant", "warriorant", "fireant" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(4), function()
		AntDelayTimemin = 3
	end)
	Trigger.AfterDelay(DateTime.Minutes(5), function()
		AntDelayTimemin = 5
		EnemyAntUnit = { "ant", "scoutant", "warriorant", "fireant", "toxicant" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(6), function()
		EnemyAntUnit = { "ant", "scoutant", "warriorant", "fireant", "toxicant", "electricant" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(7), function()
		AntDelayTimemin = 4
		EnemyAntUnit = { "ant", "scoutant", "warriorant", "fireant", "toxicant", "electricant", "fireant", "toxicant", "electricant" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(8), function()
		AntDelayTimemin = 5
		EnemyAntUnit = { "ant", "scoutant", "warriorant", "fireant", "toxicant", "electricant", "fireant", "toxicant", "electricant", "lavaant" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(9), function()
		AntDelayTimemin = 4
		EnemyAntUnit = { "ant", "scoutant", "warriorant", "fireant", "toxicant", "electricant", "fireant", "toxicant", "electricant", "lavaant", "lavaant" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(10), function()
		AntDelayTimemin = 3
		EnemyAntUnit = { "ant", "scoutant", "warriorant", "fireant", "toxicant", "electricant", "fireant", "toxicant", "electricant", "lavaant", "lavaant", "lavaant" }
	end)
end

DinoConditions = function()
	DinoDelayTimemin = 5
	DinoDelayTimemax = 7
	EnemyDinoUnit = { "GALLIMUS", "GALLIMUS" }
	EnemyDinoIncome()
	Trigger.AfterDelay(DateTime.Minutes(1), function()
		DinoDelayTimemin = 7
		EnemyDinoUnit = { "GALLIMUS", "GALLIMUS", "GALLIMUS", "GALLIMUS", "PARAUSAR" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(2), function()
		DinoDelayTimemin = 6
	end)
	Trigger.AfterDelay(DateTime.Minutes(3), function()
		EnemyDinoUnit = { "GALLIMUS", "GALLIMUS", "GALLIMUS", "GALLIMUS", "PARAUSAR", "STEGOSAUR", "TRICERATOPS" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(4), function()
		EnemyDinoUnit = { "GALLIMUS", "GALLIMUS", "GALLIMUS", "PARAUSAR", "STEGOSAUR", "TRICERATOPS" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(5), function()
		DinoDelayTimemin = 8
		EnemyDinoUnit = { "GALLIMUS", "GALLIMUS", "GALLIMUS", "PARAUSAR", "STEGOSAUR", "TRICERATOPS", "ALLOSAURUS" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(6), function()
		EnemyDinoUnit = { "GALLIMUS", "GALLIMUS", "GALLIMUS", "PARAUSAR", "STEGOSAUR", "TRICERATOPS", "ALLOSAURUS", "TYREX" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(7), function()
		EnemyDinoUnit = { "GALLIMUS", "GALLIMUS", "PARAUSAR", "STEGOSAUR", "TRICERATOPS", "ALLOSAURUS", "TYREX" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(8), function()
		DinoDelayTimemin = 7
		EnemyDinoUnit = { "GALLIMUS", "GALLIMUS", "PARAUSAR", "STEGOSAUR", "TRICERATOPS", "ALLOSAURUS", "TYREX", "BRACHIOSAURUS" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(9), function()
		DinoDelayTimemin = 6
	end)
	Trigger.AfterDelay(DateTime.Minutes(10), function()
		DinoDelayTimemin = 6
		EnemyDinoUnit = { "GALLIMUS", "PARAUSAR", "STEGOSAUR", "TRICERATOPS", "ALLOSAURUS", "TYREX", "BRACHIOSAURUS" }
	end)
end


GeneralConditions = function()
	Light = 0
	StartMusic1()
	StartingMessages()
	Trigger.AfterDelay(DateTime.Minutes(1), function()
		EngyDelayTimemin = 45
		EngyDelayTimemax = 90
		EnemyEngyIncome()
	end)
	Trigger.AfterDelay(DateTime.Minutes(5), function()
		WriteStatisticsTeam1()
		WriteStatisticsTeam2()
		EngyDelayTimemin = 35
		EngyDelayTimemax = 80
	end)
	Trigger.AfterDelay(DateTime.Minutes(7), function()
		EngyDelayTimemin = 30
		EngyDelayTimemax = 60
	end)
	Trigger.AfterDelay(DateTime.Minutes(10), function()
		WriteStatisticsTeam1()
		WriteStatisticsTeam2()
		EngyDelayTimemin = 15
		EngyDelayTimemax = 30
	end)
end

AllieUnits = true
SovietUnits = true
GdiUnits = true
NodUnits = true
MonsterUnits = true
AntUnits = true
DinoUnits = true

UnitAmountCheck = function()
	AllieUnitsAmount()
	SovietUnitsAmount()
	GdiUnitsAmount()
	NodUnitsAmount()
	MonsterAmount()
	AntAmount()
	DinoAmount()
	GeneralConditions()
	Trigger.AfterDelay(1, function()
		if AllieUnits then
			Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(5, 15)), function()
				AllieunitsConditions()
				Trigger.AfterDelay(DateTime.Seconds(3), function()
					AllieWaveInterrupter()
				end)
			end)
		end
		if SovietUnits then
			Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(5, 15)), function()
				SovietunitsConditions()
				Trigger.AfterDelay(DateTime.Seconds(3), function()
					SovietWaveInterrupter()
				end)
			end)
		end
		if GdiUnits then
			Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(5, 15)), function()
				GdiunitsConditions()
				Trigger.AfterDelay(DateTime.Seconds(3), function()
					GdiWaveInterrupter()
				end)
			end)
		end
		if NodUnits then
			Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(5, 15)), function()
				NodunitsConditions()
				Trigger.AfterDelay(DateTime.Seconds(3), function()
					NodWaveInterrupter()
				end)
			end)
		end
		if MonsterUnits then
			Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(5, 15)), function()
				MonsterConditions()
				Trigger.AfterDelay(DateTime.Seconds(3), function()
					MonsterWaveInterrupter()
				end)
			end)
		end
		if AntUnits then
			Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(5, 15)), function()
				AntConditions()
				Trigger.AfterDelay(DateTime.Seconds(3), function()
					AntWaveInterrupter()
				end)
			end)
		end
		if DinoUnits then
			Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(5, 15)), function()
				DinoConditions()
				Trigger.AfterDelay(DateTime.Seconds(3), function()
					DinoWaveInterrupter()
				end)
			end)
		end
		if SneakattackLevel ~= "none" then
			SneakattackConditions()
		end
	end)
end

ChosenAllieAmount = Map.LobbyOption("allieamount")
ChosenSovietAmount = Map.LobbyOption("sovietamount")
ChosenGdiAmount = Map.LobbyOption("gdiamount")
ChosenNodAmount = Map.LobbyOption("nodamount")
ChosenMonsterAmount = Map.LobbyOption("monsteramount")
SneakattackLevel = Map.LobbyOption("sneaklevel")
ChosenAntAmount = Map.LobbyOption("antamount")
ChosenDinoAmount = Map.LobbyOption("dinoamount")

AllieUnitsAmount = function()
	if ChosenAllieAmount == "100%" then
		AllieWaveInterval = 0
	elseif ChosenAllieAmount == "90%" then
		AllieWaveInterval = 1
	elseif ChosenAllieAmount == "80%" then
		AllieWaveInterval = 2
	elseif ChosenAllieAmount == "70%" then
		AllieWaveInterval = 3
	elseif ChosenAllieAmount == "60%" then
		AllieWaveInterval = 4
	elseif ChosenAllieAmount == "50%" then
		AllieWaveInterval = 5
	elseif ChosenAllieAmount == "40%" then
		AllieWaveInterval = 6
	elseif ChosenAllieAmount == "30%" then
		AllieWaveInterval = 7
	elseif ChosenAllieAmount == "20%" then
		AllieWaveInterval = 8
	elseif ChosenAllieAmount == "10%" then
		AllieWaveInterval = 9
	elseif ChosenAllieAmount == "0" then
		AllieUnits = false
		AllieWaveInterval = 10
	end
	AllieUnitPercent = 10 - AllieWaveInterval
end

SovietUnitsAmount = function()
	if ChosenSovietAmount == "100%" then
		SovietWaveInterval = 0
	elseif ChosenSovietAmount == "90%" then
		SovietWaveInterval = 1
	elseif ChosenSovietAmount == "80%" then
		SovietWaveInterval = 2
	elseif ChosenSovietAmount == "70%" then
		SovietWaveInterval = 3
	elseif ChosenSovietAmount == "60%" then
		SovietWaveInterval = 4
	elseif ChosenSovietAmount == "50%" then
		SovietWaveInterval = 5
	elseif ChosenSovietAmount == "40%" then
		SovietWaveInterval = 6
	elseif ChosenSovietAmount == "30%" then
		SovietWaveInterval = 7
	elseif ChosenSovietAmount == "20%" then
		SovietWaveInterval = 8
	elseif ChosenSovietAmount == "10%" then
		SovietWaveInterval = 9
	elseif ChosenSovietAmount == "0" then
		SovietUnits = false
		SovietWaveInterval = 10
	end
	SovietUnitPercent = 10 - SovietWaveInterval
end

GdiUnitsAmount = function()
	if ChosenGdiAmount == "100%" then
		GdiWaveInterval = 0
	elseif ChosenGdiAmount == "90%" then
		GdiWaveInterval = 1
	elseif ChosenGdiAmount == "80%" then
		GdiWaveInterval = 2
	elseif ChosenGdiAmount == "70%" then
		GdiWaveInterval = 3
	elseif ChosenGdiAmount == "60%" then
		GdiWaveInterval = 4
	elseif ChosenGdiAmount == "50%" then
		GdiWaveInterval = 5
	elseif ChosenGdiAmount == "40%" then
		GdiWaveInterval = 6
	elseif ChosenGdiAmount == "30%" then
		GdiWaveInterval = 7
	elseif ChosenGdiAmount == "20%" then
		GdiWaveInterval = 8
	elseif ChosenGdiAmount == "10%" then
		GdiWaveInterval = 9
	elseif ChosenGdiAmount == "0" then
		GdiUnits = false
		GdiWaveInterval = 10
	end
	GdiUnitPercent = 10 - GdiWaveInterval
end

NodUnitsAmount = function()
	if ChosenNodAmount == "100%" then
		NodWaveInterval = 0
	elseif ChosenNodAmount == "90%" then
		NodWaveInterval = 1
	elseif ChosenNodAmount == "80%" then
		NodWaveInterval = 2
	elseif ChosenNodAmount == "70%" then
		NodWaveInterval = 3
	elseif ChosenNodAmount == "60%" then
		NodWaveInterval = 4
	elseif ChosenNodAmount == "50%" then
		NodWaveInterval = 5
	elseif ChosenNodAmount == "40%" then
		NodWaveInterval = 6
	elseif ChosenNodAmount == "30%" then
		NodWaveInterval = 7
	elseif ChosenNodAmount == "20%" then
		NodWaveInterval = 8
	elseif ChosenNodAmount == "10%" then
		NodWaveInterval = 9
	elseif ChosenNodAmount == "0" then
		NodUnits = false
		NodWaveInterval = 10
	end
	NodUnitPercent = 10 - NodWaveInterval
end

MonsterAmount = function()
	if ChosenMonsterAmount == "100%" then
		MonsterWaveInterval = 0
	elseif ChosenMonsterAmount == "90%" then
		MonsterWaveInterval = 1
	elseif ChosenMonsterAmount == "80%" then
		MonsterWaveInterval = 2
	elseif ChosenMonsterAmount == "70%" then
		MonsterWaveInterval = 3
	elseif ChosenMonsterAmount == "60%" then
		MonsterWaveInterval = 4
	elseif ChosenMonsterAmount == "50%" then
		MonsterWaveInterval = 5
	elseif ChosenMonsterAmount == "40%" then
		MonsterWaveInterval = 6
	elseif ChosenMonsterAmount == "30%" then
		MonsterWaveInterval = 7
	elseif ChosenMonsterAmount == "20%" then
		MonsterWaveInterval = 8
	elseif ChosenMonsterAmount == "10%" then
		MonsterWaveInterval = 9
	elseif ChosenMonsterAmount == "0" then
		MonsterUnits = false
		MonsterWaveInterval = 10
	end
	MonsterUnitPercent = 10 - MonsterWaveInterval
end
AntAmount = function()
	if ChosenAntAmount == "100%" then
		AntWaveInterval = 0
	elseif ChosenAntAmount == "90%" then
		AntWaveInterval = 1
	elseif ChosenAntAmount == "80%" then
		AntWaveInterval = 2
	elseif ChosenAntAmount == "70%" then
		AntWaveInterval = 3
	elseif ChosenAntAmount == "60%" then
		AntWaveInterval = 4
	elseif ChosenAntAmount == "50%" then
		AntWaveInterval = 5
	elseif ChosenAntAmount == "40%" then
		AntWaveInterval = 6
	elseif ChosenAntAmount == "30%" then
		AntWaveInterval = 7
	elseif ChosenAntAmount == "20%" then
		AntWaveInterval = 8
	elseif ChosenAntAmount == "10%" then
		AntWaveInterval = 9
	elseif ChosenAntAmount == "0" then
		AntUnits = false
		AntWaveInterval = 10
	end
	AntUnitPercent = 10 - AntWaveInterval
end
DinoAmount = function()
	if ChosenDinoAmount == "100%" then
		DinoWaveInterval = 0
	elseif ChosenDinoAmount == "90%" then
		DinoWaveInterval = 1
	elseif ChosenDinoAmount == "80%" then
		DinoWaveInterval = 2
	elseif ChosenDinoAmount == "70%" then
		DinoWaveInterval = 3
	elseif ChosenDinoAmount == "60%" then
		DinoWaveInterval = 4
	elseif ChosenDinoAmount == "50%" then
		DinoWaveInterval = 5
	elseif ChosenDinoAmount == "40%" then
		DinoWaveInterval = 6
	elseif ChosenDinoAmount == "30%" then
		DinoWaveInterval = 7
	elseif ChosenDinoAmount == "20%" then
		DinoWaveInterval = 8
	elseif ChosenDinoAmount == "10%" then
		DinoWaveInterval = 9
	elseif ChosenDinoAmount == "0" then
		DinoUnits = false
		DinoWaveInterval = 10
	end
	DinoUnitPercent = 10 - DinoWaveInterval
end

PeaceTime = false
MonsterPeaceTime = false
DinoPeaceTime = false
AntPeaceTime = false
AllieWaveInterrupter = function()
	AlliePeaceTime = true
	Trigger.AfterDelay(DateTime.Seconds(AllieWaveInterval), function()
		AlliePeaceTime = false
	end)
	Trigger.AfterDelay(DateTime.Seconds(10), function()
		AllieWaveInterrupter()
	end)
end

SovietWaveInterrupter = function()
	SovietPeaceTime = true
	Trigger.AfterDelay(DateTime.Seconds(SovietWaveInterval), function()
		SovietPeaceTime = false
	end)
	Trigger.AfterDelay(DateTime.Seconds(10), function()
		SovietWaveInterrupter()
	end)
end

GdiWaveInterrupter = function()
	GdiPeaceTime = true
	Trigger.AfterDelay(DateTime.Seconds(GdiWaveInterval), function()
		GdiPeaceTime = false
	end)
	Trigger.AfterDelay(DateTime.Seconds(10), function()
		GdiWaveInterrupter()
	end)
end

NodWaveInterrupter = function()
	NodPeaceTime = true
	Trigger.AfterDelay(DateTime.Seconds(NodWaveInterval), function()
		NodPeaceTime = false
	end)
	Trigger.AfterDelay(DateTime.Seconds(10), function()
		NodWaveInterrupter()
	end)
end

MonsterWaveInterrupter = function()
	MonsterPeaceTime = true
	Trigger.AfterDelay(DateTime.Seconds(MonsterWaveInterval), function()
		MonsterPeaceTime = false
	end)
	Trigger.AfterDelay(DateTime.Seconds(10), function()
		MonsterWaveInterrupter()
	end)
end
AntWaveInterrupter = function()
	AntPeaceTime = true
	Trigger.AfterDelay(DateTime.Seconds(AntWaveInterval), function()
		AntPeaceTime = false
	end)
	Trigger.AfterDelay(DateTime.Seconds(10), function()
		AntWaveInterrupter()
	end)
end
DinoWaveInterrupter = function()
	DinoPeaceTime = true
	Trigger.AfterDelay(DateTime.Seconds(DinoWaveInterval), function()
		DinoPeaceTime = false
	end)
	Trigger.AfterDelay(DateTime.Seconds(10), function()
		DinoWaveInterrupter()
	end)
end
AllieInfantryIncome = function()
	if not AlliePeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomInfUnit = Utils.Random(AllieInfUnit)
		if RandomInfUnit == "e1" then AllieInfDelayTimemax = 5
		elseif RandomInfUnit == "e3" then AllieInfDelayTimemax = 6
		elseif RandomInfUnit == "medi" then AllieInfDelayTimemax = 4
		elseif RandomInfUnit == "mech" then AllieInfDelayTimemax = 6 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomInfUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomInfUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(AllieInfDelayTimemin, AllieInfDelayTimemax)), function()
			AllieInfantryIncome()
		end)
	end)
end

SovietInfantryIncome = function()
	if not SovietPeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomInfUnit = Utils.Random(SovietInfUnit)
		if RandomInfUnit == "e1" then SovietInfDelayTimemax = 5
		elseif RandomInfUnit == "e2" then SovietInfDelayTimemax = 4
		elseif RandomInfUnit == "e3" then SovietInfDelayTimemax = 6
		elseif RandomInfUnit == "e4" then SovietInfDelayTimemax = 9
		elseif RandomInfUnit == "shok" then SovietInfDelayTimemax = 10
		elseif RandomInfUnit == "dog" then SovietInfDelayTimemax = 4
			AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 5), Utils.RandomInteger(0, 18)), CPos.New(26,8) + CVec.New(Utils.RandomInteger(-3, 3), Utils.RandomInteger(-3, 3)), CPos.New(26,14) + CVec.New(Utils.RandomInteger(-3, 3), Utils.RandomInteger(-3, 3)), CPos.New(4,7) + CVec.New(Utils.RandomInteger(-3, 3), Utils.RandomInteger(-3, 3)) }
			AttackpathS = { CPos.New(1,37) + CVec.New(Utils.RandomInteger(0, 5), Utils.RandomInteger(0, 18)), CPos.New(26,41) + CVec.New(Utils.RandomInteger(-3, 3), Utils.RandomInteger(-3, 3)), CPos.New(26,47) + CVec.New(Utils.RandomInteger(-3, 3), Utils.RandomInteger(-3, 3)), CPos.New(4,48) + CVec.New(Utils.RandomInteger(-3, 3), Utils.RandomInteger(-3, 3)) }
		end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomInfUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomInfUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))			
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(SovietInfDelayTimemin, SovietInfDelayTimemax)), function()
			SovietInfantryIncome()
		end)
	end)
end

GdiInfantryIncome = function()
	if not GdiPeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomInfUnit = Utils.Random(GdiInfUnit)
		if RandomInfUnit == "e1cnc" then GdiInfDelayTimemax = 5
		elseif RandomInfUnit == "e2cnc" then GdiInfDelayTimemax = 4
		elseif RandomInfUnit == "e3cnc" then GdiInfDelayTimemax = 6
		elseif RandomInfUnit == "gnrl" then GdiInfDelayTimemax = 10 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomInfUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			EnemyN = { EnemyUnitN }			
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomInfUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))			
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(GdiInfDelayTimemin, GdiInfDelayTimemax)), function()
			GdiInfantryIncome()
		end)
	end)
end

NodInfantryIncome = function()
	if not NodPeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomInfUnit = Utils.Random(NodInfUnit)
		if RandomInfUnit == "e1cnc" then NodInfDelayTimemax = 5
		elseif RandomInfUnit == "e3cnc" then NodInfDelayTimemax = 6
		elseif RandomInfUnit == "e4cnc" then NodInfDelayTimemax = 7
		elseif RandomInfUnit == "e5cnc" then NodInfDelayTimemax = 8 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomInfUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomInfUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(NodInfDelayTimemin, NodInfDelayTimemax)), function()
			NodInfantryIncome()
		end)
	end)
end

AllieVehicleIncome = function()
	if not AlliePeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomVehUnit = Utils.Random(AllieVehUnit)
		if RandomVehUnit == "1tnk" then AllieVehDelayTimemax = 13
		elseif RandomVehUnit == "jeep" then AllieVehDelayTimemax = 8 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomVehUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			if ICTime then EnemyUnitN.GrantCondition("invulnerability", DateTime.Seconds(15)) end
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomVehUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			if ICTime then EnemyUnitS.GrantCondition("invulnerability", DateTime.Seconds(15)) end
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(AllieVehDelayTimemin, AllieVehDelayTimemax)), function()
			AllieVehicleIncome()
		end)
	end)
end
SovietVehicleIncome = function()
	if not SovietPeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomVehUnit = Utils.Random(SovietVehUnit)
		if RandomVehUnit == "apc" then SovietVehDelayTimemax = 12
		elseif RandomVehUnit == "ftrk" then SovietVehDelayTimemax = 10 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomVehUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			if ICTime then EnemyUnitN.GrantCondition("invulnerability", DateTime.Seconds(15)) end
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomVehUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			if ICTime then EnemyUnitS.GrantCondition("invulnerability", DateTime.Seconds(15)) end
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(SovietVehDelayTimemin, SovietVehDelayTimemax)), function()
			SovietVehicleIncome()
		end)
	end)
end

GdiVehicleIncome = function()
	if not GdiPeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomVehUnit = Utils.Random(GdiVehUnit)
		if RandomVehUnit == "apccnc" then GdiVehDelayTimemax = 13
		elseif RandomVehUnit == "humv" then GdiVehDelayTimemax = 8 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomVehUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			if ICTime then EnemyUnitN.GrantCondition("invulnerability", DateTime.Seconds(15)) end
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomVehUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			if ICTime then EnemyUnitS.GrantCondition("invulnerability", DateTime.Seconds(15)) end
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(GdiVehDelayTimemin, GdiVehDelayTimemax)), function()
			GdiVehicleIncome()
		end)
	end)
end

NodVehicleIncome = function()
	if not NodPeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomVehUnit = Utils.Random(NodVehUnit)
		if RandomVehUnit == "bggy" then NodVehDelayTimemax = 8
		elseif RandomVehUnit == "bike" then NodVehDelayTimemax = 13
		elseif RandomVehUnit == "ftnkcnc" then NodVehDelayTimemax = 10
		elseif RandomVehUnit == "mlrs" then NodVehDelayTimemax = 8 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomVehUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			if ICTime then EnemyUnitN.GrantCondition("invulnerability", DateTime.Seconds(15)) end
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomVehUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			if ICTime then EnemyUnitS.GrantCondition("invulnerability", DateTime.Seconds(15)) end
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(NodVehDelayTimemin, NodVehDelayTimemax)), function()
			NodVehicleIncome()
		end)
	end)
end

AllieTnkIncome = function()
	if not AlliePeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomTnkUnit = Utils.Random(AllieTnkUnit)
		if RandomTnkUnit == "2tnk" then AllieTnkDelayTimemax = 16
		elseif RandomTnkUnit == "ctnk" then AllieTnkDelayTimemax = 14 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomTnkUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			if ICTime then EnemyUnitN.GrantCondition("invulnerability", DateTime.Seconds(19)) end
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomTnkUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			if ICTime then EnemyUnitS.GrantCondition("invulnerability", DateTime.Seconds(19)) end
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(AllieTnkDelayTimemin, AllieTnkDelayTimemax)), function()
			AllieTnkIncome()
		end)
	end)
end

SovietTnkIncome = function()
	if not SovietPeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomTnkUnit = Utils.Random(SovietTnkUnit)
		if RandomTnkUnit == "3tnk" then SovietTnkDelayTimemax = 20
		elseif RandomTnkUnit == "4tnk" then SovietTnkDelayTimemax = 26
		elseif RandomTnkUnit == "ttnk" then SovietTnkDelayTimemax = 15 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomTnkUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			if ICTime then EnemyUnitN.GrantCondition("invulnerability", DateTime.Seconds(19)) end
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomTnkUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			if ICTime then EnemyUnitS.GrantCondition("invulnerability", DateTime.Seconds(19)) end
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(SovietTnkDelayTimemin, SovietTnkDelayTimemax)), function()
			SovietTnkIncome()
		end)
	end)
end

GdiTnkIncome = function()
	if not GdiPeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomTnkUnit = Utils.Random(GdiTnkUnit)
		if RandomTnkUnit == "mtnk" then GdiTnkDelayTimemax = 16
		elseif RandomTnkUnit == "htnk" then GdiTnkDelayTimemax = 27 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomTnkUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			if ICTime then EnemyUnitN.GrantCondition("invulnerability", DateTime.Seconds(19)) end
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomTnkUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			if ICTime then EnemyUnitS.GrantCondition("invulnerability", DateTime.Seconds(19)) end
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(GdiTnkDelayTimemin, GdiTnkDelayTimemax)), function()
			GdiTnkIncome()
		end)
	end)
end

NodTnkIncome = function()
	if not NodPeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomTnkUnit = Utils.Random(NodTnkUnit)
		if RandomTnkUnit == "ltnk" then NodTnkDelayTimemax = 14
		elseif RandomTnkUnit == "stnkcnc" then NodTnkDelayTimemax = 16 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomTnkUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			if ICTime then EnemyUnitN.GrantCondition("invulnerability", DateTime.Seconds(19)) end
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomTnkUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			if ICTime then EnemyUnitS.GrantCondition("invulnerability", DateTime.Seconds(19)) end
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(NodTnkDelayTimemin, NodTnkDelayTimemax)), function()
			NodTnkIncome()
		end)
	end)
end

AllieArtyIncome = function()
	if not AlliePeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomArtyUnit = Utils.Random(AllieArtyUnit)
		if RandomArtyUnit == "arty" then AllieArtyDelayTimemax = 20 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomArtyUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			if ICTime then EnemyUnitN.GrantCondition("invulnerability", DateTime.Seconds(15)) end
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomArtyUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			if ICTime then EnemyUnitS.GrantCondition("invulnerability", DateTime.Seconds(15)) end
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(AllieArtyDelayTimemin, AllieArtyDelayTimemax)), function()
			AllieArtyIncome()
		end)
	end)
end
SovietArtyIncome = function()
	if not SovietPeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomArtyUnit = Utils.Random(SovietArtyUnit)
		if RandomArtyUnit == "v2rl" then AllieArtyDelayTimemax = 20 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomArtyUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			if ICTime then EnemyUnitN.GrantCondition("invulnerability", DateTime.Seconds(15)) end
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomArtyUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			if ICTime then EnemyUnitS.GrantCondition("invulnerability", DateTime.Seconds(15)) end
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(SovietArtyDelayTimemin, SovietArtyDelayTimemax)), function()
			SovietArtyIncome()
		end)
	end)
end
GdiArtyIncome = function()
	if not GdiPeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomArtyUnit = Utils.Random(GdiArtyUnit)
		if RandomArtyUnit == "msam" then GdiArtyDelayTimemax = 20 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomArtyUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			if ICTime then EnemyUnitN.GrantCondition("invulnerability", DateTime.Seconds(15)) end
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomArtyUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			if ICTime then EnemyUnitS.GrantCondition("invulnerability", DateTime.Seconds(15)) end
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(GdiArtyDelayTimemin, GdiArtyDelayTimemax)), function()
			GdiArtyIncome()
		end)
	end)
end
NodArtyIncome = function()
	if not NodPeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomArtyUnit = Utils.Random(NodArtyUnit)
		if RandomArtyUnit == "artycnc" then NodArtyDelayTimemax = 20 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomArtyUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			if ICTime then EnemyUnitN.GrantCondition("invulnerability", DateTime.Seconds(15)) end
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomArtyUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			if ICTime then EnemyUnitS.GrantCondition("invulnerability", DateTime.Seconds(15)) end
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(NodArtyDelayTimemin, NodArtyDelayTimemax)), function()
			NodArtyIncome()
		end)
	end)
end
AllieHeliIncome = function()
	if not AlliePeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomHeliUnit = Utils.Random(AllieHeliUnit)
		if RandomHeliUnit == "mh60" then AllieHeliDelayTimemax = 18
		elseif RandomHeliUnit == "heli" then AllieHeliDelayTimemax = 25 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomHeliUnit, true, { Location = CPos.New(57,0) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomHeliUnit, true, { Location = CPos.New(57,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(AllieHeliDelayTimemin, AllieHeliDelayTimemax)), function()
			AllieHeliIncome()
		end)
	end)
end
SovietHeliIncome = function()
	if not SovietPeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomHeliUnit = Utils.Random(SovietHeliUnit)
		if RandomHeliUnit == "yak" then SovietHeliDelayTimemax = 18
		elseif RandomHeliUnit == "mig" then SovietHeliDelayTimemax = 20 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomHeliUnit, true, { Location = CPos.New(57,0) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomHeliUnit, true, { Location = CPos.New(57,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(SovietHeliDelayTimemin, SovietHeliDelayTimemax)), function()
			SovietHeliIncome()
		end)
	end)
end
GdiHeliIncome = function()
	if not GdiPeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomHeliUnit = Utils.Random(GdiHeliUnit)
		if RandomHeliUnit == "orca" then GdiHeliDelayTimemax = 20 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomHeliUnit, true, { Location = CPos.New(57,0) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomHeliUnit, true, { Location = CPos.New(57,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(GdiHeliDelayTimemin, GdiHeliDelayTimemax)), function()
			GdiHeliIncome()
		end)
	end)
end
NodHeliIncome = function()
	if not NodPeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomHeliUnit = Utils.Random(NodHeliUnit)
		if RandomHeliUnit == "apache" then NodHeliDelayTimemax = 20 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomHeliUnit, true, { Location = CPos.New(57,0) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomHeliUnit, true, { Location = CPos.New(57,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(NodHeliDelayTimemin, NodHeliDelayTimemax)), function()
			NodHeliIncome()
		end)
	end)
end
EnemyMonsterIncome = function()
	if not MonsterPeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomMonsterUnit = Utils.Random(EnemyMonsterUnit)
		
		if RandomMonsterUnit == "PVICE" then MonsterDelayTimemax = 13
		elseif RandomMonsterUnit == "zombie" then MonsterDelayTimemax = 10
		elseif RandomMonsterUnit == "IMP" then MonsterDelayTimemax = 28
		elseif RandomMonsterUnit == "REVE" then MonsterDelayTimemax = 30
		elseif RandomMonsterUnit == "BSPI" then MonsterDelayTimemax = 22
		elseif RandomMonsterUnit == "PINKY" then MonsterDelayTimemax = 35
		elseif RandomMonsterUnit == "MANC" then MonsterDelayTimemax = 45 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomMonsterUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomMonsterUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(MonsterDelayTimemin, MonsterDelayTimemax)), function()
			EnemyMonsterIncome()
		end)
	end)
end

EnemyAntIncome = function()
	if not AntPeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomAntUnit = Utils.Random(EnemyAntUnit)
		if RandomAntUnit == "ant" then AntDelayTimemax = 11
		elseif RandomAntUnit == "scoutant" then AntDelayTimemax = 8
		elseif RandomAntUnit == "warriorant" then AntDelayTimemax = 12
		elseif RandomAntUnit == "fireant" then AntDelayTimemax = 13
		elseif RandomAntUnit == "toxicant" then AntDelayTimemax = 14
		elseif RandomAntUnit == "electricant" then AntDelayTimemax = 15
		elseif RandomAntUnit == "lavaant" then AntDelayTimemax = 23 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomAntUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomAntUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(AntDelayTimemin, AntDelayTimemax)), function()
			EnemyAntIncome()
		end)
	end)
end

EnemyDinoIncome = function()
	if not DinoPeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomDinoUnit = Utils.Random(EnemyDinoUnit)
		if RandomDinoUnit == "PARAUSAR" then DinoDelayTimemax = 15
		elseif RandomDinoUnit == "TRICERATOPS" then DinoDelayTimemax = 16
		elseif RandomDinoUnit == "STEGOSAUR" then DinoDelayTimemax = 16
		elseif RandomDinoUnit == "ALLOSAURUS" then DinoDelayTimemax = 17
		elseif RandomDinoUnit == "TYREX" then DinoDelayTimemax = 18
		elseif RandomDinoUnit == "BRACHIOSAURUS" then DinoDelayTimemax = 21
		elseif RandomDinoUnit == "GALLIMUS" then DinoDelayTimemax = 12
			AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 5), Utils.RandomInteger(0, 18)), CPos.New(26,8) + CVec.New(Utils.RandomInteger(-3, 3), Utils.RandomInteger(-3, 3)), CPos.New(26,14) + CVec.New(Utils.RandomInteger(-3, 3), Utils.RandomInteger(-3, 3)), CPos.New(4,7) + CVec.New(Utils.RandomInteger(-3, 3), Utils.RandomInteger(-3, 3)) }
			AttackpathS = { CPos.New(1,37) + CVec.New(Utils.RandomInteger(0, 5), Utils.RandomInteger(0, 18)), CPos.New(26,41) + CVec.New(Utils.RandomInteger(-3, 3), Utils.RandomInteger(-3, 3)), CPos.New(26,47) + CVec.New(Utils.RandomInteger(-3, 3), Utils.RandomInteger(-3, 3)), CPos.New(4,48) + CVec.New(Utils.RandomInteger(-3, 3), Utils.RandomInteger(-3, 3)) }
		end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomDinoUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomDinoUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(DinoDelayTimemin, DinoDelayTimemax)), function()
			EnemyDinoIncome()
		end)
	end)
end

EnemyCustomHeliIncome = function()
	if not MonsterPeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomCustomUnit = Utils.Random(EnemyCustomHeliUnit)
		if RandomCustomUnit == "lynx" then CustomHeliDelayTimemax = 19
		elseif RandomCustomUnit == "cobra" then CustomHeliDelayTimemax = 20
		elseif RandomCustomUnit == "huey" then CustomHeliDelayTimemax = 21
		elseif RandomCustomUnit == "UFO.Beamer" then CustomHeliDelayTimemax = 20
		elseif RandomCustomUnit == "UFO.LASER" then CustomHeliDelayTimemax = 25
		elseif RandomCustomUnit == "UFO" then CustomHeliDelayTimemax = 27 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomCustomUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomCustomUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(CustomHeliDelayTimemin, CustomHeliDelayTimemax)), function()
			EnemyCustomHeliIncome()
		end)
	end)
end

EnemyCustomHeavyIncome = function()
	if not MonsterPeaceTime then
		AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
		RandomPosition = Utils.RandomInteger(0, 20)
		RandomCustomUnit = Utils.Random(EnemyCustomHeavyUnit)
		if RandomCustomUnit == "godzilla" then CustomHeavyDelayTimemax = 35
		elseif RandomCustomUnit == "kingkong" then CustomHeavyDelayTimemax = 37
		elseif RandomCustomUnit == "superman" then CustomHeavyDelayTimemax = 40 end
		if Team1plays then
			EnemyUnitN = Actor.Create(RandomCustomUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
			EnemyN = { EnemyUnitN }
			GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
		end
		if Team2plays then
			EnemyUnitS = Actor.Create(RandomCustomUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
			EnemyS = { EnemyUnitS }
			GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
		end
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(CustomHeavyDelayTimemin, CustomHeavyDelayTimemax)), function()
			EnemyCustomHeavyIncome()
		end)
	end)
end

-- &&
SpecialAttack = function()
	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(SpecialminTime, SpecialmaxTime)), function()
		EnemySpecialattack =  Utils.Random(AnySpecialattack)
		if EnemySpecialattack == 1 and not GameIsOver then
			SendParabombs()
		end
		if EnemySpecialattack == 2 and not GameIsOver then
			TargetAirstrike()
		end
		if EnemySpecialattack == 3 and not GameIsOver then
			SendParatroopers()
		end
		if EnemySpecialattack == 4 and not GameIsOver then
			SendParaparazombies()
		end
		if EnemySpecialattack == 5 and not GameIsOver then
			Demotruckincome()
		end
		if EnemySpecialattack == 6 and not GameIsOver then
			SneakHeils()
		end
		if EnemySpecialattack == 7 and not GameIsOver then
			SneakApcs()
		end
		if EnemySpecialattack == 8 and not GameIsOver then
			EngieRushTime = true
			EnemyEngyRush()
			Trigger.AfterDelay(DateTime.Seconds(10), function()
				EngieRushTime = false
			end)
		end
		if EnemySpecialattack == 9 and not GameIsOver then
			IronCurtain()
		end
		if EnemySpecialattack == 10 and not GameIsOver then
			StealthTanya()
		end
		if EnemySpecialattack == 11 and not GameIsOver then
			Chronotanks()
		end
		SpecialAttack()
	end)
end

SendParabombs = function()
	if Team1plays then
		DetonationPoint1 = Actor.Create("waypoint", true, { Location = CPos.New(6,6) + CVec.New(Utils.RandomInteger(0, 25), Utils.RandomInteger(0, 11)), Owner = Neutral })
		ParaProxy1 = Actor.Create("powerproxy.parabombs", false, { Owner = EnemysTop })
		units1 = ParaProxy1.TargetAirstrike(DetonationPoint1.CenterPosition)
	end
	if Team2plays then
		DetonationPoint2 = Actor.Create("waypoint", true, { Location = CPos.New(6,39) + CVec.New(Utils.RandomInteger(0, 25), Utils.RandomInteger(0, 11)), Owner = Neutral })
		ParaProxy2 = Actor.Create("powerproxy.parabombs", false, { Owner = EnemysBottom })
		units2 = ParaProxy2.TargetAirstrike(DetonationPoint2.CenterPosition)
	end
end
TargetAirstrike = function()
	if Team1plays then
		DetonationPoint1 = Actor.Create("waypoint", true, { Location = CPos.New(6,6) + CVec.New(Utils.RandomInteger(0, 25), Utils.RandomInteger(0, 11)), Owner = Neutral })
		ParaProxy1 = Actor.Create("powerproxy.parayaks", false, { Owner = EnemysTop })
		units1 = ParaProxy1.TargetAirstrike(DetonationPoint1.CenterPosition)
	end
	if Team2plays then
		DetonationPoint2 = Actor.Create("waypoint", true, { Location = CPos.New(6,39) + CVec.New(Utils.RandomInteger(0, 25), Utils.RandomInteger(0, 11)), Owner = Neutral })
		ParaProxy2 = Actor.Create("powerproxy.parayaks", false, { Owner = EnemysBottom })
		units2 = ParaProxy2.TargetAirstrike(DetonationPoint2.CenterPosition)
	end
end
SendParatroopers = function()
	if Team1plays then
		DetonationPoint1 = Actor.Create("waypoint", true, { Location = CPos.New(3,3) + CVec.New(Utils.RandomInteger(0, 25), Utils.RandomInteger(0, 4)), Owner = Neutral })
		ParaProxy1 = Actor.Create("powerproxy.paratroopers", false, { Owner = EnemysTop })
		units1 = ParaProxy1.TargetParatroopers(DetonationPoint1.CenterPosition)
	end
	if Team2plays then
		DetonationPoint2 = Actor.Create("waypoint", true, { Location = CPos.New(3,48) + CVec.New(Utils.RandomInteger(0, 25), Utils.RandomInteger(0, 4)), Owner = Neutral })
		ParaProxy2 = Actor.Create("powerproxy.paratroopers", false, { Owner = EnemysBottom })
		units2 = ParaProxy2.TargetParatroopers(DetonationPoint2.CenterPosition)
	end
end
SendParaparazombies = function()
	if Team1plays then
		DetonationPoint1 = Actor.Create("waypoint", true, { Location = CPos.New(3,3) + CVec.New(Utils.RandomInteger(0, 25), Utils.RandomInteger(0, 11)), Owner = Neutral })
		ParaProxy1 = Actor.Create("powerproxy.parazombies", false, { Owner = EnemysTop })
		units1 = ParaProxy1.TargetParatroopers(DetonationPoint1.CenterPosition)
	end
	if Team2plays then
		DetonationPoint2 = Actor.Create("waypoint", true, { Location = CPos.New(3,42) + CVec.New(Utils.RandomInteger(0, 25), Utils.RandomInteger(0, 11)), Owner = Neutral })
		ParaProxy2 = Actor.Create("powerproxy.parazombies", false, { Owner = EnemysBottom })
		units2 = ParaProxy2.TargetParatroopers(DetonationPoint2.CenterPosition)
	end
end
Demotruckincome = function()
	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(20, 30)), function()
		if Team1plays then
			AttackpathN = { CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
			DemoN = Actor.Create("dtrk", true, { Location = CPos.New(55,5), Owner = EnemysTop })
			DtrukN = { DemoN }
			MovePatrol(DtrukN, AttackpathN, DateTime.Seconds(3))
		end
		if Team2plays then
			AttackpathS = { CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)), CPos.New(1,31) + CVec.New(Utils.RandomInteger(0, 7), Utils.RandomInteger(0, 23)) }
			DemoS = Actor.Create("dtrk", true, { Location = CPos.New(55,50), Owner = EnemysBottom })
			DtrukS = { DemoS }
			MovePatrol(DtrukS, AttackpathS, DateTime.Seconds(3))
		end
	end)
end
HeliReinforcements = { "e1", "e3", "e2", "e1", "e1", "e1", "e4" }
ApcReinforcements = { "e3", "e2", "e1", "e1", "e4" }
TshipReinforcements = { "e3", "e2", "e4", "e4", "e4" }
Tanya = { "e7", "medi", "medi", "medi" }

SneakHeils = function()
	if Team1plays then
	Topsneakheliunits = Reinforcements.ReinforceWithTransport(EnemysTop, "tran", HeliReinforcements, { CPos.New(20,55) + CVec.New(Utils.RandomInteger(-5, 5), 0), CPos.New(9,10) + CVec.New(Utils.RandomInteger(-1, 1), 0) }, { CPos.New(55,10) + CVec.New(0, Utils.RandomInteger(-8, 8)) })
	end
	if Team2plays then
	Bottomsneakheliunits = Reinforcements.ReinforceWithTransport(EnemysBottom, "tran", HeliReinforcements, { CPos.New(20,1) + CVec.New(Utils.RandomInteger(-5, 5), 0), CPos.New(9,43) + CVec.New(Utils.RandomInteger(-1, 1), 0) }, { CPos.New(55,45) + CVec.New(0, Utils.RandomInteger(-8, 8)) })
	end
end


SneakApcs = function()
	if Team1plays then
		Topsneakapcunits = Reinforcements.ReinforceWithTransport(EnemysTop, "apc", ApcReinforcements, { CPos.New(25,1) + CVec.New(Utils.RandomInteger(-1, 1), 0), CPos.New(9,18) + CVec.New(Utils.RandomInteger(-1, 1), 0) }, { CPos.New(55,10) + CVec.New(0, Utils.RandomInteger(-5, 5)) })[2]
	end
	if Team2plays then
		Bottomsneakapcunits = Reinforcements.ReinforceWithTransport(EnemysBottom, "apc", ApcReinforcements, { CPos.New(25,55) + CVec.New(Utils.RandomInteger(-1, 1), 0), CPos.New(9,51) + CVec.New(Utils.RandomInteger(-1, 1), 0) }, { CPos.New(55,45) + CVec.New(0, Utils.RandomInteger(-5, 5)) })[2]
	end
end

ICTime = false
IronCurtain = function()
	ICTime = true
	Media.PlaySound("ironcur9.aud")
	Trigger.AfterDelay(DateTime.Seconds(14), function()
		ICTime = false
	end)
end

StealthTanya = function()
	if Team1plays then
		local TopTanya = Reinforcements.ReinforceWithTransport(EnemysTop, "stnk", Tanya, { CPos.New(23,1) + CVec.New(Utils.RandomInteger(-1, 1), 0), CPos.New(9,18) + CVec.New(Utils.RandomInteger(-1, 1), 0) }, { CPos.New(55,10) + CVec.New(0, Utils.RandomInteger(-5, 5)) })[2]
		Utils.Do(TopTanya, function(a)
			Trigger.OnAddedToWorld(a, function()
				AttackpathN = { CPos.New(26,8) + CVec.New(Utils.RandomInteger(-3, 3), Utils.RandomInteger(-3, 3)), CPos.New(26,14) + CVec.New(Utils.RandomInteger(-3, 3), Utils.RandomInteger(-3, 3)), CPos.New(4,7) + CVec.New(Utils.RandomInteger(-3, 3), Utils.RandomInteger(-3, 3)), CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 5), Utils.RandomInteger(0, 18)) }
				EnemyN = { a }
				GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(1))
			end)
		end)
	end	
	if Team2plays then
		local BottomTanya = Reinforcements.ReinforceWithTransport(EnemysBottom, "stnk", Tanya, { CPos.New(23,55) + CVec.New(Utils.RandomInteger(-1, 1), 0), CPos.New(9,51) + CVec.New(Utils.RandomInteger(-1, 1), 0) }, { CPos.New(55,45) + CVec.New(0, Utils.RandomInteger(-5, 5)) })[2]
		Utils.Do(BottomTanya, function(unit)
			Trigger.OnAddedToWorld(unit, function()
				AttackpathS = { CPos.New(26,41) + CVec.New(Utils.RandomInteger(-3, 3), Utils.RandomInteger(-3, 3)), CPos.New(26,47) + CVec.New(Utils.RandomInteger(-3, 3), Utils.RandomInteger(-3, 3)), CPos.New(4,48) + CVec.New(Utils.RandomInteger(-3, 3), Utils.RandomInteger(-3, 3)), CPos.New(1,37) + CVec.New(Utils.RandomInteger(0, 5), Utils.RandomInteger(0, 18))  }
				EnemyS = { unit }
				GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(1))
			end)
		end)
	end		
end


Chronotanks = function()
	if Team1plays then
		Trigger.AfterDelay(Utils.RandomInteger(0, 88), function()
			Chronotank2 = Actor.Create("CTNK", true, { Location = CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 5), Utils.RandomInteger(0, 18)), Owner = EnemysTop })
			Chronotank2.Scatter()
			Media.PlaySound("chrotnk1.aud")
		end)
		Trigger.AfterDelay(Utils.RandomInteger(0, 88), function()
			Chronotank3 = Actor.Create("CTNK", true, { Location = CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 5), Utils.RandomInteger(0, 18)), Owner = EnemysTop })
			Chronotank3.Scatter()
			Media.PlaySound("chrotnk1.aud")
		end)
		Trigger.AfterDelay(Utils.RandomInteger(0, 88), function()
			Chronotank4 = Actor.Create("CTNK", true, { Location = CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 5), Utils.RandomInteger(0, 18)), Owner = EnemysTop })
			Chronotank4.Scatter()
			Media.PlaySound("chrotnk1.aud")
		end)
		Trigger.AfterDelay(Utils.RandomInteger(0, 88), function()
			Chronotank5 = Actor.Create("CTNK", true, { Location = CPos.New(1,1) + CVec.New(Utils.RandomInteger(0, 5), Utils.RandomInteger(0, 18)), Owner = EnemysTop })
			Chronotank5.Scatter()
			Media.PlaySound("chrotnk1.aud")
		end)
	end		
	if Team2plays then
		Trigger.AfterDelay(Utils.RandomInteger(0, 88), function()
			Chronotank7 = Actor.Create("CTNK", true, { Location = CPos.New(1,37) + CVec.New(Utils.RandomInteger(0, 5), Utils.RandomInteger(0, 18)), Owner = EnemysBottom })
			Chronotank7.Scatter()
			Media.PlaySound("chrotnk1.aud")
		end)
		Trigger.AfterDelay(Utils.RandomInteger(0, 88), function()
			Chronotank8 = Actor.Create("CTNK", true, { Location = CPos.New(1,37) + CVec.New(Utils.RandomInteger(0, 5), Utils.RandomInteger(0, 18)), Owner = EnemysBottom })
			Chronotank8.Scatter()
			Media.PlaySound("chrotnk1.aud")
		end)
		Trigger.AfterDelay(Utils.RandomInteger(0, 88), function()
			Chronotank9 = Actor.Create("CTNK", true, { Location = CPos.New(1,37) + CVec.New(Utils.RandomInteger(0, 5), Utils.RandomInteger(0, 18)), Owner = EnemysBottom })
			Chronotank9.Scatter()
			Media.PlaySound("chrotnk1.aud")
		end)
		Trigger.AfterDelay(Utils.RandomInteger(0, 88), function()
			Chronotank10 = Actor.Create("CTNK", true, { Location = CPos.New(1,37) + CVec.New(Utils.RandomInteger(0, 5), Utils.RandomInteger(0, 18)), Owner = EnemysBottom })
			Chronotank10.Scatter()
			Media.PlaySound("chrotnk1.aud")
		end)
		Trigger.AfterDelay(Utils.RandomInteger(88, 105), function()
			Media.PlaySpeechNotification( allplayers, "ChronosphereTestSuccessful")
		end)
	end
end

BridgePathNorth = { CPos.New(43, 25), CPos.New(40, 25), CPos.New(37, 25), CPos.New(34, 25), CPos.New(31, 25), CPos.New(28, 25), CPos.New(25, 25), CPos.New(22, 25), CPos.New(19, 25), CPos.New(16, 25) }
BridgePathSouth = { CPos.New(43, 31), CPos.New(40, 31), CPos.New(37, 31), CPos.New(34, 31), CPos.New(31, 31), CPos.New(28, 31), CPos.New(25, 31), CPos.New(22, 31), CPos.New(19, 31), CPos.New(16, 31) }
EnemyEngyIncome = function()
	if Team1plays then
		EnemyUnitN = Actor.Create("e6", true, { Location = CPos.New(55,25), Owner = EnemysTop })
		EnemyN = { EnemyUnitN }
		MovePatrol(EnemyN, BridgePathNorth, DateTime.Seconds(0))
	end
	if Team2plays then
		EnemyUnitS = Actor.Create("e6", true, { Location = CPos.New(55,30), Owner = EnemysBottom })
		EnemyS = { EnemyUnitS }
		MovePatrol(EnemyS, BridgePathSouth, DateTime.Seconds(0))
	end
	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(EngyDelayTimemin, EngyDelayTimemax)), function()
		EnemyEngyIncome()
	end)
end

EnemyEngyRush = function()
	if Team1plays then
		EnemyUnitN = Actor.Create("e6", true, { Location = CPos.New(55,25), Owner = EnemysTop })
		EnemyN = { EnemyUnitN }
		MovePatrol(EnemyN, BridgePathNorth, DateTime.Seconds(0))
	end
	if Team2plays then
		EnemyUnitS = Actor.Create("e6", true, { Location = CPos.New(55,30), Owner = EnemysBottom })
		EnemyS = { EnemyUnitS }
		MovePatrol(EnemyS, BridgePathSouth, DateTime.Seconds(0))
	end
	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(1, 3)), function()
		if EngieRushTime then
			EnemyEngyRush()
		end
	end)
end

GroupPatrol = function(units, waypoints, delay) 
	local i = 1
	local stop = false

	Utils.Do(units, function(unit)
		Trigger.OnIdle(unit, function()
			if stop then
				return
			end
			if unit.Location == waypoints[i] then
				local bool = Utils.All(units, function(actor) return actor.IsIdle end)
				if bool then
					stop = true
					i = i + 1
					if i > #waypoints then
						i = 1
					end
					Trigger.AfterDelay(delay, function() stop = false end)
				end
			else
				unit.AttackMove(waypoints[i])
			end
		end)
	end)
end

MovePatrol = function(units, waypoints, delay) 
	local i = 1
	local stop = false

	Utils.Do(units, function(unit)
		Trigger.OnIdle(unit, function()
			if stop then
				return
			end
			if unit.Location == waypoints[i] then
				local bool = Utils.All(units, function(actor) return actor.IsIdle end)
				if bool then
					stop = true
					i = i + 1
					if i > #waypoints then
						i = 1
					end
					Trigger.AfterDelay(delay, function() stop = false end)
				end
			else
				unit.Move(waypoints[i])
			end
		end)
	end)
end

DestroyedBuildings1 = 0
DestroyedBuildings2 = 0

MCVincome = function()
	if AntUnits then
		newEnemylar5 = Actor.Create("LAR1", true, { Location = CPos.New(42,8) + CVec.New(0, Utils.RandomInteger(-5, 5)), Owner = EnemysTop })
		newEnemylar6 = Actor.Create("LAR2", true, { Location = CPos.New(41,16) + CVec.New(0, Utils.RandomInteger(-5, 5)), Owner = EnemysTop }) 
		newEnemylar7 = Actor.Create("LAR1", true, { Location = CPos.New(42,41) + CVec.New(0, Utils.RandomInteger(-5, 5)), Owner = EnemysBottom })
		newEnemylar8 = Actor.Create("LAR2", true, { Location = CPos.New(41,49) + CVec.New(0, Utils.RandomInteger(-5, 5)), Owner = EnemysBottom })
		if AntWaveInterval < 8 then
			TopQueen = Actor.Create("QUEEN", true, { Location = CPos.New(44,11), Owner = EnemysTop })
			BottomQueen = Actor.Create("QUEEN", true, { Location = CPos.New(44,44), Owner = EnemysBottom }) 
		end
	end
	fact0 = "mcv"
	allactors = Multi0.GetActors()
	for i,v in pairs(allactors) do
		if v.Type == "mcvgdi" then
			fact0 = "factgdi"
			v.Destroy()
		elseif v.Type == "mcvnod" then
			fact0 = "factnod"
			v.Destroy()
		elseif v.Type == "mcv" then
			fact0 = "fact"
			v.Destroy()
		end
	end
	fact1 = "mcv"
	newmcv0 = Actor.Create(fact0, true, { Location = CPos.New(8,7), Owner = Multi0 })
	allactors = Multi1.GetActors()
	for i,v in pairs(allactors) do
		if v.Type == "mcvgdi" then
			fact1 = "factgdi"
			v.Destroy()
		elseif v.Type == "mcvnod" then
			fact1 = "factnod"
			v.Destroy()
		elseif v.Type == "mcv" then
			fact1 = "fact"
			v.Destroy()
		end
	end
	fact2 = "mcv"
	newmcv1 = Actor.Create(fact1, true, { Location = CPos.New(8,15), Owner = Multi1 }) 
	allactors = Multi2.GetActors()
	for i,v in pairs(allactors) do
		if v.Type == "mcvgdi" then
			fact2 = "factgdi"
			v.Destroy()
		elseif v.Type == "mcvnod" then
			fact2 = "factnod"
			v.Destroy()
		elseif v.Type == "mcv" then
			fact2 = "fact"
			v.Destroy()
		end
	end
	newmcv2 = Actor.Create(fact2, true, { Location = CPos.New(8,40), Owner = Multi2 })
	fact3 = "mcv"
	allactors = Multi3.GetActors()
	for i,v in pairs(allactors) do
		if v.Type == "mcvgdi" then
			fact3 = "factgdi"
			v.Destroy()
		elseif v.Type == "mcvnod" then
			fact3 = "factnod"
			v.Destroy()
		elseif v.Type == "mcv" then
			fact3 = "fact"
			v.Destroy()
		end
	end
	newmcv3 = Actor.Create(fact3, true, { Location = CPos.New(8,48), Owner = Multi3 })
--	Trigger.OnKilledOrCaptured(newmcv3, function() Multi3.MarkFailedObjective(KillbaseP4) end)
	Team1Mainbases = { newmcv0, newmcv1 }
	Team2Mainbases = { newmcv2, newmcv3 }
	Trigger.OnAllKilledOrCaptured(Team1Mainbases, Team1Lost)
	Trigger.OnAllKilledOrCaptured(Team2Mainbases, Team2Lost)

	newEnemymcv0 = Actor.Create("fact.enemy", true, { Location = CPos.New(51,7), Owner = EnemysTop })
	newEnemymcv1 = Actor.Create("fact.enemy", true, { Location = CPos.New(51,15), Owner = EnemysTop }) 
	newEnemymcv2 = Actor.Create("fact.enemy", true, { Location = CPos.New(51,40), Owner = EnemysBottom })
	newEnemymcv3 = Actor.Create("fact.enemy", true, { Location = CPos.New(51,48), Owner = EnemysBottom })
	newEnemyhpad0 = Actor.Create("hpad", true, { Location = CPos.New(47,7), Owner = EnemysTop })
	newEnemyhpad1 = Actor.Create("hpad", true, { Location = CPos.New(47,15), Owner = EnemysTop }) 
	newEnemyhpad2 = Actor.Create("hpad", true, { Location = CPos.New(47,40), Owner = EnemysBottom })
	newEnemyhpad3 = Actor.Create("hpad", true, { Location = CPos.New(47,48), Owner = EnemysBottom })
	newEnemyapwr1 = Actor.Create("much.apwr", true, { Location = CPos.New(50,11), Owner = EnemysTop })
	newEnemyapwr2 = Actor.Create("much.apwr", true, { Location = CPos.New(50,44), Owner = EnemysBottom })

	Trigger.OnDamaged(newEnemymcv0, function(building)
		if building.Owner == EnemysTop and building.Health < building.MaxHealth * 3/4 then
			building.StartBuildingRepairs()
		end
	end)
	Trigger.OnDamaged(newEnemymcv1, function(building)
		if building.Owner == EnemysTop and building.Health < building.MaxHealth * 3/4 then
			building.StartBuildingRepairs()
		end
	end)
	Trigger.OnDamaged(newEnemymcv2, function(building)
		if building.Owner == EnemysBottom and building.Health < building.MaxHealth * 3/4 then
			building.StartBuildingRepairs()
		end
	end)
	Trigger.OnDamaged(newEnemymcv3, function(building)
		if building.Owner == EnemysBottom and building.Health < building.MaxHealth * 3/4 then
			building.StartBuildingRepairs()
		end
	end)

	Trigger.OnDamaged(newEnemyhpad0, function(building)
		if building.Owner == EnemysTop and building.Health < building.MaxHealth * 3/4 then
			building.StartBuildingRepairs()
		end
	end)
	Trigger.OnDamaged(newEnemyhpad1, function(building)
		if building.Owner == EnemysTop and building.Health < building.MaxHealth * 3/4 then
			building.StartBuildingRepairs()
		end
	end)
	Trigger.OnDamaged(newEnemyhpad2, function(building)
		if building.Owner == EnemysBottom and building.Health < building.MaxHealth * 3/4 then
			building.StartBuildingRepairs()
		end
	end)
	Trigger.OnDamaged(newEnemyhpad3, function(building)
		if building.Owner == EnemysBottom and building.Health < building.MaxHealth * 3/4 then
			building.StartBuildingRepairs()
		end
	end)

	Trigger.OnDamaged(newEnemyapwr1, function(building)
		if building.Owner == EnemysTop and building.Health < building.MaxHealth * 3/4 then
			building.StartBuildingRepairs()
		end
	end)
	Trigger.OnDamaged(newEnemyapwr2, function(building)
		if building.Owner == EnemysBottom and building.Health < building.MaxHealth * 3/4 then
			building.StartBuildingRepairs()
		end
	end)

	Trigger.OnKilled(newEnemymcv0, function() DestroyedBuildings1 = DestroyedBuildings1 + 1 end)
	Trigger.OnKilled(newEnemymcv1, function() DestroyedBuildings1 = DestroyedBuildings1 + 1 end)
	Trigger.OnKilled(newEnemymcv2, function() DestroyedBuildings2 = DestroyedBuildings2 + 1 end)
	Trigger.OnKilled(newEnemymcv3, function() DestroyedBuildings2 = DestroyedBuildings2 + 1 end)

	Trigger.OnKilled(newEnemyhpad0, function() DestroyedBuildings1 = DestroyedBuildings1 + 1 end)
	Trigger.OnKilled(newEnemyhpad1, function() DestroyedBuildings1 = DestroyedBuildings1 + 1 end)
	Trigger.OnKilled(newEnemyhpad2, function() DestroyedBuildings2 = DestroyedBuildings2 + 1 end)
	Trigger.OnKilled(newEnemyhpad3, function() DestroyedBuildings2 = DestroyedBuildings2 + 1 end)

	Trigger.OnKilled(newEnemyapwr1, function() DestroyedBuildings1 = DestroyedBuildings1 + 1 end)
	Trigger.OnKilled(newEnemyapwr2, function() DestroyedBuildings2 = DestroyedBuildings2 + 1 end)
	Team1Enemybases = { newEnemymcv0, newEnemymcv1, newEnemyhpad0, newEnemyhpad1, newEnemyapwr1 }
	Team2Enemybases = { newEnemymcv2, newEnemymcv3, newEnemyhpad2, newEnemyhpad3, newEnemyapwr2 }
	Trigger.OnAllKilledOrCaptured(Team1Enemybases, Team1Won)
	Trigger.OnAllKilledOrCaptured(Team2Enemybases, Team2Won)
	newEnemytsla0 = Actor.Create("tsla", true, { Location = CPos.New(45,8) + CVec.New(0, Utils.RandomInteger(-1, 1)), Owner = EnemysTop })
	newEnemytsla1 = Actor.Create("tsla", true, { Location = CPos.New(45,16) + CVec.New(0, Utils.RandomInteger(-1, 1)), Owner = EnemysTop }) 
	newEnemytsla2 = Actor.Create("tsla", true, { Location = CPos.New(45,41) + CVec.New(0, Utils.RandomInteger(-1, 1)), Owner = EnemysBottom })
	newEnemytsla3 = Actor.Create("tsla", true, { Location = CPos.New(45,49) + CVec.New(0, Utils.RandomInteger(-1, 1)), Owner = EnemysBottom })
	Trigger.OnDamaged(newEnemytsla0, function(building)
		if building.Owner == EnemysTop and building.Health < building.MaxHealth * 3/4 then
			building.StartBuildingRepairs()
		end
	end)
	Trigger.OnDamaged(newEnemytsla1, function(building)
		if building.Owner == EnemysTop and building.Health < building.MaxHealth * 3/4 then
			building.StartBuildingRepairs()
		end
	end)
	Trigger.OnDamaged(newEnemytsla2, function(building)
		if building.Owner == EnemysBottom and building.Health < building.MaxHealth * 3/4 then
			building.StartBuildingRepairs()
		end
	end)
	Trigger.OnDamaged(newEnemytsla3, function(building)
		if building.Owner == EnemysBottom and building.Health < building.MaxHealth * 3/4 then
			building.StartBuildingRepairs()
		end
	end)
	newEnemypbox0 = Actor.Create("hbox", true, { Location = CPos.New(50,10), Owner = EnemysTop })
	newEnemypbox1 = Actor.Create("hbox", true, { Location = CPos.New(50,18), Owner = EnemysTop }) 
	newEnemypbox2 = Actor.Create("hbox", true, { Location = CPos.New(50,43), Owner = EnemysBottom })
	newEnemypbox3 = Actor.Create("hbox", true, { Location = CPos.New(50,51), Owner = EnemysBottom })
--	if Map.LobbyOption("difficulty") ~= "easy" then
		newEnemyaa0 = Actor.Create("agun", true, { Location = CPos.New(49,7), Owner = EnemysTop })
		newEnemyaa1 = Actor.Create("agun", true, { Location = CPos.New(49,15), Owner = EnemysTop }) 
		newEnemyaa2 = Actor.Create("agun", true, { Location = CPos.New(49,40), Owner = EnemysBottom })
		newEnemyaa3 = Actor.Create("agun", true, { Location = CPos.New(49,48), Owner = EnemysBottom })
		newEnemypbox4 = Actor.Create("hbox", true, { Location = CPos.New(48,10), Owner = EnemysTop })
		newEnemypbox5 = Actor.Create("hbox", true, { Location = CPos.New(48,18), Owner = EnemysTop }) 
		newEnemypbox6 = Actor.Create("hbox", true, { Location = CPos.New(48,43), Owner = EnemysBottom })
		newEnemypbox7 = Actor.Create("hbox", true, { Location = CPos.New(48,51), Owner = EnemysBottom })
		Trigger.OnDamaged(newEnemyaa0, function(building)
			if building.Owner == EnemysTop and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnDamaged(newEnemyaa1, function(building)
			if building.Owner == EnemysTop and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnDamaged(newEnemyaa2, function(building)
			if building.Owner == EnemysBottom and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnDamaged(newEnemyaa3, function(building)
			if building.Owner == EnemysBottom and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		newEnemytsla4 = Actor.Create("tsla", true, { Location = CPos.New(46,8) + CVec.New(0, Utils.RandomInteger(-1, 1)), Owner = EnemysTop })
		newEnemytsla5 = Actor.Create("tsla", true, { Location = CPos.New(46,16) + CVec.New(0, Utils.RandomInteger(-1, 1)), Owner = EnemysTop }) 
		newEnemytsla6 = Actor.Create("tsla", true, { Location = CPos.New(46,41) + CVec.New(0, Utils.RandomInteger(-1, 1)), Owner = EnemysBottom })
		newEnemytsla7 = Actor.Create("tsla", true, { Location = CPos.New(46,49) + CVec.New(0, Utils.RandomInteger(-1, 1)), Owner = EnemysBottom })
		Trigger.OnDamaged(newEnemytsla4, function(building)
			if building.Owner == EnemysTop and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnDamaged(newEnemytsla5, function(building)
			if building.Owner == EnemysTop and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnDamaged(newEnemytsla6, function(building)
			if building.Owner == EnemysBottom and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnDamaged(newEnemytsla7, function(building)
			if building.Owner == EnemysBottom and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
--	end
--	if Map.LobbyOption("difficulty") == "hard" or Map.LobbyOption("difficulty") == "unbelievable" then
		newEnemypbox8 = Actor.Create("hbox", true, { Location = CPos.New(50,8), Owner = EnemysTop })
		newEnemypbox9 = Actor.Create("hbox", true, { Location = CPos.New(50,16), Owner = EnemysTop }) 
		newEnemypbox10 = Actor.Create("hbox", true, { Location = CPos.New(50,41), Owner = EnemysBottom })
		newEnemypbox11 = Actor.Create("hbox", true, { Location = CPos.New(50,49), Owner = EnemysBottom })
		newEnemyaa4 = Actor.Create("agun", true, { Location = CPos.New(53,6), Owner = EnemysTop })
		newEnemyaa5 = Actor.Create("agun", true, { Location = CPos.New(53,14), Owner = EnemysTop }) 
		newEnemyaa6 = Actor.Create("agun", true, { Location = CPos.New(53,39), Owner = EnemysBottom })
		newEnemyaa7 = Actor.Create("agun", true, { Location = CPos.New(53,47), Owner = EnemysBottom })
		Trigger.OnDamaged(newEnemyaa4, function(building)
			if building.Owner == EnemysTop and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnDamaged(newEnemyaa5, function(building)
			if building.Owner == EnemysTop and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnDamaged(newEnemyaa6, function(building)
			if building.Owner == EnemysBottom and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnDamaged(newEnemyaa7, function(building)
			if building.Owner == EnemysBottom and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		newEnemygap1 = Actor.Create("gap", true, { Location = CPos.New(48,11), Owner = EnemysTop })
		newEnemygap2 = Actor.Create("gap", true, { Location = CPos.New(48,44), Owner = EnemysBottom })
		Trigger.OnDamaged(newEnemygap1, function(building)
			if building.Owner == EnemysTop and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnDamaged(newEnemygap2, function(building)
			if building.Owner == EnemysBottom and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		newEnemytsla8 = Actor.Create("tsla", true, { Location = CPos.New(44,8) + CVec.New(0, Utils.RandomInteger(-1, 1)), Owner = EnemysTop })
		newEnemytsla9 = Actor.Create("tsla", true, { Location = CPos.New(44,16) + CVec.New(0, Utils.RandomInteger(-1, 1)), Owner = EnemysTop }) 
		newEnemytsla10 = Actor.Create("tsla", true, { Location = CPos.New(44,41) + CVec.New(0, Utils.RandomInteger(-1, 1)), Owner = EnemysBottom })
		newEnemytsla11 = Actor.Create("tsla", true, { Location = CPos.New(44,49) + CVec.New(0, Utils.RandomInteger(-1, 1)), Owner = EnemysBottom })
		Trigger.OnDamaged(newEnemytsla8, function(building)
			if building.Owner == EnemysTop and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnDamaged(newEnemytsla9, function(building)
			if building.Owner == EnemysTop and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnDamaged(newEnemytsla10, function(building)
			if building.Owner == EnemysBottom and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnDamaged(newEnemytsla11, function(building)
			if building.Owner == EnemysBottom and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
--	end
end


SetupPlayers = function()
	EnemysTop = Player.GetPlayer("EnemysTop")
	EnemysBottom = Player.GetPlayer("EnemysBottom")
	France = Player.GetPlayer("france")
	Neutral = Player.GetPlayer("Neutral")
	Multi0 = Player.GetPlayer("Multi0")
	if Multi0 == nil then
		Multi0 = Player.GetPlayer("Multi1")
		if Multi0 == nil then
			Team1plays = false
			CoverTop()
			Multi0 = Player.GetPlayer("Creeps")
		end
	end
	Multi1 = Player.GetPlayer("Multi1")
	if Multi1 == nil then
		Multi1 = Player.GetPlayer("Multi0")
		if Multi1 == nil then
			Multi1 = Player.GetPlayer("Creeps")
		end
	end
	Multi2 = Player.GetPlayer("Multi2")
	if Multi2 == nil then
		Multi2 = Player.GetPlayer("Multi3")
		if Multi2 == nil then
			Team2plays = false
			CoverBottom()
			Multi2 = Player.GetPlayer("Creeps")
		end
	end
	Multi3 = Player.GetPlayer("Multi3")
	if Multi3 == nil then
		Multi3 = Player.GetPlayer("Multi2")
		if Multi3 == nil then
			Multi3 = Player.GetPlayer("Creeps")
		end
	end
	Humans = { Multi0, Multi1, Multi2, Multi3 }
end

GameIsOver = false

WriteStatisticsTeam1 = function()
	Utils.Do(Humans, function(player)
--		Player1Name = Multi0.Name
		Player1Color = Multi0.Color
		Player1Faction = Multi0.Faction
		Player1Kills = Multi0.UnitsKilled
		Player1Looses = Multi0.UnitsLost
		Player1KillsCost = Multi0.KillsCost
		Player1DeathsCost = Multi0.DeathsCost
		Player1Experience = Multi0.Experience
--		Player2Name = Multi1.Name
--		Player2Color = Multi1.Color
		Player2Faction = Multi1.Faction
		Player2Kills = Multi1.UnitsKilled
		Player2Looses = Multi1.UnitsLost
		Player2KillsCost = Multi1.KillsCost
		Player2DeathsCost = Multi1.DeathsCost
		Player2Experience = Multi1.Experience
		Team1Kills = Player1Kills + Player2Kills
		Team1Looses = Player1Looses + Player2Looses
		Team1KillsCost = Player1KillsCost + Player2KillsCost
		Team1DeathsCost = Player1DeathsCost + Player2DeathsCost
		Team1Experience = Player1Experience + Player2Experience
	end)
	Media.DisplayMessage("" .. Player1Faction .. " + " .. Player2Faction .. "\nKilled/Lost " .. Team1Kills .. " / " .. Team1Looses .. " Units\nDestroyed " .. Team1KillsCost .. " $ and wasted " .. Team1DeathsCost .. " $\nScore : " .. Team1Experience .. "", "Team 1", Player1Color)

end

WriteStatisticsTeam2 = function()
	Utils.Do(Humans, function(player)
--		Player3Name = Multi2.Name
		Player3Color = Multi2.Color
		Player3Faction = Multi2.Faction
		Player3Kills = Multi2.UnitsKilled
		Player3Looses = Multi2.UnitsLost
		Player3KillsCost = Multi2.KillsCost
		Player3DeathsCost = Multi2.DeathsCost
		Player3Experience = Multi2.Experience
--		Player4Name = Multi3.Name
--		Player4Color = Multi3.Color
		Player4Faction = Multi3.Faction
		Player4Kills = Multi3.UnitsKilled
		Player4Looses = Multi3.UnitsLost
		Player4KillsCost = Multi3.KillsCost
		Player4DeathsCost = Multi3.DeathsCost
		Player4Experience = Multi3.Experience
		Team2Kills = Player3Kills + Player4Kills
		Team2Looses = Player3Looses + Player4Looses
		Team2KillsCost = Player3KillsCost + Player4KillsCost
		Team2DeathsCost = Player3DeathsCost + Player4DeathsCost
		Team2Experience = Player3Experience + Player4Experience
	end)
	Media.DisplayMessage("" .. Player3Faction .. " + " .. Player4Faction .. "\nKilled/Lost " .. Team2Kills .. " / " .. Team2Looses .. " Units\nDestroyed " .. Team2KillsCost .. " $ and wasted " .. Team2DeathsCost .. " $\nScore : " .. Team2Experience .. "", "Team 2", Player3Color)

end

Team1Lost = function()
	if not GameIsOver then
		Team1plays = false
		Team1Killed = true
		Multi0.MarkFailedObjective(KillbaseP1)
		Multi1.MarkFailedObjective(KillbaseP2)
		Media.PlaySoundNotification( allplayers, "AlertBuzzer")
		Media.DisplayMessage("" .. Multi0.Name .. " and " ..Multi1.Name .. " looses !" , "Materia", TimerColor)
--		BombTop()
		Trigger.AfterDelay(DateTime.Seconds(1), function()
			T1Lost = Actor.Create("team1loose", true, { Location = CPos.New(26,10), Owner = EnemysTop })
			CoverTop()
		end)
	end
end
Team1Won = function()
	if not GameIsOver and Team1plays then
		Team1plays = false
		GameIsOver = true
		Media.PlayMusic("track2")
		turnOff()
		Media.PlaySoundNotification( allplayers, "AlertBuzzer")
		Media.DisplayMessage("Congratulations Team 1 wins the Game!", "Materia", TimerColor)
		Trigger.AfterDelay(DateTime.Seconds(3), function()
			Media.DisplayMessage("Team 1", "Materia", TimerColor)
			WriteStatisticsTeam1()
			if Multi0 ~= Multi1 then Playername = Actor.Create("nix01pname", true, { Location = CPos.New(27,26), Owner = Multi0 }) end
			if Multi0 ~= Multi1 then And = Actor.Create("nix01and", true, { Location = CPos.New(28,28), Owner = Multi0 }) end
			Playername = Actor.Create("nix01pname", true, { Location = CPos.New(27,32), Owner = Multi1 })
			Wins = Actor.Create("nix01wins", true, { Location = CPos.New(24,35), Owner = Multi1 })
			Trigger.AfterDelay(DateTime.Seconds(7), function()
				WriteStatisticsTeam2()
			end)
		end)
		Trigger.AfterDelay(DateTime.Seconds(15), function()
			EndLight = 1.05
			Lighting.Ambient = EndLight
			Multi0.MarkCompletedObjective(KillbaseP1) 
			Multi1.MarkCompletedObjective(KillbaseP2)
			if not Team2Killed then
				Multi2.MarkFailedObjective(KillbaseP3)
				Multi3.MarkFailedObjective(KillbaseP4)
			end
		end)
	end
end
Team2Lost = function()
	if not GameIsOver then
		Team2plays = false
		Team2Killed = true
		Multi2.MarkFailedObjective(KillbaseP3)
		Multi3.MarkFailedObjective(KillbaseP4)
		Media.PlaySoundNotification( allplayers, "AlertBuzzer")
		Media.DisplayMessage("" .. Multi2.Name .. " and " ..Multi3.Name .. " looses !" , "Materia", TimerColor)
--		BombBottom()
		Trigger.AfterDelay(DateTime.Seconds(1), function()
			T1Lost = Actor.Create("team2loose", true, { Location = CPos.New(26,45), Owner = EnemysBottom })
			CoverBottom()
		end)
	end
end



Team2Won = function()
	if not GameIsOver and Team2plays then
		Team2plays = false
		GameIsOver = true
		Media.PlayMusic("track2")
		turnOff()
		Media.PlaySoundNotification( allplayers, "AlertBuzzer")
		Media.DisplayMessage("Congratulations Team 2 wins the Game!", "Materia", TimerColor)
		Trigger.AfterDelay(DateTime.Seconds(3), function()
			WriteStatisticsTeam2()
			if Multi2 ~= Multi3 then Playername = Actor.Create("nix01pname", true, { Location = CPos.New(27,26), Owner = Multi2 }) end
			if Multi2 ~= Multi3 then And = Actor.Create("nix01and", true, { Location = CPos.New(28,28), Owner = Multi2 }) end
			Playername = Actor.Create("nix01pname", true, { Location = CPos.New(27,32), Owner = Multi3 })
			Wins = Actor.Create("nix01wins", true, { Location = CPos.New(24,35), Owner = Multi3 })
			Trigger.AfterDelay(DateTime.Seconds(7), function()
				WriteStatisticsTeam1()
			end)
		end)
		Trigger.AfterDelay(DateTime.Seconds(15), function()
			EndLight = 1.05
			Lighting.Ambient = EndLight
			Multi2.MarkCompletedObjective(KillbaseP3) 
			Multi3.MarkCompletedObjective(KillbaseP4)
			if not Team1Killed then
				Multi0.MarkFailedObjective(KillbaseP1)
				Multi1.MarkFailedObjective(KillbaseP2)
			end
		end)
	end
end
Musictracks = { "track1", "track2", "track3" }
StartMusic1 = function()
	RandomTrack1 = Utils.Random(Musictracks)
	Media.PlayMusic(RandomTrack1)
	if RandomTrack1 == "track1" or RandomTrack1 == "track2" then
		PlayTime = 300
	else
		PlayTime = 218
	end
	Trigger.AfterDelay(DateTime.Seconds(PlayTime), function()
		StartMusic2()
	end)
end

StartMusic2 = function()
	RandomTrack2 = Utils.Random(Musictracks)
	if RandomTrack2 == RandomTrack1 then
		StartMusic2()
		return
	end
	Media.PlayMusic(RandomTrack2)
	if RandomTrack2 == "track1" or RandomTrack2 == "track2" then
		PlayTime = 300
	else
		PlayTime = 218
	end
	Trigger.AfterDelay(DateTime.Seconds(PlayTime), function()
		StartMusic3()
	end)
end

StartMusic3 = function()
	RandomTrack3 = Utils.Random(Musictracks)
	if RandomTrack3 == RandomTrack1 or RandomTrack3 == RandomTrack2 then
		StartMusic3()
		return
	end
	Media.PlayMusic(RandomTrack3)
	if RandomTrack2 == "track1" or RandomTrack2 == "track2" then
		PlayTime = 300
	else
		PlayTime = 218
	end
	Trigger.AfterDelay(DateTime.Seconds(PlayTime), function()
		StartMusic1()
	end)
end

SetCamera = function(Multi)
	local mainbase = Multi.GetActorsByType("fact")[1]
	if mainbase ~= nil then
		Camera.Position = mainbase.CenterPosition
	end
end


turnOn = function()
	Lighting.Ambient = Light
	if Light < 1 then
		Light = Light + 0.01
		Trigger.AfterDelay(1, function()
			turnOn()
		end)
	end
end
turnOff = function()
	Lighting.Ambient = Light
	if Light > 0.05 then
		Light = Light - 0.025
		Trigger.AfterDelay(1, function()
			turnOff()
		end)
	end
end

GiveMoney = function()
	if not newmcv0.IsDead and Multi0.Experience>0 and not GameIsOver then
		Multi0.Cash = Multi0.Cash + Multi0.Experience
		Media.FloatingText("" .. (Multi0.Experience) .. " $ Scorebonus", newmcv0.CenterPosition, 30, Multi0.Color)
	end
	if not newmcv1.IsDead and Multi1.Experience>0 and not GameIsOver then
		Multi1.Cash = Multi1.Cash + Multi1.Experience
		Media.FloatingText("" .. (Multi1.Experience) .. " $ Scorebonus", newmcv1.CenterPosition, 30, Multi1.Color)
	end
	if not newmcv2.IsDead and Multi2.Experience>0 and not GameIsOver then
		Multi2.Cash = Multi2.Cash + Multi2.Experience
		Media.FloatingText("" .. (Multi2.Experience) .. " $ Scorebonus", newmcv2.CenterPosition, 30, Multi2.Color)
	end
	if not newmcv3.IsDead and Multi3.Experience>0 and not GameIsOver then
		Multi3.Cash = Multi3.Cash + Multi3.Experience
		Media.FloatingText("" .. (Multi3.Experience) .. " $ Scorebonus", newmcv3.CenterPosition, 30, Multi3.Color)
	end
	Trigger.AfterDelay(DateTime.Seconds(4), function()
		GiveMoney()
	end)
end

Actors1 = { "q1d01", "q1d01", "q1d05", "q1d05", "q1d05", "q1d03" }

countH1 = 0
countV1 = 0
countH2 = 0
countH3 = 0
countV3 = 0
GroundMaker = function()
	if countV1 < 22 then
		if countH1 < 22 then
--			newactor = Actor.Create("q1d08", true, { Location = CPos.New(0,-2) + CVec.New(countH1, countV1), Owner = France })
--			newactor = Actor.Create("q1d11", true, { Location = CPos.New(0,34) + CVec.New(countH1, countV1), Owner = France })
			countH1 = countH1 + 5
		elseif countH1 > 22 then
			RandomActor1 = Utils.Random(Actors1)
			RandomActor2 = Utils.Random(Actors1)
--			newactor = Actor.Create(RandomActor1, true, { Location = CPos.New(0,-2) + CVec.New(countH1, countV1), Owner = France })
--			newactor = Actor.Create(RandomActor2, true, { Location = CPos.New(0,34) + CVec.New(countH1, countV1), Owner = France })
			countH1 = countH1 + 5
			if countH1 > 55 then
				countV1 = countV1 + 5
				countH1 = 0
			end
		
		end
		GroundMaker()
	end
	if countH2 < 15 then
		newactor = Actor.Create("nix03", true, { Location = CPos.New(0,26) + CVec.New(countH2, 0), Owner = France })
		newactor = Actor.Create("nix03", true, { Location = CPos.New(0,28) + CVec.New(countH2, 0), Owner = France })
	end
	if countH2 < 45 then
		newactor = Actor.Create("q1d12", true, { Location = CPos.New(0,23) + CVec.New(countH2, 0), Owner = France })

		newactor = Actor.Create("q1d12", true, { Location = CPos.New(0,31) + CVec.New(countH2, 0), Owner = France })
		countH2 = countH2 + 3
	end
	if countV3 < 9 then
		newactor = Actor.Create("q1d12", true, { Location = CPos.New(45,23) + CVec.New(countH3, countV3), Owner = France })
		countH3 = countH3 + 3	
		if countH3 > 9 then
			countH3 = 0
			if countV3 < 6 or countV3 > 6 then
				countV3 = countV3 + 3
			elseif countV3 == 6 then
				countV3 = countV3 + 2
			end
		end
	end
end
countVT = 0
countHT = 0
CoverTop = function()
	if countVT < 30 then
		newactor = Actor.Create("nix04", true, { Location = CPos.New(0,0) + CVec.New(countHT, countVT), Owner = France })
		countHT = countHT + 3	
		if countHT > 55 then
			countHT = 0
			countVT = countVT + 3
		end
		CoverTop()
	end
end
countVB = 0
countHB = 0
CoverBottom = function()
	if countVB < 30 then
		newactor = Actor.Create("nix04", true, { Location = CPos.New(0,27) + CVec.New(countHB, countVB), Owner = France })
		countHB = countHB + 3	
		if countHB > 55 then
			countHB = 0
			countVB = countVB + 3
		end
		CoverBottom()
	end
end

countVTB = 0
countHTB = 0
BombTop = function()
	if countVTB < 20 then
		newactor = Actor.Create("dtrk", true, { Location = CPos.New(5,5) + CVec.New(countHTB, countVTB), Owner = France })
		countHTB = countHTB + 10	
		if countHTB > 50 then
			countHTB = 0
			countVTB = countVTB + 6
		end
--		Trigger.AfterDelay(1, function()
--		newactor.Kill()
		BombTop()
--		end)
	end
end

countVBB = 0
countHBB = 0
BombBottom = function()
	if countVBB < 20 then
		newactor = Actor.Create("dtrk", true, { Location = CPos.New(10,35) + CVec.New(countHBB, countVBB), Owner = France })
		countHBB = countHBB + 10	
		if countHBB > 50 then
			countHBB = 0
			countVBB = countVBB + 6
		end
--		Trigger.AfterDelay(1, function()
--		newactor.Kill()
		BombBottom()
--		end)
	end
end


PlayerObjectives = function()
	KillbaseP1 = Multi0.AddPrimaryObjective("Kill the top enemys Mainbase")
	KillbaseP2 = Multi1.AddPrimaryObjective("Kill the top enemys Mainbase")
	KillbaseP3 = Multi2.AddPrimaryObjective("Kill the bottom enemys Mainbase")
	KillbaseP4 = Multi3.AddPrimaryObjective("Kill the bottom enemys Mainbase")
end
SetStartingCamera = function()
	Trigger.AfterDelay(1, function()
		Protectorsign = Actor.Create("nix01pr", true, { Location = CPos.New(5,28), Owner = Multi0 })
		if Multi0.IsLocalPlayer then
			SetCamera(Multi0)
		elseif Multi1.IsLocalPlayer then
			SetCamera(Multi1)
		elseif Multi2.IsLocalPlayer then
			SetCamera(Multi2)
		elseif Multi3.IsLocalPlayer then
			SetCamera(Multi3)
		end
	end)
end
BurningConditioner = function()
	fireantz = EnemysTop.GetActorsByType("fireant")
	for p,fireants in pairs(fireantz) do
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(1, 10)), function()
			if fireants.IsInWorld then fireants.GrantCondition("fireon", Utils.RandomInteger(43, 185)) end
		end)
	end
	lavaantz = EnemysTop.GetActorsByType("lavaant")
	for p,lavaants in pairs(lavaantz) do
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(1, 10)), function()
			if lavaants.IsInWorld then lavaants.GrantCondition("fireon", Utils.RandomInteger(60, 235)) end
		end)
	end
	fireantz = EnemysBottom.GetActorsByType("fireant")
	for p,fireants in pairs(fireantz) do
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(1, 10)), function()
			if fireants.IsInWorld then fireants.GrantCondition("fireon", Utils.RandomInteger(43, 185)) end
		end)
	end
	lavaantz = EnemysBottom.GetActorsByType("lavaant")
	for p,lavaants in pairs(lavaantz) do
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(1, 10)), function()
			if lavaants.IsInWorld then lavaants.GrantCondition("fireon", Utils.RandomInteger(60, 235)) end
		end)
	end
	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(12, 18)), function()
		BurningConditioner()
	end)
end



StartingMessages = function()
	Media.DisplayMessage("Defend your bases against the incoming forces.", "Materia", TimerColor)	
	Trigger.AfterDelay(DateTime.Seconds(5), function()
		Media.DisplayMessage("These are the enemy force amounts.\nAllie units: " .. AllieUnitPercent .. "0%\nSoviet units: " .. SovietUnitPercent .. "0%\nGDI units: " .. GdiUnitPercent .. "0%\nNOD units: " .. NodUnitPercent .. "0%\nDoomed Monsters: " .. MonsterUnitPercent .. "0%\nGiant Ants: " .. AntUnitPercent .. "0%\nDinosaurs: " .. DinoUnitPercent .. "0%\nThe Sneakattack level is set to " .. SneakattackLevel .. " ", "Materia", TimerColor)
	end)
	Trigger.AfterDelay(DateTime.Seconds(10), function()
		Media.DisplayMessage("Try to destroy the enemys base in front of you.", "Materia", TimerColor)
	end)
	Trigger.AfterDelay(DateTime.Seconds(15), function()
		Media.DisplayMessage("You can capture Oilderricks by moving any unit close to it.", "Materia", TimerColor)
		Media.PlaySoundNotification( allplayers, "Beacon")
		Beacon.New(Multi0, Actor37.CenterPosition, 1000, true)
		Beacon.New(Multi0, Actor38.CenterPosition, 1000, true)
		Beacon.New(Multi1, Actor39.CenterPosition, 1000, true)
		Beacon.New(Multi1, Actor40.CenterPosition, 1000, true)
		Beacon.New(Multi2, Actor41.CenterPosition, 1000, true)
		Beacon.New(Multi2, Actor42.CenterPosition, 1000, true)
		Beacon.New(Multi3, Actor43.CenterPosition, 1000, true)
		Beacon.New(Multi3, Actor44.CenterPosition, 1000, true)

	end)
	Trigger.AfterDelay(DateTime.Seconds(18), function()
		Media.DisplayMessage("Oilderricks give you buildarea.", "Materia", TimerColor)
	end)
	Trigger.AfterDelay(DateTime.Seconds(23), function()
		Media.DisplayMessage("All chargetimes are halfed.", "Materia", TimerColor)
	end)
end
TBridgebuilder1= { CPos.New(42, 25), CPos.New(43, 25), CPos.New(44, 25) }
TBridgebuilder2= { CPos.New(39, 25), CPos.New(40, 25), CPos.New(41, 25) }
TBridgebuilder3= { CPos.New(36, 25), CPos.New(37, 25), CPos.New(38, 25) }
TBridgebuilder4= { CPos.New(33, 25), CPos.New(34, 25), CPos.New(35, 25) }
TBridgebuilder5= { CPos.New(30, 25), CPos.New(31, 25), CPos.New(32, 25) }
TBridgebuilder6= { CPos.New(27, 25), CPos.New(28, 25), CPos.New(29, 25) }
TBridgebuilder7= { CPos.New(24, 25), CPos.New(25, 25), CPos.New(26, 25) }
TBridgebuilder8= { CPos.New(21, 25), CPos.New(22, 25), CPos.New(23, 25) }
TBridgebuilder9= { CPos.New(18, 25), CPos.New(19, 25), CPos.New(20, 25) }
TBridgebuilder10= { CPos.New(15, 25), CPos.New(16, 25), CPos.New(17, 25) }
BBridgebuilder1= { CPos.New(42, 31), CPos.New(43, 31), CPos.New(44, 31) }
BBridgebuilder2= { CPos.New(39, 31), CPos.New(40, 31), CPos.New(41, 31) }
BBridgebuilder3= { CPos.New(36, 31), CPos.New(37, 31), CPos.New(38, 31) }
BBridgebuilder4= { CPos.New(33, 31), CPos.New(34, 31), CPos.New(35, 31) }
BBridgebuilder5= { CPos.New(30, 31), CPos.New(31, 31), CPos.New(32, 31) }
BBridgebuilder6= { CPos.New(27, 31), CPos.New(28, 31), CPos.New(29, 31) }
BBridgebuilder7= { CPos.New(24, 31), CPos.New(25, 31), CPos.New(26, 31) }
BBridgebuilder8= { CPos.New(21, 31), CPos.New(22, 31), CPos.New(23, 31) }
BBridgebuilder9= { CPos.New(18, 31), CPos.New(19, 31), CPos.New(20, 31) }
BBridgebuilder10= { CPos.New(15, 31), CPos.New(16, 31), CPos.New(17, 31) }
EngiePointN= { CPos.New(16, 25) }
EngiePointS= { CPos.New(16, 31) }

SetBridgeTriggers = function()
	Trigger.OnEnteredFootprint(EngiePointN, function(a, id) 
		if a.Type == "e6" and a.Owner == EnemysTop and Team1plays then
			a.Stop()
			if a.IsInWorld and newmcv1.IsInWorld and newmcv1.Owner ~= Player.GetPlayer("Creeps") and newmcv1.Owner ~= EnemysTop and not newmcv1.IsDead  then
				a.Capture(newmcv1)
			elseif a.IsInWorld and newmcv0.IsInWorld and newmcv0.Owner ~= Player.GetPlayer("Creeps") and newmcv0.Owner ~= EnemysTop then
				a.Capture(newmcv0)
			elseif a.IsInWorld then
				a.Scatter()
			end
		end
	end)
	Trigger.OnEnteredFootprint(EngiePointS, function(a, id) 
		if a.Type == "e6" and a.Owner == EnemysBottom and Team2plays then
			a.Stop()
			if a.IsInWorld and newmcv2.IsInWorld and newmcv2.Owner ~= Player.GetPlayer("Creeps") and newmcv2.Owner ~= EnemysBottom and not newmcv2.IsDead  then
				a.Capture(newmcv2)
			elseif a.IsInWorld and newmcv3.IsInWorld and newmcv3.Owner ~= Player.GetPlayer("Creeps") and newmcv3.Owner ~= EnemysBottom then
				a.Capture(newmcv3)
			elseif a.IsInWorld then
				a.Scatter()
			end
		end
	end)
	NIX1 = Actor.Create("nix03", true, { Location = CPos.New(42,26), Owner = France })
	Trigger.OnEnteredFootprint(TBridgebuilder1, function(a, id) 
		if a.Type == "e6" and a.Owner ~= Neutral then
			Trigger.RemoveFootprintTrigger(id)
			Trigger.AfterDelay(DateTime.Seconds(1), function()
				NIX1.Destroy()
				a.Owner = Neutral
				if not a.IsDead then a.Kill() end
				Bridge1 = Actor.Create("q1d12", true, { Location = (CPos.New(42,26)), Owner = France })
			end)
		end
	end)
	NIX2 = Actor.Create("nix03", true, { Location = CPos.New(39,26), Owner = France })
	Trigger.OnEnteredFootprint(TBridgebuilder2, function(a, id) 
		if a.Type == "e6" and a.Owner ~= Neutral then
			Trigger.RemoveFootprintTrigger(id)
			Trigger.AfterDelay(DateTime.Seconds(1), function()
				NIX2.Destroy()
				a.Owner = Neutral 
				if not a.IsDead then a.Kill() end
				Bridge1 = Actor.Create("q1d12", true, { Location = (CPos.New(39,26)), Owner = France })
			end)
		end
	end)
	NIX3 = Actor.Create("nix03", true, { Location = CPos.New(36,26), Owner = France })
	Trigger.OnEnteredFootprint(TBridgebuilder3, function(a, id) 
		if a.Type == "e6" and a.Owner ~= Neutral then
			Trigger.RemoveFootprintTrigger(id)
			Trigger.AfterDelay(DateTime.Seconds(1), function()
				NIX3.Destroy()
				a.Owner = Neutral 
				if not a.IsDead then a.Kill() end
				Bridge1 = Actor.Create("q1d12", true, { Location = (CPos.New(36,26)), Owner = France })
			end)
		end
	end)
	NIX4 = Actor.Create("nix03", true, { Location = CPos.New(33,26), Owner = France })
	Trigger.OnEnteredFootprint(TBridgebuilder4, function(a, id) 
		if a.Type == "e6" and a.Owner ~= Neutral then
			Trigger.RemoveFootprintTrigger(id)
			Trigger.AfterDelay(DateTime.Seconds(1), function()
				NIX4.Destroy()
				a.Owner = Neutral 
				if not a.IsDead then a.Kill() end
				Bridge1 = Actor.Create("q1d12", true, { Location = (CPos.New(33,26)), Owner = France })
			end)
		end
	end)
	NIX5 = Actor.Create("nix03", true, { Location = CPos.New(30,26), Owner = France })
	Trigger.OnEnteredFootprint(TBridgebuilder5, function(a, id) 
		if a.Type == "e6" and a.Owner ~= Neutral then
			Trigger.RemoveFootprintTrigger(id)
			Trigger.AfterDelay(DateTime.Seconds(1), function()
				NIX5.Destroy()
				a.Owner = Neutral 
				if not a.IsDead then a.Kill() end
				Bridge1 = Actor.Create("q1d12", true, { Location = (CPos.New(30,26)), Owner = France })
			end)
		end
	end)
	NIX6 = Actor.Create("nix03", true, { Location = CPos.New(27,26), Owner = France })
	Trigger.OnEnteredFootprint(TBridgebuilder6, function(a, id) 
		if a.Type == "e6" and a.Owner ~= Neutral then
			Trigger.RemoveFootprintTrigger(id)
			Trigger.AfterDelay(DateTime.Seconds(1), function()
				NIX6.Destroy()
				a.Owner = Neutral 
				if not a.IsDead then a.Kill() end
				Bridge1 = Actor.Create("q1d12", true, { Location = (CPos.New(27,26)), Owner = France })
			end)
		end
	end)
	NIX7 = Actor.Create("nix03", true, { Location = CPos.New(24,26), Owner = France })
	Trigger.OnEnteredFootprint(TBridgebuilder7, function(a, id) 
		if a.Type == "e6" and a.Owner ~= Neutral then
			Trigger.RemoveFootprintTrigger(id)
			Trigger.AfterDelay(DateTime.Seconds(1), function()
				NIX7.Destroy()
				a.Owner = Neutral 
				if not a.IsDead then a.Kill() end
				Bridge1 = Actor.Create("q1d12", true, { Location = (CPos.New(24,26)), Owner = France })
			end)
		end
	end)
	NIX8 = Actor.Create("nix03", true, { Location = CPos.New(21,26), Owner = France })
	Trigger.OnEnteredFootprint(TBridgebuilder8, function(a, id) 
		if a.Type == "e6" and a.Owner ~= Neutral then
			Trigger.RemoveFootprintTrigger(id)
			Trigger.AfterDelay(DateTime.Seconds(1), function()
				NIX8.Destroy()
				a.Owner = Neutral 
				if not a.IsDead then a.Kill() end
				Bridge1 = Actor.Create("q1d12", true, { Location = (CPos.New(21,26)), Owner = France })
			end)
		end
	end)
	NIX9 = Actor.Create("nix03", true, { Location = CPos.New(18,26), Owner = France })
	Trigger.OnEnteredFootprint(TBridgebuilder9, function(a, id) 
		if a.Type == "e6" and a.Owner ~= Neutral then
			Trigger.RemoveFootprintTrigger(id)
			Trigger.AfterDelay(DateTime.Seconds(1), function()
				NIX9.Destroy()
				a.Owner = Neutral 
				if not a.IsDead then a.Kill() end
				Bridge1 = Actor.Create("q1d12", true, { Location = (CPos.New(18,26)), Owner = France })
			end)
		end
	end)
	NIX10 = Actor.Create("nix03", true, { Location = CPos.New(15,26), Owner = France })
	Trigger.OnEnteredFootprint(TBridgebuilder10, function(a, id) 
		if a.Type == "e6" and a.Owner ~= Neutral then
			Trigger.RemoveFootprintTrigger(id)
			Trigger.AfterDelay(DateTime.Seconds(1), function()
				NIX10.Destroy()
				a.Owner = Neutral 
				if not a.IsDead then a.Kill() end
				Bridge1 = Actor.Create("q1d12", true, { Location = (CPos.New(15,26)), Owner = France })
			end)
		end
	end)
	NIX11 = Actor.Create("nix03", true, { Location = CPos.New(42,28), Owner = France })
	Trigger.OnEnteredFootprint(BBridgebuilder1, function(a, id) 
		if a.Type == "e6" and a.Owner ~= Neutral then
			Trigger.RemoveFootprintTrigger(id)
			Trigger.AfterDelay(DateTime.Seconds(1), function()
				NIX11.Destroy()
				a.Owner = Neutral 
				if not a.IsDead then a.Kill() end
				Bridge1 = Actor.Create("q1d12", true, { Location = (CPos.New(42,28)), Owner = France })
			end)
		end
	end)
	NIX12 = Actor.Create("nix03", true, { Location = CPos.New(39,28), Owner = France })
	Trigger.OnEnteredFootprint(BBridgebuilder2, function(a, id) 
		if a.Type == "e6" and a.Owner ~= Neutral then
			Trigger.RemoveFootprintTrigger(id)
			Trigger.AfterDelay(DateTime.Seconds(1), function()
				NIX12.Destroy()
				a.Owner = Neutral 
				if not a.IsDead then a.Kill() end
				Bridge1 = Actor.Create("q1d12", true, { Location = (CPos.New(39,28)), Owner = France })
			end)
		end
	end)
	NIX13 = Actor.Create("nix03", true, { Location = CPos.New(36,28), Owner = France })
	Trigger.OnEnteredFootprint(BBridgebuilder3, function(a, id) 
		if a.Type == "e6" and a.Owner ~= Neutral then
			Trigger.RemoveFootprintTrigger(id)
			Trigger.AfterDelay(DateTime.Seconds(1), function()
				NIX13.Destroy()
				a.Owner = Neutral 
				if not a.IsDead then a.Kill() end
				Bridge1 = Actor.Create("q1d12", true, { Location = (CPos.New(36,28)), Owner = France })
			end)
		end
	end)
	NIX14 = Actor.Create("nix03", true, { Location = CPos.New(33,28), Owner = France })
	Trigger.OnEnteredFootprint(BBridgebuilder4, function(a, id) 
		if a.Type == "e6" and a.Owner ~= Neutral then
			Trigger.RemoveFootprintTrigger(id)
			Trigger.AfterDelay(DateTime.Seconds(1), function()
				NIX14.Destroy()
				a.Owner = Neutral 
				if not a.IsDead then a.Kill() end
				Bridge1 = Actor.Create("q1d12", true, { Location = (CPos.New(33,28)), Owner = France })
			end)
		end
	end)
	NIX15 = Actor.Create("nix03", true, { Location = CPos.New(30,28), Owner = France })
	Trigger.OnEnteredFootprint(BBridgebuilder5, function(a, id) 
		if a.Type == "e6" and a.Owner ~= Neutral then
			Trigger.RemoveFootprintTrigger(id)
			Trigger.AfterDelay(DateTime.Seconds(1), function()
				NIX15.Destroy()
				a.Owner = Neutral 
				if not a.IsDead then a.Kill() end
				Bridge1 = Actor.Create("q1d12", true, { Location = (CPos.New(30,28)), Owner = France })
			end)
		end
	end)
	NIX16 = Actor.Create("nix03", true, { Location = CPos.New(27,28), Owner = France })
	Trigger.OnEnteredFootprint(BBridgebuilder6, function(a, id) 
		if a.Type == "e6" and a.Owner ~= Neutral then
			Trigger.RemoveFootprintTrigger(id)
			Trigger.AfterDelay(DateTime.Seconds(1), function()
				NIX16.Destroy()
				a.Owner = Neutral 
				if not a.IsDead then a.Kill() end
				Bridge1 = Actor.Create("q1d12", true, { Location = (CPos.New(27,28)), Owner = France })
			end)
		end
	end)
	NIX17 = Actor.Create("nix03", true, { Location = CPos.New(24,28), Owner = France })
	Trigger.OnEnteredFootprint(BBridgebuilder7, function(a, id) 
		if a.Type == "e6" and a.Owner ~= Neutral then
			Trigger.RemoveFootprintTrigger(id)
			Trigger.AfterDelay(DateTime.Seconds(1), function()
				NIX17.Destroy()
				a.Owner = Neutral 
				if not a.IsDead then a.Kill() end
				Bridge1 = Actor.Create("q1d12", true, { Location = (CPos.New(24,28)), Owner = France })
			end)
		end
	end)
	NIX18 = Actor.Create("nix03", true, { Location = CPos.New(21,28), Owner = France })
	Trigger.OnEnteredFootprint(BBridgebuilder8, function(a, id) 
		if a.Type == "e6" and a.Owner ~= Neutral then
			Trigger.RemoveFootprintTrigger(id)
			Trigger.AfterDelay(DateTime.Seconds(1), function()
				NIX18.Destroy()
				a.Owner = Neutral 
				if not a.IsDead then a.Kill() end
				Bridge1 = Actor.Create("q1d12", true, { Location = (CPos.New(21,28)), Owner = France })
			end)
		end
	end)
	NIX19 = Actor.Create("nix03", true, { Location = CPos.New(18,28), Owner = France })
	Trigger.OnEnteredFootprint(BBridgebuilder9, function(a, id) 
		if a.Type == "e6" and a.Owner ~= Neutral then
			Trigger.RemoveFootprintTrigger(id)
			Trigger.AfterDelay(DateTime.Seconds(1), function()
				NIX19.Destroy()
				a.Owner = Neutral 
				if not a.IsDead then a.Kill() end
				Bridge1 = Actor.Create("q1d12", true, { Location = (CPos.New(18,28)), Owner = France })
			end)
		end
	end)
	NIX20 = Actor.Create("nix03", true, { Location = CPos.New(15,28), Owner = France })
	Trigger.OnEnteredFootprint(BBridgebuilder10, function(a, id) 
		if a.Type == "e6" and a.Owner ~= Neutral then
			Trigger.RemoveFootprintTrigger(id)
			Trigger.AfterDelay(DateTime.Seconds(1), function()
				NIX20.Destroy()
				a.Owner = Neutral 
				if not a.IsDead then a.Kill() end
				Bridge1 = Actor.Create("q1d12", true, { Location = (CPos.New(15,28)), Owner = France })
			end)
		end
	end)
end

function WorldLoaded()
	SetupPlayers()
	SetStartingCamera()
	GroundMaker()
	SetBridgeTriggers()
	UnitAmountCheck()
	MCVincome()
	GetandsetFlags()
	GiveMoney()
	PlayerObjectives()
	turnOn()
end

Team1plays = true
Team2plays = true
TimerColor = HSLColor.LawnGreen

Tick = function()
	if DestroyedBuildings1 > 3 or DestroyedBuildings2 > 3 and not TimerRed then
		TimerColor = HSLColor.Red
		TimerRed = true
	end
	if Team1plays and Team2plays then
		UserInterface.SetMissionText("Team 1   " .. (DestroyedBuildings1) .. " / 5 destroyed Enemy buildings                                   Team 2   " .. (DestroyedBuildings2) .. " / 5 destroyed Enemy buildings" , TimerColor)
	elseif Team1plays and not Team2plays then
		UserInterface.SetMissionText("Team 1   " .. (DestroyedBuildings1) .. " / 5 destroyed Enemy buildings" , TimerColor)

	elseif Team2plays and not Team1plays then
		UserInterface.SetMissionText("Team 2   " .. (DestroyedBuildings2) .. " / 5 destroyed Enemy buildings" , TimerColor)
	else
		UserInterface.SetMissionText(" ", TimerColor)
	end
end
