
RAunitsConditions = function()
	InfDelayTimemin = 1
	InfDelayTimemax = 3
	EnemyInfUnit = { "dog", "dog" }
	EnemyInfantryIncome()
	Trigger.AfterDelay(DateTime.Seconds(15), function()
		InfDelayTimemin = 2
		EnemyInfUnit = { "e1", "e3", "e2", "dog" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(1), function()
		EnemyInfUnit = { "e1", "e1", "e2", "e3", "medi", "dog" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(2), function()
		VehDelayTimemin = 7
		VehDelayTimemax = 10
		EnemyInfUnit = { "e1", "e1", "e2", "e3", "e4", "medi", "medi", "dog" }
		EnemyVehUnit = { "apc", "1tnk", "jeep", "ftrk" }
		EnemyVehicleIncome()
	end)
	Trigger.AfterDelay(DateTime.Minutes(3), function()
		InfDelayTimemin = 1
		EnemyInfUnit = { "e1", "e2", "e3", "e4", "medi", "medi", "dog", "mech" }
		EnemyVehUnit = { "apc", "1tnk", "1tnk", "jeep", "ftrk" }
		VehDelayTimemin = 6
	end)
	Trigger.AfterDelay(DateTime.Minutes(4), function()
		VehDelayTimemin = 5
		EnemyVehUnit = { "apc", "1tnk", "1tnk", "jeep", "ftrk", "ftrk" }
		TnkDelayTimemin = 12
		TnkDelayTimemax = 14
		EnemyTnkUnit = { "2tnk", "3tnk" }
		EnemyTnkIncome()
	end)
	Trigger.AfterDelay(DateTime.Minutes(5), function()
		EnemyInfUnit = { "e1", "e2", "e3", "e4", "medi", "medi", "medi", "dog", "mech", "mech" }
		HeliDelayTimemin = 12
		HeliDelayTimemax = 14
		EnemyHeliUnit = { "hind", "mh60" }
		ArtyDelayTimemin = 15
		ArtyDelayTimemax = 17
		EnemyArtyUnit = { "v2rl", "arty" }
		EnemyArtyIncome()
		EnemyHeliIncome()
	end)
	Trigger.AfterDelay(DateTime.Minutes(6), function()
		EnemyInfUnit = { "e1", "e2", "e3", "e4", "medi", "medi", "dog", "mech", "mech", "shok", "shok" }
		EnemyHeliUnit = { "heli", "hind", "mh60" }
		EnemyTnkUnit = { "2tnk", "3tnk", "ctnk", "4tnk" }
		TnkDelayTimemin = 10
		ArtyDelayTimemin = 14
	end)
	Trigger.AfterDelay(DateTime.Minutes(7), function()
		ArtyDelayTimemin = 13
		EnemyInfUnit = { "e1", "e2", "e3", "e4", "medi", "medi", "dog", "mech", "mech", "shok", "shok", "shok" }
		EnemyTnkUnit = { "2tnk", "3tnk", "ctnk", "ttnk", "4tnk", "4tnk" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(8), function()
		EnemyInfUnit = { "e1", "e2", "e3", "e4", "medi", "medi", "dog", "mech", "mech", "shok", "shok", "shok", "shok" }
		EnemyTnkUnit = { "2tnk", "3tnk", "ctnk", "ttnk", "ttnk", "4tnk", "4tnk" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(9), function()
		EnemyVehUnit = { "apc", "1tnk", "1tnk", "1tnk", "jeep", "ftrk", "ftrk", "ftrk", "ftrk", "ftrk" }
		VehDelayTimemin = 4
	end)
	Trigger.AfterDelay(DateTime.Minutes(10), function()
		TnkDelayTimemin = 7
		ArtyDelayTimemin = 12
		EnemyHeliUnit = { "heli", "heli", "heli", "hind", "mh60" }
	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" }
	EnemyMonsterIncome()
	Trigger.AfterDelay(DateTime.Minutes(1), function()
		MonsterDelayTimemin = 6
		EnemyMonsterUnit = { "PVICE", "BSPI" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(2), function()
		MonsterDelayTimemin = 7
		EnemyMonsterUnit = { "PVICE", "IMP", "BSPI", "BSPI" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(3), function()
		MonsterDelayTimemin = 8
		EnemyMonsterUnit = { "PVICE", "IMP", "IMP", "BSPI", "BSPI", "REVE" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(4), function()
		MonsterDelayTimemin = 9
		EnemyMonsterUnit = { "PVICE", "IMP", "IMP", "BSPI", "BSPI", "REVE", "REVE" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(5), function()
		MonsterDelayTimemin = 10
		EnemyMonsterUnit = { "PVICE", "IMP", "IMP", "BSPI", "BSPI", "REVE", "REVE" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(6), function()
		MonsterDelayTimemin = 11
		EnemyMonsterUnit = { "PVICE", "IMP", "IMP", "IMP", "REVE", "REVE", "BSPI", "BSPI", "PINKY" }
	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()
		MonsterDelayTimemin = 10
	end)
	Trigger.AfterDelay(DateTime.Minutes(9), function()
		EnemyMonsterUnit = { "IMP", "IMP", "IMP", "REVE", "REVE", "BSPI", "BSPI", "BSPI", "PINKY", "MANC" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(10), function()
		MonsterDelayTimemin = 9
	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()
	EnemyDinoUnit = { "GALLIMUS", "PARAUSAR", "STEGOSAUR", "TRICERATOPS", "ALLOSAURUS", "TYREX", "BRACHIOSAURUS" }
	end)
end

CustomConditions = function()
	CustomLightDelayTimemin = 6
	CustomLightDelayTimemax = 8
	EnemyCustomLightUnit = { "zombie", "BIKE" }
	EnemyCustomLightIncome()
	Trigger.AfterDelay(DateTime.Minutes(1), function()
		CustomLightDelayTimemin = 5
		EnemyCustomLightUnit = { "zombie", "BIKE", "BGGY" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(2), function()
		CustomLightDelayTimemin = 4
		EnemyCustomLightUnit = { "zombie", "BIKE", "HUMV", "BGGY" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(3), function()
		EnemyCustomLightUnit = { "zombie", "HUMV", "BIKE", "BGGY", "FTNKcnc" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(4), function()
		EnemyCustomLightUnit = { "zombie", "HUMV", "BIKE", "BGGY", "FTNKcnc", "FTNKcnc" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(5), function()
		CustomArtyDelayTimemin = 10
		CustomArtyDelayTimemax = 12
		EnemyCustomArtyUnit = { "MSAM", "ARTYcnc" }
		EnemyCustomArtyIncome()
		CustomHeliDelayTimemin = 15
		CustomHeliDelayTimemax = 17
		EnemyCustomHeliUnit = { "lynx", "cobra", "huey" }
		EnemyCustomHeliIncome()
	end)
	Trigger.AfterDelay(DateTime.Minutes(6), function()
		CustomArtyDelayTimemin = 9
		EnemyCustomHeliUnit = { "lynx", "cobra", "huey", "UFO.Beamer", "UFO.LASER" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(7), function()
		CustomLightDelayTimemin = 3
		CustomArtyDelayTimemin = 8
		EnemyCustomHeliUnit = { "lynx", "cobra", "huey", "UFO.Beamer", "UFO.LASER", "UFO" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(8), function()
		CustomArtyDelayTimemin = 7
		CustomHeavyDelayTimemin = 25
		CustomHeavyDelayTimemax = 27
		EnemyCustomHeavyUnit = { "godzilla" }
		EnemyCustomHeavyIncome()
	end)
	Trigger.AfterDelay(DateTime.Minutes(9), function()
		CustomHeliDelayTimemin = 11
		EnemyCustomHeavyUnit = { "godzilla", "kingkong" }
	end)
	Trigger.AfterDelay(DateTime.Minutes(10), function()
		CustomHeavyDelayTimemin = 20
		EnemyCustomHeavyUnit = { "godzilla", "kingkong", "superman" }
		EnemyCustomHeliUnit = { "lynx", "cobra", "huey", "UFO", "UFO" }
	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

RAUnits = true
MonsterUnits = true
AntUnits = true
DinoUnits = true
CustomUnits = true

UnitAmountCheck = function()
	RAUnitsAmount()
	MonsterAmount()
	AntAmount()
	DinoAmount()
	CustomAmount()
	GeneralConditions()
	Trigger.AfterDelay(1, function()
		if RAUnits then
			Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(3, 25)), function()
				RAunitsConditions()
				Trigger.AfterDelay(DateTime.Seconds(3), function()
					RAWaveInterrupter()
				end)
			end)
		end
		if MonsterUnits then
			Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(3, 25)), function()
				MonsterConditions()
				Trigger.AfterDelay(DateTime.Seconds(3), function()
					MonsterWaveInterrupter()
				end)
			end)
		end
		if AntUnits then
			Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(3, 25)), function()
				AntConditions()
				Trigger.AfterDelay(DateTime.Seconds(3), function()
					AntWaveInterrupter()
				end)
			end)
		end
		if DinoUnits then
			Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(3, 25)), function()
				DinoConditions()
				Trigger.AfterDelay(DateTime.Seconds(3), function()
					DinoWaveInterrupter()
				end)
			end)
		end
		if CustomUnits then
			Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(3, 25)), function()
				CustomConditions()
				Trigger.AfterDelay(DateTime.Seconds(3), function()
					CustomWaveInterrupter()
				end)
			end)
		end
		if SneakattackLevel ~= "none" then
			SneakattackConditions()
		end
	end)
end

ChosenRAAmount = Map.LobbyOption("raamount")
ChosenMonsterAmount = Map.LobbyOption("monsteramount")
SneakattackLevel = Map.LobbyOption("sneaklevel")
ChosenAntAmount = Map.LobbyOption("antamount")
ChosenDinoAmount = Map.LobbyOption("dinoamount")
ChosenCustomAmount = Map.LobbyOption("customamount")

RAUnitsAmount = function()
	if ChosenRAAmount == "100%" then
		RAWaveInterval = 0
	elseif ChosenRAAmount == "90%" then
		RAWaveInterval = 1
	elseif ChosenRAAmount == "80%" then
		RAWaveInterval = 2
	elseif ChosenRAAmount == "70%" then
		RAWaveInterval = 3
	elseif ChosenRAAmount == "60%" then
		RAWaveInterval = 4
	elseif ChosenRAAmount == "50%" then
		RAWaveInterval = 5
	elseif ChosenRAAmount == "40%" then
		RAWaveInterval = 6
	elseif ChosenRAAmount == "30%" then
		RAWaveInterval = 7
	elseif ChosenRAAmount == "20%" then
		RAWaveInterval = 8
	elseif ChosenRAAmount == "10%" then
		RAWaveInterval = 9
	elseif ChosenRAAmount == "0" then
		RAUnits = false
		RAWaveInterval = 10
	end
	RAUnitPercent = 10 - RAWaveInterval
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
CustomAmount = function()
	if ChosenCustomAmount == "100%" then
		CustomWaveInterval = 0
	elseif ChosenCustomAmount == "90%" then
		CustomWaveInterval = 1
	elseif ChosenCustomAmount == "80%" then
		CustomWaveInterval = 2
	elseif ChosenCustomAmount == "70%" then
		CustomWaveInterval = 3
	elseif ChosenCustomAmount == "60%" then
		CustomWaveInterval = 4
	elseif ChosenCustomAmount == "50%" then
		CustomWaveInterval = 5
	elseif ChosenCustomAmount == "40%" then
		CustomWaveInterval = 6
	elseif ChosenCustomAmount == "30%" then
		CustomWaveInterval = 7
	elseif ChosenCustomAmount == "20%" then
		CustomWaveInterval = 8
	elseif ChosenCustomAmount == "10%" then
		CustomWaveInterval = 9
	elseif ChosenCustomAmount == "0" then
		CustomUnits = false
		CustomWaveInterval = 10
	end
	CustomUnitPercent = 10 - CustomWaveInterval
end
PeaceTime = false
MonsterPeaceTime = false
CustomPeaceTime = false
DinoPeaceTime = false
AntPeaceTime = false
RAWaveInterrupter = function()
	PeaceTime = true
	Trigger.AfterDelay(DateTime.Seconds(RAWaveInterval), function()
		PeaceTime = false
	end)
	Trigger.AfterDelay(DateTime.Seconds(10), function()
		RAWaveInterrupter()
	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
CustomWaveInterrupter = function()
	CustomPeaceTime = true
	Trigger.AfterDelay(DateTime.Seconds(CustomWaveInterval), function()
		CustomPeaceTime = false
	end)
	Trigger.AfterDelay(DateTime.Seconds(10), function()
		CustomWaveInterrupter()
	end)
end
EnemyInfantryIncome = function()
	if not PeaceTime 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(EnemyInfUnit)
		if RandomInfUnit == "e1" then InfDelayTimemax = 5
		elseif RandomInfUnit == "e2" then InfDelayTimemax = 4
		elseif RandomInfUnit == "e3" then InfDelayTimemax = 6
		elseif RandomInfUnit == "e4" then InfDelayTimemax = 9
		elseif RandomInfUnit == "medi" then InfDelayTimemax = 4
		elseif RandomInfUnit == "mech" then InfDelayTimemax = 6
		elseif RandomInfUnit == "shok" then InfDelayTimemax = 10
		elseif RandomInfUnit == "dog" then InfDelayTimemax = 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
		EnemyUnitN = Actor.Create(RandomInfUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
		EnemyUnitS = Actor.Create(RandomInfUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
		EnemyN = { EnemyUnitN }
		EnemyS = { EnemyUnitS }
		GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(0))
		GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(0))
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(InfDelayTimemin, InfDelayTimemax)), function()
			EnemyInfantryIncome()
		end)
	end)
end


EnemyVehicleIncome = function()
	if not PeaceTime 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(EnemyVehUnit)
		if RandomVehUnit == "apc" then VehDelayTimemax = 10
		elseif RandomVehUnit == "1tnk" then VehDelayTimemax = 15
		elseif RandomVehUnit == "jeep" then VehDelayTimemax = 8
		elseif RandomVehUnit == "ftrk" then VehDelayTimemax = 9 end
		EnemyUnitN = Actor.Create(RandomVehUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
		EnemyUnitS = Actor.Create(RandomVehUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
		if ICTime then EnemyUnitN.GrantCondition("invulnerability", DateTime.Seconds(15)) end
		if ICTime then EnemyUnitS.GrantCondition("invulnerability", DateTime.Seconds(15)) end
		EnemyN = { EnemyUnitN }
		EnemyS = { EnemyUnitS }
		GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(0))
		GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(0))
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(VehDelayTimemin, VehDelayTimemax)), function()
			EnemyVehicleIncome()
		end)
	end)
end

EnemyTnkIncome = function()
	if not PeaceTime 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(EnemyTnkUnit)
		if RandomTnkUnit == "2tnk" then TnkDelayTimemax = 18
		elseif RandomTnkUnit == "3tnk" then TnkDelayTimemax = 20
		elseif RandomTnkUnit == "ctnk" then TnkDelayTimemax = 14 
		elseif RandomTnkUnit == "4tnk" then TnkDelayTimemax = 29
		elseif RandomTnkUnit == "ttnk" then TnkDelayTimemax = 16 end
		EnemyUnitN = Actor.Create(RandomTnkUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
		EnemyUnitS = Actor.Create(RandomTnkUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
		if ICTime then EnemyUnitN.GrantCondition("invulnerability", DateTime.Seconds(19)) end
		if ICTime then EnemyUnitS.GrantCondition("invulnerability", DateTime.Seconds(19)) end
		EnemyN = { EnemyUnitN }
		EnemyS = { EnemyUnitS }
		GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(0))
		GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(0))
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(TnkDelayTimemin, TnkDelayTimemax)), function()
			EnemyTnkIncome()
		end)
	end)
