-------------------------------------------------------------------
TechBuildingCreator = function()
end
-------------------------------------------------------------------
CreateTechBuilding = function()
end
-------------------------------------------------------------------
InsertWaterTechBuildings = function()
	Trigger.AfterDelay(444, function()
		InsertBeachHotel(Utils.Random({ RandomBeachWaypoint0, RandomBeachWaypoint1, RandomBeachWaypoint2, RandomBeachWaypoint3, RandomBeachWaypoint4, RandomBeachWaypoint5, RandomBeachWaypoint6, RandomBeachWaypoint7 }))
		InsertBeachHotel(Utils.Random({ RandomBeachWaypoint0, RandomBeachWaypoint1, RandomBeachWaypoint2, RandomBeachWaypoint3, RandomBeachWaypoint4, RandomBeachWaypoint5, RandomBeachWaypoint6, RandomBeachWaypoint7 }))
		InsertBeachHotel(Utils.Random({ RandomBeachWaypoint0, RandomBeachWaypoint1, RandomBeachWaypoint2, RandomBeachWaypoint3, RandomBeachWaypoint4, RandomBeachWaypoint5, RandomBeachWaypoint6, RandomBeachWaypoint7 }))
		InsertBeachHotel(Utils.Random({ RandomBeachWaypoint0, RandomBeachWaypoint1, RandomBeachWaypoint2, RandomBeachWaypoint3, RandomBeachWaypoint4, RandomBeachWaypoint5, RandomBeachWaypoint6, RandomBeachWaypoint7 }))
		InsertBeachHotel(Utils.Random({ RandomBeachWaypoint0, RandomBeachWaypoint1, RandomBeachWaypoint2, RandomBeachWaypoint3, RandomBeachWaypoint4, RandomBeachWaypoint5, RandomBeachWaypoint6, RandomBeachWaypoint7 }))
		InsertBeachHotel(Utils.Random({ RandomBeachWaypoint0, RandomBeachWaypoint1, RandomBeachWaypoint2, RandomBeachWaypoint3, RandomBeachWaypoint4, RandomBeachWaypoint5, RandomBeachWaypoint6, RandomBeachWaypoint7 }))
		InsertBeachHotel(Utils.Random({ RandomBeachWaypoint0, RandomBeachWaypoint1, RandomBeachWaypoint2, RandomBeachWaypoint3, RandomBeachWaypoint4, RandomBeachWaypoint5, RandomBeachWaypoint6, RandomBeachWaypoint7 }))
	end)
	Trigger.AfterDelay(666, function()
		InsertTechBuilding13A()
		InsertTechBuilding13B()
	end)
end
-------------------------------------------------------------------
InsertBeachHotel = function(HotelWaypoint)
	local BeachHotel = Actor.Create("hotel" .. Utils.RandomInteger(1, 5) .. ".fix", true, { Owner = neutral, Location = HotelWaypoint.Location + CVec.New(Utils.RandomInteger(-4, 3), Utils.RandomInteger(-4, 3)) })
	Trigger.OnKilled(BeachHotel, function()
		Trigger.AfterDelay(0, function()
			InsertBeachHotel(Utils.Random({ RandomBeachWaypoint0, RandomBeachWaypoint1, RandomBeachWaypoint2, RandomBeachWaypoint3, RandomBeachWaypoint4, RandomBeachWaypoint5, RandomBeachWaypoint6, RandomBeachWaypoint7 })) 
		end)
	end)
	Trigger.AfterDelay(42, function()
		if BeachHotel.IsInWorld then 
			BeachHotel.Owner = Utils.Random({ neutral0, neutral1, neutral2, neutral3 })
		end
	end)
end
-------------------------------------------------------------------
InsertTechBuilding13A = function()
	TechBuilding13A = Actor.Create("containerport", true, { Owner = neutral, Location = Utils.Random({ RandomBeachWaypoint0, RandomBeachWaypoint1, RandomBeachWaypoint2, RandomBeachWaypoint3 }).Location + CVec.New(Utils.RandomInteger(3, 6), 0) })
	Trigger.AfterDelay(42, function()
		if TechBuilding13A.IsInWorld then 
			TechBuilding13A.Owner = Utils.Random({ neutral0, neutral1, neutral2, neutral3 })
		end
	end)
end
-------------------------------------------------------------------
InsertTechBuilding13B = function()
	TechBuilding13B = Actor.Create("containerport", true, { Owner = neutral, Location = Utils.Random({ RandomBeachWaypoint4, RandomBeachWaypoint5, RandomBeachWaypoint6, RandomBeachWaypoint7 }).Location + CVec.New(Utils.RandomInteger(3, 6), 0) })
	Trigger.AfterDelay(42, function()
		if TechBuilding13B.IsInWorld then 
			TechBuilding13B.Owner = Utils.Random({ neutral0, neutral1, neutral2, neutral3 })
		end
	end)
end
-------------------------------------------------------------------
InsertTechBuildings = function()
	TechBuildingFixedState00A = false
	TechBuildingFixedState01A = false
	TechBuildingFixedState04A = false
	TechBuildingFixedState06A = false
	TechBuildingFixedState08A = false
	TechBuildingFixedState08B = false
	TechBuildingFixedState09A = false
	TechBuildingFixedState11A = false
	TechBuildingFixedState11B = false
	TechBuildingFixedState12A = false
	TechBuildingFixedState12B = false
	InsertTechBuilding00A()
	InsertTechBuilding01A()
	InsertTechBuilding04A()
	InsertTechBuilding06A()
	InsertTechBuilding08A()
	InsertTechBuilding09A()
	InsertTechBuilding11A()
	InsertTechBuilding11B()
	InsertTechBuilding12A()
	InsertTechBuilding12B()
	InsertTechAirfield(CPos.New(Utils.RandomInteger(33, 55), Utils.RandomInteger(77, 99)))
	InsertTechAirfield(CPos.New(Utils.RandomInteger(88, 122), Utils.RandomInteger(88, 122)))
	Trigger.AfterDelay(11, function()
		local OilWells = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return (self.Type == "v19" or self.Type == "v19.fix") and self.Owner == mines end)
		Utils.Do(OilWells, function(well)
			local OilWellsPosition = well.Location
			local OilWellsWaypoints = Actor.Create("waypoint", true, { Owner = clearpoint, Location = OilWellsPosition })
			local OilWellBarrelA = Actor.Create("boxes0" .. Utils.RandomInteger(1, 9), true, { Owner = well.Owner, Location = OilWellsWaypoints.Location + CVec.New(1, -1) })
			local OilWellBarrelB = Actor.Create(Utils.Random({ "barl", "brl3", "ffuelcrate" }), true, { Owner = well.Owner, Location = OilWellsWaypoints.Location + CVec.New(-1, 0) })
			local OilWellBarrelC = Actor.Create(Utils.Random({ "barl", "brl3", "ffuelcrate" }), true, { Owner = well.Owner, Location = OilWellsWaypoints.Location + CVec.New(0, -1) })
			local OilWellBarrelD = Actor.Create(Utils.Random({ "barl", "brl3", "ffuelcrate" }), true, { Owner = well.Owner, Location = OilWellsWaypoints.Location + CVec.New(-1, -1) })
--			local OilTruck = Actor.Create("pick" .. Utils.Random({ "", ".lightred", ".red", ".darkred", ".lightgreen", ".green", ".blue", ".brown", ".teal", ".darkyellow", ".yellow" }), true, { Owner = well.Owner, Location = OilWellsWaypoints.Location + CVec.New(-1, 1), Facing = Utils.RandomInteger(128 - 32, 128 + 32) })
--			OilTruck.GrantUpgrade("autocontrol")
--			OilTruck.Stance = "HoldFire"
		end)
		local BigOreMines = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return (self.Type == "bigoremine" or self.Type == "bigoremine.fix") and self.Owner == mines end)
		Utils.Do(BigOreMines, function(bigoremine)
			local BigOreMinesPosition = bigoremine.Location
			local BigOreMineWaypoints = Actor.Create("waypoint", true, { Owner = clearpoint, Location = BigOreMinesPosition })
			local BigOreMineBoxA = Actor.Create("boxes0" .. Utils.RandomInteger(1, 9), true, { Owner = bigoremine.Owner, Location = BigOreMineWaypoints.Location + CVec.New(Utils.RandomInteger(-1, 0), Utils.RandomInteger(-1, 1)) })
			local BigOreMineBoxB = Actor.Create("boxes0" .. Utils.RandomInteger(1, 9), true, { Owner = bigoremine.Owner, Location = BigOreMineWaypoints.Location + CVec.New(Utils.RandomInteger(1, 2), Utils.RandomInteger(-1, 1)) })
			local BigOreMineBoxC = Actor.Create("boxes0" .. Utils.RandomInteger(1, 9), true, { Owner = bigoremine.Owner, Location = BigOreMineWaypoints.Location + CVec.New(Utils.RandomInteger(-1, 1), Utils.RandomInteger(-1, 1)) })
			local BigOreMineExcavator = Actor.Create("trctr" .. tostring(Utils.RandomInteger(7, 8)), true, { Owner = bigoremine.Owner, Location = BigOreMineWaypoints.Location + CVec.New(Utils.RandomInteger(-3, -1), Utils.RandomInteger(1, 2)), Facing = Utils.RandomInteger(0, 255) })
			BigOreMineExcavator.GrantUpgrade("autocontrol")
			BigOreMineExcavator.Stance = "HoldFire"
			Trigger.OnIdle(BigOreMineExcavator, function(Excavator)
				if not Excavator.IsDead and Excavator.IsInWorld then
					Excavator.Patrol({BigOreMineWaypoints.Location + CVec.New(Utils.RandomInteger(-2, -1), Utils.RandomInteger(1, 2)), BigOreMineWaypoints.Location + CVec.New(Utils.RandomInteger(-2, -1), Utils.RandomInteger(1, 2)), BigOreMineWaypoints.Location + CVec.New(Utils.RandomInteger(-2, -1), Utils.RandomInteger(1, 2)), BigOreMineWaypoints.Location + CVec.New(Utils.RandomInteger(-2, -1), Utils.RandomInteger(1, 2)), BigOreMineWaypoints.Location + CVec.New(Utils.RandomInteger(-2, -1), Utils.RandomInteger(1, 2)), BigOreMineWaypoints.Location + CVec.New(Utils.RandomInteger(-2, -1), Utils.RandomInteger(1, 2)), BigOreMineWaypoints.Location + CVec.New(Utils.RandomInteger(-2, -1), Utils.RandomInteger(1, 2))}, true, DateTime.Seconds(Utils.RandomInteger(2.3, 3.2)))
				end 
			end)
		end)
		local OreMines = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return (self.Type == "mine" or self.Type == "mine.fix") and self.Owner == mines end)
		Utils.Do(OreMines, function(mine)
			local OreMinesPosition = mine.Location
			local OreMineWaypoints = Actor.Create("waypoint", true, { Owner = clearpoint, Location = OreMinesPosition })
			local OreMineBoxA = Actor.Create("boxes0" .. Utils.RandomInteger(1, 9), true, { Owner = mine.Owner, Location = OreMineWaypoints.Location + CVec.New(Utils.RandomInteger(-1, 0), Utils.RandomInteger(-1, 1)) })
			local OreMineBoxB = Actor.Create("boxes0" .. Utils.RandomInteger(1, 9), true, { Owner = mine.Owner, Location = OreMineWaypoints.Location + CVec.New(Utils.RandomInteger(1, 2), Utils.RandomInteger(-1, 1)) })
			local OreMineBoxC = Actor.Create("boxes0" .. Utils.RandomInteger(1, 9), true, { Owner = mine.Owner, Location = OreMineWaypoints.Location + CVec.New(Utils.RandomInteger(-1, 1), Utils.RandomInteger(-1, 1)) })
			local OreMineExcavator = Actor.Create("trctr" .. tostring(Utils.RandomInteger(2, 5)), true, { Owner = mine.Owner, Location = OreMineWaypoints.Location + CVec.New(Utils.RandomInteger(-2, 2), Utils.RandomInteger(-2, 2)), Facing = Utils.RandomInteger(0, 255) })
			OreMineExcavator.GrantUpgrade("autocontrol")
			OreMineExcavator.Stance = "HoldFire"
			Trigger.OnIdle(OreMineExcavator, function(Excavator)
				if not Excavator.IsDead and Excavator.IsInWorld then
					Excavator.Patrol({OreMineWaypoints.Location + CVec.New(Utils.RandomInteger(-2, 2), Utils.RandomInteger(-2, 2)), OreMineWaypoints.Location + CVec.New(Utils.RandomInteger(-2, 2), Utils.RandomInteger(-2, 2)), OreMineWaypoints.Location + CVec.New(Utils.RandomInteger(-2, 2), Utils.RandomInteger(-2, 2)), OreMineWaypoints.Location + CVec.New(Utils.RandomInteger(-2, 2), Utils.RandomInteger(-2, 2)), OreMineWaypoints.Location + CVec.New(Utils.RandomInteger(-2, 2), Utils.RandomInteger(-2, 2)), OreMineWaypoints.Location + CVec.New(Utils.RandomInteger(-2, 2), Utils.RandomInteger(-2, 2)), OreMineWaypoints.Location + CVec.New(Utils.RandomInteger(-2, 2), Utils.RandomInteger(-2, 2))}, true, DateTime.Seconds(Utils.RandomInteger(2.3, 3.2)))
				end 
			end)
		end)
	end)
	Trigger.AfterDelay(688, function()
		InsertTechBuildingPlus00()
		InsertTechBuildingPlus01()
		InsertTechBuildingPlus04()
		InsertTechBuildingPlus06()
		Trigger.AfterDelay(66, function()
			InsertTechBuildingPlus08()
--			InsertTechBuildingPlus08A()
		end)
		Trigger.AfterDelay(88, function()
--			InsertTechBuildingPlus08B() 
		end)
		InsertTechBuildingPlus09A()
		InsertTechBuildingPlus11A(TechBuilding11A, nod)
		InsertTechBuildingPlus11B(TechBuilding11B, isis)
	end)
	Trigger.AfterDelay(799, function()
		InsertHospitalTransport()
		InsertFactoryTransport()
		InsertMoneyTransport()
	end)
	Trigger.AfterDelay(888, function()
		SetupProducedUnitTypes()
	end)
	Trigger.AfterDelay(999, function()
		SetupFactories()
		Utils.Do(ProducedUnitTypes, ProduceUnits)
	end)
