XGM Forum
Сайт - Статьи - Проекты - Ресурсы - Блоги

Форуме в режиме ТОЛЬКО ЧТЕНИЕ. Вы можете задать вопросы в Q/A на сайте, либо создать свой проект или ресурс.
Вернуться   XGM Forum > Warcraft> Академия: форум для вопросов
Ник
Пароль
Войти через VK в один клик
Сайт использует только имя.

Ответ
 
xpadd91

offline
Опыт: 10,739
Активность:
Тормоз AI
  1. Сделаю Редактор ИИ F8.
  2. Всего 3 файлы *.ai
3)Всего 3 Компьютер каждому загружает файлы *.ai
Тестирование:
  1. вводить чит warpten.
5)Подождать 5 мин. или 15 мин.
  1. Становиться жутко тормоз и 1-3 сек продолжает игр и опять тормоз долго.
Почему так?
xpadd91 добавил:
Вот исходный код!
xpadd91 добавил:
Вот архив:
  1. Source AI.rar (1.8 Кбайт) исходный код AI
  2. AI.rar (6.0 Кбайт) *.ai
Прикрепленные файлы
Тип файла: rar AI.rar (6.0 Кбайт, 5 просмотров )
Тип файла: rar Source AI.rar (1.8 Кбайт, 3 просмотров )
Старый 18.12.2013, 22:44
DioD

offline
Опыт: 45,134
Активность:
не увидел отладочных сообщений в коде, возник вопрос, а они там есть и хорошо спрятаны или их там нет?
Старый 19.12.2013, 13:44
xpadd91

offline
Опыт: 10,739
Активность:
DioD:
не увидел отладочных сообщений в коде
Добавил любое место:
call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Main Entry Point |r")
результаты полный отказ AI бот! вот ничего не работает!
» Alex2v2a.ai
//===========================================================================
// 
// Alex
// 
//   Warcraft III AI script
//   Generated by the Warcraft III World Editor
//   Date: Wed Dec 18 19:28:43 2013
// 
//===========================================================================

//***************************************************************************
//*
//*  Global Variables
//*
//***************************************************************************

globals
    integer                 attackWave                 = 1
    integer                 nextDelay                  = 0
    integer                 awGold                     = 0
    integer                 awWood                     = 0
endglobals

//***************************************************************************
//*
//*  Utility Functions
//*
//***************************************************************************

//===========================================================================
function CheckLastCommand takes boolean pop returns integer
    local integer cmd = GetLastCommand()
    if (pop) then
        call PopLastCommand(  )
call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2CheckLastCommand |r")
    endif
    return cmd
endfunction

//===========================================================================
function CheckLastCommandData takes boolean pop returns integer
    local integer data = GetLastData()
    if (pop) then
        call PopLastCommand(  )
call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2CheckLastCommandData |r")
    endif
    return data
endfunction

//===========================================================================
function TotalFoodProduced takes nothing returns integer
    return GetPlayerState(ai_player,PLAYER_STATE_RESOURCE_FOOD_CAP)
call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2TotalFoodProduced |r")
endfunction

//===========================================================================
function ExpansionNeeded takes nothing returns boolean
    return take_exp
call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2ExpansionNeeded |r")
endfunction

//===========================================================================
function BuildExpansion takes integer hallID, integer mineID returns nothing
    if (HallsCompleted(hallID)) then
        call SetBuildExpa( TownCount(hallID) + 1, mineID )
call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2BuildExpansion |r")
    endif
endfunction

//===========================================================================
function CurrentAttackWave takes nothing returns integer
    return attackWave
call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2CurrentAttackWave |r")
endfunction

//===========================================================================
function ResetAttackUnits takes nothing returns nothing
    set awGold = 0
    set awWood = 0
    call InitAssaultGroup(  )
call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2ResetAttackUnits |r")
endfunction

//===========================================================================
function AddAttackUnit takes integer minQty, integer maxQty, integer unitID returns nothing
    // Track attacking gold workers
    if (unitID == 'hpea') then
        set awGold = awGold + minQty
call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2AddAttackUnit===Track attacking gold workers |r")
    endif

    // Track attacking wood workers
    if (unitID == 'hpea') then
        set awWood = awWood + minQty
call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2AddAttackUnit===Track attacking wood workers |r")
    endif

    call SetAssaultGroup( minQty, maxQty, unitID )

call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2AddAttackUnit===call SetAssaultGroup( minQty, maxQty, unitID ) |r")
endfunction

//***************************************************************************
//*
//*  Basic Options
//*
//***************************************************************************

//===========================================================================
function InitOptions takes nothing returns nothing
    call SetMeleeAI(  )
    call SetDefendPlayer( true )
    call SetRandomPaths( true )
    call SetTargetHeroes( true )
    call SetPeonsRepair( true )
    call SetHeroesFlee( true )
    call SetHeroesBuyItems( true )
    call SetUnitsFlee( true )
    call SetGroupsFlee( true )
    call SetWatchMegaTargets( true )
    call SetIgnoreInjured( true )
    call SetHeroesTakeItems( true )
    call SetSlowChopping( false )
    call SetCaptainChanges( true )
    call SetSmartArtillery( true )
endfunction

//***************************************************************************
//*
//*  Conditions
//*
//***************************************************************************

//===========================================================================
// Updates the values of all preset conditions
//===========================================================================
function UpdateConditions takes nothing returns nothing
endfunction

//***************************************************************************
//*
//*  Heroes
//*
//***************************************************************************