end

EnemyArtyIncome = function()
	if not PeaceTime 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(EnemyArtyUnit)
		if RandomArtyUnit == "arty" then ArtyDelayTimemax = 20 
		elseif RandomArtyUnit == "v2rl" then ArtyDelayTimemax = 25 end
		EnemyUnitN = Actor.Create(RandomArtyUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
		EnemyUnitS = Actor.Create(RandomArtyUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
		if ICTime then EnemyUnitN.GrantCondition("invulnerability", DateTime.Seconds(15)) end
		if ICTime then EnemyUnitS.GrantCondition("invulnerability", DateTime.Seconds(15)) end
		EnemyN = { EnemyUnitN }
		EnemyS = { EnemyUnitS }
		GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(0))
		GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(0))
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(ArtyDelayTimemin, ArtyDelayTimemax)), function()
			EnemyArtyIncome()
		end)
	end)
end

EnemyHeliIncome = function()
	if not PeaceTime 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(EnemyHeliUnit)
		if RandomHeliUnit == "hind" then HeliDelayTimemax = 18
		elseif RandomHeliUnit == "mh60" then HeliDelayTimemax = 18
		elseif RandomHeliUnit == "heli" then HeliDelayTimemax = 25 end
		EnemyUnitN = Actor.Create(RandomHeliUnit, true, { Location = CPos.New(57,0) + CVec.New(0, RandomPosition), Owner = EnemysTop })
		EnemyUnitS = Actor.Create(RandomHeliUnit, true, { Location = CPos.New(57,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
		EnemyN = { EnemyUnitN }
		EnemyS = { EnemyUnitS }
		GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(0))
		GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(0))
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(HeliDelayTimemin, HeliDelayTimemax)), function()
			EnemyHeliIncome()
		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 == "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
		EnemyUnitN = Actor.Create(RandomMonsterUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
		EnemyUnitS = Actor.Create(RandomMonsterUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
		EnemyN = { EnemyUnitN }
		EnemyS = { EnemyUnitS }
		GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(0))
		GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(0))
	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 = 13
		elseif RandomAntUnit == "scoutant" then AntDelayTimemax = 10
		elseif RandomAntUnit == "warriorant" then AntDelayTimemax = 15
		elseif RandomAntUnit == "fireant" then AntDelayTimemax = 16
		elseif RandomAntUnit == "toxicant" then AntDelayTimemax = 18
		elseif RandomAntUnit == "electricant" then AntDelayTimemax = 19
		elseif RandomAntUnit == "lavaant" then AntDelayTimemax = 21 end
		EnemyUnitN = Actor.Create(RandomAntUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
		EnemyUnitS = Actor.Create(RandomAntUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
		EnemyN = { EnemyUnitN }
		EnemyS = { EnemyUnitS }
		GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(0))
		GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(0))
	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 = 16
		elseif RandomDinoUnit == "TRICERATOPS" then DinoDelayTimemax = 18
		elseif RandomDinoUnit == "STEGOSAUR" then DinoDelayTimemax = 18
		elseif RandomDinoUnit == "ALLOSAURUS" then DinoDelayTimemax = 20
		elseif RandomDinoUnit == "TYREX" then DinoDelayTimemax = 20
		elseif RandomDinoUnit == "BRACHIOSAURUS" then DinoDelayTimemax = 23
		elseif RandomDinoUnit == "GALLIMUS" then DinoDelayTimemax = 14
			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
		EnemyUnitN = Actor.Create(RandomDinoUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
		EnemyUnitS = Actor.Create(RandomDinoUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
		EnemyN = { EnemyUnitN }
		EnemyS = { EnemyUnitS }
		GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(0))
		GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(0))
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(DinoDelayTimemin, DinoDelayTimemax)), function()
			EnemyDinoIncome()
		end)
	end)