end
InsertTechBuilding00A = function()
	TechBuilding00A = Actor.Create("hosp.fix", true, { Owner = neutral, Location = CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)) })
	Trigger.OnKilled(TechBuilding00A, function()
--	Trigger.OnRemovedFromWorld(TechBuilding00A, function()
		Trigger.AfterDelay(0, function()
			InsertTechBuilding00A() 
		end)
	end)
end
InsertTechBuilding01A = function()
	TechBuilding01A = Actor.Create("tnksprt.fix", true, { Owner = neutral, Location = CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)) })
	Trigger.OnKilled(TechBuilding01A, function()
--	Trigger.OnRemovedFromWorld(TechBuilding01A, function()
		Trigger.AfterDelay(0, function()
			InsertTechBuilding01A() 
		end)
	end)
end
InsertTechBuilding04A = function()
	TechBuilding04A = Actor.Create(Utils.Random({ "radiotower", "radiotower2" }) .. ".fix", true, { Owner = neutral, Location = CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)) })
	Trigger.OnKilled(TechBuilding04A, function()
--	Trigger.OnRemovedFromWorld(TechBuilding04A, function()
		Trigger.AfterDelay(0, function()
			InsertTechBuilding04A() 
		end)
	end)
end
InsertTechBuilding06A = function()
	TechBuilding06A = Actor.Create(Utils.Random({ "bank", "bank1" }) .. ".fix", true, { Owner = neutral, Location = CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)) })
	Trigger.OnKilled(TechBuilding06A, function()
--	Trigger.OnRemovedFromWorld(TechBuilding06A, function()
		Trigger.AfterDelay(0, function()
			InsertTechBuilding06A() 
		end)
	end)
end
InsertTechBuilding08A = function()
	TechBuilding08A = Actor.Create("gaspump1.fix", true, { Owner = neutral, Location = CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)) })
	Trigger.OnKilled(TechBuilding08A, function()
--	Trigger.OnRemovedFromWorld(TechBuilding08A, function()
		Trigger.AfterDelay(0, function()
			InsertTechBuilding08A() 
		end)
	end)
end
InsertTechBuilding08B = function()
	TechBuilding08B = Actor.Create("gaspump1.fix", true, { Owner = neutral, Location = CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)) })
	Trigger.OnKilled(TechBuilding08B, function()
--	Trigger.OnRemovedFromWorld(TechBuilding08B, function()
		Trigger.AfterDelay(0, function()
			InsertTechBuilding08B() 
		end)
	end)
end
InsertTechBuilding09A = function()
	TechBuilding09A = Actor.Create(Utils.Random({ "civil_factory", "civilfactory1" }) .. ".fix", true, { Owner = neutral, Location = CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)) })
	Trigger.OnKilled(TechBuilding09A, function()
--	Trigger.OnRemovedFromWorld(TechBuilding09A, function()
		Trigger.AfterDelay(0, function()
			InsertTechBuilding09A() 
		end)
	end)
end
InsertTechBuilding11A = function()
	TechBuilding11A = Actor.Create("hand", true, { Owner = neutral, Location = CPos.New(Utils.RandomInteger(77, 99), Utils.RandomInteger(66, 88)) })
end
InsertTechBuilding11B = function()
	TechBuilding11B = Actor.Create("abarr", true, { Owner = neutral, Location = CPos.New(Utils.RandomInteger(66, 88), Utils.RandomInteger(144, 166)) })
end
InsertTechAirfield = function(AirfieldPosition)
	local TechAirfield = Actor.Create("advafld", true, { Owner = Utils.Random({ neutral0, neutral1, neutral2, neutral3 }), Location = AirfieldPosition })
	InsertTechAirfieldPlus(TechAirfield)
end
InsertTechAirfieldPlus = function(Airfield)
	local TechAirfieldPosition = Airfield.Location
	local TechAirfieldWaypoint = Actor.Create("waypoint", true, { Owner = clearpoint, Location = TechAirfieldPosition })
	local AirfieldBagtruck = Actor.Create("planebagtruck", true, { Owner = Airfield.Owner, Location = TechAirfieldWaypoint.Location + CVec.New(3, 0), Facing = Utils.RandomInteger(64 - Utils.RandomInteger(4, 28), 64 + Utils.RandomInteger(4, 28)), SubCell = 4 })
	local AirfieldFueltruck = Actor.Create("planefueltruck", true, { Owner = Airfield.Owner, Location = TechAirfieldWaypoint.Location + CVec.New(3, 1), Facing = Utils.RandomInteger(64 - Utils.RandomInteger(4, 28), 64 + Utils.RandomInteger(4, 28)), SubCell = 4 })
	local AirfieldParkingCarA = Actor.Create(CivilianCarTypes[Utils.RandomInteger(1, 28)], true, { Owner = Utils.Random({ neutral0, neutral1, neutral2, neutral3 }), Location = TechAirfieldWaypoint.Location + CVec.New(5, 0), Facing = Utils.RandomInteger(64 - Utils.RandomInteger(0, 8), 64 + Utils.RandomInteger(0, 8)) })
	local AirfieldParkingCarB = Actor.Create(CivilianCarTypes[Utils.RandomInteger(1, 28)], true, { Owner = Utils.Random({ neutral0, neutral1, neutral2, neutral3 }), Location = TechAirfieldWaypoint.Location + CVec.New(5, 1), Facing = Utils.RandomInteger(64 - Utils.RandomInteger(0, 8), 64 + Utils.RandomInteger(0, 8)) })
	local AirfieldParkingCarC = Actor.Create(CivilianCarTypes[Utils.RandomInteger(1, 28)], true, { Owner = Utils.Random({ neutral0, neutral1, neutral2, neutral3 }), Location = TechAirfieldWaypoint.Location + CVec.New(5, 2), Facing = Utils.RandomInteger(64 - Utils.RandomInteger(0, 8), 64 + Utils.RandomInteger(0, 8)) })
	local AirfieldParkingCarD = Actor.Create(CivilianCarTypes[Utils.RandomInteger(1, 28)], true, { Owner = Utils.Random({ neutral0, neutral1, neutral2, neutral3 }), Location = TechAirfieldWaypoint.Location + CVec.New(1, 3), Facing = Utils.Random({ Utils.RandomInteger(0, 0 + 22), Utils.RandomInteger(255 - 22, 255) }) })
	local AirfieldParkingCarE = Actor.Create(CivilianCarTypes[Utils.RandomInteger(1, 28)], true, { Owner = Utils.Random({ neutral0, neutral1, neutral2, neutral3 }), Location = TechAirfieldWaypoint.Location + CVec.New(2, 3), Facing = Utils.Random({ Utils.RandomInteger(0, 0 + 22), Utils.RandomInteger(255 - 22, 255) }) })
	local AirfieldParkingCarF = Actor.Create(CivilianCarTypes[Utils.RandomInteger(1, 28)], true, { Owner = Utils.Random({ neutral0, neutral1, neutral2, neutral3 }), Location = TechAirfieldWaypoint.Location + CVec.New(3, 3), Facing = Utils.Random({ Utils.RandomInteger(0, 0 + 22), Utils.RandomInteger(255 - 22, 255) }) })
	local AirfieldParkingCarG = Actor.Create(CivilianCarTypes[Utils.RandomInteger(1, 28)], true, { Owner = Utils.Random({ neutral0, neutral1, neutral2, neutral3 }), Location = TechAirfieldWaypoint.Location + CVec.New(4, 3), Facing = Utils.Random({ Utils.RandomInteger(0, 0 + 22), Utils.RandomInteger(255 - 22, 255) }) })
	local AirfieldParkingCarH = Actor.Create(CivilianCarTypes[Utils.RandomInteger(1, 28)], true, { Owner = Utils.Random({ neutral0, neutral1, neutral2, neutral3 }), Location = TechAirfieldWaypoint.Location + CVec.New(1, 4), Facing = Utils.Random({ Utils.RandomInteger(0, 0 + 22), Utils.RandomInteger(255 - 22, 255) }) })
	local AirfieldParkingCarI = Actor.Create(CivilianCarTypes[Utils.RandomInteger(1, 28)], true, { Owner = Utils.Random({ neutral0, neutral1, neutral2, neutral3 }), Location = TechAirfieldWaypoint.Location + CVec.New(2, 4), Facing = Utils.Random({ Utils.RandomInteger(0, 0 + 22), Utils.RandomInteger(255 - 22, 255) }) })
	local AirfieldParkingCarJ = Actor.Create(CivilianCarTypes[Utils.RandomInteger(1, 28)], true, { Owner = Utils.Random({ neutral0, neutral1, neutral2, neutral3 }), Location = TechAirfieldWaypoint.Location + CVec.New(3, 4), Facing = Utils.Random({ Utils.RandomInteger(0, 0 + 22), Utils.RandomInteger(255 - 22, 255) }) })
	local AirfieldParkingCarK = Actor.Create(CivilianCarTypes[Utils.RandomInteger(1, 28)], true, { Owner = Utils.Random({ neutral0, neutral1, neutral2, neutral3 }), Location = TechAirfieldWaypoint.Location + CVec.New(4, 4), Facing = Utils.Random({ Utils.RandomInteger(0, 0 + 22), Utils.RandomInteger(255 - 22, 255) }) })
	local AirfieldBusA = Actor.Create("bbus" .. tostring(Utils.RandomInteger(1, 3)) .. tostring(Utils.Random({ "", ".lightred", ".red", ".darkred", ".lightgreen", ".green", ".blue", ".brown", ".teal", ".darkyellow", ".yellow" })), true, { Owner = Utils.Random({ neutral0, neutral1, neutral2, neutral3 }), Location = TechAirfieldWaypoint.Location + CVec.New(3, -1), Facing = Utils.RandomInteger(0, 255) })
	local AirfieldBusB = Actor.Create("bbus" .. Utils.RandomInteger(1, 3) .. Utils.Random({ "", ".lightred", ".red", ".darkred", ".lightgreen", ".green", ".blue", ".brown", ".teal", ".darkyellow", ".yellow" }), true, { Owner = Utils.Random({ neutral0, neutral1, neutral2, neutral3 }), Location = TechAirfieldWaypoint.Location + CVec.New(5, -1), Facing = Utils.RandomInteger(0, 255) })
	Utils.Do({ AirfieldBagtruck, AirfieldFueltruck, AirfieldParkingCarA, AirfieldParkingCarB, AirfieldParkingCarC, AirfieldParkingCarD, AirfieldParkingCarE, AirfieldParkingCarF, AirfieldParkingCarG, AirfieldParkingCarH, AirfieldParkingCarI, AirfieldParkingCarJ, AirfieldParkingCarK, AirfieldBusA, AirfieldBusB }, function(airfieldvehicles)
		airfieldvehicles.GrantUpgrade("autocontrol")
		airfieldvehicles.Stance = "HoldFire"
	end)
end
InsertTechBuilding12A = function()
	local TechBuilding12A = Actor.Create("gdihq.fix", true, { Owner = neutral, Location = CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)) })
	Trigger.OnKilled(TechBuilding12A, function()
--	Trigger.OnRemovedFromWorld(TechBuilding12A, function()
		Trigger.AfterDelay(0, function()
			InsertTechBuilding12A() 
		end)
	end)
end
InsertTechBuilding12B = function()
	local TechBuilding12B = Actor.Create("cityhq.fix", true, { Owner = neutral, Location = CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)) })
	Trigger.OnKilled(TechBuilding12B, function()
--	Trigger.OnRemovedFromWorld(TechBuilding12B, function()
		Trigger.AfterDelay(0, function()
			InsertTechBuilding12B() 
		end)
	end)
end
InsertTechBuildingPlus00 = function()
	local TechBuilding = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return (self.Type == "hosp.fix" or self.Type == "hosp") and self.Owner == neutral end)
	Utils.Do(TechBuilding, function(TechBuilding)
		local RandomCountry = Utils.Random({ neutral0, neutral1, neutral2, neutral3 })
		local TechBuildingPosition = TechBuilding.Location
		local TechBuildingWaypoint = Actor.Create("waypoint", true, { Owner = clearpoint, Location = TechBuildingPosition })
		TechBuilding.Owner = RandomCountry
		TechBuilding.GrantTimedUpgrade("medic.prefix", Utils.RandomInteger(2222, 4444))
		TechBuilding.GrantTimedUpgrade("normal.objective", Utils.RandomInteger(2222, 4444))
		local TechPowerPlant = Actor.Create(Utils.Random({ "civcoalplant", "windplant", "trafo" }), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(4, Utils.RandomInteger(-1, 2)) })
		local TechBuildingCycl00 = Actor.Create("wood", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(-2, -1) })
		local TechBuildingCycl00 = Actor.Create("wood", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(-2, 0) })
		local TechBuildingCycl01 = Actor.Create("wood", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(-1, -1) })
		local TechBuildingCycl02 = Actor.Create("wood", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(0, -1) })
		local TechBuildingCycl03 = Actor.Create("wood", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(1, -1) })
		local TechBuildingCycl04 = Actor.Create("wood", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(-2, 3) })
		local TechBuildingCycl05 = Actor.Create("wood", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(-1, 3) })
		local TechBuildingCycl06 = Actor.Create("wood", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(2, 3) })
		local TechBuildingCycl07 = Actor.Create("wood", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(1, 3) })
		local TechBuildingCycl08 = Actor.Create("wood", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(-2, 1) })
		local TechBuildingCycl09 = Actor.Create("wood", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(-2, 2) })
		local TechBuildingCycl10 = Actor.Create("wood", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(2, -1) })
		local TechBuildingCycl11 = Actor.Create("wood", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(3, -1) })
		local TechBuildingCycl12 = Actor.Create("wood", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(3, 3) })
		local TechBuildingCycl12 = Actor.Create("wood", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(3, 0) })
		local HospitalCrateA = Actor.Create("healcrate2", true, { Owner = neutral, Location = TechBuildingWaypoint.Location + CVec.New(2, 1), Facing = Utils.RandomInteger(0, 255) })
		local HospitalCrateB = Actor.Create("healcrate0", true, { Owner = neutral, Location = TechBuildingWaypoint.Location + CVec.New(2, 0), Facing = 0 })
		local HospitalCrateC = Actor.Create("amfetamincrate", true, { Owner = neutral, Location = TechBuildingWaypoint.Location + CVec.New(-1, 0), Facing = 0 })
		local HospitalAmbulance = Actor.Create("ambulance" .. tostring(Utils.RandomInteger(0, 1)), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(-1, 1), Facing = Utils.RandomInteger(0, 255) })
		HospitalAmbulance.GrantUpgrade("autocontrol")
		HospitalAmbulance.Stance = "Defend"
		local GuardA = Actor.Create(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "policeman" }), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(0, 3), Facing = Utils.RandomInteger(99, 188), SubCell = Utils.RandomInteger(1, 2) })
		local GuardB = Actor.Create(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "policeman" }), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(0, 3), Facing = Utils.RandomInteger(99, 188), SubCell = Utils.RandomInteger(4, 5) })
		local GuardC = Actor.Create(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "policeman" }), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(1, 3), Facing = Utils.RandomInteger(99, 188), SubCell = Utils.RandomInteger(1, 2) })
		local GuardD = Actor.Create(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "policeman" }), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(1, 3), Facing = Utils.RandomInteger(99, 188), SubCell = Utils.RandomInteger(4, 5) })
		Utils.Do({ GuardA, GuardB, GuardC, GuardD }, function(Guards)
			Guards.GrantUpgrade(Utils.Random({ "firepower", "damage", "speed", "reload", "inaccuracy", "m16upg", "mp5upg", "ak47upg", "smawupg", "rpg7upg" }))
			Guards.GrantUpgrade("autocontrol")
			Guards.GrantUpgrade("wandering")
			Guards.Stance = "Defend"
			Guards.Scatter()
			Trigger.OnIdle(Guards, function(guard)
				if not guard.IsDead and guard.IsInWorld then
					guard.Patrol({TechBuildingWaypoint.Location + Utils.Random({ CVec.New(-1, 3), CVec.New(0, 3), CVec.New(-1, 4), CVec.New(0, 4), CVec.New(0, 1), CVec.New(0, 2), CVec.New(-1, 3), CVec.New(0, 3), CVec.New(1, 3), CVec.New(2, 3), CVec.New(-2, 4), CVec.New(-1, 4), CVec.New(0, 4), CVec.New(1, 4), CVec.New(2, 4), CVec.New(3, 4) }), TechBuildingWaypoint.Location + Utils.Random({ CVec.New(-1, 3), CVec.New(0, 3), CVec.New(-1, 4), CVec.New(0, 4), CVec.New(0, 1), CVec.New(0, 2), CVec.New(-1, 3), CVec.New(0, 3), CVec.New(1, 3), CVec.New(2, 3), CVec.New(-2, 4), CVec.New(-1, 4), CVec.New(0, 4), CVec.New(1, 4), CVec.New(2, 4), CVec.New(3, 4) }), TechBuildingWaypoint.Location + Utils.Random({ CVec.New(-1, 3), CVec.New(0, 3), CVec.New(-1, 4), CVec.New(0, 4), CVec.New(0, 1), CVec.New(0, 2), CVec.New(-1, 3), CVec.New(0, 3), CVec.New(1, 3), CVec.New(2, 3), CVec.New(-2, 4), CVec.New(-1, 4), CVec.New(0, 4), CVec.New(1, 4), CVec.New(2, 4), CVec.New(3, 4) }), TechBuildingWaypoint.Location + Utils.Random({ CVec.New(-1, 3), CVec.New(0, 3), CVec.New(-1, 4), CVec.New(0, 4), CVec.New(0, 1), CVec.New(0, 2), CVec.New(-1, 3), CVec.New(0, 3), CVec.New(1, 3), CVec.New(2, 3), CVec.New(-2, 4), CVec.New(-1, 4), CVec.New(0, 4), CVec.New(1, 4), CVec.New(2, 4), CVec.New(3, 4) }), TechBuildingWaypoint.Location + Utils.Random({ CVec.New(-1, 3), CVec.New(0, 3), CVec.New(-1, 4), CVec.New(0, 4), CVec.New(0, 1), CVec.New(0, 2), CVec.New(-1, 3), CVec.New(0, 3), CVec.New(1, 3), CVec.New(2, 3), CVec.New(-2, 4), CVec.New(-1, 4), CVec.New(0, 4), CVec.New(1, 4), CVec.New(2, 4), CVec.New(3, 4) }), TechBuildingWaypoint.Location + Utils.Random({ CVec.New(-1, 3), CVec.New(0, 3), CVec.New(-1, 4), CVec.New(0, 4), CVec.New(0, 1), CVec.New(0, 2), CVec.New(-1, 3), CVec.New(0, 3), CVec.New(1, 3), CVec.New(2, 3), CVec.New(-2, 4), CVec.New(-1, 4), CVec.New(0, 4), CVec.New(1, 4), CVec.New(2, 4), CVec.New(3, 4) }), TechBuildingWaypoint.Location + Utils.Random({ CVec.New(-1, 3), CVec.New(0, 3), CVec.New(-1, 4), CVec.New(0, 4), CVec.New(0, 1), CVec.New(0, 2), CVec.New(-1, 3), CVec.New(0, 3), CVec.New(1, 3), CVec.New(2, 3), CVec.New(-2, 4), CVec.New(-1, 4), CVec.New(0, 4), CVec.New(1, 4), CVec.New(2, 4), CVec.New(3, 4) })}, true, DateTime.Seconds(Utils.RandomInteger(1.3, 3.1)))
				end 
			end)
		end)
		local HospitalDoctors = Reinforcements.Reinforce(RandomCountry, { Utils.Random({ "doctor", "chan", "doctor", "medi", "doctor" }), Utils.Random({ "doctor", "chan", "doctor", "medi", "doctor" }), Utils.Random({ "doctor", "chan", "doctor", "medi", "doctor" }) }, { TechBuildingWaypoint.Location + CVec.New(0, 1) }, Utils.RandomInteger(33, 99))
		Utils.Do(HospitalDoctors, function(civ)
			Trigger.OnIdle(civ, function()
				if civ.Location == TechBuildingWaypoint.Location + CVec.New(-1, 2) then
					civ.Wait(Utils.RandomInteger(66, 99))
					civ.Scatter()
					civ.Scatter()
					civ.Scatter()
				else
					civ.Wait(Utils.RandomInteger(33, 66))
					civ.Move(TechBuildingWaypoint.Location + CVec.New(-1, 2))
				end
			end)
		end)
	end)