//===========================================================================
// Stores hero ID and skills
//===========================================================================
function SetHero takes integer order, integer heroid returns nothing
    if (order == 1) then
        set hero_id = heroid
        if (heroid == 'Hpal') then
            set skills1[ 1] = 'AHhb'
            set skills1[ 2] = 'AHds'
            set skills1[ 3] = 'AHad'
            set skills1[ 4] = 'AHhb'
            set skills1[ 5] = 'AHds'
            set skills1[ 6] = 'AHre'
            set skills1[ 7] = 'AHad'
            set skills1[ 8] = 'AHhb'
            set skills1[ 9] = 'AHds'
            set skills1[10] = 'AHad'
        elseif (heroid == 'Hamg') then
            set skills1[ 1] = 'AHbz'
            set skills1[ 2] = 'AHab'
            set skills1[ 3] = 'AHwe'
            set skills1[ 4] = 'AHbz'
            set skills1[ 5] = 'AHab'
            set skills1[ 6] = 'AHmt'
            set skills1[ 7] = 'AHwe'
            set skills1[ 8] = 'AHbz'
            set skills1[ 9] = 'AHab'
            set skills1[10] = 'AHwe'
        elseif (heroid == 'Hmkg') then
            set skills1[ 1] = 'AHtc'
            set skills1[ 2] = 'AHtb'
            set skills1[ 3] = 'AHbh'
            set skills1[ 4] = 'AHtc'
            set skills1[ 5] = 'AHtb'
            set skills1[ 6] = 'AHav'
            set skills1[ 7] = 'AHbh'
            set skills1[ 8] = 'AHtc'
            set skills1[ 9] = 'AHtb'
            set skills1[10] = 'AHbh'
        endif
    elseif (order == 2) then
        set hero_id2 = heroid
        if (heroid == 'Hpal') then
            set skills2[ 1] = 'AHhb'
            set skills2[ 2] = 'AHds'
            set skills2[ 3] = 'AHad'
            set skills2[ 4] = 'AHhb'
            set skills2[ 5] = 'AHds'
            set skills2[ 6] = 'AHre'
            set skills2[ 7] = 'AHad'
            set skills2[ 8] = 'AHhb'
            set skills2[ 9] = 'AHds'
            set skills2[10] = 'AHad'
        elseif (heroid == 'Hamg') then
            set skills2[ 1] = 'AHbz'
            set skills2[ 2] = 'AHab'
            set skills2[ 3] = 'AHwe'
            set skills2[ 4] = 'AHbz'
            set skills2[ 5] = 'AHab'
            set skills2[ 6] = 'AHmt'
            set skills2[ 7] = 'AHwe'
            set skills2[ 8] = 'AHbz'
            set skills2[ 9] = 'AHab'
            set skills2[10] = 'AHwe'
        elseif (heroid == 'Hmkg') then
            set skills2[ 1] = 'AHtc'
            set skills2[ 2] = 'AHtb'
            set skills2[ 3] = 'AHbh'
            set skills2[ 4] = 'AHtc'
            set skills2[ 5] = 'AHtb'
            set skills2[ 6] = 'AHav'
            set skills2[ 7] = 'AHbh'
            set skills2[ 8] = 'AHtc'
            set skills2[ 9] = 'AHtb'
            set skills2[10] = 'AHbh'
        endif
    elseif (order == 3) then
        set hero_id3 = heroid
        if (heroid == 'Hpal') then
            set skills3[ 1] = 'AHhb'
            set skills3[ 2] = 'AHds'
            set skills3[ 3] = 'AHad'
            set skills3[ 4] = 'AHhb'
            set skills3[ 5] = 'AHds'
            set skills3[ 6] = 'AHre'
            set skills3[ 7] = 'AHad'
            set skills3[ 8] = 'AHhb'
            set skills3[ 9] = 'AHds'
            set skills3[10] = 'AHad'
        elseif (heroid == 'Hamg') then
            set skills3[ 1] = 'AHbz'
            set skills3[ 2] = 'AHab'
            set skills3[ 3] = 'AHwe'
            set skills3[ 4] = 'AHbz'
            set skills3[ 5] = 'AHab'
            set skills3[ 6] = 'AHmt'
            set skills3[ 7] = 'AHwe'
            set skills3[ 8] = 'AHbz'
            set skills3[ 9] = 'AHab'
            set skills3[10] = 'AHwe'
        elseif (heroid == 'Hmkg') then
            set skills3[ 1] = 'AHtc'
            set skills3[ 2] = 'AHtb'
            set skills3[ 3] = 'AHbh'
            set skills3[ 4] = 'AHtc'
            set skills3[ 5] = 'AHtb'
            set skills3[ 6] = 'AHav'
            set skills3[ 7] = 'AHbh'
            set skills3[ 8] = 'AHtc'
            set skills3[ 9] = 'AHtb'
            set skills3[10] = 'AHbh'
        endif
    endif
endfunction

//===========================================================================
// Selects hero IDs for three possible heroes
//===========================================================================
function SelectHeroes takes nothing returns nothing
    local integer roll = GetRandomInt(1,100)
    if (roll <= 17) then
        call SetHero( 1, 'Hpal' )
        call SetHero( 2, 'Hamg' )
        call SetHero( 3, 'Hmkg' )
    elseif (roll <= 34) then
        call SetHero( 1, 'Hpal' )
        call SetHero( 2, 'Hmkg' )
        call SetHero( 3, 'Hamg' )
    elseif (roll <= 50) then
        call SetHero( 1, 'Hamg' )
        call SetHero( 2, 'Hpal' )
        call SetHero( 3, 'Hmkg' )
    elseif (roll <= 67) then
        call SetHero( 1, 'Hamg' )
        call SetHero( 2, 'Hmkg' )
        call SetHero( 3, 'Hpal' )
    elseif (roll <= 84) then
        call SetHero( 1, 'Hmkg' )
        call SetHero( 2, 'Hpal' )
        call SetHero( 3, 'Hamg' )
    else
        call SetHero( 1, 'Hmkg' )
        call SetHero( 2, 'Hamg' )
        call SetHero( 3, 'Hpal' )
    endif
endfunction

//===========================================================================
// Returns the hero skill for the given hero and level
//===========================================================================
function ChooseHeroSkill takes nothing returns integer
    local integer curHero = GetHeroId()
    local integer level = GetHeroLevelAI()

    if (level > max_hero_level) then
        set max_hero_level = level
    endif

    if (curHero == hero_id) then
        return skills1[level]
    elseif (curHero == hero_id2) then
        return skills2[level]
    elseif (curHero == hero_id3) then
        return skills3[level]
    endif
    return 0
endfunction

//***************************************************************************
//*
//*  Building and Harvesting
//*
//***************************************************************************

