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

About campaign AI call SetTargetHeroes(false) and the difference between Normal and Hard difficulty.

Status
Not open for further replies.
Level 16
Joined
May 2, 2011
Messages
1,345
Hey everyone,

Why does it seem to me that Hard AI will prioritize targeting siege unit more than Normal and easy difficulty? towers also seem to prioritize unarmored units.

Could it have something to do with call SetTargetHeroes(false) which I found on some AI tutorials?
If I set it to true, will normal and easy towers target un-armored units? will they also target siege units?
Thanks!
below is the AI tutorial I am talking about



JASS:
function CampaignAI takes integer farms, code heroes returns nothing
    if GetGameDifficulty() == MAP_DIFFICULTY_EASY then
        set difficulty = EASY

        call SetTargetHeroes(false)
        call SetUnitsFlee(false)

    elseif GetGameDifficulty() == MAP_DIFFICULTY_NORMAL then
        set difficulty = NORMAL

        call SetTargetHeroes(false)
        call SetUnitsFlee(false)

    elseif GetGameDifficulty() == MAP_DIFFICULTY_HARD then
        set difficulty = HARD

        call SetPeonsRepair(true)
    else
        set difficulty = INSANE
    endif

    call InitAI()
    call InitBuildArray()
    call InitAssaultGroup()
    call CreateCaptains()

    call SetNewHeroes(false)
    if heroes != null then
        call SetHeroLevels(heroes)
    endif

    call SetHeroesFlee(false)
    call SetGroupsFlee(false)
    call SetSlowChopping(true)
    call GroupTimedLife(false)
    call SetCampaignAI()
    call Sleep(0.1)

    set racial_farm = farms
    call StartThread(function CampaignBasics)
    call StartBuildLoop()
endfunction
 
Level 16
Joined
May 2, 2011
Messages
1,345
SetTargetHeroes tells the AI whether he should prioritize enemy heroes or not. It has nothing to do with targeting siege units or unarmored units. I think this latter is just how hard difficulty is supposed to work.
Yea, that seems to be the case :(

I tried adding these commands both before and after calling campaignAI with no use
Code:
function main takes nothing returns nothing
    set difficulty = EASY
    call SetTargetHeroes(false)
    call CampaignAI(HOUSE,null)
    set difficulty = EASY
    call SetTargetHeroes(false)
    call SetReplacements(1,3,99)

I wish there was some workaround

@Turnro What do you think?
 
Level 31
Joined
Dec 8, 2009
Messages
1,326
Yea, that seems to be the case :(

I tried adding these commands both before and after calling campaignAI with no use
Code:
function main takes nothing returns nothing
    set difficulty = EASY
    call SetTargetHeroes(false)
    call CampaignAI(HOUSE,null)
    set difficulty = EASY
    call SetTargetHeroes(false)
    call SetReplacements(1,3,99)

I wish there was some workaround

@Turnro What do you think?

I've never noticed the AI targeting units based on armor types. I do know, however, that the AI will prioritize units with less than 300 hit points.

Either way, the prioritizing seems to be something that is hard-coded into the game rather than an option you can determine via AI scripting.
 
Status
Not open for further replies.
Top