end
InsertTechBuildingPlus01 = function()
	local TechBuilding = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return (self.Type == "tnksprt.fix" or self.Type == "tnksprt") and self.Owner == neutral end)
	Utils.Do(TechBuilding, function(TechBuilding)
		local RandomCountry = Utils.Random({ neutral0, neutral1, neutral2, neutral3 })
		TechBuilding.Owner = RandomCountry
		local TechBuildingPosition = TechBuilding.Location
		local TechBuildingWaypoint = Actor.Create("waypoint", true, { Owner = clearpoint, Location = TechBuildingPosition })
		TechBuilding.GrantTimedUpgrade("repair.prefix", Utils.RandomInteger(2222, 4444))
		TechBuilding.GrantTimedUpgrade("normal.objective", Utils.RandomInteger(2222, 4444))
		local TechPowerPlant = Actor.Create(Utils.Random({ "civcoalplant", "windplant", "trafo" }), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(4, Utils.RandomInteger(-1, 2)) })
		local DepoCrate = Actor.Create(Utils.Random({ "armorcrate0", "woodcrate" .. Utils.RandomInteger(0, 1), "healcrate2", "ammocrate" .. Utils.RandomInteger(0, 1), "computercrate" .. Utils.RandomInteger(0, 4) }), true, { Owner = neutral, Location = TechBuildingWaypoint.Location + CVec.New(2, 2), Facing = Utils.RandomInteger(0, 255) })
		local TechBuildingWallType = Utils.Random({ "sbag", "brik", "fenc", "cycl", "barb", "wood" })
		local TechBuildingCycl00 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(-1, 0) })
		local TechBuildingCycl01 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(0, 0) })
		local TechBuildingCycl02 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(1, 0) })
		local TechBuildingCycl03 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(-1, 3) })
		local TechBuildingCycl04 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(2, 3) })
		local TechBuildingCycl05 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(1, 3) })
		local TechBuildingCycl06 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(-1, 1) })
		local TechBuildingCycl07 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(-1, 2) })
		local TechBuildingCycl08 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(2, 0) })
		local TechBuildingCycl09 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(3, 0) })
		local TechBuildingCycl10 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(3, 1) })
		local TechBuildingCycl11 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(3, 2) })
		local TechBuildingCycl12 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(3, 3) })
		local GuardA = Actor.Create(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "policeman" }), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(0, 3), Facing = Utils.RandomInteger(99, 188), SubCell = Utils.RandomInteger(1, 2) })
		local GuardB = Actor.Create(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "policeman" }), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(0, 3), Facing = Utils.RandomInteger(99, 188), SubCell = Utils.RandomInteger(4, 5) })
		local GuardC = Actor.Create(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "policeman" }), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(1, 3), Facing = Utils.RandomInteger(99, 188), SubCell = Utils.RandomInteger(1, 2) })
		local GuardD = Actor.Create(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "policeman" }), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(1, 3), Facing = Utils.RandomInteger(99, 188), SubCell = Utils.RandomInteger(4, 5) })
		Utils.Do({ GuardA, GuardB, GuardC, GuardD }, function(Guards)
			Guards.GrantUpgrade(Utils.Random({ "firepower", "damage", "speed", "reload", "inaccuracy", "m16upg", "mp5upg", "ak47upg", "smawupg", "rpg7upg" }))
			Guards.GrantUpgrade("autocontrol")
			Guards.GrantUpgrade("wandering")
			Guards.Stance = "Defend"
			Guards.Scatter()
			Trigger.OnIdle(Guards, function(guard)
				if not guard.IsDead and guard.IsInWorld then
					guard.Patrol({TechBuildingWaypoint.Location + Utils.Random({ CVec.New(0, 2), CVec.New(0, 3), CVec.New(0, 4), CVec.New(-1, 4) }), TechBuildingWaypoint.Location + Utils.Random({ CVec.New(0, 2), CVec.New(0, 3), CVec.New(0, 4), CVec.New(-1, 4) }), TechBuildingWaypoint.Location + Utils.Random({ CVec.New(0, 2), CVec.New(0, 3), CVec.New(0, 4), CVec.New(-1, 4) }), TechBuildingWaypoint.Location + Utils.Random({ CVec.New(0, 2), CVec.New(0, 3), CVec.New(0, 4), CVec.New(-1, 4) }), TechBuildingWaypoint.Location + Utils.Random({ CVec.New(0, 2), CVec.New(0, 3), CVec.New(0, 4), CVec.New(-1, 4) }), TechBuildingWaypoint.Location + Utils.Random({ CVec.New(0, 2), CVec.New(0, 3), CVec.New(0, 4), CVec.New(-1, 4) }), TechBuildingWaypoint.Location + Utils.Random({ CVec.New(0, 2), CVec.New(0, 3), CVec.New(0, 4), CVec.New(-1, 4) }), TechBuildingWaypoint.Location + Utils.Random({ CVec.New(0, 2), CVec.New(0, 3), CVec.New(0, 4), CVec.New(-1, 4) }), TechBuildingWaypoint.Location + Utils.Random({ CVec.New(0, 2), CVec.New(0, 3), CVec.New(0, 4), CVec.New(-1, 4) })}, true, DateTime.Seconds(Utils.RandomInteger(1.3, 3.1)))
				end 
			end)
		end)
		local DepoEngineers = Reinforcements.Reinforce(RandomCountry, { Utils.Random({ "mech", "delphi", "mech", "hacke6", "mech", "e6" }), Utils.Random({ "mech", "delphi", "mech", "hacke6", "mech", "e6" }), Utils.Random({ "mech", "delphi", "mech", "hacke6", "mech", "e6" }) }, { TechBuildingWaypoint.Location + CVec.New(0, 2) }, Utils.RandomInteger(33, 99))
		Utils.Do(DepoEngineers, function(civ)
			Trigger.OnIdle(civ, function()
				if civ.Location == TechBuildingWaypoint.Location + CVec.New(0, 2) then
					civ.Wait(Utils.RandomInteger(111, 222))
					civ.Scatter()
					civ.Scatter()
				else
					civ.Wait(Utils.RandomInteger(66, 99))
					civ.Move(TechBuildingWaypoint.Location + CVec.New(0, 2))
				end
			end)
		end)
		local DepoCrane = Actor.Create("trctr" .. tostring(Utils.RandomInteger(1, 8)), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(1, 3), 4), Facing = Utils.RandomInteger(0, 255) })
		DepoCrane.GrantUpgrade("autocontrol")
		DepoCrane.GrantUpgrade("wandering")
		DepoCrane.Stance = "HoldFire"
		Trigger.OnIdle(DepoCrane, function(DepoCrane)
			if not DepoCrane.IsDead and DepoCrane.IsInWorld then
				DepoCrane.Patrol({TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(-2, 3), Utils.RandomInteger(2, 3)), TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(-2, 3), Utils.RandomInteger(2, 3)), TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(-2, 3), Utils.RandomInteger(2, 3)), TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(-2, 3), Utils.RandomInteger(2, 3)), TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(-2, 3), Utils.RandomInteger(2, 3)), TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(-2, 3), Utils.RandomInteger(2, 3)), TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(-2, 3), Utils.RandomInteger(2, 3))}, true, DateTime.Seconds(Utils.RandomInteger(2.3, 3.2)))
			end 
		end)
	end)
