----------------------------------------------------------------------------------------------------------
Difficulty = Map.LobbyOption("difficulty")
----------------------------------------------------------------------------------------------------------
Tick = function()
----------------------------------------------------------------------------------------------------------
	if multi0.HasPrerequisites({ "general.arrived" }) and not PlayerGeneralArrivedState0 then
		PlayerGeneralArrivedState0 = true
		Trigger.AfterDelay(44, function()
			Trigger.AfterDelay(66, function() PlayerGeneralFirstArrivedState0 = true end)
			InitNationGeneral0() 
		end)
	end
	if multi1.HasPrerequisites({ "general.arrived" }) and not PlayerGeneralArrivedState1 then
		PlayerGeneralArrivedState1 = true
		Trigger.AfterDelay(44, function() 
			Trigger.AfterDelay(66, function() PlayerGeneralFirstArrivedState1 = true end)
			InitNationGeneral1() 
		end)
	end
	if multi2.HasPrerequisites({ "general.arrived" }) and not PlayerGeneralArrivedState2 then
		PlayerGeneralArrivedState2 = true
		Trigger.AfterDelay(44, function() 
			Trigger.AfterDelay(66, function() PlayerGeneralFirstArrivedState2 = true end)
			InitNationGeneral2() 
		end)
	end
	if multi3.HasPrerequisites({ "general.arrived" }) and not PlayerGeneralArrivedState3 then
		PlayerGeneralArrivedState3 = true
		Trigger.AfterDelay(44, function() 
			Trigger.AfterDelay(66, function() PlayerGeneralFirstArrivedState3 = true end)
			InitNationGeneral3() 
		end)
	end
----------------------------------------------------------------------------------------------------------
	if multi0.HasPrerequisites({ "barracks" }) and not PlayerBarracksState0 then
		PlayerBarracksState0 = true
		GetPlayerBarracks0()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(4, 6)), function() ReConscriptPlayerBarracks0() end)
	end
	if multi1.HasPrerequisites({ "barracks" }) and not PlayerBarracksState1 then
		PlayerBarracksState1 = true
		GetPlayerBarracks1()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(4, 6)), function() ReConscriptPlayerBarracks1() end)
	end
	if multi2.HasPrerequisites({ "barracks" }) and not PlayerBarracksState2 then
		PlayerBarracksState2 = true
		GetPlayerBarracks2()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(4, 6)), function() ReConscriptPlayerBarracks2() end)
	end
	if multi3.HasPrerequisites({ "barracks" }) and not PlayerBarracksState3 then
		PlayerBarracksState3 = true
		GetPlayerBarracks3()
		Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(4, 6)), function() ReConscriptPlayerBarracks3() end)
	end
----------------------------------------------------------------------------------------------------------
	if multi0.HasPrerequisites({ "first.proc" }) and not PlayerFirstProcState0 then
		PlayerFirstProcState0 = true
		Trigger.AfterDelay(11, function()
			Trigger.AfterDelay(66, function() FirstPlayerFirstProcState0 = true end)
			SelectPlayerFirstOreRefinery0() 
			Trigger.AfterDelay(0.0001, function() SelectPlayerFirstHarvester0() end)
		end)
	end
	if multi1.HasPrerequisites({ "first.proc" }) and not PlayerFirstProcState1 then
		PlayerFirstProcState1 = true
		Trigger.AfterDelay(11, function() 
			Trigger.AfterDelay(66, function() FirstPlayerFirstProcState1 = true end)
			SelectPlayerFirstOreRefinery1() 
			Trigger.AfterDelay(0.0001, function() SelectPlayerFirstHarvester1() end)
		end)
	end
	if multi2.HasPrerequisites({ "first.proc" }) and not PlayerFirstProcState2 then
		PlayerFirstProcState2 = true
		Trigger.AfterDelay(11, function() 
			Trigger.AfterDelay(66, function() FirstPlayerFirstProcState2 = true end)
			SelectPlayerFirstOreRefinery2() 
			Trigger.AfterDelay(0.0001, function() SelectPlayerFirstHarvester2() end)
		end)
	end
	if multi3.HasPrerequisites({ "first.proc" }) and not PlayerFirstProcState3 then
		PlayerFirstProcState3 = true
		Trigger.AfterDelay(11, function() 
			Trigger.AfterDelay(66, function() 
				FirstPlayerFirstProcState3 = true 
			end)
			SelectPlayerFirstOreRefinery3() 
			Trigger.AfterDelay(0.0001, function() SelectPlayerFirstHarvester3() end)
		end)
	end
