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

[Solved] ORC Melee AI doesn't train 3rd hero?

Status
Not open for further replies.
Level 29
Joined
May 14, 2021
Messages
1,118
For anyone who want to make Orc AI train 3 heroes (they only train 2 heroes by default):

You need both MPQ Editor and JassCraft. Note that, you can't use JassCraft on Windows 11.
If your game doesn't have MPQ, you must use CASC Viewer.

This instructions assumes that your game has MPQ (for 1.29 below):
Go to "Scripts" and find the file called "orc.ai".
Extract to anywhere else, then open it with JassCraft.
CTRL + F and put in "init_vars". Add these lines:

JASS:
    set b_hero1_done        = GetUnitCountDone(hero_id) >= 1
    set b_hero2_done        = GetUnitCountDone(hero_id2) >= 1
    set b_hero3_done        = GetUnitCountDone(hero_id3) >= 1
    set b_ensnare           = GetUpgradeLevel(UPG_ORC_ENSNARE) >= 1

CTRL + F and this time put in "build_sequence".
Take a look at the "always rebuild heroes for defense" tag. Make sure the "if c_altar_done" look like this:

JASS:
    if c_altar_done >= 1 then
        if b_hero1_done and MeleeDifficulty() != MELEE_NEWBIE then
            if b_hero2_done then
                if b_hero3_done or c_fortress_done >= 1 then
                    call SetBuildUnit( 1, hero_id3 )
                endif
            else
                call SetBuildUnit( 1, hero_id2 )
            endif
        else
            call SetBuildUnit( 1, hero_id )
        endif

Save changes, then replace the original "orc.ai" with the ones you modified.

If you still get boring on playing against Orc AI with 3 heroes, here's the complete AI scripts for all races.
Make sure to use the correct path based on the MPQ when you import the AI files.

EDIT: There's an alternate one, which is necessary for the Classic 1.31.1. since AI heroes can't use their spells:
 
Level 5
Joined
Oct 29, 2020
Messages
82
For anyone who want to make Orc AI train 3 heroes (they only train 2 heroes by default):

You need both MPQ Editor and JassCraft. Note that, you can't use JassCraft on Windows 11.
If your game doesn't have MPQ, you must use CASC Viewer.

This instructions assumes that your game has MPQ (for 1.29 below):
Go to "Scripts" and find the file called "orc.ai".
Extract to anywhere else, then open it with JassCraft.
CTRL + F and put in "init_vars". Add these lines:

JASS:
    set b_hero1_done        = GetUnitCountDone(hero_id) >= 1
    set b_hero2_done        = GetUnitCountDone(hero_id2) >= 1
    set b_hero3_done        = GetUnitCountDone(hero_id3) >= 1
    set b_ensnare           = GetUpgradeLevel(UPG_ORC_ENSNARE) >= 1

CTRL + F and this time put in "build_sequence".
Take a look at the "always rebuild heroes for defense" tag. Make sure the "if c_altar_done" look like this:

JASS:
    if c_altar_done >= 1 then
        if b_hero1_done and MeleeDifficulty() != MELEE_NEWBIE then
            if b_hero2_done then
                if b_hero3_done or c_fortress_done >= 1 then
                    call SetBuildUnit( 1, hero_id3 )
                endif
            else
                call SetBuildUnit( 1, hero_id2 )
            endif
        else
            call SetBuildUnit( 1, hero_id )
        endif

Save changes, then replace the original "orc.ai" with the ones you modified.

If you still get boring on playing against Orc AI with 3 heroes, here's the complete AI scripts for all races.
Make sure to use the correct path based on the MPQ when you import the AI files.

EDIT: There's an alternate one, which is necessary for the Classic 1.31.1. since AI heroes can't use their spells:

Awesome. I tried. However, the codes didn't work. I used Notepad.exe to edit the .AI files. Was it wrong?​

Well, it doesn't matter. Because I found Ujimasa Hojo's AI is great. I modified it to suit my custom heroes which have different abilities from the original ones, and it works well. Thank you so much.​

 
Level 29
Joined
May 14, 2021
Messages
1,118

Awesome. I tried. However, the codes didn't work. I used Notepad.exe to edit the .AI files. Was it wrong?​

Well, it doesn't matter. Because I found Ujimasa Hojo's AI is great. I modified it to suit my custom heroes which have different abilities from the original ones, and it works well. Thank you so much.​

You probably need JassCraft to open the .AI files, but since Windows 11 doesn't allow me to use JassCraft due to the compatibility issue, your only option would be to get the modified one by Ujimasa Hojo (or kizonrus if you prefer working AI heroes on 1.31.1). Both of these scripts allow the AI to do numerous things (such as 3 heroes, Spirit Walkers, and Demolishers with Burning Oil upgrade for Orc AI, 3 Masonry upgrades and Siege Engine with Barrage upgrade for Human AI, and so on). To use the script, either use the World Editor's Import Manager, but be sure to change the "war3mapImported" to "Scripts" so that it overrides the original from War3.mpq/War3x.mpq, or you can use the Local files trick, which involves placing the entire "Scripts" folder to Warcraft 3 game directory. If you want to play skirmish with more enhanced AI (hire mercenaries, neutral heroes, etc), you probably need AMAI.
 
Level 5
Joined
Oct 29, 2020
Messages
82
You probably need JassCraft to open the .AI files, but since Windows 11 doesn't allow me to use JassCraft due to the compatibility issue, your only option would be to get the modified one by Ujimasa Hojo (or kizonrus if you prefer working AI heroes on 1.31.1). Both of these scripts allow the AI to do numerous things (such as 3 heroes, Spirit Walkers, and Demolishers with Burning Oil upgrade for Orc AI, 3 Masonry upgrades and Siege Engine with Barrage upgrade for Human AI, and so on). To use the script, either use the World Editor's Import Manager, but be sure to change the "war3mapImported" to "Scripts" so that it overrides the original from War3.mpq/War3x.mpq, or you can use the Local files trick, which involves placing the entire "Scripts" folder to Warcraft 3 game directory. If you want to play skirmish with more enhanced AI (hire mercenaries, neutral heroes, etc), you probably need AMAI.
Thank you for your detailed guidance. Ujimasa Hojo's AI is good enough for classic WC3. More enhanced AI may be too strong for me to beat.:pgrin:
 
Status
Not open for further replies.
Top