end
InsertTechBuildingPlus04 = function()
	local TechBuilding = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return (self.Type == "radiotower.fix" or self.Type == "radiotower2.fix" or self.Type == "radiotower" or self.Type == "radiotower2") and self.Owner == neutral end)
	Utils.Do(TechBuilding, function(TechBuilding)
		local RandomCountry = Utils.Random({ neutral0, neutral1, neutral2, neutral3 })
		local TechBuildingPosition = TechBuilding.Location
		local TechBuildingWaypoint = Actor.Create("waypoint", true, { Owner = clearpoint, Location = TechBuildingPosition })
		TechBuilding.Owner = RandomCountry
		local TechPowerPlant = Actor.Create(Utils.Random({ "civcoalplant", "windplant", "trafo" }), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(4, Utils.RandomInteger(-1, 2)) })
		local TechBuildingWallType = Utils.Random({ "fenc", "cycl", "barb", "wood" })
		local TechBuildingCycl00 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(-1, 2) })
		local TechBuildingCycl01 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(0, 2) })
		local TechBuildingCycl02 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(1, 2) })
		local TechBuildingCycl03 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(-1, 5) })
		local TechBuildingCycl04 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(2, 5) })
		local TechBuildingCycl05 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(1, 5) })
		local TechBuildingCycl06 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(-1, 3) })
		local TechBuildingCycl07 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(-1, 4) })
		local TechBuildingCycl08 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(2, 2) })
		local TechBuildingCycl10 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(2, 3) })
		local TechBuildingCycl11 = Actor.Create(TechBuildingWallType, true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(2, 4) })
		local TechCrateA = Actor.Create("computercrate" .. Utils.RandomInteger(0, 4), true, { Owner = neutral, Location = TechBuildingWaypoint.Location + CVec.New(0, 3), Facing = Utils.RandomInteger(0, 255) })
		local TechCrateB = Actor.Create("computercrate" .. Utils.RandomInteger(0, 4), true, { Owner = neutral, Location = TechBuildingWaypoint.Location + CVec.New(1, 3), Facing = Utils.RandomInteger(0, 255) })
		local TechCrateC = Actor.Create("computercrate" .. Utils.RandomInteger(0, 4), true, { Owner = neutral, Location = TechBuildingWaypoint.Location + CVec.New(1, 4), Facing = Utils.RandomInteger(0, 255) })
		local TechVehicle = Actor.Create("van" .. tostring(Utils.Random({ "", ".lightred", ".red", ".darkred", ".lightgreen", ".green", ".blue", ".brown", ".teal", ".darkyellow", ".yellow" })), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(0, 4), Facing = Utils.RandomInteger(0, 255) })
		local RadioWorkers = Reinforcements.Reinforce(RandomCountry, { Utils.Random({ "chan", "delphi", "c" .. Utils.RandomInteger(1, 10), "einstein", "spy", "c" .. Utils.RandomInteger(1, 10), "c" .. Utils.RandomInteger(1, 10) }), Utils.Random({ "chan", "delphi", "c" .. Utils.RandomInteger(1, 10), "einstein", "spy", "c" .. Utils.RandomInteger(1, 10), "c" .. Utils.RandomInteger(1, 10) }), Utils.Random({ "chan", "delphi", "c" .. Utils.RandomInteger(1, 10), "einstein", "spy", "c" .. Utils.RandomInteger(1, 10), "c" .. Utils.RandomInteger(1, 10) }), Utils.Random({ "chan", "delphi", "c" .. Utils.RandomInteger(1, 10), "einstein", "spy", "c" .. Utils.RandomInteger(1, 10), "c" .. Utils.RandomInteger(1, 10) }), Utils.Random({ "chan", "delphi", "c" .. Utils.RandomInteger(1, 10), "einstein", "spy", "c" .. Utils.RandomInteger(1, 10), "c" .. Utils.RandomInteger(1, 10) }), Utils.Random({ "chan", "delphi", "c" .. Utils.RandomInteger(1, 10), "einstein", "spy", "c" .. Utils.RandomInteger(1, 10), "c" .. Utils.RandomInteger(1, 10) }) }, { TechBuildingWaypoint.Location + CVec.New(0, 5) }, Utils.RandomInteger(42, 64))
		Utils.Do(RadioWorkers, function(civ)
			Trigger.OnIdle(civ, function()
				if civ.Location == TechBuildingWaypoint.Location + CVec.New(0, 6) then
					civ.Wait(Utils.RandomInteger(111, 222))
					civ.Scatter()
					civ.Scatter()
				else
					civ.Wait(Utils.RandomInteger(88, 166))
					civ.Move(TechBuildingWaypoint.Location + CVec.New(0, 6))
				end
			end)
		end)
	end)