----------------------------------------------------------------------------------------------------------
	if multi0.HasPrerequisites({ "second.oilrefinery" }) and not PlayerSecondProcState0 then
		PlayerSecondProcState0 = true
		Trigger.AfterDelay(66, function()
			Trigger.AfterDelay(66, function()
				FirstPlayerSecondProcState0 = true 
			end)
			SelectPlayerSecondHarvester0() 
		end)
	end
	if multi1.HasPrerequisites({ "second.oilrefinery" }) and not PlayerSecondProcState1 then
		PlayerSecondProcState1 = true
		Trigger.AfterDelay(66, function() 
			Trigger.AfterDelay(66, function()
				FirstPlayerSecondProcState1 = true
			end)
			SelectPlayerSecondHarvester1() 
		end)
	end
	if multi2.HasPrerequisites({ "second.oilrefinery" }) and not PlayerSecondProcState2 then
		PlayerSecondProcState2 = true
		Trigger.AfterDelay(66, function() 
			Trigger.AfterDelay(66, function()
				FirstPlayerSecondProcState2 = true 
			end)
			SelectPlayerSecondHarvester2() 
		end)
	end
	if multi3.HasPrerequisites({ "second.oilrefinery" }) and not PlayerSecondProcState3 then
		PlayerSecondProcState3 = true
		Trigger.AfterDelay(66, function() 
			Trigger.AfterDelay(66, function()
				FirstPlayerSecondProcState3 = true 
			end)
			SelectPlayerSecondHarvester3() 
		end)
	end
----------------------------------------------------------------------------------------------------------
	if multi0.HasPrerequisites({ "oiltanker.second" }) and not SecondOilTankerState0 then
		SecondOilTankerSelectState0 = true
		Trigger.AfterDelay(1, function()
			if not SecondOilTankerState0 then 
				SelectPlayerSecondOilTanker0()
			end
		end)
	end
	if multi1.HasPrerequisites({ "oiltanker.second" }) and not SecondOilTankerState1 then
		SecondOilTankerSelectState1 = true
		Trigger.AfterDelay(1, function() 
			if not SecondOilTankerState1 then 
				SelectPlayerSecondOilTanker1()
			end
		end)
	end
	if multi2.HasPrerequisites({ "oiltanker.second" }) and not SecondOilTankerState2 then
		SecondOilTankerSelectState2 = true
		Trigger.AfterDelay(1, function() 
			if not SecondOilTankerState2 then 
				SelectPlayerSecondOilTanker2()
			end
		end)
	end
	if multi3.HasPrerequisites({ "oiltanker.second" }) and not SecondOilTankerState3 then
		SecondOilTankerSelectState3 = true
		Trigger.AfterDelay(1, function() 
			if not SecondOilTankerState3 then 
				SelectPlayerSecondOilTanker3()
			end
		end)
	end
----------------------------------------------------------------------------------------------------------
	if DateTime.GameTime > 1 then
	end
end
-------------------------------------------------------------------
InitWaypoints = function()
	InsertWaypointsCreators()
end
-------------------------------------------------------------------
InitColors = function()
end
----------------------------------------------------------------------------------------------------------
InitTraffic = function()
	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(8, 12)), function()
		SendFollowLandTraffic()
	end)
	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(22, 44)), function()
		SendLandTraffic()
	end)
	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(22, 44)), function()
		SendCommercialPlaneTroughMap()
	end)
	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(222, 444)), function()
		SendCommercialShipsTroughMapA()
	end)
	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(333, 666)), function()
		SendConvoyShips()
		SendCounterNavalArmy()
	end)
end
----------------------------------------------------------------------------------------------------------
InitStarGate = function()
	InsertStarGate()
	InsertStarGateWayPoints()
	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(44, 66)), function() 
		StarGateQuests() 
	end)
end
----------------------------------------------------------------------------------------------------------
SelectNoTargetNationsToAttack = function()
	Utils.Do(allies.GetGroundAttackers(), function(unit)
		IdleHunt(unit)
	end)
	Utils.Do(england.GetGroundAttackers(), function(unit)
		IdleHunt(unit)
	end)
	Utils.Do(france.GetGroundAttackers(), function(unit)
		IdleHunt(unit)
	end)
	Utils.Do(germany.GetGroundAttackers(), function(unit)
		IdleHunt(unit)
	end)
	Utils.Do(ussr.GetGroundAttackers(), function(unit)
		IdleHunt(unit)
	end)
	Utils.Do(russia.GetGroundAttackers(), function(unit)
		IdleHunt(unit)
	end)
	Utils.Do(ukraine.GetGroundAttackers(), function(unit)
		IdleHunt(unit)
	end)
	Utils.Do(china.GetGroundAttackers(), function(unit)
		IdleHunt(unit)
	end)
	Utils.Do(gdi.GetGroundAttackers(), function(unit)
		IdleHunt(unit)
	end)
	Utils.Do(un.GetGroundAttackers(), function(unit)
		IdleHunt(unit)
	end)
	Utils.Do(neutral.GetGroundAttackers(), function(unit)
		Trigger.OnDamaged(unit, function() 
			IdleHunt(unit)
		end)
	end)
	Trigger.AfterDelay(444, function()
		SelectNoTargetNationsToAttack()
	end)