end


EnemyCustomLightIncome = function()
	if not CustomPeaceTime 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(EnemyCustomLightUnit)
		if RandomCustomUnit == "zombie" then CustomDelayTimemax = 9
		elseif RandomCustomUnit == "HUMV" then CustomDelayTimemax = 13
		elseif RandomCustomUnit == "BIKE" then CustomDelayTimemax = 14
		elseif RandomCustomUnit == "BGGY" then CustomDelayTimemax = 13
		elseif RandomCustomUnit == "FTNKcnc" then CustomDelayTimemax = 15 end
		EnemyUnitN = Actor.Create(RandomCustomUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
		EnemyUnitS = Actor.Create(RandomCustomUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
		EnemyN = { EnemyUnitN }
		EnemyS = { EnemyUnitS }
		GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(0))
		GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(0))
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(CustomLightDelayTimemin, CustomDelayTimemax)), function()
			EnemyCustomLightIncome()
		end)
	end)
end

EnemyCustomArtyIncome = function()
	if not CustomPeaceTime 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(EnemyCustomArtyUnit)
		if RandomCustomUnit == "MSAM" then CustomDelayTimemax = 19
		elseif RandomCustomUnit == "ARTYcnc" then CustomDelayTimemax = 15 end
		EnemyUnitN = Actor.Create(RandomCustomUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
		EnemyUnitS = Actor.Create(RandomCustomUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
		EnemyN = { EnemyUnitN }
		EnemyS = { EnemyUnitS }
		GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(0))
		GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(0))
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(CustomArtyDelayTimemin, CustomDelayTimemax)), function()
			EnemyCustomArtyIncome()
		end)
	end)