end
InsertTechBuildingPlus06 = function()
	local TechBuilding = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return (self.Type == "bank.fix" or self.Type == "bank1.fix" or self.Type == "bank" or self.Type == "bank1") and self.Owner == neutral end)
	Utils.Do(TechBuilding, function(TechBuilding)
		local RandomCountry = Utils.Random({ neutral0, neutral1, neutral2, neutral3 })
		local TechBuildingPosition = TechBuilding.Location
		local TechBuildingWaypoint = Actor.Create("waypoint", true, { Owner = clearpoint, Location = TechBuildingPosition })
		TechBuilding.Owner = RandomCountry
		local TechPowerPlant = Actor.Create(Utils.Random({ "civcoalplant", "windplant", "trafo" }), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(4, Utils.RandomInteger(-1, 2)) })
		local MoneyCrateA = Actor.Create("woodcrate" .. Utils.RandomInteger(0, 1), true, { Owner = neutral, Location = TechBuildingWaypoint.Location + CVec.New(4, 1), Facing = Utils.RandomInteger(0, 255) })
		local MoneyCrateB = Actor.Create("woodcrate" .. Utils.RandomInteger(0, 1), true, { Owner = neutral, Location = TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(-1, 3), Utils.RandomInteger(-1, 3)), Facing = Utils.RandomInteger(0, 255) })
		local MoneyVan = Actor.Create("moneyvan" .. Utils.RandomInteger(0, 1), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(0, 0), Facing = Utils.RandomInteger(0, 255) })
		local PoliceCar = Actor.Create("copcar" .. Utils.RandomInteger(0, 1), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(0, 3), Utils.RandomInteger(4, 6)), Facing = Utils.RandomInteger(0, 255) })
		PoliceCar.GrantUpgrade("autocontrol")
		PoliceCar.GrantUpgrade("wandering")
		PoliceCar.Stance = "ReturnFire"
		PoliceCar.Scatter()
		Trigger.OnIdle(PoliceCar, function(PoliceCar)
			if not PoliceCar.IsDead and PoliceCar.IsInWorld then
				PoliceCar.Patrol({TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(-2, 5), Utils.RandomInteger(4, 7)), TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(-2, 5), Utils.RandomInteger(4, 7)), TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(-2, 5), Utils.RandomInteger(4, 7)), TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(-2, 5), Utils.RandomInteger(4, 7)), TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(-2, 5), Utils.RandomInteger(4, 7)), TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(-2, 5), Utils.RandomInteger(4, 7)), TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(-2, 5), Utils.RandomInteger(4, 7)), TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(-2, 5), Utils.RandomInteger(4, 7)), TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(-2, 5), Utils.RandomInteger(4, 7))}, true, DateTime.Seconds(Utils.RandomInteger(4.4, 8.8)))
			end 
		end)
		local BankPoliceA = Actor.Create("policeman", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(2, 2), Facing = Utils.RandomInteger(88, 166), SubCell = Utils.RandomInteger(1, 2) })
		local BankPoliceB = Actor.Create("policeman", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(3, 2), Facing = Utils.RandomInteger(88, 166), SubCell = Utils.RandomInteger(1, 2) })
		local BankPoliceC = Actor.Create("policeman", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(2, 2), Facing = Utils.RandomInteger(99, 188), SubCell = Utils.RandomInteger(4, 5) })
		local BankPoliceD = Actor.Create("policeman", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(3, 2), Facing = Utils.RandomInteger(99, 188), SubCell = Utils.RandomInteger(4, 5) })
		local BankPoliceE = Actor.Create("policeman", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(3, 3), Facing = Utils.RandomInteger(99, 188), SubCell = Utils.RandomInteger(1, 3) })
		local BankPoliceF = Actor.Create("policeman", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(3, 3), Facing = Utils.RandomInteger(99, 188), SubCell = Utils.RandomInteger(4, 5) })
		Utils.Do({ BankPoliceA, BankPoliceB, BankPoliceC, BankPoliceD, BankPoliceE, BankPoliceF }, function(PoliceSquad)
			PoliceSquad.GrantUpgrade("autocontrol")
			PoliceSquad.GrantUpgrade("wandering")
			PoliceSquad.GrantUpgrade(Utils.Random({ "firepower", "damage", "speed", "reload", "inaccuracy", "mp5upg" }))
			PoliceSquad.Stance = "ReturnFire"
			PoliceSquad.Scatter()
			Trigger.OnIdle(PoliceSquad, function(PoliceSquad)
				if not PoliceSquad.IsDead and PoliceSquad.IsInWorld then
					PoliceSquad.Patrol({TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(0, 3), Utils.RandomInteger(3, 4)), TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(0, 3), Utils.RandomInteger(3, 4)), TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(0, 3), Utils.RandomInteger(3, 4)), TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(0, 3), Utils.RandomInteger(3, 4)), TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(0, 3), Utils.RandomInteger(3, 4)), TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(0, 3), Utils.RandomInteger(3, 4)), TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(0, 3), Utils.RandomInteger(3, 4)), TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(0, 3), Utils.RandomInteger(3, 4))}, true, DateTime.Seconds(Utils.RandomInteger(3.6, 6.3)))
				end 
			end)
		end)
	end)
end
InsertTechBuildingPlus08 = function()
	local TechBuilding = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return self.Type == "gaspump1.fix" or self.Type == "gaspump1" and self.Owner == neutral end)
--	Utils.Do(Utils.Take(1, TechBuilding), function(TechBuilding)
	Utils.Do(TechBuilding, function(TechBuilding)
		local RandomCountry = Utils.Random({ neutral0, neutral1, neutral2, neutral3 })
		TechBuilding.Owner = RandomCountry
		local TechBuildingPosition = TechBuilding.Location
		local TechBuildingWaypoint = Actor.Create("waypoint", true, { Owner = clearpoint, Location = TechBuildingPosition })
		local TechPowerPlant = Actor.Create(Utils.Random({ "civcoalplant", "windplant", "trafo" }), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(4, Utils.RandomInteger(-1, 2)) })
		local Gaspump_ffuelcrateA = Actor.Create("ffuelcrate", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(3, 1), Facing = 0 })
		local Gaspump_ffuelcrateB = Actor.Create("ffuelcrate", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(2, 2), Facing = 0 })
		local Gaspump_roadsignal1 = Actor.Create("roadsignal3a", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(-1, 3), Utils.RandomInteger(-1, 3)), Facing = 0 })
		local Gaspump_roadsignal2 = Actor.Create("roadsignal2", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(0, 1), Facing = 0 })
		local Gaspump_FuelTruck = Actor.Create("fueltruck", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(0, 2), Facing = Utils.RandomInteger(208, 222) })
	end)
end
InsertTechBuildingPlus08A = function()
	local RandomCountry = Utils.Random({ neutral0, neutral1, neutral2, neutral3 })
	local TechBuilding = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return self.Type == "gaspump1.fix" or self.Type == "gaspump1" and self.Owner == neutral end)
	Utils.Do(Utils.Take(1, TechBuilding), function(TechBuilding)
		TechBuilding.Owner = RandomCountry
		local TechBuildingPosition = TechBuilding.Location
		local TechBuildingWaypoint = Actor.Create("waypoint", true, { Owner = clearpoint, Location = TechBuildingPosition })
		local TechPowerPlant = Actor.Create(Utils.Random({ "civcoalplant", "windplant", "trafo" }), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(4, Utils.RandomInteger(-1, 2)) })
		local Gaspump_ffuelcrateA = Actor.Create("ffuelcrate", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(3, 1), Facing = 0 })
		local Gaspump_ffuelcrateB = Actor.Create("ffuelcrate", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(2, 2), Facing = 0 })
		local Gaspump_roadsignal1 = Actor.Create("roadsignal3a", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(-1, 3), Utils.RandomInteger(-1, 3)), Facing = 0 })
		local Gaspump_roadsignal2 = Actor.Create("roadsignal2", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(0, 1), Facing = 0 })
		local Gaspump_FuelTruck = Actor.Create("fueltruck", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(0, 2), Facing = Utils.RandomInteger(208, 222) })
	end)