end
-------------------------------------------------------------------
SelectNoTargetPrimevalsToAttack = function()
	Utils.Do(nod.GetGroundAttackers(), function(unit)
		IdleHunt(unit)
	end)
	Utils.Do(isis.GetGroundAttackers(), function(unit)
		IdleHunt(unit)
	end)
	Utils.Do(creeps.GetGroundAttackers(), function(unit)
		IdleHunt(unit)
	end)
	Utils.Do(ants.GetGroundAttackers(), function(unit)
		IdleHunt(unit)
	end)
	Utils.Do(dinosaurs.GetGroundAttackers(), function(unit)
		IdleHunt(unit)
	end)
	Utils.Do(aliens.GetGroundAttackers(), function(unit)
		IdleHunt(unit)
	end)
	Trigger.AfterDelay(444, function()
		SelectNoTargetPrimevalsToAttack()
	end)
end
-------------------------------------------------------------------
InitTriggers = function()
end
-------------------------------------------------------------------
InitMonsters = function()
	Trigger.AfterDelay(Utils.RandomInteger(2222, 4444), function()
		Media.DisplayMessage(" -Interesting gosships hearing in the harbour-district inn, for many missing ship and jetsky-lovers...\n -Open your eyes on the ocean!", "[Harbour-Gosship]", RandomMainColor)
		Trigger.AfterDelay(Utils.RandomInteger(222, 444), function()
			InsertKrakken()
		end)
		Trigger.AfterDelay(Utils.RandomInteger(1111, 2222), function()
			InsertKrakken()
		end)
	end)
	Trigger.AfterDelay(Utils.RandomInteger(6666, 8888), function()
		ChronoshiftDinosaurs(StarGateWaypoint.Location, PlantDinoUnitTypes, Utils.RandomInteger(22, 44)) 
	end)
	Trigger.AfterDelay(Utils.RandomInteger(9999, 11111), function()
		SendPrimevalDinosaurs(StarGateWaypoint.Location, DinoUnitTypes, Utils.RandomInteger(33, 66))
	end)
	Trigger.AfterDelay(Utils.RandomInteger(12222, 14444), function()
		ChronoshiftTripods(StarGateWaypoint.Location, UFOUnitTypes, Utils.RandomInteger(44, 88))
	end)
	Trigger.AfterDelay(Utils.RandomInteger(16666, 19999), function()
		InsertBigMonster() 
	end)
end
-------------------------------------------------------------------
InitMines = function()
	Trigger.AfterDelay(0, function() 
		RandomDebrisCreator()
		RandomTreeCreator()
		RandomRockCreator()
	end)
	Trigger.AfterDelay(0, function() 
		BigOreMineCreator()
		OreMineCreator()
		OilRigCreator()
		OilWellCreator()
	end)
end
-------------------------------------------------------------------
InitParatroopers = function()
	Trigger.AfterDelay(Utils.RandomInteger(666, 999), function()
		InsertRandomParatroopersReinforcement() 
	end)
end
-------------------------------------------------------------------
InitBridges = function()
	Trigger.AfterDelay(0, function() 
		SetupBridges() 
	end)
	Trigger.AfterDelay(3, function() 
		SetupBridges0()
		SetupBridges1()
		SetupBridges2()
		SetupBridges3()
	end)
end
-------------------------------------------------------------------
InitDecorations = function()
	Trigger.AfterDelay(0, function()
		CloudCreator()
		BirdCreator()
	end)
	Trigger.AfterDelay(0, function()
		InsertWaterTechBuildings()
		InsertTechBuildings()
	end)
end
----------------------------------------------------------------------------------------------------------
InitUnitTypes = function()
	Trigger.AfterDelay(3, function()
		FactionIInfantryTypes()
	end)
end
-------------------------------------------------------------------
InitBuildingRepairs = function()
	Trigger.AfterDelay(666, function()
		NotPlayerRepairBuildings()
	end)
	Trigger.AfterDelay(888, function()
		RepairBuildingsPlayer0()
		RepairBuildingsPlayer1()
		RepairBuildingsPlayer2()
		RepairBuildingsPlayer3()
	end)