end


EnemyCustomHeliIncome = function()
	if not CustomPeaceTime 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 CustomDelayTimemax = 19
		elseif RandomCustomUnit == "cobra" then CustomDelayTimemax = 20
		elseif RandomCustomUnit == "huey" then CustomDelayTimemax = 21
		elseif RandomCustomUnit == "UFO.Beamer" then CustomDelayTimemax = 20
		elseif RandomCustomUnit == "UFO.LASER" then CustomDelayTimemax = 25
		elseif RandomCustomUnit == "UFO" then CustomDelayTimemax = 27 end
		EnemyUnitN = Actor.Create(RandomCustomUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
		EnemyUnitS = Actor.Create(RandomCustomUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
		EnemyN = { EnemyUnitN }
		EnemyS = { EnemyUnitS }
		GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(0))
		GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(0))
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(CustomHeliDelayTimemin, CustomDelayTimemax)), function()
			EnemyCustomHeliIncome()
		end)
	end)
end

EnemyCustomHeavyIncome = function()
	if not CustomPeaceTime 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 CustomDelayTimemax = 40
		elseif RandomCustomUnit == "kingkong" then CustomDelayTimemax = 42
		elseif RandomCustomUnit == "superman" then CustomDelayTimemax = 45 end
		EnemyUnitN = Actor.Create(RandomCustomUnit, true, { Location = CPos.New(55,1) + CVec.New(0, RandomPosition), Owner = EnemysTop })
		EnemyUnitS = Actor.Create(RandomCustomUnit, true, { Location = CPos.New(55,36) + CVec.New(0, RandomPosition), Owner = EnemysBottom })
		EnemyN = { EnemyUnitN }
		EnemyS = { EnemyUnitS }
		GroupPatrol(EnemyN, AttackpathN, DateTime.Seconds(0))
		GroupPatrol(EnemyS, AttackpathS, DateTime.Seconds(0))
	end
	Trigger.AfterDelay(1, function()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(CustomHeavyDelayTimemin, CustomDelayTimemax)), 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
			SendAirstrike()
		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()
	DetonationPoint1 = Actor.Create("waypoint", true, { Location = CPos.New(6,6) + CVec.New(Utils.RandomInteger(0, 25), Utils.RandomInteger(0, 11)), Owner = Neutral })
	DetonationPoint2 = Actor.Create("waypoint", true, { Location = CPos.New(6,39) + CVec.New(Utils.RandomInteger(0, 25), Utils.RandomInteger(0, 11)), Owner = Neutral })
	ParaProxy1 = Actor.Create("powerproxy.parabombs", false, { Owner = EnemysTop })
	ParaProxy2 = Actor.Create("powerproxy.parabombs", false, { Owner = EnemysBottom })
	units1 = ParaProxy1.SendAirstrike(DetonationPoint1.CenterPosition)
	units2 = ParaProxy2.SendAirstrike(DetonationPoint2.CenterPosition)
