

EnemyBuildingCounter = 0
DestroyedBuildings = 0
EnemysBaseMaker = function()
	if Multi0 ~= nil then
		newEnemyfact0 = Actor.Create("fact", true, { Location = CPos.New(146,9), Owner = Enemys })
		Trigger.OnDamaged(newEnemyfact0, function(building)
			if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnKilledOrCaptured(newEnemyfact0, function() DestroyedBuildings = DestroyedBuildings + 1 end)
		newEnemyapwr0 = Actor.Create("much.apwr", true, { Location = CPos.New(146,4), Owner = Enemys })
		Trigger.OnDamaged(newEnemyapwr0, function(building)
			if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnKilledOrCaptured(newEnemyapwr0, function() DestroyedBuildings = DestroyedBuildings + 1 end)		
		newEnemytsla0 = Actor.Create("tsla", true, { Location = CPos.New(143,6), Owner = Enemys })
		if Difficulty ~= "easy" then
			Trigger.OnDamaged(newEnemytsla0, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
		end
		newEnemypbox0 = Actor.Create("pbox", true, { Location = CPos.New(148,8), Owner = Enemys })
		if Difficulty ~= "easy" then
			Trigger.OnDamaged(newEnemypbox0, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
		end
		EnemyBuildingCounter = EnemyBuildingCounter + 2
	end
	if Multi1 ~= nil then
		newEnemyfact1 = Actor.Create("fact", true, { Location = CPos.New(146,36), Owner = Enemys })
		Trigger.OnDamaged(newEnemyfact1, function(building)
			if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnKilledOrCaptured(newEnemyfact1, function() DestroyedBuildings = DestroyedBuildings + 1 end)
		newEnemyapwr1 = Actor.Create("much.apwr", true, { Location = CPos.New(146,34), Owner = Enemys })
		Trigger.OnDamaged(newEnemyapwr1, function(building)
			if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnKilledOrCaptured(newEnemyapwr1, function() DestroyedBuildings = DestroyedBuildings + 1 end)	
		newEnemytsla1 = Actor.Create("tsla", true, { Location = CPos.New(143,32), Owner = Enemys })
		if Difficulty ~= "easy" then
			Trigger.OnDamaged(newEnemytsla1, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
		end
		newEnemypbox1 = Actor.Create("pbox", true, { Location = CPos.New(148,32), Owner = Enemys })
		if Difficulty ~= "easy" then
			Trigger.OnDamaged(newEnemypbox1, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
		end
		EnemyBuildingCounter = EnemyBuildingCounter + 2
	end
	if Multi2 ~= nil then
		newEnemyfact2 = Actor.Create("fact", true, { Location = CPos.New(143,45), Owner = Enemys })
		Trigger.OnDamaged(newEnemyfact2, function(building)
			if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnKilledOrCaptured(newEnemyfact2, function() DestroyedBuildings = DestroyedBuildings + 1 end)
		newEnemyapwr2 = Actor.Create("much.apwr", true, { Location = CPos.New(146,46), Owner = Enemys })
		Trigger.OnDamaged(newEnemyapwr2, function(building)
			if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnKilledOrCaptured(newEnemyapwr2, function() DestroyedBuildings = DestroyedBuildings + 1 end)	
		newEnemytsla2 = Actor.Create("tsla", true, { Location = CPos.New(142,45), Owner = Enemys })
		if Difficulty ~= "easy" then
			Trigger.OnDamaged(newEnemytsla2, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
		end
		newEnemypbox2 = Actor.Create("pbox", true, { Location = CPos.New(144,43), Owner = Enemys })
		if Difficulty ~= "easy" then
			Trigger.OnDamaged(newEnemypbox2, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
		end
		EnemyBuildingCounter = EnemyBuildingCounter + 2
	end
	if Multi3 ~= nil then
		newEnemyfact3 = Actor.Create("fact", true, { Location = CPos.New(146,55), Owner = Enemys })
		Trigger.OnDamaged(newEnemyfact3, function(building)
			if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnKilledOrCaptured(newEnemyfact3, function() DestroyedBuildings = DestroyedBuildings + 1 end)
		newEnemyapwr3 = Actor.Create("much.apwr", true, { Location = CPos.New(146,60), Owner = Enemys })
		Trigger.OnDamaged(newEnemyapwr3, function(building)
			if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnKilledOrCaptured(newEnemyapwr3, function() DestroyedBuildings = DestroyedBuildings + 1 end)	
		newEnemytsla3 = Actor.Create("tsla", true, { Location = CPos.New(143,57), Owner = Enemys })
		if Difficulty ~= "easy" then
			Trigger.OnDamaged(newEnemytsla3, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
		end
		newEnemypbox3 = Actor.Create("pbox", true, { Location = CPos.New(148,58), Owner = Enemys })
		if Difficulty ~= "easy" then
			Trigger.OnDamaged(newEnemypbox3, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
		end
		EnemyBuildingCounter = EnemyBuildingCounter + 2
	end	
	if Multi4 ~= nil then
		newEnemyfact4 = Actor.Create("fact", true, { Location = CPos.New(145,90), Owner = Enemys })
		Trigger.OnDamaged(newEnemyfact4, function(building)
			if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnKilledOrCaptured(newEnemyfact4, function() DestroyedBuildings = DestroyedBuildings + 1 end)
		newEnemyapwr4 = Actor.Create("much.apwr", true, { Location = CPos.New(145,94), Owner = Enemys })
		Trigger.OnDamaged(newEnemyapwr4, function(building)
			if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
				building.StartBuildingRepairs()
			end
		end)
		Trigger.OnKilledOrCaptured(newEnemyapwr4, function() DestroyedBuildings = DestroyedBuildings + 1 end)
		newEnemytsla4 = Actor.Create("tsla", true, { Location = CPos.New(143,92), Owner = Enemys })
		if Difficulty ~= "easy" then
			Trigger.OnDamaged(newEnemytsla4, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
		end
		newEnemypbox4 = Actor.Create("pbox", true, { Location = CPos.New(144,94), Owner = Enemys })
		if Difficulty ~= "easy" then
			Trigger.OnDamaged(newEnemypbox4, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
		end
		EnemyBuildingCounter = EnemyBuildingCounter + 2
	end
	if Difficulty ~= "easy" then
		if Multi0 ~= nil then
			newEnemyhpad0 = Actor.Create("hpad", true, { Location = CPos.New(142,3), Owner = Enemys })
			Trigger.OnDamaged(newEnemyhpad0, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			Trigger.OnKilledOrCaptured(newEnemyhpad0, function() DestroyedBuildings = DestroyedBuildings + 1 end)
			newEnemyagun0 = Actor.Create("agun", true, { Location = CPos.New(144,8), Owner = Enemys })
			Trigger.OnDamaged(newEnemyagun0, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			newEnemytsla0 = Actor.Create("tsla", true, { Location = CPos.New(143,10), Owner = Enemys })
			Trigger.OnDamaged(newEnemytsla0, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			EnemyBuildingCounter = EnemyBuildingCounter + 1
		end
		if Multi1 ~= nil then
			newEnemyhpad1 = Actor.Create("hpad", true, { Location = CPos.New(142,29), Owner = Enemys })
			Trigger.OnDamaged(newEnemyhpad1, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			Trigger.OnKilledOrCaptured(newEnemyhpad1, function() DestroyedBuildings = DestroyedBuildings + 1 end)
			newEnemyagun1 = Actor.Create("agun", true, { Location = CPos.New(144,35), Owner = Enemys })
			Trigger.OnDamaged(newEnemyagun1, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			newEnemytsla1 = Actor.Create("tsla", true, { Location = CPos.New(141,30), Owner = Enemys })
			Trigger.OnDamaged(newEnemytsla1, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			EnemyBuildingCounter = EnemyBuildingCounter + 1
		end
		if Multi2 ~= nil then
			newEnemyhpad2 = Actor.Create("hpad", true, { Location = CPos.New(142,40), Owner = Enemys })
			Trigger.OnDamaged(newEnemyhpad2, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			Trigger.OnKilledOrCaptured(newEnemyhpad2, function() DestroyedBuildings = DestroyedBuildings + 1 end)
			newEnemyagun2 = Actor.Create("agun", true, { Location = CPos.New(147,45), Owner = Enemys })
			Trigger.OnDamaged(newEnemyagun2, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			newEnemytsla2 = Actor.Create("tsla", true, { Location = CPos.New(140,42), Owner = Enemys })
			Trigger.OnDamaged(newEnemytsla2, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			EnemyBuildingCounter = EnemyBuildingCounter + 1
		end
		if Multi3 ~= nil then
			newEnemyhpad3 = Actor.Create("hpad", true, { Location = CPos.New(142,54), Owner = Enemys })
			Trigger.OnDamaged(newEnemyhpad3, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			Trigger.OnKilledOrCaptured(newEnemyhpad3, function() DestroyedBuildings = DestroyedBuildings + 1 end)
			newEnemyagun3 = Actor.Create("agun", true, { Location = CPos.New(144,61), Owner = Enemys })
			Trigger.OnDamaged(newEnemyagun3, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			newEnemytsla3 = Actor.Create("tsla", true, { Location = CPos.New(141,57), Owner = Enemys })
			Trigger.OnDamaged(newEnemytsla3, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			EnemyBuildingCounter = EnemyBuildingCounter + 1
		end
		if Multi4 ~= nil then
			newEnemyhpad4 = Actor.Create("hpad", true, { Location = CPos.New(142,89), Owner = Enemys })
			Trigger.OnDamaged(newEnemyhpad4, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			Trigger.OnKilledOrCaptured(newEnemyhpad4, function() DestroyedBuildings = DestroyedBuildings + 1 end)
			newEnemyagun4 = Actor.Create("agun", true, { Location = CPos.New(143,94), Owner = Enemys })
			Trigger.OnDamaged(newEnemyagun4, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			newEnemytsla4 = Actor.Create("tsla", true, { Location = CPos.New(141,92), Owner = Enemys })
			Trigger.OnDamaged(newEnemytsla4, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			EnemyBuildingCounter = EnemyBuildingCounter + 1
		end
	end
	if Difficulty == "hard" then
		if Multi0 ~= nil then
			newEnemyhpad02 = Actor.Create("hpad", true, { Location = CPos.New(142,11), Owner = Enemys })
			Trigger.OnDamaged(newEnemyhpad02, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			Trigger.OnKilledOrCaptured(newEnemyhpad02, function() DestroyedBuildings = DestroyedBuildings + 1 end)
			newEnemygap0 = Actor.Create("gap", true, { Location = CPos.New(144,9), Owner = Enemys })
			Trigger.OnDamaged(newEnemygap0, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			newEnemyagun02 = Actor.Create("agun", true, { Location = CPos.New(144,5), Owner = Enemys })
			Trigger.OnDamaged(newEnemyagun02, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			newEnemyhbox02 = Actor.Create("hbox", true, { Location = CPos.New(144,6), Owner = Enemys })
			Trigger.OnDamaged(newEnemyhbox02, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			EnemyBuildingCounter = EnemyBuildingCounter + 1	
		end
		if Multi1 ~= nil then
			newEnemyhpad12 = Actor.Create("hpad", true, { Location = CPos.New(142,34), Owner = Enemys })
			Trigger.OnDamaged(newEnemyhpad12, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			Trigger.OnKilledOrCaptured(newEnemyhpad12, function() DestroyedBuildings = DestroyedBuildings + 1 end)
			newEnemygap1 = Actor.Create("gap", true, { Location = CPos.New(144,32), Owner = Enemys })
			Trigger.OnDamaged(newEnemygap1, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			newEnemyagun12 = Actor.Create("agun", true, { Location = CPos.New(146,28), Owner = Enemys })
			Trigger.OnDamaged(newEnemyagun12, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			newEnemyhbox12 = Actor.Create("hbox", true, { Location = CPos.New(144,34), Owner = Enemys })
			Trigger.OnDamaged(newEnemyhbox12, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			EnemyBuildingCounter = EnemyBuildingCounter + 1	
		end
		if Multi2 ~= nil then
			newEnemyhpad22 = Actor.Create("hpad", true, { Location = CPos.New(141,46), Owner = Enemys })
			Trigger.OnDamaged(newEnemyhpad22, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			Trigger.OnKilledOrCaptured(newEnemyhpad22, function() DestroyedBuildings = DestroyedBuildings + 1 end)
			newEnemygap2 = Actor.Create("gap", true, { Location = CPos.New(143,43), Owner = Enemys })
			Trigger.OnDamaged(newEnemygap2, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			newEnemyagun22 = Actor.Create("agun", true, { Location = CPos.New(141,42), Owner = Enemys })
			Trigger.OnDamaged(newEnemyagun22, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			newEnemyhbox22 = Actor.Create("hbox", true, { Location = CPos.New(148,45), Owner = Enemys })
			Trigger.OnDamaged(newEnemyhbox22, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			EnemyBuildingCounter = EnemyBuildingCounter + 1	
		end
		if Multi3 ~= nil then
			newEnemyhpad32 = Actor.Create("hpad", true, { Location = CPos.New(143,62), Owner = Enemys })
			Trigger.OnDamaged(newEnemyhpad32, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			Trigger.OnKilledOrCaptured(newEnemyhpad32, function() DestroyedBuildings = DestroyedBuildings + 1 end)
			newEnemygap3 = Actor.Create("gap", true, { Location = CPos.New(145,60), Owner = Enemys })
			Trigger.OnDamaged(newEnemygap3, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			newEnemyagun32 = Actor.Create("agun", true, { Location = CPos.New(144,56), Owner = Enemys })
			Trigger.OnDamaged(newEnemyagun32, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			newEnemyhbox32 = Actor.Create("hbox", true, { Location = CPos.New(143,60), Owner = Enemys })
			Trigger.OnDamaged(newEnemyhbox32, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			EnemyBuildingCounter = EnemyBuildingCounter + 1	
		end
		if Multi4 ~= nil then
			newEnemyhpad42 = Actor.Create("hpad", true, { Location = CPos.New(141,95), Owner = Enemys })
			Trigger.OnDamaged(newEnemyhpad42, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			Trigger.OnKilledOrCaptured(newEnemyhpad42, function() DestroyedBuildings = DestroyedBuildings + 1 end)
			newEnemygap4 = Actor.Create("gap", true, { Location = CPos.New(144,91), Owner = Enemys })
			Trigger.OnDamaged(newEnemygap4, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			newEnemyagun42 = Actor.Create("agun", true, { Location = CPos.New(146,87), Owner = Enemys })
			Trigger.OnDamaged(newEnemyagun42, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			newEnemyhbox42 = Actor.Create("hbox", true, { Location = CPos.New(144,92), Owner = Enemys })
			Trigger.OnDamaged(newEnemyhbox42, function(building)
				if building.Owner == Enemys and building.Health < building.MaxHealth * 3/4 then
					building.StartBuildingRepairs()
				end
			end)
			EnemyBuildingCounter = EnemyBuildingCounter + 1	
		end
	end
end