end
InsertTechBuildingPlus08B = function()
	local RandomCountry = Utils.Random({ neutral0, neutral1, neutral2, neutral3 })
	local TechBuilding = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return self.Type == "gaspump1.fix" or self.Type == "gaspump1" and self.Owner == neutral end)
	Utils.Do(Utils.Take(1, TechBuilding), function(TechBuilding)
		TechBuilding.Owner = RandomCountry
		local TechBuildingPosition = TechBuilding.Location
		local TechBuildingWaypoint = Actor.Create("waypoint", true, { Owner = clearpoint, Location = TechBuildingPosition })
		local TechPowerPlant = Actor.Create(Utils.Random({ "civcoalplant", "windplant", "trafo" }), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(4, Utils.RandomInteger(-1, 2)) })
		local Gaspump_ffuelcrateA = Actor.Create("ffuelcrate", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(3, 1), Facing = 0 })
		local Gaspump_ffuelcrateB = Actor.Create("ffuelcrate", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(2, 2), Facing = 0 })
		local Gaspump_roadsignal1 = Actor.Create("roadsignal3a", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(Utils.RandomInteger(-1, 3), Utils.RandomInteger(-1, 3)), Facing = 0 })
		local Gaspump_roadsignal2 = Actor.Create("roadsignal2", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(0, 1), Facing = 0 })
		local Gaspump_FuelTruck = Actor.Create("fueltruck", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(0, 2), Facing = Utils.RandomInteger(208, 222) })
	end)
end
InsertTechBuildingPlus09A = function()
	local TechBuilding = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return (self.Type == "civil_factory.fix" or self.Type == "civilfactory1.fix" or self.Type == "civil_factory" or self.Type == "civilfactory1") and self.Owner == neutral end)
--	Utils.Do(Utils.Take(1, TechBuilding), function(TechBuilding)
	Utils.Do(TechBuilding, function(TechBuilding)
		local RandomCountry = Utils.Random({ neutral0, neutral1, neutral2, neutral3 })
		TechBuilding.Owner = RandomCountry
		local TechBuildingPosition = TechBuilding.Location
		local TechBuildingWaypoint = Actor.Create("waypoint", true, { Owner = clearpoint, Location = TechBuildingPosition })
		local TechPowerPlant = Actor.Create(Utils.Random({ "civcoalplant", "windplant", "trafo" }), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(4, Utils.RandomInteger(-1, 2)) })
		local FactoryCrane00 = Actor.Create("trctr" .. tostring(Utils.RandomInteger(1, 8)), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(-1, 1), Facing = Utils.RandomInteger(0, 255) })
		local FactoryCrane01 = Actor.Create("bobcat", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(-1, 2), Facing = Utils.RandomInteger(0, 255) })
		local Factory_hwaysign = Actor.Create("hwaysign" .. Utils.RandomInteger(1, 2), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(2, 3), Facing = Utils.RandomInteger(0, 255) })
		local Factory_roadsignal = Actor.Create("roadsignal2", true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(0, 2), Facing = 0 })
		local FactoryToolBoxes01 = Actor.Create("boxes0" .. Utils.RandomInteger(1, 9), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(1, 4), Facing = 0 })
		local FactoryToolBoxes02 = Actor.Create("boxes0" .. Utils.RandomInteger(1, 9), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(2, 4), Facing = 0 })
		local FactoryToolBoxes03 = Actor.Create("boxes0" .. Utils.RandomInteger(1, 9), true, { Owner = RandomCountry, Location = TechBuildingWaypoint.Location + CVec.New(2, 1), Facing = 0 })
		Utils.Do({ FactoryCrane00, FactoryCrane01 }, function(FactoryCrane)
			FactoryCrane.GrantUpgrade("autocontrol")
			FactoryCrane.Stance = "HoldFire"
		end)
	end)
end
InsertTechBuildingPlus11A = function(Barrack, Country)
	Barrack.Owner = Country
	PartisanBarrackA = Barrack
	local TechBuildingPosition = Barrack.Location
	local TechBuildingWaypoint = Actor.Create("waypoint", true, { Owner = clearpoint, Location = TechBuildingPosition })
	local AirGuard = Actor.Create(Utils.Random({ "agun", "sam", "samunderground" }), true, { Owner = Country, Location = TechBuildingWaypoint.Location + CVec.New(3, 1), Facing = Utils.RandomInteger(0, 255) })
	local Trafo = Actor.Create(Utils.Random({ "powr", "civcoalplant", "windplant", "trafo" }), true, { Owner = Country, Location = TechBuildingWaypoint.Location + CVec.New(4, -1) })
	HPad11A = Actor.Create("mercenaryport", true, { Owner = Country, Location = TechBuildingWaypoint.Location + CVec.New(2, 3) })
	local OilRefinery = Actor.Create("oilrefinery", true, { Owner = Country, Location = TechBuildingWaypoint.Location + CVec.New(6, 0) })
	local Flag = Actor.Create(Utils.Random({ "ctflag", "ctflag" }), true, { Owner = Country, Location = TechBuildingWaypoint.Location + CVec.New(-1, 1) })
	local CrateWeaponA = Actor.Create(Utils.Random({ "healcrate1", "healcrate0", "amfetamincrate", "m16crate", "mp5crate", "ak47crate", "smawcrate", "rpg7crate" }), true, { Owner = Country, Location = TechBuildingWaypoint.Location + CVec.New(2, 2) })
	local CrateWeaponB = Actor.Create(Utils.Random({ "healcrate1", "healcrate0", "amfetamincrate", "m16crate", "mp5crate", "ak47crate", "smawcrate", "rpg7crate" }), true, { Owner = Country, Location = TechBuildingWaypoint.Location + CVec.New(0, 2) })
	local GuardTowerA = Actor.Create(Utils.Random({ "hbox", "pbox" }) .. ".withsoldiers", true, { Owner = Country, Location = TechBuildingWaypoint.Location + CVec.New(-2, 2) })
	GuardTowerA.GrantTimedUpgrade(Utils.Random({ "attack.objective", "destroy.objective" }), Utils.RandomInteger(2222, 4444)) 
	GuardTowerA.GrantTimedUpgrade(Utils.Random({ "flag.northkorea", "flag.iran" }), Utils.RandomInteger(666, 999))
	if Difficulty == "easy" then
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "spy", "partisan" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "spy", "partisan" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "spy", "partisan" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "spy", "partisan" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "spy", "partisan" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "spy", "partisan" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "spy", "partisan" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "jeep", "jeep.recon", "ftrk" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "jeep", "jeep.recon" }), Country, TechBuildingWaypoint)
	elseif Difficulty == "normal" then   
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "spy", "partisan", "terrorist" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "spy", "partisan", "terrorist" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "spy", "partisan", "terrorist" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "spy", "partisan", "terrorist" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "spy", "partisan", "terrorist" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "spy", "partisan", "terrorist" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "spy", "partisan", "terrorist" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "spy", "partisan", "terrorist" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "spy", "partisan", "terrorist" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "ftrk", "apc.tower", "jeep.recon", "jeep", "1tnk" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "ftrk", "apc.tower", "jeep.recon", "jeep", "1tnk" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "apc.tower", "jeep.recon", "jeep", "1tnk" }), Country, TechBuildingWaypoint)
	elseif Difficulty == "hard" then     
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "ftrk", "apc.tower", "jeep", "1tnk", "2tnk" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "ftrk", "apc.tower", "jeep", "1tnk", "2tnk" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "ftrk", "apc.tower", "jeep", "1tnk", "2tnk" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "apc.tower", "jeep", "1tnk", "2tnk" }), Country, TechBuildingWaypoint)
	else                                 
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "ftrk", "aatrk", "apc.tower", "jeep", "1tnk", "2tnk", "3tnk" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "ftrk", "aatrk", "apc.tower", "jeep", "1tnk", "2tnk", "3tnk" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "ftrk", "aatrk", "apc.tower", "jeep", "1tnk", "2tnk", "3tnk" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "ftrk", "aatrk", "apc.tower", "jeep", "1tnk", "2tnk", "3tnk" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "apc.tower", "jeep", "1tnk", "2tnk", "3tnk" }), Country, TechBuildingWaypoint)
	end
end
InsertTechBuildingPlus11B = function(Barrack, Country)
	Barrack.Owner = Country
	PartisanBarrackB = Barrack
	local TechBuildingPosition = Barrack.Location
	local TechBuildingWaypoint = Actor.Create("waypoint", true, { Owner = clearpoint, Location = TechBuildingPosition })
	local AirGuard = Actor.Create(Utils.Random({ "agun", "sam", "samunderground" }), true, { Owner = Country, Location = TechBuildingWaypoint.Location + CVec.New(3, 1), Facing = Utils.RandomInteger(0, 255) })
	local Trafo = Actor.Create(Utils.Random({ "powr", "civcoalplant", "windplant", "trafo" }), true, { Owner = Country, Location = TechBuildingWaypoint.Location + CVec.New(4, -1) })
	HPad11B = Actor.Create("mercenaryport", true, { Owner = Country, Location = TechBuildingWaypoint.Location + CVec.New(2, 3) })
	local OilRefinery = Actor.Create("oilrefinery", true, { Owner = Country, Location = TechBuildingWaypoint.Location + CVec.New(6, 0) })
	local Flag = Actor.Create(Utils.Random({ "ctflag", "ctflag" }), true, { Owner = Country, Location = TechBuildingWaypoint.Location + CVec.New(-1, 1) })
	local CrateWeaponA = Actor.Create(Utils.Random({ "healcrate1", "healcrate0", "amfetamincrate", "m16crate", "mp5crate", "ak47crate", "smawcrate", "rpg7crate" }), true, { Owner = Country, Location = TechBuildingWaypoint.Location + CVec.New(2, 2) })
	local CrateWeaponB = Actor.Create(Utils.Random({ "healcrate1", "healcrate0", "amfetamincrate", "m16crate", "mp5crate", "ak47crate", "smawcrate", "rpg7crate" }), true, { Owner = Country, Location = TechBuildingWaypoint.Location + CVec.New(0, 2) })
	local GuardTowerA = Actor.Create(Utils.Random({ "hbox", "pbox" }) .. ".withsoldiers", true, { Owner = Country, Location = TechBuildingWaypoint.Location + CVec.New(-2, 2) })
	GuardTowerA.GrantTimedUpgrade(Utils.Random({ "attack.objective", "destroy.objective" }), Utils.RandomInteger(2222, 4444)) 
	GuardTowerA.GrantTimedUpgrade(Utils.Random({ "prefix.nod", "prefix.nod" }), Utils.RandomInteger(666, 999))
	if Difficulty == "easy" then
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "spy", "partisan" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "spy", "partisan" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "spy", "partisan" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "spy", "partisan" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "spy", "partisan" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "spy", "partisan" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "spy", "partisan" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "jeep", "jeep.recon", "ftrk" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "jeep", "jeep.recon" }), Country, TechBuildingWaypoint)
	elseif Difficulty == "normal" then   
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "spy", "partisan", "terrorist" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "spy", "partisan", "terrorist" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "spy", "partisan", "terrorist" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "spy", "partisan", "terrorist" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "spy", "partisan", "terrorist" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "spy", "partisan", "terrorist" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "spy", "partisan", "terrorist" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "spy", "partisan", "terrorist" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "spy", "partisan", "terrorist" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "ftrk", "apc.tower", "jeep.recon", "jeep", "1tnk" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "ftrk", "apc.tower", "jeep.recon", "jeep", "1tnk" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "apc.tower", "jeep.recon", "jeep", "1tnk" }), Country, TechBuildingWaypoint)
	elseif Difficulty == "hard" then     
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "ftrk", "apc.tower", "jeep", "1tnk", "2tnk" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "ftrk", "apc.tower", "jeep", "1tnk", "2tnk" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "ftrk", "apc.tower", "jeep", "1tnk", "2tnk" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "apc.tower", "jeep", "1tnk", "2tnk" }), Country, TechBuildingWaypoint)
	else                                 
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "e1", "e2", "e3", "e3aa", "e4", "e5", "e10", "e11", "e12", "e13", "shok", "spy", "partisan", "terrorist", "sniper" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "ftrk", "aatrk", "apc.tower", "jeep", "1tnk", "2tnk", "3tnk" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "ftrk", "aatrk", "apc.tower", "jeep", "1tnk", "2tnk", "3tnk" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "ftrk", "aatrk", "apc.tower", "jeep", "1tnk", "2tnk", "3tnk" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "ftrk", "aatrk", "apc.tower", "jeep", "1tnk", "2tnk", "3tnk" }), Country, TechBuildingWaypoint)
		InsertPartisanBarrackGuard(Utils.Random({ "apc.tower", "jeep", "1tnk", "2tnk", "3tnk" }), Country, TechBuildingWaypoint)
	end