end
-------------------------------------------------------------------
NotPlayerRepairBuildings = function()
	local buildings = Utils.Where(Map.ActorsInWorld, function(actor) return (actor.Owner == neutral or actor.Owner == neutral0 or actor.Owner == neutral1 or actor.Owner == neutral2 or actor.Owner == neutral3 or actor.Owner == creeps or actor.Owner == dinosaurs or actor.Owner == ants or actor.Owner == nod or actor.Owner == isis or actor.Owner == gdi or actor.Owner == un) and actor.HasProperty("StartBuildingRepairs") end)
	Utils.Do(buildings, function(actor)
		Trigger.OnDamaged(actor, function(building)
			if (building.Owner == neutral or building.Owner == neutral0 or building.Owner == neutral1 or building.Owner == neutral2 or building.Owner == neutral3 or building.Owner == creeps or building.Owner == dinosaurs or building.Owner == ants or building.Owner == nod or building.Owner == isis or building.Owner == gdi or building.Owner == un) and building.Health < building.MaxHealth * DamageModifier then
				building.StartBuildingRepairs()
			end
		end)
	end)
	Trigger.AfterDelay(444, function()
		NotPlayerRepairBuildings()
	end)
end
-------------------------------------------------------------------
RepairBuildingsPlayer0 = function()
	local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == multi0 and self.HasProperty("StartBuildingRepairs") end)
	Utils.Do(buildings, function(actor)
		Trigger.OnDamaged(actor, function(building)
			if building.Owner == multi0 and building.Health < building.MaxHealth * DamageModifier then
				building.StartBuildingRepairs()
			end
		end)
	end)
	Trigger.AfterDelay(333, function()
		RepairBuildingsPlayer0()
	end)
end
RepairBuildingsPlayer1 = function()
	local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == multi1 and self.HasProperty("StartBuildingRepairs") end)
	Utils.Do(buildings, function(actor)
		Trigger.OnDamaged(actor, function(building)
			if building.Owner == multi1 and building.Health < building.MaxHealth * DamageModifier then
				building.StartBuildingRepairs()
			end
		end)
	end)
	Trigger.AfterDelay(333, function()
		RepairBuildingsPlayer1()
	end)
end
RepairBuildingsPlayer2 = function()
	local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == multi2 and self.HasProperty("StartBuildingRepairs") end)
	Utils.Do(buildings, function(actor)
		Trigger.OnDamaged(actor, function(building)
			if building.Owner == multi2 and building.Health < building.MaxHealth * DamageModifier then
				building.StartBuildingRepairs()
			end
		end)
	end)
	Trigger.AfterDelay(333, function()
		RepairBuildingsPlayer2()
	end)
end
RepairBuildingsPlayer3 = function()
	local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == multi3 and self.HasProperty("StartBuildingRepairs") end)
	Utils.Do(buildings, function(actor)
		Trigger.OnDamaged(actor, function(building)
			if building.Owner == multi3 and building.Health < building.MaxHealth * DamageModifier then
				building.StartBuildingRepairs()
			end
		end)
	end)
	Trigger.AfterDelay(333, function()
		RepairBuildingsPlayer3()
	end)
end
-------------------------------------------------------------------
InitPlayers = function()
-------------------------------------------------------------------
	tv = Player.GetPlayer("TV")
-------------------------------------------------------------------
	medias = { tv }
-------------------------------------------------------------------
	neutral = Player.GetPlayer("Neutral")
	neutral0 = Player.GetPlayer("Neutral0")
	neutral1 = Player.GetPlayer("Neutral1")
	neutral2 = Player.GetPlayer("Neutral2")
	neutral3 = Player.GetPlayer("Neutral3")
-------------------------------------------------------------------
	neutrals = { neutral, neutral0, neutral1, neutral2, neutral3 }
	orneutrals = neutral or neutral0 or neutral1 or neutral2 or neutral3
-------------------------------------------------------------------
	citizens = { neutral0, neutral1, neutral2, neutral3 }
	orcitizens = (neutral0 or neutral1 or neutral2 or neutral3)
-------------------------------------------------------------------
	creeps = Player.GetPlayer("Creeps")
	ants = Player.GetPlayer("Ants")
	dinosaurs = Player.GetPlayer("Dinosaurs")
	aliens = Player.GetPlayer("Aliens")
-------------------------------------------------------------------
	primevals = { creeps, ants, dinosaurs, aliens }
	orprimevals = (creeps or ants or dinosaurs or aliens)
-------------------------------------------------------------------
	multi0 = Player.GetPlayer("Multi0")
	multi1 = Player.GetPlayer("Multi1")
	multi2 = Player.GetPlayer("Multi2")
	multi3 = Player.GetPlayer("Multi3")
-------------------------------------------------------------------
	players = { multi0, multi1, multi2, multi3 }
	orplayers = (multi0 or multi1 or multi2 or multi3)
	isbotplayers = multi0.IsBot and multi1.IsBot and multi2.IsBot and multi3.IsBot
