• 🏆 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!

Custom Campaign AI strange behaviour

Status
Not open for further replies.
Level 1
Joined
Apr 23, 2020
Messages
2
Hello guys, probably most of me don't remember me, but I was many years ago often guest on this
board and I've decided to practice coding AI due the quarantine period and I've encountered strange
problem on my script few days ago.

Here are listed problems I've noticed in my AI
- Peasants ignores trigger that tells them to collect wood
- 10 peasants are mining gold in one gold mine
- Assault group attacks my camp with incomplete set (even on warpten cheat)
- Even though in config I've set "without mercy" option remnants of attacking group are retreating
- When AI heroes dies they are beign revived in altars only when the game starts preparing next assault group.

I would be very pleased if someone could take a look at this script and check what is wrong with it.
It's also worth to mention that I'm using warcraft 3 1.27.1.7085 (pretty old one) and the food limit is raised from default 100 to 300 and CPU that uses that AI has always set gold and wood to fixed value 99.999 (I think it's a fair value, since it's more than enough to train units from 3 barracks and etc at the same time and not causing some integer range errors)

and here is this unfourtunate AI script wich i wrote using JASSCraft 1.1.3.
JASS:
globals
    player user = Player(3) //teal player(???)
endglobals

function main takes nothing returns nothing

    call SetDefendPlayer( false )
    call SetRandomPaths( true )
    call SetTargetHeroes( true )
    call SetPeonsRepair( true )
    call SetHeroesFlee( false )
    call SetHeroesBuyItems( true )
    call SetUnitsFlee( false )
    call SetGroupsFlee( false )
    call SetWatchMegaTargets( true )
    call SetIgnoreInjured( true )
    call SetHeroesTakeItems( true )
    call SetSlowChopping( true )
    call SetCaptainChanges( false )
    call SetSmartArtillery( true )
 
    call CampaignAI(HOUSE,null)
    call SetReplacements(1,1,3) 
 
    call SetBuildUnit( 1, TOWN_HALL )
    call SetBuildUnit( 5, PEASANT )
    call SetBuildUnit( 5, HOUSE )
    call SetBuildUnit( 2, 'halt') //Altar
    call SetBuildUnit( 3, BARRACKS )
    call SetBuildUnit( 3, LUMBER_MILL )
    call SetBuildUnit( 1, BLACKSMITH )
    call SetBuildUnit( 5, HOUSE ) //Farms
    call SetBuildUnit( 1, KEEP )
    call SetBuildUnit( 3, 'hars' ) //Sanctuary
    call SetBuildUnit( 3, 'harm' ) //Workshop
    call SetBuildUnit( 5, HOUSE )
    call SetBuildUnit( 3, 'hgra' ) //gryphons
    call SetBuildUnit( 1, CASTLE )
    call SetBuildUnit( 6, HOUSE )
    call SetBuildUnit( 6, HOUSE )
 
    //setup defences in camp
    call CampaignDefenderEx(3,3,2, 'hfoo')
    call CampaignDefenderEx(3,3,2, 'hkni')
    call CampaignDefenderEx(3,3,2, 'hgyr')
    call CampaignDefenderEx(3,3,2, 'hgry')
    call CampaignDefenderEx(3,3,2, 'hmpr')
    call CampaignDefenderEx(3,3,2, 'hrif')
 

        //Cavalry #1
        call InitAssaultGroup()
        call CampaignAttackerEx( 1,1,1, 'Hpal') 
        call CampaignAttackerEx( 1,1,1, 'Hmkg')    //Muradin
          call CampaignAttackerEx( 1,1,1, 'Nfir')    //Fire Lord 
          call CampaignAttackerEx( 3,3,4, 'hkni')
        call CampaignAttackerEx( 3,3,5, 'hfoo')
        call SuicideOnPlayerEx(M5,M5,M1,user)
     
        //Cavalry #2
        call InitAssaultGroup()
        call CampaignAttackerEx( 1,1,1, 'Hpal') 
        call CampaignAttackerEx( 1,1,1, 'Hmkg')    //Muradin
          call CampaignAttackerEx( 1,1,1, 'Nfir')    //Fire Lord 
          call CampaignAttackerEx( 3,3,4, 'hkmi')
        call CampaignAttackerEx( 3,3,3, 'hfoo')
        call CampaignAttackerEx( 3,3,2, 'hmpr')                       
        call CampaignAttackerEx( 3,3,2, 'hsor')     
        call SuicideOnPlayerEx(M5,M5,M1,user)
     
        //Artilery
        call InitAssaultGroup()
        call CampaignAttackerEx( 1,1,1, 'Hpal') 
        call CampaignAttackerEx( 1,1,1, 'Hmkg')    //Muradin
          call CampaignAttackerEx( 1,1,1, 'Nfir')    //Fire Lord 
          call CampaignAttackerEx( 3,3,4, 'hrif')
        call CampaignAttackerEx( 3,3,3, 'hrtt')
        call CampaignAttackerEx( 3,3,2, 'hmtm')
        call SuicideOnPlayerEx(M5,M5,M1,user)                         
     
        //Air Attack
        call InitAssaultGroup()
          call CampaignAttackerEx( 3,3,9, 'hgyr')
        call CampaignAttackerEx( 3,3,3, 'hgry')
        call CampaignAttackerEx( 3,3,2, 'hmtm')
        call SuicideOnPlayerEx(M5,M5,M1,user)     
    loop
        //This is full squad wich should keep attacking every three minutes
        //but for some unknown reason attacking squad comes to attack partially
        //even though delay attack is big enough to form entire army.
        call InitAssaultGroup()
        call CampaignAttackerEx( 1,1,1, 'Hpal')    //Paladin
        call CampaignAttackerEx( 1,1,1, 'Hmkg')    //Hero Muradin
          call CampaignAttackerEx( 1,1,1, 'Nfir')    //Hero Fire Lord 
          call CampaignAttackerEx( 3,3,4, 'hrif') //Riflemen
        call CampaignAttackerEx( 3,3,3, 'hrtt') //Upgraded Tank
        call CampaignAttackerEx( 3,3,2, 'hmtm') //Mortar team
          call CampaignAttackerEx( 3,3,9, 'hgyr') //Gyrocopter
        call CampaignAttackerEx( 3,3,3, 'hgry') //Gryphon Rider
          call CampaignAttackerEx( 3,3,4, 'hkni') //Knights
        call CampaignAttackerEx( 3,3,5, 'hfoo') //Footmen
        call CampaignAttackerEx( 3,3,2, 'hsor') //Sorceress
        call CampaignAttackerEx( 3,3,2, 'hmpr') //Priest
        call SuicideOnPlayerEx(M5,M5,M3,user)               
    endloop       
endfunction

Thank you for your time and I'm ready to provide any more info you will need to solve these problems.
If that also might help, I'm trying to write extremly brutal and merciles AI (for Hard difficulty) i can come up after watching many replays I could find on youtube.
 
Last edited:
Status
Not open for further replies.
Top