end
InsertPartisanBarrackGuard = function(UnitType, UnitOwner, UnitWaypoint)
	local GuardPoint0 = Utils.Random({ CVec.New(-2, -1), CVec.New(-2, 0), CVec.New(-2, 1), CVec.New(-2, 3), CVec.New(-2, 4), CVec.New(-2, 5), CVec.New(-1, -1), CVec.New(-1, 0), CVec.New(-1, 1), CVec.New(-2, 2), CVec.New(-1, 3), CVec.New(-1, 4), CVec.New(-1, 5), CVec.New(0, -1), CVec.New(0, 1), CVec.New(0, 2), CVec.New(0, 3), CVec.New(0, 4), CVec.New(0, 5), CVec.New(1, -1), CVec.New(1, 0), CVec.New(1, 1), CVec.New(1, 2), CVec.New(1, 3), CVec.New(1, 4), CVec.New(1, 5), CVec.New(2, -1), CVec.New(2, 0), CVec.New(2, 1), CVec.New(2, 2), CVec.New(2, 3), CVec.New(2, 4), CVec.New(2, 5), CVec.New(3, -1), CVec.New(3, 0), CVec.New(3, 1), CVec.New(3, 2), CVec.New(3, 3), CVec.New(3, 4), CVec.New(3, 5), CVec.New(4, 1), CVec.New(4, 2), CVec.New(4, 3), CVec.New(4, 4), CVec.New(4, 5), CVec.New(5, 1), CVec.New(5, 2), CVec.New(5, 3), CVec.New(5, 4), CVec.New(5, 5), CVec.New(6, -1), CVec.New(6, 1), CVec.New(6, 2), CVec.New(6, 3), CVec.New(6, 4), CVec.New(6, 5), CVec.New(7, -1), CVec.New(7, 0), CVec.New(7, 2), CVec.New(7, 3), CVec.New(7, 4), CVec.New(7, 5), CVec.New(8, -1), CVec.New(8, 0), CVec.New(8, 2), CVec.New(8, 3), CVec.New(8, 4), CVec.New(8, 5) })
	local GuardPoint1 = Utils.Random({ CVec.New(-2, -1), CVec.New(-2, 0), CVec.New(-2, 1), CVec.New(-2, 3), CVec.New(-2, 4), CVec.New(-2, 5), CVec.New(-1, -1), CVec.New(-1, 0), CVec.New(-1, 1), CVec.New(-2, 2), CVec.New(-1, 3), CVec.New(-1, 4), CVec.New(-1, 5), CVec.New(0, -1), CVec.New(0, 1), CVec.New(0, 2), CVec.New(0, 3), CVec.New(0, 4), CVec.New(0, 5), CVec.New(1, -1), CVec.New(1, 0), CVec.New(1, 1), CVec.New(1, 2), CVec.New(1, 3), CVec.New(1, 4), CVec.New(1, 5), CVec.New(2, -1), CVec.New(2, 0), CVec.New(2, 1), CVec.New(2, 2), CVec.New(2, 3), CVec.New(2, 4), CVec.New(2, 5), CVec.New(3, -1), CVec.New(3, 0), CVec.New(3, 1), CVec.New(3, 2), CVec.New(3, 3), CVec.New(3, 4), CVec.New(3, 5), CVec.New(4, 1), CVec.New(4, 2), CVec.New(4, 3), CVec.New(4, 4), CVec.New(4, 5), CVec.New(5, 1), CVec.New(5, 2), CVec.New(5, 3), CVec.New(5, 4), CVec.New(5, 5), CVec.New(6, -1), CVec.New(6, 1), CVec.New(6, 2), CVec.New(6, 3), CVec.New(6, 4), CVec.New(6, 5), CVec.New(7, -1), CVec.New(7, 0), CVec.New(7, 2), CVec.New(7, 3), CVec.New(7, 4), CVec.New(7, 5), CVec.New(8, -1), CVec.New(8, 0), CVec.New(8, 2), CVec.New(8, 3), CVec.New(8, 4), CVec.New(8, 5) })
	local GuardPoint2 = Utils.Random({ CVec.New(-2, -1), CVec.New(-2, 0), CVec.New(-2, 1), CVec.New(-2, 3), CVec.New(-2, 4), CVec.New(-2, 5), CVec.New(-1, -1), CVec.New(-1, 0), CVec.New(-1, 1), CVec.New(-2, 2), CVec.New(-1, 3), CVec.New(-1, 4), CVec.New(-1, 5), CVec.New(0, -1), CVec.New(0, 1), CVec.New(0, 2), CVec.New(0, 3), CVec.New(0, 4), CVec.New(0, 5), CVec.New(1, -1), CVec.New(1, 0), CVec.New(1, 1), CVec.New(1, 2), CVec.New(1, 3), CVec.New(1, 4), CVec.New(1, 5), CVec.New(2, -1), CVec.New(2, 0), CVec.New(2, 1), CVec.New(2, 2), CVec.New(2, 3), CVec.New(2, 4), CVec.New(2, 5), CVec.New(3, -1), CVec.New(3, 0), CVec.New(3, 1), CVec.New(3, 2), CVec.New(3, 3), CVec.New(3, 4), CVec.New(3, 5), CVec.New(4, 1), CVec.New(4, 2), CVec.New(4, 3), CVec.New(4, 4), CVec.New(4, 5), CVec.New(5, 1), CVec.New(5, 2), CVec.New(5, 3), CVec.New(5, 4), CVec.New(5, 5), CVec.New(6, -1), CVec.New(6, 1), CVec.New(6, 2), CVec.New(6, 3), CVec.New(6, 4), CVec.New(6, 5), CVec.New(7, -1), CVec.New(7, 0), CVec.New(7, 2), CVec.New(7, 3), CVec.New(7, 4), CVec.New(7, 5), CVec.New(8, -1), CVec.New(8, 0), CVec.New(8, 2), CVec.New(8, 3), CVec.New(8, 4), CVec.New(8, 5) })
	local GuardPoint3 = Utils.Random({ CVec.New(-2, -1), CVec.New(-2, 0), CVec.New(-2, 1), CVec.New(-2, 3), CVec.New(-2, 4), CVec.New(-2, 5), CVec.New(-1, -1), CVec.New(-1, 0), CVec.New(-1, 1), CVec.New(-2, 2), CVec.New(-1, 3), CVec.New(-1, 4), CVec.New(-1, 5), CVec.New(0, -1), CVec.New(0, 1), CVec.New(0, 2), CVec.New(0, 3), CVec.New(0, 4), CVec.New(0, 5), CVec.New(1, -1), CVec.New(1, 0), CVec.New(1, 1), CVec.New(1, 2), CVec.New(1, 3), CVec.New(1, 4), CVec.New(1, 5), CVec.New(2, -1), CVec.New(2, 0), CVec.New(2, 1), CVec.New(2, 2), CVec.New(2, 3), CVec.New(2, 4), CVec.New(2, 5), CVec.New(3, -1), CVec.New(3, 0), CVec.New(3, 1), CVec.New(3, 2), CVec.New(3, 3), CVec.New(3, 4), CVec.New(3, 5), CVec.New(4, 1), CVec.New(4, 2), CVec.New(4, 3), CVec.New(4, 4), CVec.New(4, 5), CVec.New(5, 1), CVec.New(5, 2), CVec.New(5, 3), CVec.New(5, 4), CVec.New(5, 5), CVec.New(6, -1), CVec.New(6, 1), CVec.New(6, 2), CVec.New(6, 3), CVec.New(6, 4), CVec.New(6, 5), CVec.New(7, -1), CVec.New(7, 0), CVec.New(7, 2), CVec.New(7, 3), CVec.New(7, 4), CVec.New(7, 5), CVec.New(8, -1), CVec.New(8, 0), CVec.New(8, 2), CVec.New(8, 3), CVec.New(8, 4), CVec.New(8, 5) })
	local Guard = Actor.Create(UnitType, true, { Owner = UnitOwner, Location = UnitWaypoint.Location + CVec.New(Utils.RandomInteger(-1, 2), Utils.RandomInteger(2, 4)), Facing = Utils.RandomInteger(0, 255), SubCell = Utils.RandomInteger(1, 5) })
	Guard.GrantUpgrade("autocontrol")
	Guard.GrantUpgrade("wandering")
	Guard.Stance = "Defend"
	Guard.Scatter()
	Trigger.OnIdle(Guard, function(Guard)
		if not Guard.IsDead and Guard.IsInWorld then
			Guard.Patrol({UnitWaypoint.Location + GuardPoint0, UnitWaypoint.Location + GuardPoint1, UnitWaypoint.Location + GuardPoint2, UnitWaypoint.Location + GuardPoint3}, true, DateTime.Seconds(Utils.RandomInteger(1.345, 3.123)))
		end 
	end)
end
SetupProducedUnitTypes = function()
	ProducedUnitTypes =
	{
		{ factory = TechBuilding01A, types = { "trctr1", "trctr2", "trctr3", "trctr4", "trctr5", "trctr6", "trctr7", "trctr8", "trctr9", "trctr10" } },
		{ factory = TechBuilding09A, types = { "trctr1", "trctr2", "trctr3", "trctr4", "trctr5", "trctr6", "trctr7", "trctr8", "trctr9", "trctr10" } },
		{ factory = PartisanBarrackA, types = { "partisan", "terrorist" } },
		{ factory = PartisanBarrackB, types = { "partisan", "terrorist" } },
		{ factory = HPad11A, types = { "waypointdelivery.jeep", "waypointdelivery.reconjeep", "waypointdelivery.apctower", "waypointdelivery.1tnk", "waypointdelivery.2tnk", "waypointdelivery.3tnk", "waypointdelivery.4tnk", "waypointdelivery.stnk", "waypointdelivery.raytnk", "waypointdelivery.vettnk", "waypointdelivery.ctnk", "waypointdelivery.latnk", "waypointdelivery.ftnk", "waypointdelivery.totnk", "waypointdelivery.ttnk", "waypointdelivery.ntnk" } },
		{ factory = HPad11B, types = { "waypointdelivery.raytnk", "waypointdelivery.reconjeep", "waypointdelivery.apctower", "waypointdelivery.1tnk", "waypointdelivery.2tnk", "waypointdelivery.3tnk", "waypointdelivery.4tnk", "waypointdelivery.stnk", "waypointdelivery.stnk", "waypointdelivery.vettnk", "waypointdelivery.ctnk", "waypointdelivery.latnk", "waypointdelivery.ftnk", "waypointdelivery.totnk", "waypointdelivery.ttnk", "waypointdelivery.ntnk" } }
	}