//===========================================================================
// Specifies building priorities for workers
//===========================================================================
function BuildPriorities takes nothing returns nothing
    local integer mine = TownWithMine()
    call SetBuildAll( BUILD_UNIT, 1, 'htow', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'halt', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hbar', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hlum', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hbla', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hkee', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hfoo', -1 )
    call SetBuildAll( BUILD_UNIT, 1, hero_id, -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hfoo', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hfoo', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hbar', -1 )
    call SetBuildAll( BUILD_UNIT, 1, hero_id2, -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hrif', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hrif', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'harm', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hars', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hvlt', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hcas', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hrif', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hrif', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hrif', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hhou', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhme', -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 9, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 10, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 11, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hrif', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hrif', -1 )
    call SetBuildAll( BUILD_UNIT, 1, hero_id3, -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hrif', -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hmpr', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hsor', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hgra', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 12, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 13, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 9, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 14, 'hhou', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhlh', -1 )
    call SetBuildAll( BUILD_UNIT, 9, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hmpr', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hsor', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hmpr', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hmpr', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hmpr', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhpt', -1 )
    call SetBuildAll( BUILD_UNIT, 15, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 10, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 16, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 10, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 17, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 18, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 19, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 20, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 11, 'hpea', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhla', -1 )
    call SetBuildAll( BUILD_UNIT, 9, 'hrif', -1 )
    call SetBuildAll( BUILD_UNIT, 10, 'hrif', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hmtm', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hmtm', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hmpr', -1 )
    call SetBuildAll( BUILD_UNIT, 12, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hmpr', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhra', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hfoo', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 21, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 22, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 13, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 11, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 23, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'halt', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hgra', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'harm', -1 )
    call SetBuildAll( BUILD_UPGRADE, 2, 'Rhme', -1 )
    call SetBuildAll( BUILD_UNIT, 24, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 25, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 26, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 11, 'hrif', -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 9, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 10, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 27, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 28, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 29, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 30, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 31, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 12, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'harm', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hvlt', -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 9, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 10, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 13, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hctw', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hatw', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hbla', -1 )
    call SetBuildAll( BUILD_UNIT, 32, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hmpr', -1 )
    call SetBuildAll( BUILD_UNIT, 9, 'hmpr', -1 )
    call SetBuildAll( BUILD_UNIT, 10, 'hmpr', -1 )
    call SetBuildAll( BUILD_UPGRADE, 3, 'Rhme', -1 )
    call SetBuildAll( BUILD_UNIT, 33, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 34, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 11, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hsor', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hspt', -1 )
    call SetBuildAll( BUILD_UNIT, 11, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 12, 'hdhw', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhse', -1 )
    call SetBuildAll( BUILD_UNIT, 14, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 15, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 9, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 10, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 14, 'hpea', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhhb', -1 )
    call SetBuildAll( BUILD_UNIT, 12, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 35, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 36, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 13, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 16, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 11, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 12, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 13, 'hgtw', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhac', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 9, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 37, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 38, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 39, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 40, 'hhou', -1 )
    call SetBuildAll( BUILD_UPGRADE, 2, 'Rhac', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhan', -1 )
    call SetBuildAll( BUILD_UPGRADE, 2, 'Rhpt', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhst', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhfs', -1 )
    call SetBuildAll( BUILD_UNIT, 17, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hmtm', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hmtm', -1 )
    call SetBuildAll( BUILD_UNIT, 10, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 13, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hmtm', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hmtm', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hmtm', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhcd', -1 )
    call SetBuildAll( BUILD_UNIT, 15, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 41, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 42, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 18, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 19, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 20, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 14, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 15, 'hgtw', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhar', -1 )
    call SetBuildAll( BUILD_UPGRADE, 2, 'Rhra', -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hmtm', -1 )
    call SetBuildAll( BUILD_UNIT, 43, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 44, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 45, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 46, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 47, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 21, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 16, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 48, 'hhou', -1 )
    call SetBuildAll( BUILD_UPGRADE, 3, 'Rhra', -1 )
    call SetBuildAll( BUILD_UPGRADE, 2, 'Rhlh', -1 )
    call SetBuildAll( BUILD_UPGRADE, 3, 'Rhac', -1 )
    call SetBuildAll( BUILD_UNIT, 14, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 11, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 12, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 11, 'hmpr', -1 )
    call SetBuildAll( BUILD_UNIT, 22, 'hwtw', -1 )
    call SetBuildAll( BUILD_UPGRADE, 2, 'Rhar', -1 )
    call SetBuildAll( BUILD_UNIT, 9, 'hmtm', -1 )
    call SetBuildAll( BUILD_UNIT, 10, 'hmtm', -1 )
    call SetBuildAll( BUILD_UNIT, 14, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 11, 'hmtm', -1 )
    call SetBuildAll( BUILD_UNIT, 12, 'hmpr', -1 )
    call SetBuildAll( BUILD_UNIT, 15, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 16, 'hpea', -1 )
    call SetBuildAll( BUILD_UPGRADE, 3, 'Rhar', -1 )
    call SetBuildAll( BUILD_UNIT, 13, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 16, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 12, 'hmtm', -1 )
    call SetBuildAll( BUILD_UPGRADE, 2, 'Rhla', -1 )
    call SetBuildAll( BUILD_UNIT, 17, 'hdhw', -1 )
    call SetBuildAll( BUILD_UPGRADE, 3, 'Rhlh', -1 )
    call SetBuildAll( BUILD_UNIT, 23, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 17, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 17, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 24, 'hwtw', -1 )
    call SetBuildAll( BUILD_UPGRADE, 3, 'Rhla', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhde', -1 )
    call SetBuildAll( BUILD_UNIT, 25, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 18, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hctw', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hatw', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hatw', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hctw', -1 )
    call SetBuildAll( BUILD_UNIT, 19, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'halt', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hbar', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hlum', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hbla', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'harm', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hars', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hgra', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hvlt', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'harm', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hbar', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hbar', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hars', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hgra', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'htow', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'halt', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hbar', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hlum', -1 )
    call SetBuildAll( BUILD_UNIT, 18, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 19, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 26, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hars', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hbar', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hgra', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'harm', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hgra', -1 )
    call SetBuildAll( BUILD_UNIT, 27, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 20, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hbar', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hars', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hgra', -1 )
    call SetBuildAll( BUILD_UNIT, 28, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 21, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'harm', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hars', -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hgra', -1 )
    call SetBuildAll( BUILD_UNIT, 29, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 30, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 22, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hctw', -1 )
endfunction

//===========================================================================
// Specifies harvesting priorities for workers
//===========================================================================
function HarvestPriorities takes nothing returns nothing
    local integer mine = TownWithMine()
    local integer allGold = GetUnitCountDone('hpea')
    local integer allWood = GetUnitCountDone('hpea')
    local integer numWorkers
    set numWorkers = 5
    call HarvestWood( 0, numWorkers )
    set numWorkers = 4
    call HarvestWood( 0, numWorkers )
endfunction

//===========================================================================
// Determines all building and harvesting assignments for workers
//===========================================================================
function WorkerAssignment takes nothing returns nothing
    loop
        call UpdateConditions(  )

        // Harvesting
        call ClearHarvestAI(  )
        call HarvestPriorities(  )

        // Building
        call InitBuildArray(  )
        call BuildPriorities(  )

        call Sleep( 2 )
    endloop
endfunction

//***************************************************************************
//*
//*  Attacking
//*
//***************************************************************************

//===========================================================================
// Returns true if the minimum forces for an attack exist
//===========================================================================
function HaveMinimumAttackers takes nothing returns boolean
    local integer count

    // Check for attack wave limit
    if (attackWave > 1) then
        return false
    endif

    // First Hero Only
    if (GetUnitCountDone(hero_id) < 1) then
        return false
    endif

    return true
endfunction

//===========================================================================
// Assigns units to attack based on the given attack group
//===========================================================================
function PrepareAttackGroup takes integer groupID returns nothing
    local integer all

    // Attack Group #1: Все войска
    if (groupID == 1) then
        set all = GetUnitCountDone( hero_id )
        call AddAttackUnit( all, all, hero_id )
        set all = GetUnitCountDone( hero_id2 )
        call AddAttackUnit( all, all, hero_id2 )
        set all = GetUnitCountDone( hero_id3 )
        call AddAttackUnit( all, all, hero_id3 )
        set all = GetUnitCountDone( 'hdhw' )
        call AddAttackUnit( all, all, 'hdhw' )
        set all = GetUnitCountDone( 'hfoo' )
        call AddAttackUnit( all, all, 'hfoo' )
        set all = GetUnitCountDone( 'hgry' )
        call AddAttackUnit( all, all, 'hgry' )
        set all = GetUnitCountDone( 'hgyr' )
        call AddAttackUnit( all, all, 'hgyr' )
        set all = GetUnitCountDone( 'hkni' )
        call AddAttackUnit( all, all, 'hkni' )
        set all = GetUnitCountDone( 'hmpr' )
        call AddAttackUnit( all, all, 'hmpr' )
        set all = GetUnitCountDone( 'hmtm' )
        call AddAttackUnit( all, all, 'hmtm' )
        set all = GetUnitCountDone( 'hmtt' )
        call AddAttackUnit( all, all, 'hmtt' )
        set all = GetUnitCountDone( 'hrif' )
        call AddAttackUnit( all, all, 'hrif' )
        set all = GetUnitCountDone( 'hsor' )
        call AddAttackUnit( all, all, 'hsor' )
        set all = GetUnitCountDone( 'hspt' )
        call AddAttackUnit( all, all, 'hspt' )
call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2PrepareAttackGroup |r")
    endif
endfunction

//===========================================================================
// Prepares an attack group based on the current attack wave
//===========================================================================
function PrepareForces takes nothing returns nothing
    if (attackWave == 1) then
        call PrepareAttackGroup( 1 )
call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2PrepareForces |r")
    endif
endfunction

//===========================================================================
// Sleep delays for each attack wave
//===========================================================================
function AttackWaveDelay takes integer inWave returns nothing
    if (inWave < nextDelay) then
        return
call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2AttackWaveDelay ===  if (inWave < nextDelay) then |r")
    endif

    set nextDelay = inWave + 1

endfunction

//===========================================================================
// Advances attack wave counter
//===========================================================================
function AttackWaveUpdate takes nothing returns nothing
    call AttackWaveDelay( attackWave )
    set attackWave = attackWave + 1
    if (attackWave > 1) then
        set attackWave = 1
        set nextDelay = attackWave + 1

call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2AttackWaveUpdate === call AttackWaveDelay( attackWave ) === if (attackWave > 1) then |r")
    endif
endfunction

//===========================================================================
// Basic attack functionality
//===========================================================================
function AttackTarget takes unit target, boolean addAlliance returns nothing
    if (target == null) then
        return

call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2AttackTarget ===   if (target == null) then |r")
    endif
    if (addAlliance) then
        call SetAllianceTarget( target )

call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2AttackTarget ===   if (addAlliance) then |r")
    endif
    call FormGroup( 3, true )
    call AttackMoveKillA( target )

call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2AttackTarget ===   call AttackMoveKillA( target ) |r")
    if (not addAlliance) then
        call SetAllianceTarget( null )

call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2AttackTarget ===    if (not addAlliance) then |r")
    endif
endfunction

//===========================================================================
// Initiates an attack based on target priorities
//===========================================================================
function LaunchAttack takes nothing returns nothing
    local unit target = null
    local boolean setAlly = true

    // Don't launch any attack while town is threatened
    if (TownThreatened()) then
        call Sleep( 2 )

call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===  if (TownThreatened()) then  |r")
        return
    endif

    // Target Priority #1
    if (target == null) then
        set target = GetAllianceTarget()

call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #1  |r")
        if (target != null) then
            set setAlly = false

call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #1 +++  |r")
        endif
    endif

    // Target Priority #2
    if (target == null) then
        set target = GetExpansionFoe()

call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #2  |r")
        if (target != null) then
            set take_exp = false

call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #2 +++  |r")
        endif
    endif

    // Target Priority #3
    if (target == null) then
        set target = GetMegaTarget()

call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #3  |r")
    endif

    // Target Priority #4
    if (target == null) then
        set target = GetEnemyExpansion()

call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #4  |r")
    endif

    // Target Priority #5
    if (target == null) then
        set target = GetEnemyExpansion()

call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #5  |r")
        if (target == null) then
            call StartGetEnemyBase(  )
            loop
                exitwhen (not WaitGetEnemyBase())
                call SuicideSleep( 1 )
call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #5 loop+++")
            endloop
            set target = GetEnemyBase()

call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #5  GetEnemyBase()+++")
        endif
    endif

    // Target Priority #6
    if (target == null) then
        set target = GetCreepCamp( 0, 9, false )


call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #6  |r")
    endif

    // Target Priority #7
    if (target == null) then
        set target = GetCreepCamp( 10, 100, true )

call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #7  |r")
    endif

    // Target Priority #8
    if (target == null) then
        call PurchaseZeppelin(  )

call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #8  |r")
        return
    endif

    // Attack the target and increment attack wave
    if (target != null) then
        call AttackTarget( target, setAlly )
        call AttackWaveUpdate(  )

call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===   Attack the target and increment attack wave  |r")
    else
        // If no target was found, sleep a bit before trying again
        call Sleep( 20 )

call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===   Attack the target and increment attack wave  +++ |r")
    endif
endfunction

//===========================================================================
// Determines all attacking assignments
//===========================================================================
function AttackAssignment takes nothing returns nothing
    call StaggerSleep( 0, 2 )

call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Determines all attacking assignments  |r")
    if (attackWave == 1) then
        call AttackWaveDelay( 0 )

call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Determines all attacking assignments === if (attackWave == 1) then    |r")
    endif
    loop
        loop
            call UpdateConditions(  )
            exitwhen (HaveMinimumAttackers() and not CaptainRetreating())
call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Determines all attacking assignments === loop  exitwhen (HaveMinimumAttackers() and not CaptainRetreating())    |r")
            call Sleep( 2 )
        endloop
        call RemoveInjuries(  )
        call ResetAttackUnits(  )
        call PrepareForces(  )
        call LaunchAttack(  )
call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Determines all attacking assignments === loop   endloop   |r")
    endloop
endfunction

//***************************************************************************
//*
//*  Main Entry Point
//*
//***************************************************************************

//===========================================================================
function main takes nothing returns nothing
    call InitAI(  )
    call SetPlayerName( ai_player, "Alex" )
    call InitOptions(  )
    call SelectHeroes(  )
    call CreateCaptains(  )
    call SetHeroLevels( function ChooseHeroSkill )

    call Sleep( 0.1 )
    call StartThread( function WorkerAssignment )
    call StartThread( function AttackAssignment )
    call PlayGame(  )


call BJDebugMsg("|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Main Entry Point |r")
endfunction
ps.Попробовал убрал каждый вызов BJDebugMsg, тоже неполучает.
Старый 19.12.2013, 19:57
DioD

offline
Опыт: 45,134
Активность:
результаты отладки хотябы скриншотом представьте штоле?
Я ведь прошу отладку не для того чтобы она была (внезапно), а для того чтобы вы сделали попытку всётаки найти ошибку самостоятельно, это предполагает не просто добавить отладку, но и запустить код с ней.
маленькая подсказка, для отладки АИ есть специальные методы для показа сообщений, ваш любимый БЖ сюда тянуть не следует.
Старый 19.12.2013, 21:20
xpadd91

offline
Опыт: 10,739
Активность:
DioD:
результаты отладки хотябы скриншотом представьте штоле?
Где скринтош! это нету!

нашел
» debag
//===========================================================================
// 
// Alex
// 
//   Warcraft III AI script
//   Generated by the Warcraft III World Editor
//   Date: Wed Dec 18 19:28:43 2013
// 
//===========================================================================

//***************************************************************************
//*
//*  Global Variables
//*
//***************************************************************************

globals
    integer                 attackWave                 = 1
    integer                 nextDelay                  = 0
    integer                 awGold                     = 0
    integer                 awWood                     = 0
endglobals

//***************************************************************************
//*
//*  Utility Functions
//*
//***************************************************************************

//===========================================================================
function CheckLastCommand takes boolean pop returns integer
    local integer cmd = GetLastCommand()
    if (pop) then
        call PopLastCommand(  )
call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2CheckLastCommand |r")
    endif
    return cmd
endfunction

//===========================================================================
function CheckLastCommandData takes boolean pop returns integer
    local integer data = GetLastData()
    if (pop) then
        call PopLastCommand(  )
call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2CheckLastCommandData |r")
    endif
    return data
endfunction

//===========================================================================
function TotalFoodProduced takes nothing returns integer
    return GetPlayerState(ai_player,PLAYER_STATE_RESOURCE_FOOD_CAP)
call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2TotalFoodProduced |r")
endfunction

//===========================================================================
function ExpansionNeeded takes nothing returns boolean
    return take_exp
call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2ExpansionNeeded |r")
endfunction

//===========================================================================
function BuildExpansion takes integer hallID, integer mineID returns nothing
    if (HallsCompleted(hallID)) then
        call SetBuildExpa( TownCount(hallID) + 1, mineID )
call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2BuildExpansion |r")
    endif
endfunction

//===========================================================================
function CurrentAttackWave takes nothing returns integer
    return attackWave
call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2CurrentAttackWave |r")
endfunction

//===========================================================================
function ResetAttackUnits takes nothing returns nothing
    set awGold = 0
    set awWood = 0
    call InitAssaultGroup(  )
call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2ResetAttackUnits |r")
endfunction

//===========================================================================
function AddAttackUnit takes integer minQty, integer maxQty, integer unitID returns nothing
    // Track attacking gold workers
    if (unitID == 'hpea') then
        set awGold = awGold + minQty
call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2AddAttackUnit===Track attacking gold workers |r")
    endif

    // Track attacking wood workers
    if (unitID == 'hpea') then
        set awWood = awWood + minQty
call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2AddAttackUnit===Track attacking wood workers |r")
    endif

    call SetAssaultGroup( minQty, maxQty, unitID )

call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2AddAttackUnit===call SetAssaultGroup( minQty, maxQty, unitID ) |r")
endfunction

//***************************************************************************
//*
//*  Basic Options
//*
//***************************************************************************

//===========================================================================
function InitOptions takes nothing returns nothing
    call SetMeleeAI(  )
    call SetDefendPlayer( true )
    call SetRandomPaths( true )
    call SetTargetHeroes( true )
    call SetPeonsRepair( true )
    call SetHeroesFlee( true )
    call SetHeroesBuyItems( true )
    call SetUnitsFlee( true )
    call SetGroupsFlee( true )
    call SetWatchMegaTargets( true )
    call SetIgnoreInjured( true )
    call SetHeroesTakeItems( true )
    call SetSlowChopping( false )
    call SetCaptainChanges( true )
    call SetSmartArtillery( true )
endfunction

//***************************************************************************
//*
//*  Conditions
//*
//***************************************************************************

//===========================================================================
// Updates the values of all preset conditions
//===========================================================================
function UpdateConditions takes nothing returns nothing
endfunction

//***************************************************************************
//*
//*  Heroes
//*
//***************************************************************************

//===========================================================================
// Stores hero ID and skills
//===========================================================================
function SetHero takes integer order, integer heroid returns nothing
    if (order == 1) then
        set hero_id = heroid
        if (heroid == 'Hpal') then
            set skills1[ 1] = 'AHhb'
            set skills1[ 2] = 'AHds'
            set skills1[ 3] = 'AHad'
            set skills1[ 4] = 'AHhb'
            set skills1[ 5] = 'AHds'
            set skills1[ 6] = 'AHre'
            set skills1[ 7] = 'AHad'
            set skills1[ 8] = 'AHhb'
            set skills1[ 9] = 'AHds'
            set skills1[10] = 'AHad'
        elseif (heroid == 'Hamg') then
            set skills1[ 1] = 'AHbz'
            set skills1[ 2] = 'AHab'
            set skills1[ 3] = 'AHwe'
            set skills1[ 4] = 'AHbz'
            set skills1[ 5] = 'AHab'
            set skills1[ 6] = 'AHmt'
            set skills1[ 7] = 'AHwe'
            set skills1[ 8] = 'AHbz'
            set skills1[ 9] = 'AHab'
            set skills1[10] = 'AHwe'
        elseif (heroid == 'Hmkg') then
            set skills1[ 1] = 'AHtc'
            set skills1[ 2] = 'AHtb'
            set skills1[ 3] = 'AHbh'
            set skills1[ 4] = 'AHtc'
            set skills1[ 5] = 'AHtb'
            set skills1[ 6] = 'AHav'
            set skills1[ 7] = 'AHbh'
            set skills1[ 8] = 'AHtc'
            set skills1[ 9] = 'AHtb'
            set skills1[10] = 'AHbh'
        endif
    elseif (order == 2) then
        set hero_id2 = heroid
        if (heroid == 'Hpal') then
            set skills2[ 1] = 'AHhb'
            set skills2[ 2] = 'AHds'
            set skills2[ 3] = 'AHad'
            set skills2[ 4] = 'AHhb'
            set skills2[ 5] = 'AHds'
            set skills2[ 6] = 'AHre'
            set skills2[ 7] = 'AHad'
            set skills2[ 8] = 'AHhb'
            set skills2[ 9] = 'AHds'
            set skills2[10] = 'AHad'
        elseif (heroid == 'Hamg') then
            set skills2[ 1] = 'AHbz'
            set skills2[ 2] = 'AHab'
            set skills2[ 3] = 'AHwe'
            set skills2[ 4] = 'AHbz'
            set skills2[ 5] = 'AHab'
            set skills2[ 6] = 'AHmt'
            set skills2[ 7] = 'AHwe'
            set skills2[ 8] = 'AHbz'
            set skills2[ 9] = 'AHab'
            set skills2[10] = 'AHwe'
        elseif (heroid == 'Hmkg') then
            set skills2[ 1] = 'AHtc'
            set skills2[ 2] = 'AHtb'
            set skills2[ 3] = 'AHbh'
            set skills2[ 4] = 'AHtc'
            set skills2[ 5] = 'AHtb'
            set skills2[ 6] = 'AHav'
            set skills2[ 7] = 'AHbh'
            set skills2[ 8] = 'AHtc'
            set skills2[ 9] = 'AHtb'
            set skills2[10] = 'AHbh'
        endif
    elseif (order == 3) then
        set hero_id3 = heroid
        if (heroid == 'Hpal') then
            set skills3[ 1] = 'AHhb'
            set skills3[ 2] = 'AHds'
            set skills3[ 3] = 'AHad'
            set skills3[ 4] = 'AHhb'
            set skills3[ 5] = 'AHds'
            set skills3[ 6] = 'AHre'
            set skills3[ 7] = 'AHad'
            set skills3[ 8] = 'AHhb'
            set skills3[ 9] = 'AHds'
            set skills3[10] = 'AHad'
        elseif (heroid == 'Hamg') then
            set skills3[ 1] = 'AHbz'
            set skills3[ 2] = 'AHab'
            set skills3[ 3] = 'AHwe'
            set skills3[ 4] = 'AHbz'
            set skills3[ 5] = 'AHab'
            set skills3[ 6] = 'AHmt'
            set skills3[ 7] = 'AHwe'
            set skills3[ 8] = 'AHbz'
            set skills3[ 9] = 'AHab'
            set skills3[10] = 'AHwe'
        elseif (heroid == 'Hmkg') then
            set skills3[ 1] = 'AHtc'
            set skills3[ 2] = 'AHtb'
            set skills3[ 3] = 'AHbh'
            set skills3[ 4] = 'AHtc'
            set skills3[ 5] = 'AHtb'
            set skills3[ 6] = 'AHav'
            set skills3[ 7] = 'AHbh'
            set skills3[ 8] = 'AHtc'
            set skills3[ 9] = 'AHtb'
            set skills3[10] = 'AHbh'
        endif
    endif
endfunction

//===========================================================================
// Selects hero IDs for three possible heroes
//===========================================================================
function SelectHeroes takes nothing returns nothing
    local integer roll = GetRandomInt(1,100)
    if (roll <= 17) then
        call SetHero( 1, 'Hpal' )
        call SetHero( 2, 'Hamg' )
        call SetHero( 3, 'Hmkg' )
    elseif (roll <= 34) then
        call SetHero( 1, 'Hpal' )
        call SetHero( 2, 'Hmkg' )
        call SetHero( 3, 'Hamg' )
    elseif (roll <= 50) then
        call SetHero( 1, 'Hamg' )
        call SetHero( 2, 'Hpal' )
        call SetHero( 3, 'Hmkg' )
    elseif (roll <= 67) then
        call SetHero( 1, 'Hamg' )
        call SetHero( 2, 'Hmkg' )
        call SetHero( 3, 'Hpal' )
    elseif (roll <= 84) then
        call SetHero( 1, 'Hmkg' )
        call SetHero( 2, 'Hpal' )
        call SetHero( 3, 'Hamg' )
    else
        call SetHero( 1, 'Hmkg' )
        call SetHero( 2, 'Hamg' )
        call SetHero( 3, 'Hpal' )
    endif
endfunction

//===========================================================================
// Returns the hero skill for the given hero and level
//===========================================================================
function ChooseHeroSkill takes nothing returns integer
    local integer curHero = GetHeroId()
    local integer level = GetHeroLevelAI()

    if (level > max_hero_level) then
        set max_hero_level = level
    endif

    if (curHero == hero_id) then
        return skills1[level]
    elseif (curHero == hero_id2) then
        return skills2[level]
    elseif (curHero == hero_id3) then
        return skills3[level]
    endif
    return 0
endfunction

//***************************************************************************
//*
//*  Building and Harvesting
//*
//***************************************************************************

//===========================================================================
// Specifies building priorities for workers
//===========================================================================
function BuildPriorities takes nothing returns nothing
    local integer mine = TownWithMine()
    call SetBuildAll( BUILD_UNIT, 1, 'htow', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'halt', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hbar', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hlum', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hbla', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hkee', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hfoo', -1 )
    call SetBuildAll( BUILD_UNIT, 1, hero_id, -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hfoo', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hfoo', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hbar', -1 )
    call SetBuildAll( BUILD_UNIT, 1, hero_id2, -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hrif', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hrif', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'harm', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hars', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hvlt', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hcas', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hrif', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hrif', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hrif', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hhou', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhme', -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 9, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 10, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 11, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hrif', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hrif', -1 )
    call SetBuildAll( BUILD_UNIT, 1, hero_id3, -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hrif', -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hmpr', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hsor', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hgra', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 12, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 13, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 9, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 14, 'hhou', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhlh', -1 )
    call SetBuildAll( BUILD_UNIT, 9, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hmpr', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hsor', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hmpr', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hmpr', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hmpr', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhpt', -1 )
    call SetBuildAll( BUILD_UNIT, 15, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 10, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 16, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 10, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 17, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 18, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 19, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 20, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 11, 'hpea', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhla', -1 )
    call SetBuildAll( BUILD_UNIT, 9, 'hrif', -1 )
    call SetBuildAll( BUILD_UNIT, 10, 'hrif', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hmtm', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hmtm', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hmpr', -1 )
    call SetBuildAll( BUILD_UNIT, 12, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hmpr', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhra', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hfoo', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 21, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 22, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 13, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 11, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 23, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'halt', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hgra', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'harm', -1 )
    call SetBuildAll( BUILD_UPGRADE, 2, 'Rhme', -1 )
    call SetBuildAll( BUILD_UNIT, 24, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 25, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 26, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 11, 'hrif', -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 9, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 10, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 27, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 28, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 29, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 30, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 31, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 12, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'harm', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hvlt', -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 9, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 10, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 13, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hctw', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hatw', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hbla', -1 )
    call SetBuildAll( BUILD_UNIT, 32, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hmpr', -1 )
    call SetBuildAll( BUILD_UNIT, 9, 'hmpr', -1 )
    call SetBuildAll( BUILD_UNIT, 10, 'hmpr', -1 )
    call SetBuildAll( BUILD_UPGRADE, 3, 'Rhme', -1 )
    call SetBuildAll( BUILD_UNIT, 33, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 34, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 11, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hsor', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hspt', -1 )
    call SetBuildAll( BUILD_UNIT, 11, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 12, 'hdhw', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhse', -1 )
    call SetBuildAll( BUILD_UNIT, 14, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 15, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 9, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 10, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 14, 'hpea', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhhb', -1 )
    call SetBuildAll( BUILD_UNIT, 12, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 35, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 36, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 13, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 1, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 16, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 11, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 12, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 13, 'hgtw', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhac', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 9, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 37, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 38, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 39, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 40, 'hhou', -1 )
    call SetBuildAll( BUILD_UPGRADE, 2, 'Rhac', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhan', -1 )
    call SetBuildAll( BUILD_UPGRADE, 2, 'Rhpt', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhst', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhfs', -1 )
    call SetBuildAll( BUILD_UNIT, 17, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hmtm', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hmtm', -1 )
    call SetBuildAll( BUILD_UNIT, 10, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 13, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hmtm', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hmtm', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hmtm', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhcd', -1 )
    call SetBuildAll( BUILD_UNIT, 15, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 41, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 42, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 18, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 19, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 20, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 14, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 15, 'hgtw', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhar', -1 )
    call SetBuildAll( BUILD_UPGRADE, 2, 'Rhra', -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hmtm', -1 )
    call SetBuildAll( BUILD_UNIT, 43, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 44, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 45, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 46, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 47, 'hhou', -1 )
    call SetBuildAll( BUILD_UNIT, 21, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 16, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 48, 'hhou', -1 )
    call SetBuildAll( BUILD_UPGRADE, 3, 'Rhra', -1 )
    call SetBuildAll( BUILD_UPGRADE, 2, 'Rhlh', -1 )
    call SetBuildAll( BUILD_UPGRADE, 3, 'Rhac', -1 )
    call SetBuildAll( BUILD_UNIT, 14, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 11, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 12, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 11, 'hmpr', -1 )
    call SetBuildAll( BUILD_UNIT, 22, 'hwtw', -1 )
    call SetBuildAll( BUILD_UPGRADE, 2, 'Rhar', -1 )
    call SetBuildAll( BUILD_UNIT, 9, 'hmtm', -1 )
    call SetBuildAll( BUILD_UNIT, 10, 'hmtm', -1 )
    call SetBuildAll( BUILD_UNIT, 14, 'hkni', -1 )
    call SetBuildAll( BUILD_UNIT, 11, 'hmtm', -1 )
    call SetBuildAll( BUILD_UNIT, 12, 'hmpr', -1 )
    call SetBuildAll( BUILD_UNIT, 15, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 16, 'hpea', -1 )
    call SetBuildAll( BUILD_UPGRADE, 3, 'Rhar', -1 )
    call SetBuildAll( BUILD_UNIT, 13, 'hgry', -1 )
    call SetBuildAll( BUILD_UNIT, 16, 'hdhw', -1 )
    call SetBuildAll( BUILD_UNIT, 12, 'hmtm', -1 )
    call SetBuildAll( BUILD_UPGRADE, 2, 'Rhla', -1 )
    call SetBuildAll( BUILD_UNIT, 17, 'hdhw', -1 )
    call SetBuildAll( BUILD_UPGRADE, 3, 'Rhlh', -1 )
    call SetBuildAll( BUILD_UNIT, 23, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 17, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 17, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 24, 'hwtw', -1 )
    call SetBuildAll( BUILD_UPGRADE, 3, 'Rhla', -1 )
    call SetBuildAll( BUILD_UPGRADE, 1, 'Rhde', -1 )
    call SetBuildAll( BUILD_UNIT, 25, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 18, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hctw', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hatw', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hatw', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hctw', -1 )
    call SetBuildAll( BUILD_UNIT, 19, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'halt', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hbar', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hlum', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hbla', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'harm', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'hars', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hgra', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hvlt', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'harm', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hbar', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hbar', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hars', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hgra', -1 )
    call SetBuildAll( BUILD_UNIT, 2, 'htow', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'halt', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hbar', -1 )
    call SetBuildAll( BUILD_UNIT, 3, 'hlum', -1 )
    call SetBuildAll( BUILD_UNIT, 18, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 19, 'hpea', -1 )
    call SetBuildAll( BUILD_UNIT, 26, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hars', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hbar', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hgra', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'harm', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hgra', -1 )
    call SetBuildAll( BUILD_UNIT, 27, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 20, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hbar', -1 )
    call SetBuildAll( BUILD_UNIT, 5, 'hars', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'hgra', -1 )
    call SetBuildAll( BUILD_UNIT, 28, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 21, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 7, 'harm', -1 )
    call SetBuildAll( BUILD_UNIT, 6, 'hars', -1 )
    call SetBuildAll( BUILD_UNIT, 8, 'hgra', -1 )
    call SetBuildAll( BUILD_UNIT, 29, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 30, 'hwtw', -1 )
    call SetBuildAll( BUILD_UNIT, 22, 'hgtw', -1 )
    call SetBuildAll( BUILD_UNIT, 4, 'hctw', -1 )
endfunction

//===========================================================================
// Specifies harvesting priorities for workers
//===========================================================================
function HarvestPriorities takes nothing returns nothing
    local integer mine = TownWithMine()
    local integer allGold = GetUnitCountDone('hpea')
    local integer allWood = GetUnitCountDone('hpea')
    local integer numWorkers
    set numWorkers = 5
    call HarvestWood( 0, numWorkers )
    set numWorkers = 4
    call HarvestWood( 0, numWorkers )
endfunction

//===========================================================================
// Determines all building and harvesting assignments for workers
//===========================================================================
function WorkerAssignment takes nothing returns nothing
    loop
        call UpdateConditions(  )

        // Harvesting
        call ClearHarvestAI(  )
        call HarvestPriorities(  )

        // Building
        call InitBuildArray(  )
        call BuildPriorities(  )

        call Sleep( 2 )
    endloop
endfunction

//***************************************************************************
//*
//*  Attacking
//*
//***************************************************************************

//===========================================================================
// Returns true if the minimum forces for an attack exist
//===========================================================================
function HaveMinimumAttackers takes nothing returns boolean
    local integer count

    // Check for attack wave limit
    if (attackWave > 1) then
        return false
    endif

    // First Hero Only
    if (GetUnitCountDone(hero_id) < 1) then
        return false
    endif

    return true
endfunction

//===========================================================================
// Assigns units to attack based on the given attack group
//===========================================================================
function PrepareAttackGroup takes integer groupID returns nothing
    local integer all

    // Attack Group #1: Все войска
    if (groupID == 1) then
        set all = GetUnitCountDone( hero_id )
        call AddAttackUnit( all, all, hero_id )
        set all = GetUnitCountDone( hero_id2 )
        call AddAttackUnit( all, all, hero_id2 )
        set all = GetUnitCountDone( hero_id3 )
        call AddAttackUnit( all, all, hero_id3 )
        set all = GetUnitCountDone( 'hdhw' )
        call AddAttackUnit( all, all, 'hdhw' )
        set all = GetUnitCountDone( 'hfoo' )
        call AddAttackUnit( all, all, 'hfoo' )
        set all = GetUnitCountDone( 'hgry' )
        call AddAttackUnit( all, all, 'hgry' )
        set all = GetUnitCountDone( 'hgyr' )
        call AddAttackUnit( all, all, 'hgyr' )
        set all = GetUnitCountDone( 'hkni' )
        call AddAttackUnit( all, all, 'hkni' )
        set all = GetUnitCountDone( 'hmpr' )
        call AddAttackUnit( all, all, 'hmpr' )
        set all = GetUnitCountDone( 'hmtm' )
        call AddAttackUnit( all, all, 'hmtm' )
        set all = GetUnitCountDone( 'hmtt' )
        call AddAttackUnit( all, all, 'hmtt' )
        set all = GetUnitCountDone( 'hrif' )
        call AddAttackUnit( all, all, 'hrif' )
        set all = GetUnitCountDone( 'hsor' )
        call AddAttackUnit( all, all, 'hsor' )
        set all = GetUnitCountDone( 'hspt' )
        call AddAttackUnit( all, all, 'hspt' )
call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2PrepareAttackGroup |r")
    endif
endfunction

//===========================================================================
// Prepares an attack group based on the current attack wave
//===========================================================================
function PrepareForces takes nothing returns nothing
    if (attackWave == 1) then
        call PrepareAttackGroup( 1 )
call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2PrepareForces |r")
    endif
endfunction

//===========================================================================
// Sleep delays for each attack wave
//===========================================================================
function AttackWaveDelay takes integer inWave returns nothing
    if (inWave < nextDelay) then
        return
call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2AttackWaveDelay ===  if (inWave < nextDelay) then |r")
    endif

    set nextDelay = inWave + 1

endfunction

//===========================================================================
// Advances attack wave counter
//===========================================================================
function AttackWaveUpdate takes nothing returns nothing
    call AttackWaveDelay( attackWave )
    set attackWave = attackWave + 1
    if (attackWave > 1) then
        set attackWave = 1
        set nextDelay = attackWave + 1

call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2AttackWaveUpdate === call AttackWaveDelay( attackWave ) === if (attackWave > 1) then |r")
    endif
endfunction

//===========================================================================
// Basic attack functionality
//===========================================================================
function AttackTarget takes unit target, boolean addAlliance returns nothing
    if (target == null) then
        return

call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2AttackTarget ===   if (target == null) then |r")
    endif
    if (addAlliance) then
        call SetAllianceTarget( target )

call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2AttackTarget ===   if (addAlliance) then |r")
    endif
    call FormGroup( 3, true )
    call AttackMoveKillA( target )

call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2AttackTarget ===   call AttackMoveKillA( target ) |r")
    if (not addAlliance) then
        call SetAllianceTarget( null )

call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2AttackTarget ===    if (not addAlliance) then |r")
    endif
endfunction

//===========================================================================
// Initiates an attack based on target priorities
//===========================================================================
function LaunchAttack takes nothing returns nothing
    local unit target = null
    local boolean setAlly = true

    // Don't launch any attack while town is threatened
    if (TownThreatened()) then
        call Sleep( 2 )

call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===  if (TownThreatened()) then  |r")
        return
    endif

    // Target Priority #1
    if (target == null) then
        set target = GetAllianceTarget()

call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #1  |r")
        if (target != null) then
            set setAlly = false

call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #1 +++  |r")
        endif
    endif

    // Target Priority #2
    if (target == null) then
        set target = GetExpansionFoe()

call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #2  |r")
        if (target != null) then
            set take_exp = false

call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #2 +++  |r")
        endif
    endif

    // Target Priority #3
    if (target == null) then
        set target = GetMegaTarget()

call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #3  |r")
    endif

    // Target Priority #4
    if (target == null) then
        set target = GetEnemyExpansion()

call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #4  |r")
    endif

    // Target Priority #5
    if (target == null) then
        set target = GetEnemyExpansion()

call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #5  |r")
        if (target == null) then
            call StartGetEnemyBase(  )
            loop
                exitwhen (not WaitGetEnemyBase())
                call SuicideSleep( 1 )
call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #5 loop+++")
            endloop
            set target = GetEnemyBase()

call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #5  GetEnemyBase()+++")
        endif
    endif

    // Target Priority #6
    if (target == null) then
        set target = GetCreepCamp( 0, 9, false )


call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #6  |r")
    endif

    // Target Priority #7
    if (target == null) then
        set target = GetCreepCamp( 10, 100, true )

call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #7  |r")
    endif

    // Target Priority #8
    if (target == null) then
        call PurchaseZeppelin(  )

call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #8  |r")
        return
    endif

    // Attack the target and increment attack wave
    if (target != null) then
        call AttackTarget( target, setAlly )
        call AttackWaveUpdate(  )

call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===   Attack the target and increment attack wave  |r")
    else
        // If no target was found, sleep a bit before trying again
        call Sleep( 20 )

call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===   Attack the target and increment attack wave  +++ |r")
    endif
endfunction

//===========================================================================
// Determines all attacking assignments
//===========================================================================
function AttackAssignment takes nothing returns nothing
    call StaggerSleep( 0, 2 )

call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Determines all attacking assignments  |r")
    if (attackWave == 1) then
        call AttackWaveDelay( 0 )

call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Determines all attacking assignments === if (attackWave == 1) then    |r")
    endif
    loop
        loop
            call UpdateConditions(  )
            exitwhen (HaveMinimumAttackers() and not CaptainRetreating())
call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Determines all attacking assignments === loop  exitwhen (HaveMinimumAttackers() and not CaptainRetreating())    |r")
            call Sleep( 2 )
        endloop
        call RemoveInjuries(  )
        call ResetAttackUnits(  )
        call PrepareForces(  )
        call LaunchAttack(  )
call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Determines all attacking assignments === loop   endloop   |r")
    endloop
endfunction

//***************************************************************************
//*
//*  Main Entry Point
//*
//***************************************************************************

//===========================================================================
function main takes nothing returns nothing
    call InitAI(  )
    call SetPlayerName( ai_player, "Alex" )
    call InitOptions(  )
    call SelectHeroes(  )
    call CreateCaptains(  )
    call SetHeroLevels( function ChooseHeroSkill )

    call Sleep( 0.1 )
    call StartThread( function WorkerAssignment )
    call StartThread( function AttackAssignment )
    call PlayGame(  )


call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Main Entry Point |r")
endfunction
Тормоз, вот сообщение дубль |cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities === Target Priority #5 loop+++
    // Target Priority #5
    if (target == null) then
        set target = GetEnemyExpansion()

call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #5  |r")
        if (target == null) then
            call StartGetEnemyBase(  )
            loop
                exitwhen (not WaitGetEnemyBase())
                call SuicideSleep( 1 )
call DisplayTextToPlayer( GetLocalPlayer(), 0.0, 0.0, "|cFF00005EBOT: Alex|r |cFF000035function===|r |cFF0000F2Initiates an attack based on target priorities ===    // Target Priority #5 loop+++")
            endloop
xpadd91 добавил:
/
Миниатюры
Кликните на картинку для увеличения
Название:  ScreenShot217.jpg
Просмотров: 51
Размер:  338.9 Кбайт  Кликните на картинку для увеличения
Название:  ScreenShot218.jpg
Просмотров: 15
Размер:  308.7 Кбайт  
Старый 19.12.2013, 22:12
DioD

offline
Опыт: 45,134
Активность:
уже лучше, теперь судя по всему известен метод, который вызывается часто и постоянно и в теории может сильно тормозить игру...
увеличиваем sleep на этом методе до 20 секунд, так как каждую секунду совершать проверку явно слишком часто.
запускаем и смотрим изменилась ли ситуация со слипом в 20 секунд, если нет, то проблема не в этом методе, а где-то еще.
для того чтобы оценить скорость исполнения кода, запускаете таймер (или делаете счётчик иным образом) и извлекаете "текущее игровое время" в сообщение, это позволит выявить методы которые исполняются слишком часто - для таймера getelapsed
Старый 20.12.2013, 07:42
Ответ

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск

Ваши права в разделе
Вы не можете создавать темы
Вы не можете отвечать на сообщения
Вы не можете прикреплять файлы
Вы можете скачивать файлы

BB-коды Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход



Часовой пояс GMT +3, время: 08:34.