end
SendAirstrike = function()
	DetonationPoint1 = Actor.Create("waypoint", true, { Location = CPos.New(6,6) + CVec.New(Utils.RandomInteger(0, 25), Utils.RandomInteger(0, 11)), Owner = Neutral })
	DetonationPoint2 = Actor.Create("waypoint", true, { Location = CPos.New(6,39) + CVec.New(Utils.RandomInteger(0, 25), Utils.RandomInteger(0, 11)), Owner = Neutral })
	ParaProxy1 = Actor.Create("powerproxy.parayaks", false, { Owner = EnemysTop })
	ParaProxy2 = Actor.Create("powerproxy.parayaks", false, { Owner = EnemysBottom })
	units1 = ParaProxy1.SendAirstrike(DetonationPoint1.CenterPosition)
	units2 = ParaProxy2.SendAirstrike(DetonationPoint2.CenterPosition)
end
SendParatroopers = function()
	DetonationPoint1 = Actor.Create("waypoint", true, { Location = CPos.New(3,3) + CVec.New(Utils.RandomInteger(0, 25), Utils.RandomInteger(0, 4)), Owner = Neutral })
	DetonationPoint2 = Actor.Create("waypoint", true, { Location = CPos.New(3,48) + CVec.New(Utils.RandomInteger(0, 25), Utils.RandomInteger(0, 4)), Owner = Neutral })
	ParaProxy1 = Actor.Create("powerproxy.paratroopers", false, { Owner = EnemysTop })
	ParaProxy2 = Actor.Create("powerproxy.paratroopers", false, { Owner = EnemysBottom })
	units1 = ParaProxy1.SendParatroopers(DetonationPoint1.CenterPosition)
	units2 = ParaProxy2.SendParatroopers(DetonationPoint2.CenterPosition)