-------------------------------------------------------------------
	multiai0 = Player.GetPlayer("MultiAI0")
	multiai1 = Player.GetPlayer("MultiAI1")
	multiai2 = Player.GetPlayer("MultiAI2")
	multiai3 = Player.GetPlayer("MultiAI3")
-------------------------------------------------------------------
	playersai = { multiai0, multiai1, multiai2, multiai3 }
	orplayersai = (multiai0 or multiai1 or multiai2 or multiai3)
-------------------------------------------------------------------
	allies = Player.GetPlayer("Allies")
	england = Player.GetPlayer("England")
	france = Player.GetPlayer("France")
	germany = Player.GetPlayer("Germany")
-------------------------------------------------------------------
	nato = { allies, england, france, germany }
	ornato = (allies or england or france or germany)
-------------------------------------------------------------------
	ussr = Player.GetPlayer("USSR")
	russia = Player.GetPlayer("Russia")
	ukraine = Player.GetPlayer("Ukraine")
	china = Player.GetPlayer("China")
-------------------------------------------------------------------
	varsopact = { ussr, russia, ukraine, china }
	orvarsopact = (ussr or russia or ukraine or china)
-------------------------------------------------------------------
	un = Player.GetPlayer("UN")
	gdi = Player.GetPlayer("GDI")
-------------------------------------------------------------------
	peacekeepers = { un, gdi }
	orpeacekeepers = (un or gdi)
-------------------------------------------------------------------
	isis = Player.GetPlayer("ISIS")
	nod = Player.GetPlayer("NOD")
-------------------------------------------------------------------
	terrorists = { isis, nod }
	orterrorists = (isis or nod)
-------------------------------------------------------------------
	clouds = Player.GetPlayer("Clouds")
	trees = Player.GetPlayer("Trees")
	roads = Player.GetPlayer("Roads")
	rocks = Player.GetPlayer("Rocks")
	ice = Player.GetPlayer("Ice")
	mines = Player.GetPlayer("Mines")
-------------------------------------------------------------------
	decorations = { clouds, trees, roads, rocks, ice, mines }
	ordecorations = (clouds or trees or roads or rocks or ice or mines)
-------------------------------------------------------------------
	clearpoint = Player.GetPlayer("Clearpoint")
	scriptpoints = { clearpoint }
-------------------------------------------------------------------
	if Map.IsSinglePlayer then
	else
	end
end
WorldLoaded = function()
-------------------------------------------------------------------
	MapEdgeStartHorizontical = 0 --Map Bound
	MapEdgeOverHorizontical = 258 --Map Bound
	MapEdgeStartVertical = 0 --Map Bound
	MapEdgeOverVertical = 258 --Map Bound
-------------------------------------------------------------------
	MapSlippedEdgeStartHorizontical = MapEdgeStartHorizontical + 8
	MapSlippedEdgeOverHorizontical = MapEdgeOverHorizontical - 8
	MapSlippedEdgeStartVertical = MapEdgeStartVertical + 8
	MapSlippedEdgeOverVertical = MapEdgeOverVertical - 8
-------------------------------------------------------------------
	MapEdgeOverHorizonticalVerticalMergeNumbers = MapEdgeOverHorizontical + MapEdgeOverVertical
-------------------------------------------------------------------
	ticks = 0
	speed = 5
-------------------------------------------------------------------
	PartOfTheDayCount = 1
	HourCount = 0
	DateDayCount = Utils.RandomInteger(1, 30)
	DayCount = Utils.RandomInteger(1, 7)
	WeekCount = Utils.RandomInteger(1, 4)
	MonthCount = Utils.Random({ Utils.RandomInteger(1, 12), Utils.Random({ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }) })
	YearCount = Utils.Random({ Utils.RandomInteger(1987, 1995), Utils.Random({ 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995 }) })
-------------------------------------------------------------------
	WinterState = false
	SummerState = false
-------------------------------------------------------------------
	CitizensCount = 0
-------------------------------------------------------------------
	JamesBondProduced0 = 0
	JamesBondProduced1 = 0
	JamesBondProduced2 = 0
	JamesBondProduced3 = 0
-------------------------------------------------------------------
	HeroProduced0 = 0
	HeroProduced1 = 0
	HeroProduced2 = 0
	HeroProduced3 = 0
-------------------------------------------------------------------
	SpyProduced0 = 0
	SpyProduced1 = 0
	SpyProduced2 = 0
	SpyProduced3 = 0
-------------------------------------------------------------------
	PlayerBarracksState0 = false
	PlayerBarracksState1 = false
	PlayerBarracksState2 = false
	PlayerBarracksState3 = false
-------------------------------------------------------------------
	ConscriptableCitizensBarrackACount0 = 0
	ConscriptableCitizensBarrackACount1 = 0
	ConscriptableCitizensBarrackACount2 = 0
	ConscriptableCitizensBarrackACount3 = 0
