• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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 12
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