end
SendParaparazombies = function()
	DetonationPoint1 = Actor.Create("waypoint", true, { Location = CPos.New(3,3) + CVec.New(Utils.RandomInteger(0, 25), Utils.RandomInteger(0, 11)), Owner = Neutral })
	DetonationPoint2 = Actor.Create("waypoint", true, { Location = CPos.New(3,42) + CVec.New(Utils.RandomInteger(0, 25), Utils.RandomInteger(0, 11)), Owner = Neutral })
	ParaProxy1 = Actor.Create("powerproxy.parazombies", false, { Owner = EnemysTop })
	ParaProxy2 = Actor.Create("powerproxy.parazombies", false, { Owner = EnemysBottom })
	units1 = ParaProxy1.SendParatroopers(DetonationPoint1.CenterPosition)
	units2 = ParaProxy2.SendParatroopers(DetonationPoint2.CenterPosition)
end
Demotruckincome = function()
	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(20, 30)), function()
		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)) }
		DemoN = Actor.Create("dtrk", true, { Location = CPos.New(55,5), Owner = EnemysTop })
		DemoS = Actor.Create("dtrk", true, { Location = CPos.New(55,50), Owner = EnemysBottom })
		DtrukN = { DemoN }
		DtrukS = { DemoS }
		MovePatrol(DtrukN, AttackpathN, DateTime.Seconds(3))
		MovePatrol(DtrukS, AttackpathS, DateTime.Seconds(3))
	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()
	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)) })
	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