-------------------------------------------------------------------
	EnableTrainBarrackAState0 = false
	EnableTrainBarrackAState1 = false
	EnableTrainBarrackAState2 = false
	EnableTrainBarrackAState3 = false
	EnableTrainBarrackStateA0 = false
	EnableTrainBarrackStateA1 = false
	EnableTrainBarrackStateA3 = false
	EnableTrainBarrackStateA4 = false
-------------------------------------------------------------------------------	
	bridgecountOwnDefend0 = 0
	bridgecountOwnDefend1 = 0
	bridgecountOwnDefend2 = 0
	bridgecountOwnDefend3 = 0
-------------------------------------------------------------------------------	
	bridgecountEnemyDestroy0 = 0
	bridgecountEnemyDestroy1 = 0
	bridgecountEnemyDestroy2 = 0
	bridgecountEnemyDestroy3 = 0
-------------------------------------------------------------------------------
	BigOreMineMaxcount = 2
	OreMineMaxcount = 10
	OilWellMaxcount = 6
	OilRigMaxcount = 2
-------------------------------------------------------------------------------
	BigOreMinecount = 0
	OreMinecount = 0
	OilWellcount = 0
	OilRigcount = 0
-------------------------------------------------------------------
	BigOreMineCreatorState = true
	OilRigCreatorState = true
	OilWellCreatorState = true
	OreMineCreatorState = true
-------------------------------------------------------------------------------
	TechBuildingCreatorState = true
	TechBuildingMaxcount = Utils.RandomInteger(14, 22)
	TechBuildingcount = 0
-------------------------------------------------------------------------------
	CivilianPowerPlantCreatorState = true
	CivilianPowerPlantMaxcount = Utils.RandomInteger(12, 16)
	CivilianPowerPlantcount = 0
-------------------------------------------------------------------
	DebrisMaxcount = Utils.RandomInteger(222, 444)
	RandomDebriscount = 0
	RandomDebrisCreatorState = true
-------------------------------------------------------------------------------
	TreeMaxcount = Utils.RandomInteger(666, 999)
	RandomTreecount = 0
	RandomTreeCreatorState = true
-------------------------------------------------------------------------------
	RockMaxcount = Utils.RandomInteger(333, 444)
	RandomRockcount = 0
	RandomRockCreatorState = true
-------------------------------------------------------------------
	CloudMaxcount = Utils.RandomInteger(122, 166)
	Cloudcount = 0
	CloudCreatorState = true
-------------------------------------------------------------------------------
	BirdMaxcount = Utils.RandomInteger(88, 122)
	Birdcount = 0
	BirdCreatorState = true
-------------------------------------------------------------------------------
	JetskyMaxcount = Utils.RandomInteger(33, 44)
	Jetskycount = 0
	JetskyCreatorState = true
-------------------------------------------------------------------
	OceanIceMaxcount = Utils.RandomInteger(666, 888)
	OceanIcecount = 0
	OceanIceCreatorState = true
-------------------------------------------------------------------
	VacationerMaxcount = Utils.RandomInteger(8, 12)
	Vacationercount = 0
	VacationerCreatorState = true
-------------------------------------------------------------------
	WaypointRoadcount = 0
	WaypointRoadCreatorState = true
	WaypointRoadCreatorFinish = false
-------------------------------------------------------------------
	CounterNavalArmyOnSite = false
	ConvoyShipOnSite = false
-------------------------------------------------------------------
	Followtransport0 = false
	Followtransport1 = false
	Followtransport2 = false
	Followtransport3 = false
-------------------------------------------------------------------
	FieldGeneralHealth0 = 0
	FieldGeneralHealth1 = 0
	FieldGeneralHealth2 = 0
	FieldGeneralHealth3 = 0
-------------------------------------------------------------------
	FieldGeneralLiveState0 = true
	FieldGeneralLiveState1 = true
	FieldGeneralLiveState2 = true
	FieldGeneralLiveState3 = true
-------------------------------------------------------------------
	RandomGeneralBadNATO = false
	RandomGeneralBadUSSR = false
-------------------------------------------------------------------
	GeneralTeamA0 = 0
	GeneralTeamA1 = 0
	GeneralTeamA2 = 0
	GeneralTeamA3 = 0
-------------------------------------------------------------------
	GeneralTeamStateA0 = false
	GeneralTeamStateA1 = false
	GeneralTeamStateA2 = false
	GeneralTeamStateA3 = false
-------------------------------------------------------------------
	PlayerGeneralArrivedState0 = false
	PlayerGeneralArrivedState1 = false
	PlayerGeneralArrivedState2 = false
	PlayerGeneralArrivedState3 = false
