createArmyMinePatrol = function()
	-- OutpostDefence
	OutpostDefenceUA = UnlimitedArmy:New({
				Player = 4,
				Area = 20000,
				AutoDestroyIfEmpty = true,
				TransitAttackMove = true,
				Formation = UnlimitedArmy.Formations.Chaotic,
				LeaderFormation = FormationFunktion,
				AIActive = true,
				AutoRotateRange = true,
				DoNotNormalizeSpeed = false,
				})
	OutpostDefenceUASpawnGenerator = UnlimitedArmySpawnGenerator:New(OutpostDefenceUA,{
					Position = GetPosition("army1"),
					ArmySize = 20,
					SpawnCounter = 180,
					SpawnLeaders = 20,
					LeaderDesc = {
							{LeaderType = Entities.PU_LeaderHeavyCavalry2, SoldierNum = 3, SpawnNum = 3, Looped = true, Experience = 3},
							{LeaderType = Entities.PU_LeaderBow4, SoldierNum = 8, SpawnNum = 2, Looped = true, Experience = 3},
							{LeaderType = Entities.PU_LeaderSword4, SoldierNum = 8, SpawnNum = 3, Looped = true, Experience = 3},
							{LeaderType = Entities.PV_Cannon3, SoldierNum = 0, SpawnNum = 1, Looped = true, Experience = 3},
							{LeaderType = Entities.PU_LeaderCavalry2, SoldierNum = 3, SpawnNum = 3, Looped =true, Experience = 3},
							{LeaderType = Entities.PU_LeaderBow4, SoldierNum = 8, SpawnNum = 2, Looped = true, Experience = 3},
							{LeaderType = Entities.PU_LeaderSword4, SoldierNum = 8, SpawnNum = 2, Looped = true, Experience = 3},
							{LeaderType = Entities.PU_LeaderPoleArm4, SoldierNum = 8, SpawnNum = 2, Looped = true, Experience = 3},
							{LeaderType = Entities.PV_Cannon3, SoldierNum = 0, SpawnNum = 2, Looped = true, Experience = 3}
							},
					Generator = "outpost",
					})
	OutpostDefenceUA.armychecktable = {}
	Trigger.RequestTrigger(Events.LOGIC_EVENT_EVERY_SECOND,nil,"Check_ArmySoldiers",1,nil,{OutpostDefenceUA})
	OutpostDefenceUA:AddCommandDefend(GetPosition("army1"),20000,true)
end

Check_ArmySoldiers = function (UATable)
    for hochzahl,id in ipairs(UATable.Leaders) do
		if Logic.GetEntityTypeName(Logic.GetEntityType(id)) ~= "PU_LeaderSword1"  then
			if Logic.LeaderGetNumberOfSoldiers(id)<1 and Logic.LeaderGetMaxNumberOfSoldiers(id)>0 and not Table_Check(UATable.armychecktable, id) then
				table.insert(UATable.armychecktable, 1, {id,15})
			end
		end
    end
	if table.getn(UATable.armychecktable) < 1 then
		return false
	else
		for ccounter = table.getn(UATable.armychecktable), 1,-1 do
			if UATable.armychecktable[ccounter][2] == 0 then
				if IsValid(UATable.armychecktable[ccounter][1]) then
				SetHealth(UATable.armychecktable[ccounter][1],0)
				end 
				table.remove(UATable.armychecktable, ccounter)
			else
				UATable.armychecktable[ccounter][2] = UATable.armychecktable[ccounter][2] - 1
			end
		end
	end
	return false
end

Table_Check = function(tableinsert,ida)
for k,tableinsertis in ipairs(tableinsert) do
    if tableinsertis[1] == ida then
      return true
    end
  end
  return false
end