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

[AI] Editing melee AI

Status
Not open for further replies.
Level 28
Joined
Aug 7, 2015
Messages
602
Can anyone tell me how do I let the standard melee AI trains Heroes that are originally not from their race? Like Human AI summons a Beastmaster. I wanted to give each faction extra 2 heroes from the tavern, I just don't understand how should I edit it, worried that I might screw things up
 
Last edited:
Level 14
Joined
Feb 7, 2020
Messages
386
AI Editor has been a mystery to me. I looked through it and got a bit of a better understanding. I toyed around with setting up a "Custom" race config where you could select Tavern heroes and set up their order of selection probability. Not sure what to do past that or if that was correct.

I did find this on the 'tube:

It might help answer some of your questions on setting it up.
 
Level 28
Joined
Aug 7, 2015
Messages
602
AI Editor has been a mystery to me. I looked through it and got a bit of a better understanding. I toyed around with setting up a "Custom" race config where you could select Tavern heroes and set up their order of selection probability. Not sure what to do past that or if that was correct.

I did find this on the 'tube:

It might help answer some of your questions on setting it up.
I also watched this video, but the only thing that I really stuck at is the Heroes tab, which you can only set stuff up to for only 3 Heroes, but I'm planning to have 5 Heroes for each section. Nonetheless I will still try again
 
Level 28
Joined
Feb 18, 2014
Messages
3,574
So do I just add the tavern heroes' ids into the scripts?
Yes, but you also need to make some modifications to the common.ai (Or just edit the melee script by replacing hero_id/hero_id2/hero_id3 with the ID of the tavern hero) :
JASS:
//============================================================================
//  PickMeleeHero
//============================================================================
function PickMeleeHero takes race raceid returns integer
    local integer first
    local integer second
    local integer third
    local integer last
    local integer array heroes

    //------------------------------------------------------------------------
    if raceid == RACE_HUMAN then
    //------------------------------------------------------------------------
        set heroes[1] = ARCHMAGE
        set heroes[2] = MTN_KING
        set heroes[3] = PALADIN
        set heroes[4] = BLOOD_MAGE

    //------------------------------------------------------------------------
    elseif raceid == RACE_ORC then
    //------------------------------------------------------------------------
        set heroes[1] = BLADE_MASTER
        set heroes[2] = FAR_SEER
        set heroes[3] = TAUREN_CHIEF
        set heroes[4] = SHADOW_HUNTER

    //------------------------------------------------------------------------
If you scroll to the bottom of the common.ai you will see that each race has its unique heroes. You change which hero should be summoned by overwriting them with the ID of the new hero or you can add more.
JASS:
//--------------------------------------------------------------------------------------------------
//  set_skills
//--------------------------------------------------------------------------------------------------
function set_skills takes nothing returns nothing

    set skill[ 1] = HOLY_BOLT
    set skill[ 2] = DEVOTION_AURA
    set skill[ 3] = HOLY_BOLT
    set skill[ 4] = DIVINE_SHIELD
    set skill[ 5] = HOLY_BOLT
    set skill[ 6] = RESURRECTION
    set skill[ 7] = DEVOTION_AURA
    set skill[ 8] = DEVOTION_AURA
    set skill[ 9] = DIVINE_SHIELD
    set skill[10] = DIVINE_SHIELD

    call SetSkillArray(1,'Nbst') //Beastmaster
    call SetSkillArray(2,'Nbst') //Beastmaster
    call SetSkillArray(3,'Nbst') //Beastmaster

    set skill[ 1] = THUNDER_BOLT
    set skill[ 2] = BASH
    set skill[ 3] = THUNDER_BOLT
    set skill[ 4] = THUNDER_CLAP
    set skill[ 5] = THUNDER_BOLT
    set skill[ 6] = AVATAR
    set skill[ 7] = BASH
    set skill[ 8] = BASH
    set skill[ 9] = THUNDER_CLAP
    set skill[10] = THUNDER_CLAP

    call SetSkillArray(1,'Nngs') //Naga Sea Witch
    call SetSkillArray(2,'Nngs') //Naga Sea Witch
    call SetSkillArray(3,'Nngs') //Naga Sea Witch
Now, as for the melee script : You just need to replace SetSkillArray with the ID of the tavern hero and manage his skills.
 
Level 28
Joined
Aug 7, 2015
Messages
602
Yes, but you also need to make some modifications to the common.ai (Or just edit the melee script by replacing hero_id/hero_id2/hero_id3 with the ID of the tavern hero) :
JASS:
//============================================================================
//  PickMeleeHero
//============================================================================
function PickMeleeHero takes race raceid returns integer
    local integer first
    local integer second
    local integer third
    local integer last
    local integer array heroes

    //------------------------------------------------------------------------
    if raceid == RACE_HUMAN then
    //------------------------------------------------------------------------
        set heroes[1] = ARCHMAGE
        set heroes[2] = MTN_KING
        set heroes[3] = PALADIN
        set heroes[4] = BLOOD_MAGE

    //------------------------------------------------------------------------
    elseif raceid == RACE_ORC then
    //------------------------------------------------------------------------
        set heroes[1] = BLADE_MASTER
        set heroes[2] = FAR_SEER
        set heroes[3] = TAUREN_CHIEF
        set heroes[4] = SHADOW_HUNTER

    //------------------------------------------------------------------------
If you scroll to the bottom of the common.ai you will see that each race has its unique heroes. You change which hero should be summoned by overwriting them with the ID of the new hero or you can add more.
JASS:
//--------------------------------------------------------------------------------------------------
//  set_skills
//--------------------------------------------------------------------------------------------------
function set_skills takes nothing returns nothing

    set skill[ 1] = HOLY_BOLT
    set skill[ 2] = DEVOTION_AURA
    set skill[ 3] = HOLY_BOLT
    set skill[ 4] = DIVINE_SHIELD
    set skill[ 5] = HOLY_BOLT
    set skill[ 6] = RESURRECTION
    set skill[ 7] = DEVOTION_AURA
    set skill[ 8] = DEVOTION_AURA
    set skill[ 9] = DIVINE_SHIELD
    set skill[10] = DIVINE_SHIELD

    call SetSkillArray(1,'Nbst') //Beastmaster
    call SetSkillArray(2,'Nbst') //Beastmaster
    call SetSkillArray(3,'Nbst') //Beastmaster

    set skill[ 1] = THUNDER_BOLT
    set skill[ 2] = BASH
    set skill[ 3] = THUNDER_BOLT
    set skill[ 4] = THUNDER_CLAP
    set skill[ 5] = THUNDER_BOLT
    set skill[ 6] = AVATAR
    set skill[ 7] = BASH
    set skill[ 8] = BASH
    set skill[ 9] = THUNDER_CLAP
    set skill[10] = THUNDER_CLAP

    call SetSkillArray(1,'Nngs') //Naga Sea Witch
    call SetSkillArray(2,'Nngs') //Naga Sea Witch
    call SetSkillArray(3,'Nngs') //Naga Sea Witch
Now, as for the melee script : You just need to replace SetSkillArray with the ID of the tavern hero and manage his skills.
AHH, thanks a lot dude! I didn't know the bottom list of common.ai was important too, thanks a lot!
 
Status
Not open for further replies.
Top