-------------------------------------------------------------------
	SecondOilTankerState0 = false
	SecondOilTankerState1 = false
	SecondOilTankerState2 = false
	SecondOilTankerState3 = false
	SecondOilTankerSelectState0 = false
	SecondOilTankerSelectState1 = false
	SecondOilTankerSelectState2 = false
	SecondOilTankerSelectState3 = false
-------------------------------------------------------------------
	PlayerFirstProcState0 = false
	PlayerFirstProcState1 = false
	PlayerFirstProcState2 = false
	PlayerFirstProcState3 = false
	FirstPlayerFirstProcState0 = false
	FirstPlayerFirstProcState1 = false
	FirstPlayerFirstProcState2 = false
	FirstPlayerFirstProcState3 = false
-------------------------------------------------------------------
	PlayerSecondProcState0 = false
	PlayerSecondProcState1 = false
	PlayerSecondProcState2 = false
	PlayerSecondProcState3 = false
	FirstPlayerSecondProcState0 = false
	FirstPlayerSecondProcState1 = false
	FirstPlayerSecondProcState2 = false
	FirstPlayerSecondProcState3 = false
-------------------------------------------------------------------
	Rank = "Officer"
	Rank0 = "Officer"
	Rank1 = "Officer"
	Rank2 = "Officer"
	Rank3 = "Officer"
-------------------------------------------------------------------
	FollowSuperMan = false
	FollowBigMonster = false
	FollowBlackHawkGDI = false
	FollowTerroristCarryall = false
	FollowRandomGeneralBadNATO = false
	FollowRandomGeneralBadUSSR = false
	FollowRandomGeneralBad = false
	FollowJetFighterNOD = false
	FollowVehicleCarryall = false
	FollowAnt = false
-------------------------------------------------------------------
	RandomGeneralBadEyeOn = true
-------------------------------------------------------------------
	Trigger.AfterDelay(777, function()
		if multi0.IsBot and multi1.IsBot and multi2.IsBot and multi3.IsBot then
			RandomFollowStates()
			viewportOrigin = Camera.Position
		elseif not multi0.IsBot and not multi1.IsBot and not multi2.IsBot and not multi3.IsBot then
		else
		end
	end)
---------------------------------------------------------------------
	Trigger.AfterDelay(0.000001, function()
		EmptiesPrintTick()
	end)
	Trigger.AfterDelay(666, function()
		LampsStartTurnOff() 
	end)
-------------------------------------------------------------------
	turnOn()
-------------------------------------------------------------------
	InitTriggers()
	InitDecorations()
	InitTraffic()
	InitPlayers()
	InitObjectives()
	InitBuildingRepairs()
	InitUnitTypes()
	InitWaypoints()
	InitStarGate()
	InitBridges()
	InitParatroopers()
	InitMines()
	InitMonsters()
----------------------------------------------------------------------------------------------------------------------------------------
	Trigger.AfterDelay(0.000001, function()
		InitSeason()
	end)
	Trigger.AfterDelay(0.000001, function()
		InitOfficer()
	end)
	Trigger.AfterDelay(0.000001, function()
		InitStartPoint()
	end)
----------------------------------------------------------------------------------------------------------------------------------------
	ColorTick()
	CalendarTick()
	FactionsTick()
	RandomActorTypesTick()
	FollowCamerasTick()
	MissionTextTick()
	ObjectivesTick()
	BridgeTick()
	LightningTick()
----------------------------------------------------------------------------------------------------------------------------------------
	Trigger.AfterDelay(0.000001, function() 
		OfficersTick()
	end)
----------------------------------------------------------------------------------------------------------------------------------------
	InsertSuperman()
	InsertBlackHawkGDI()
----------------------------------------------------------------------------------------------------------------------------------------
	Trigger.AfterDelay(Utils.RandomInteger(3333, 9999), function()
		InsertAircraftCarrier(Utils.Random({ allies, england, france, germany, ussr, russia, ukraine, china, gdi, un, nod })) 
	end)
----------------------------------------------------------------------------------------------------------------------------------------
	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(333, 666)), function() 
		InsertJetFighters(Utils.Random({ allies, england, france, germany, ussr, russia, ukraine, china, gdi, un, nod }), JetFighterSquadType, Utils.Random({ RandomEdgeWaypoint0, RandomEdgeWaypoint1, RandomEdgeWaypoint2, RandomEdgeWaypoint3, RandomEdgeWaypoint4, RandomEdgeWaypoint5, RandomEdgeWaypoint6, RandomEdgeWaypoint7, RandomEdgeWaypoint8 }), Utils.Random({ MultiSpawnTypePoint0, MultiSpawnTypePoint1, MultiSpawnTypePoint2, MultiSpawnTypePoint3, RandomLandWaypoint00, RandomLandWaypoint01, RandomLandWaypoint02, RandomLandWaypoint03, RandomLandWaypoint04, RandomLandWaypoint05, RandomLandWaypoint06, RandomLandWaypoint07, RandomLandWaypoint08, RandomLandWaypoint09, RandomLandWaypoint10, RandomLandWaypoint11, CruiserPoint0, CruiserPoint1, CruiserPoint2, CruiserPoint3 }), Utils.Random({ RandomWaypoint0, RandomWaypoint1, RandomWaypoint2, RandomWaypoint3, RandomWaypoint4, RandomWaypoint5, RandomWaypoint6, RandomWaypoint7, RandomWaypoint8 }))
	end)
