• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[AI] No Retreating

Status
Not open for further replies.
Level 2
Joined
Feb 12, 2008
Messages
6
Man, I have like the same problem, and with some tests, the AI near don't retreat (only when have incomplete buildings)

Try to set in the Attacking Priority in the Waves Section like this.
Enemy - Major Assault
Enemy - Any Town

Test and say if worked =)
 
Level 13
Joined
Apr 15, 2008
Messages
1,063
I believe the problem is he retreats every time the unit count drops below "Minimum forces for attack". Since units can't join the attack group while it is out of base, he will eventually run out of units and run away to his base, and there realize he once again has enough units and attack again.

So there are two ways to solve this: either drop minimum forces requirement, when there is no resistance (not sure how to do this), or force him to replace fallen units, by launching new attack, while the previous attack is still in progress. That can be done by altering following function:

JASS:
function AttackAssignment takes nothing returns nothing
    call StaggerSleep( 0, 2 )
    if (attackWave == 1) then
        call AttackWaveDelay( 0 )
    endif
    loop
        loop
            call UpdateConditions(  )
            exitwhen (HaveMinimumAttackers() and not CaptainRetreating())
            call Sleep( 2 )
        endloop
        call RemoveInjuries(  )
        call ResetAttackUnits(  )
        call PrepareForces(  )
        call LaunchAttack(  )
    endloop
endfunction

By removing the and not CaptainRetreating(). That condition prevents AI from launching new attack while captain is out in field, retreating. It will also allow to "clear" one creep camp after another, not having to return to base after each one, which is also a pretty good feature.
 
Level 22
Joined
Feb 3, 2009
Messages
3,292
Look to the AI wave from Night Elf 04x04 from MPQ:

JASS:
//*** WAVE 1 ***
    call InitAssaultGroup()
    call CampaignAttackerEx( 1, 1, 1, NAGA_VASHJ        )
    call CampaignAttackerEx( 4, 4, 6, NAGA_REAVER       )
    call CampaignAttackerEx( 0, 0, 1, NAGA_MYRMIDON        )
    call SuicideOnPlayer(M3,user)

How I do this "SuicideOnPlayer" line in the AI Editor?
 
Status
Not open for further replies.
Top