SneakApcs = function()
	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]
	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

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

StealthTanya = function()
	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(0))
		end)
	end)
	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(0))
		end)
	end)
end


Chronotanks = function()
		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)

		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()
	EnemyUnitN = Actor.Create("e6", true, { Location = CPos.New(55,27), Owner = EnemysTop })
	EnemyUnitS = Actor.Create("e6", true, { Location = CPos.New(55,28), Owner = EnemysBottom })
	EnemyN = { EnemyUnitN }
	EnemyS = { EnemyUnitS }
	MovePatrol(EnemyN, BridgePathNorth, DateTime.Seconds(0))
	MovePatrol(EnemyS, BridgePathSouth, DateTime.Seconds(0))
	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(EngyDelayTimemin, EngyDelayTimemax)), function()
		EnemyEngyIncome()
	end)
end

EnemyEngyRush = function()
	EnemyUnitN = Actor.Create("e6", true, { Location = CPos.New(55,27), Owner = EnemysTop })
	EnemyUnitS = Actor.Create("e6", true, { Location = CPos.New(55,28), Owner = EnemysBottom })
	EnemyN = { EnemyUnitN }
	EnemyS = { EnemyUnitS }
	MovePatrol(EnemyN, BridgePathNorth, DateTime.Seconds(0))
	MovePatrol(EnemyS, BridgePathSouth, DateTime.Seconds(0))
	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
	newmcv0 = Actor.Create("fact", true, { Location = CPos.New(8,7), Owner = Multi0 })