----------------------------------------------------------------------------------------------------------------------------------------
	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(444, 888)), function()
		SendParabombs(Utils.Random({ allies, england, france, germany, ussr, russia, ukraine, china, gdi, un, nod }), Utils.Random({ MultiSpawnTypePoint0, MultiSpawnTypePoint1, MultiSpawnTypePoint2, MultiSpawnTypePoint3, RandomLandWaypoint00, RandomLandWaypoint01, RandomLandWaypoint02, RandomLandWaypoint03, RandomLandWaypoint04, RandomLandWaypoint05, RandomLandWaypoint06, RandomLandWaypoint07, RandomLandWaypoint08, RandomLandWaypoint09, RandomLandWaypoint10, RandomLandWaypoint11, CruiserPoint0, CruiserPoint1, CruiserPoint2, CruiserPoint3 }))
	end)
----------------------------------------------------------------------------------------------------------------------------------------
	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(444, 666)), function() 
		SendMoneyCratePlaneDrop() 
	end)
----------------------------------------------------------------------------------------------------------------------------------------
	InsertTerroristCarryall()
	InsertNeutralCarryall()
----------------------------------------------------------------------------------------------------------------------------------------
	Trigger.AfterDelay(Utils.RandomInteger(1111, 2222), function()
		AutoCrateCarryallRandomCrate()
	end)
-------------------------------------------------------------------------------------------------------------------------------------
	Trigger.AfterDelay(Utils.RandomInteger(2222, 4444), function()
		CrateCarryallReinforcement() 
	end)
------------------------------------------------------------------------------------------------------------------------------------------
	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(333, 666)), function() 
		InsertCarryallVehicleReinforcement(Utils.Random({ RandomEdgeWaypoint0, RandomEdgeWaypoint1, RandomEdgeWaypoint2, RandomEdgeWaypoint3, RandomEdgeWaypoint4, RandomEdgeWaypoint5, RandomEdgeWaypoint6, RandomEdgeWaypoint7, RandomEdgeWaypoint8 }), Utils.Random({ RandomWaypoint0, RandomWaypoint1, RandomWaypoint2, RandomWaypoint3, RandomWaypoint4, RandomWaypoint5, RandomWaypoint6, RandomWaypoint7, RandomWaypoint8 }))
	end)
-------------------------------------------------------------------
	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(444, 888)), function()
		InsertCarryallRandomPartisanVehicle()
	end)
----------------------------------------------------------------------------------------------------------------------------------------
--	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(66, 99)), function() SendTrucks() end)
----------------------------------------------------------------------------------------------------------------------------------------
	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(333, 999)), function()
		InsertGiantAntQueen()
	end)
----------------------------------------------------------------------------------------------------------------------------------------
	Trigger.AfterDelay(0.000001, function()
		StartingVehicles()
	end)
	Trigger.AfterDelay(0.000001, function() 
		InsertTechicalSqad0()
	end)
	Trigger.AfterDelay(0.000001, function()
		InsertTechicalSqad1()
	end)
	Trigger.AfterDelay(0.000001, function()
		InsertTechicalSqad2()
	end)
	Trigger.AfterDelay(0.000001, function() 
		InsertTechicalSqad3()
	end)
----------------------------------------------------------------------------------------------------------------------------------------
	Trigger.AfterDelay(0.000001, function()
		GetStartMCV()
	end)
----------------------------------------------------------------------------------------------------------------------------------------
	Trigger.AfterDelay(3, function()
		InsertStartInfantries0()
		InsertStartInfantries1()
		InsertStartInfantries2()
		InsertStartInfantries3()
	end)
----------------------------------------------------------------------------------------------------------------------------------------
	Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(444, 888)), function()
		SolarFlareEvent()
	end)
----------------------------------------------------------------------------------------------------------------------------------------
	Trigger.AfterDelay(Utils.RandomInteger(4444, 6666), function()
		InsertAlienMechHusk()
	end)
----------------------------------------------------------------------------------------------------------------------------------------
	Trigger.AfterDelay(6666, function()
		SelectNoTargetPrimevalsToAttack()
		SelectNoTargetNationsToAttack()
	end)
end
----------------------------------------------------------------------------------------------------------------------------------------

