• 🏆 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 expanding on a different location

Status
Not open for further replies.
Level 4
Joined
Apr 14, 2021
Messages
56
Hello, I am curious as to how I can make my AI make/expand their base at a different gold mine, just like in blizzard maps, the AI kills the creeps guarding the mine or another player using the mine, then they go and build a small (outpost?) base there. Thanks in forward to those that anwer. :grin:
 
Level 4
Joined
Apr 14, 2021
Messages
56
Very sorry for not answering, and I don't even know if you'll see this because I haven't been on for months. As you said, I want it to expand automatically on the nearest/best location. But I have no idea what code it is in Jass.
 
Level 2
Joined
Feb 24, 2020
Messages
6
They are saying that AI for melee maps is hard coded, you can’t tell it what to do other than configuring it in the AI editor. Custom AI would require JASS and is on the advanced end of programming so if you are new it will be a while to learn some general coding practices first.
 
Level 4
Joined
Apr 14, 2021
Messages
56
Which I obviously lack and really wanna learn. And I found no tutorials to help me learn the hard side of Jass.
 
Level 39
Joined
Feb 27, 2007
Messages
4,992
I don't even know if you'll see this because I haven't been on for months
Most users get notifications for new replies to threads they're 'subscribed' to. And replying to a thread automatically subscribes you, so it's likely they got a notification.
They are saying that AI for melee maps is hard coded, you can’t tell it what to do other than configuring it in the AI editor.
Not strictly true. You could bypass the normal call to StandardAI() that runs every 'melee' AI and call appropriate functions yourself, which would cause it to behave differently. That function is found in common.ai, which is a handy place to look to see how the ai stuff is handled in JASS by default:
JASS:
function StandardAI takes code heroes, code peons, code attacks returns nothing

    local boolean isNewbie = (MeleeDifficulty() == MELEE_NEWBIE)

    call InitAI()

    call SetMeleeAI()

    call SetDefendPlayer(true)
    call SetGroupsFlee(not isNewbie)
    call SetHeroesBuyItems(not isNewbie)
    call SetHeroesFlee(true)
    call SetHeroesTakeItems(true)
    call SetIgnoreInjured(true)
    call SetPeonsRepair(true)
    call SetSmartArtillery(not isNewbie)
    call SetTargetHeroes(not isNewbie)
    call SetUnitsFlee(not isNewbie)
    call SetWatchMegaTargets(true)

    call CreateCaptains()

    call SetHeroLevels(heroes)

    call Sleep(0.1)
    call StartThread(peons)
    call StartThread(attacks)
endfunction
Here's a link to a relatively recent common.ai (probably nothing changed in it since then): common.ai -- patch 1.31.1
And I found no tutorials to help me learn the hard side of Jass.
I'm not entirely sure what you mean, but AI scripting tutorials exist though they may be buried years back in the tutorials section. You may find these other threads helpful in getting started, and you can always ask questions here and get a usually prompt reply.
 
Status
Not open for further replies.
Top