• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

AI not working at all

Status
Not open for further replies.
Level 4
Joined
May 16, 2010
Messages
94
My AI isnt working AT ALL and this script as no syntax errors (i run a syntax check).

What can i do? It's just frustrating ive tried everything and this isnt working.

JASS:
globals
        constant integer SHIPACOLYTE          = 'u001'
        player bloodelf = Player( 0 )
        player nightelf = Player( 1 )
        player guardian = Player( 2 )
endglobals

function hero takes nothing returns integer
    local integer hero  = GetHeroId()           //Gets the hero
    local integer level = GetHeroLevelAI()      //Hero level
    local integer abil = 0                         //ability
    if hero == CRYPT_LORD then
        if level == 1 or level == 4 or level == 8 then
            set abil = CARRION_SCARAB
        endif
        if level == 2 or level == 5 or level == 9 then
            set abil = THORNY_SHIELD
        endif
        if level == 3 or level == 7 or level == 10 then
            set abil = IMPALE
        endif
        if level == 6 then
            set abil = LOCUST_SWARM
        endif 
    endif
     return abil
endfunction

 function Setup takes nothing returns nothing
call SetTargetHeroes( true )                  //Targets heroes with higher priority
call SetUnitsFlee( false )                    //No flee
call SetHeroesFlee( false )
call SetGroupsFlee( false )
call SetSlowChopping( true )                  //Slow harvest
call SetPeonsRepair( true )                   //Repair stuff
call SetHeroesBuyItems( true )                //Heroes buy items
call SetHeroesTakeItems( true )               //Heroes take items
call SetWoodPeons(3)                          //3 Lumber Workers
    endfunction 
   
function main takes nothing returns nothing
   call CampaignAI( ZIGGURAT_1, function hero )  
   call Setup()
//============================================================
//Buildings
   call SetReplacements( 10,15,20 )
   call SetBuildUnit( 1, ACOLYTE )
   call SetBuildUnit( 1, NECROPOLIS_1 )
   call SetBuildUnit( 5, ACOLYTE )
   call SetBuildUnit( 3, SHIPACOLYTE )
   call SetBuildUnit( 1, UNDEAD_MINE )
   call SetBuildUnit( 10, ZIGGURAT_1 )
   call SetBuildUnit( 1, CRYPT )
   call SetBuildUnit( 1, UNDEAD_ALTAR )
   call SetBuildUnit( 1, GRAVEYARD )
   call SetBuildUnit( 1, TOMB_OF_RELICS )
   call SetBuildUnit( 1, NECROPOLIS_2 )
   call SetBuildUnit( 1, SLAUGHTERHOUSE )
   call SetBuildUnit( 1, DAMNED_TEMPLE )
   call SetBuildUnit( 1, SAC_PIT )
   call SetBuildUnit( 1, NECROPOLIS_3 )
   call SetBuildUnit( 1, BONEYARD )
   call SetBuildUnit( 5, ZIGGURAT_2 )
   call SetBuildUnit( 3, ZIGGURAT_FROST )
   call SetBuildUnit( 2, UNDEAD_BARGE )
   call CampaignDefenderEx( 1,1,1, DOOMGUARD )
   call CampaignDefenderEx( 2,2,2, GHOUL )
   call CampaignDefenderEx( 2,2,2, CRYPT_FIEND )
   call CampaignDefenderEx( 1,1,1, GARGOYLE )
   call CampaignDefenderEx( 1,1,1, ABOMINATION )
   call CampaignDefenderEx( 1,1,1, SHADE )

//Wave 1
   call InitAssaultGroup()
   call CampaignAttackerEx( 1,1,1, DEATH_KNIGHT )
   call CampaignAttackerEx( 8,8,8, GHOUL )
   call CampaignAttackerEx( 5,5,5, PIT_FIEND )
   call SuicideOnPlayerEx( 120,120,120, bloodelf )

endfunction
 
Level 4
Joined
May 16, 2010
Messages
94
It is a computer slot and i activated it with triggers. However, i found out the problem: apperently having a function named hero messes up the AI.
 
Status
Not open for further replies.
Top