--	Trigger.OnKilledOrCaptured(newmcv0, function() Multi0.MarkFailedObjective(KillbaseP1) end)
	newmcv1 = Actor.Create("fact", true, { Location = CPos.New(8,15), Owner = Multi1 }) 
--	Trigger.OnKilledOrCaptured(newmcv1, function() Multi1.MarkFailedObjective(KillbaseP2) end)
	newmcv2 = Actor.Create("fact", true, { Location = CPos.New(8,40), Owner = Multi2 })
--	Trigger.OnKilledOrCaptured(newmcv2, function() Multi2.MarkFailedObjective(KillbaseP3) end)
	newmcv3 = Actor.Create("fact", 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, Team2Won)
	Trigger.OnAllKilledOrCaptured(Team2Mainbases, Team1Won)

	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
			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
			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

Team1Won = function()
	if not GameIsOver then
		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,25), Owner = Multi0 }) end
			if Multi0 ~= Multi1 then And = Actor.Create("nix01and", true, { Location = CPos.New(28,27), Owner = Multi0 }) end
			Playername = Actor.Create("nix01pname", true, { Location = CPos.New(27,31), Owner = Multi1 })
			Wins = Actor.Create("nix01wins", true, { Location = CPos.New(24,34), 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)
			Multi2.MarkFailedObjective(KillbaseP3)
			Multi3.MarkFailedObjective(KillbaseP4)
		end)
	end
end
Team2Won = function()
	if not GameIsOver then
		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,25), Owner = Multi2 }) end
			if Multi2 ~= Multi3 then And = Actor.Create("nix01and", true, { Location = CPos.New(28,27), Owner = Multi2 }) end
			Playername = Actor.Create("nix01pname", true, { Location = CPos.New(27,31), Owner = Multi3 })
			Wins = Actor.Create("nix01wins", true, { Location = CPos.New(24,34), 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)
			Multi0.MarkFailedObjective(KillbaseP1)
			Multi1.MarkFailedObjective(KillbaseP2)
		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]
	Camera.Position = mainbase.CenterPosition
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 < 13 then
		newactor = Actor.Create("q1d12", true, { Location = CPos.New(45,23) + CVec.New(countH3, countV3), Owner = France })
		countH3 = countH3 + 3	
		if countH3 > 10 then
			countH3 = 0
			if countV3 < 6 or countV3 > 6 then
				countV3 = countV3 + 3
			elseif countV3 == 6 then
				countV3 = countV3 + 2
			end
		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,27), 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.\nRA units: " .. RAUnitPercent .. "0%\nDoomed Monsters: " .. MonsterUnitPercent .. "0%\nGiant Ants: " .. AntUnitPercent .. "0%\nDinosaurs: " .. DinoUnitPercent .. "0%\nCustom Army: " .. CustomUnitPercent .. "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 then
			a.Stop()
			if a.IsInWorld and newmcv1.IsInWorld and newmcv1.Owner ~= Player.GetPlayer("Creeps") and newmcv1.Owner ~= EnemysTop 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 then
			a.Stop()
			if a.IsInWorld and newmcv2.IsInWorld and newmcv2.Owner ~= Player.GetPlayer("Creeps") and newmcv2.Owner ~= EnemysBottom 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

TimerColor = HSLColor.LawnGreen

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