end
ProduceUnits = function(t)
	local factory = t.factory
	if not factory.IsDead then
		local unitType = t.types[Utils.RandomInteger(1, #t.types + 1)]
		factory.Wait(Actor.BuildTime(unitType) * Utils.RandomInteger(1, 2))
		factory.Produce(unitType)
		factory.CallFunc(function()
			ProduceUnits(t) 
		end)
	end
end
SetupFactories = function()
	Utils.Do(ProducedUnitTypes, function(production)
		Trigger.OnProduction(production.factory, function(_, a) 
			BindActorTriggers(a)
		end)
	end)
end
InsertHospitalTransport = function()
	local HospitalTransport = Actor.Create("ambulance" .. tostring(Utils.RandomInteger(0, 1)), true, { Owner = Utils.Random({ neutral0, neutral1, neutral2, neutral3 }), Location = Utils.Random({ RandomEdgeRoadWaypoint, RandomEdgeRoadWaypoint01, RandomEdgeRoadWaypoint02, RandomEdgeRoadWaypoint03, RandomEdgeRoadWaypoint04, RandomEdgeRoadWaypoint05, RandomEdgeRoadWaypoint06, RandomEdgeRoadWaypoint07 }).Location, Facing = Utils.RandomInteger(0, 255) })
	HospitalTransport.GrantTimedUpgrade("medic.prefix", Utils.RandomInteger(2222, 4444))
	HospitalTransport.GrantTimedUpgrade("normal.objective", Utils.RandomInteger(666, 999))
	HospitalTransport.GrantUpgrade("nocontrol")
	HospitalTransport.GrantUpgrade("autocontrol")
	HospitalTransport.GrantUpgrade("wandering")
	HospitalTransport.Stance = "HoldFire"
	local HospitalTransportCargoTypeA = Utils.Random({ "healcrate2", "healcrate1", "doctor", "healcrate0", "healcrate", "doctor", "amfetamincrate", "doctor", "medi" })
	local HospitalTransportCargoTypeB = Utils.Random({ "healcrate2", "healcrate1", "doctor", "healcrate0", "healcrate", "doctor", "amfetamincrate", "doctor", "medi" })
	local HospitalTransportCargoTypeC = Utils.Random({ "healcrate2", "healcrate1", "doctor", "healcrate0", "healcrate", "doctor", "amfetamincrate", "doctor", "medi" })
	local HospitalTransportCargoA = HospitalTransportCargoTypeA
	local HospitalTransportCargoB = HospitalTransportCargoTypeB
	local HospitalTransportCargoC = HospitalTransportCargoTypeC
	LoadTransport(HospitalTransport, HospitalTransportCargoA)
	LoadTransport(HospitalTransport, HospitalTransportCargoB)
	LoadTransport(HospitalTransport, HospitalTransportCargoC)
	local TechBuilding = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return (self.Type == "hosp.fix" or self.Type == "hospital.fix" or self.Type == "hosp" or self.Type == "hospital") end)
	Utils.Do(Utils.Take(1, TechBuilding), function(TechBuilding)
		local TechBuildingWaypoint = Actor.Create("waypoint", true, { Owner = clearpoint, Location = TechBuilding.Location })
		Trigger.OnIdle(HospitalTransport, function(HospitalTransport)
			if not HospitalTransport.IsDead and HospitalTransport.IsInWorld then
				HospitalTransport.Scatter()
				HospitalTransport.Move(TechBuildingWaypoint.Location + CVec.New(-1, 2))
				HospitalTransport.Wait(Utils.RandomInteger(111, 222))
				HospitalTransport.Move(Utils.Random({ RandomEdgeRoadWaypoint, RandomEdgeRoadWaypoint01, RandomEdgeRoadWaypoint02, RandomEdgeRoadWaypoint03, RandomEdgeRoadWaypoint04, RandomEdgeRoadWaypoint05, RandomEdgeRoadWaypoint06, RandomEdgeRoadWaypoint07 }).Location)
				HospitalTransport.Destroy()
			end
		end)
	end)
	Trigger.OnRemovedFromWorld(HospitalTransport, function()
		Trigger.AfterDelay(Utils.RandomInteger(222, 444), function()
			InsertHospitalTransport()
		end)
	end)
end
InsertFactoryTransport = function()
	local FactoryTransport = Actor.Create("mkam" .. tostring(Utils.Random({ "", ".lightred", ".red", ".darkred", ".lightgreen", ".green", ".blue", ".brown", ".teal", ".darkyellow", ".yellow" })), true, { Owner = Utils.Random({ neutral0, neutral1, neutral2, neutral3 }), Location = Utils.Random({ RandomEdgeRoadWaypoint, RandomEdgeRoadWaypoint01, RandomEdgeRoadWaypoint02, RandomEdgeRoadWaypoint03, RandomEdgeRoadWaypoint04, RandomEdgeRoadWaypoint05, RandomEdgeRoadWaypoint06, RandomEdgeRoadWaypoint07 }).Location, Facing = Utils.RandomInteger(0, 255) })
	FactoryTransport.GrantTimedUpgrade(Utils.Random({ "speed.prefix", "earth.prefix", "empulse.prefix", "fpower.prefix", "gps.prefix" }), Utils.RandomInteger(333, 666))
	FactoryTransport.GrantTimedUpgrade("normal.objective", Utils.RandomInteger(1111, 2222))
	FactoryTransport.GrantUpgrade("nocontrol")
	FactoryTransport.GrantUpgrade("autocontrol")
	FactoryTransport.GrantUpgrade("wandering")
	FactoryTransport.Stance = "HoldFire"
	local FactoryTransportCargoType = Utils.Random({ "jeep", "jeep.recon", "1tnk", "2tnk", "3tnk", "4tnk", "apc.tower", "commandercarrier", "mrj", "arty", "v2rl", "stnk", "ftnk", "totnk", "ctnk", "ttnk", "raytnk", "latnk", "ntnk", "mechw", "mnly.ap", "mnly.at", "dtrk", "ftrk", "aatrk", "vettnk", "apc", "smalltran", "tran", "f117", "advmig", "mig", "lightjet", "yak", "heli", "hind", "armorcrate0", "woodcrate" .. Utils.RandomInteger(0, 1), "healcrate2", "ammocrate" .. Utils.RandomInteger(0, 1), "computercrate" .. Utils.RandomInteger(0, 4) })
	local FactoryTransportCargo = FactoryTransportCargoType
	LoadTransport(FactoryTransport, FactoryTransportCargo)
	local TechBuilding = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return (self.Type == "civil_factory.fix" or self.Type == "civilfactory1.fix" or self.Type == "civil_factory" or self.Type == "civilfactory1") end)
	Utils.Do(Utils.Take(1, TechBuilding), function(TechBuilding)
		local TechBuildingWaypoint = Actor.Create("waypoint", true, { Owner = clearpoint, Location = TechBuilding.Location })
		Trigger.OnIdle(FactoryTransport, function(FactoryTransport)
			if not FactoryTransport.IsDead and FactoryTransport.IsInWorld then
				FactoryTransport.Scatter()
				FactoryTransport.Move(TechBuildingWaypoint.Location + CVec.New(-1, 2))
				FactoryTransport.Wait(Utils.RandomInteger(111, 222))
				FactoryTransport.Move(Utils.Random({ RandomEdgeRoadWaypoint, RandomEdgeRoadWaypoint01, RandomEdgeRoadWaypoint02, RandomEdgeRoadWaypoint03, RandomEdgeRoadWaypoint04, RandomEdgeRoadWaypoint05, RandomEdgeRoadWaypoint06, RandomEdgeRoadWaypoint07 }).Location)
				FactoryTransport.Destroy()
			end
		end)
	end)
	Trigger.OnRemovedFromWorld(FactoryTransport, function()
		Trigger.AfterDelay(Utils.RandomInteger(222, 444), function()
			InsertFactoryTransport()
		end)
	end)
end
InsertMoneyTransport = function()
	local MoneyTransport = Actor.Create("moneyvan" .. Utils.RandomInteger(0, 1), true, { Owner = Utils.Random({ neutral0, neutral1, neutral2, neutral3 }), Location = Utils.Random({ RandomEdgeRoadWaypoint, RandomEdgeRoadWaypoint01, RandomEdgeRoadWaypoint02, RandomEdgeRoadWaypoint03, RandomEdgeRoadWaypoint04, RandomEdgeRoadWaypoint05, RandomEdgeRoadWaypoint06, RandomEdgeRoadWaypoint07 }).Location, Facing = Utils.RandomInteger(0, 255) })
	MoneyTransport.GrantTimedUpgrade(Utils.Random({ "dollar.prefix", "oildollar.prefix", "wateroildollar.prefix" }), Utils.RandomInteger(2222, 4444)) 
	MoneyTransport.GrantTimedUpgrade(Utils.Random({ "prefix.gdi", "flag.un", "flag.usa" }), Utils.RandomInteger(333, 666))
	MoneyTransport.GrantUpgrade("nocontrol")
	MoneyTransport.GrantUpgrade("autocontrol")
	MoneyTransport.GrantUpgrade("wandering")
	MoneyTransport.Stance = "HoldFire"
	local TechBuilding = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return (self.Type == "bank.fix" or self.Type == "bank1.fix" or self.Type == "bank" or self.Type == "bank1") end)
	Utils.Do(Utils.Take(1, TechBuilding), function(TechBuilding)
		local TechBuildingWaypoint = Actor.Create("waypoint", true, { Owner = clearpoint, Location = TechBuilding.Location })
		Trigger.OnIdle(MoneyTransport, function(MoneyTransport)
			if not MoneyTransport.IsDead and MoneyTransport.IsInWorld then
				MoneyTransport.Scatter()
				MoneyTransport.Move(TechBuildingWaypoint.Location + CVec.New(1, 3))
				MoneyTransport.Wait(Utils.RandomInteger(111, 222))
				MoneyTransport.Move(Utils.Random({ RandomEdgeRoadWaypoint, RandomEdgeRoadWaypoint01, RandomEdgeRoadWaypoint02, RandomEdgeRoadWaypoint03, RandomEdgeRoadWaypoint04, RandomEdgeRoadWaypoint05, RandomEdgeRoadWaypoint06, RandomEdgeRoadWaypoint07 }).Location)
				MoneyTransport.Destroy()
			end
		end)
	end)
	Trigger.OnRemovedFromWorld(MoneyTransport, function()
		Trigger.AfterDelay(Utils.RandomInteger(222, 444), function()
			InsertMoneyTransport()
		end)
	end)
end

