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

[Solved] How to make an AI Hero learn all the custom abilities?

Status
Not open for further replies.
Level 5
Joined
Oct 29, 2020
Messages
82
How to make an AI Hero learn all the custom abilities? What's the right trigger?
For example, Dreadlord with the following custom abilities: Death Coil, Howl of Terror, Dark Ritual and Inferno.
Fixed order of learning all the custom abilities is acceptable.
 
Level 5
Joined
Oct 29, 2020
Messages
82
Are you actually running an AI (script) in the player slot that owns this Dreadlord, or are you trying make a trigger-based AI for that Dreadlord (maybe to function as a boss battle or something)?
The former. I like the original melee mode, but don't like the abiliy settings of most heroes, so I've changed almost all of them in order to make the melee games more interesting. Now I just want AI to learn these custom abilities.
 
Level 13
Joined
Dec 20, 2012
Messages
154
You need two triggers for that. One when heroes are trained and the second one when heroes leveling up.
  • Dreadlord AI Learn Start
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • ((Owner of (Trained unit)) controller) Equal to Computer
      • ((Trained unit) is A Hero) Equal to True
      • (Unit-type of (Trained unit)) Equal to Dreadlord
    • Actions
      • Hero - Learn skill for (Trained unit): Death Coil

  • Dreadlord AI Learn
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • ((Owner of (Leveling Hero)) controller) Equal to Computer
      • ((Leveling Hero) is A Hero) Equal to True
      • (Unit-type of (Leveling Hero)) Equal to Dreadlord
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Leveling Hero)) Equal to 2
        • Then - Actions
          • Hero - Learn skill for (Leveling Hero): Howl of Terror
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Leveling Hero)) Equal to 3
        • Then - Actions
          • Hero - Learn skill for (Leveling Hero): Death Coil
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Leveling Hero)) Equal to 4
        • Then - Actions
          • Hero - Learn skill for (Leveling Hero): Howl of Terror
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Leveling Hero)) Equal to 5
        • Then - Actions
          • Hero - Learn skill for (Leveling Hero): Death Coil
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Leveling Hero)) Equal to 6
        • Then - Actions
          • Hero - Learn skill for (Leveling Hero): Inferno
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Leveling Hero)) Equal to 7
        • Then - Actions
          • Hero - Learn skill for (Leveling Hero): Howl of Terror
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Leveling Hero)) Equal to 8
        • Then - Actions
          • Hero - Learn skill for (Leveling Hero): Dark Ritual
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Leveling Hero)) Equal to 9
        • Then - Actions
          • Hero - Learn skill for (Leveling Hero): Dark Ritual
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Leveling Hero)) Equal to 10
        • Then - Actions
          • Hero - Learn skill for (Leveling Hero): Dark Ritual
        • Else - Actions
 
Level 5
Joined
Oct 29, 2020
Messages
82
You need two triggers for that. One when heroes are trained and the second one when heroes leveling up.
  • Dreadlord AI Learn Start
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • ((Owner of (Trained unit)) controller) Equal to Computer
      • ((Trained unit) is A Hero) Equal to True
      • (Unit-type of (Trained unit)) Equal to Dreadlord
    • Actions
      • Hero - Learn skill for (Trained unit): Death Coil

  • Dreadlord AI Learn
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • ((Owner of (Leveling Hero)) controller) Equal to Computer
      • ((Leveling Hero) is A Hero) Equal to True
      • (Unit-type of (Leveling Hero)) Equal to Dreadlord
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Leveling Hero)) Equal to 2
        • Then - Actions
          • Hero - Learn skill for (Leveling Hero): Howl of Terror
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Leveling Hero)) Equal to 3
        • Then - Actions
          • Hero - Learn skill for (Leveling Hero): Death Coil
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Leveling Hero)) Equal to 4
        • Then - Actions
          • Hero - Learn skill for (Leveling Hero): Howl of Terror
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Leveling Hero)) Equal to 5
        • Then - Actions
          • Hero - Learn skill for (Leveling Hero): Death Coil
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Leveling Hero)) Equal to 6
        • Then - Actions
          • Hero - Learn skill for (Leveling Hero): Inferno
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Leveling Hero)) Equal to 7
        • Then - Actions
          • Hero - Learn skill for (Leveling Hero): Howl of Terror
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Leveling Hero)) Equal to 8
        • Then - Actions
          • Hero - Learn skill for (Leveling Hero): Dark Ritual
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Leveling Hero)) Equal to 9
        • Then - Actions
          • Hero - Learn skill for (Leveling Hero): Dark Ritual
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (Leveling Hero)) Equal to 10
        • Then - Actions
          • Hero - Learn skill for (Leveling Hero): Dark Ritual
        • Else - Actions
Thank you very much for your specific guide. However, it doen't work perfectly. For example, I give Acid Bomb ability to Lich and make AI learn it after Lich is trained just as you showed, but in the test, when Lich is at level 6, Acid Bomb is still at level 1. The other abilities except Death And Decay are all my custom ones, so it is impossible for AI to spend skill points on these abilities. I don't know why.
 
Level 5
Joined
Oct 29, 2020
Messages
82
Yes, that trigger will accomplish what you want (god forbid there was switch/case in GUI)... but you don't have to do it that way. The AI editor can actually have a skill order programmed into it. See this tutorial: The AI Editor
How to make the AI editor use custom hero abilities? The AI editor can only use the original abilities of all heroes.
 
Level 39
Joined
Feb 27, 2007
Messages
5,019
They should use any ability that has defined AI behavior for it. For example if you give them an ability based on Heal (priest ability) they’ll cast it on nearby friendly targets not at 100% hp. But if you make it able to target enemies unlike heal originally worked, the hero will not not cast it on enemies but rather still looks for hurt allied targets to heal.
 
Level 5
Joined
Oct 29, 2020
Messages
82
They should use any ability that has defined AI behavior for it. For example if you give them an ability based on Heal (priest ability) they’ll cast it on nearby friendly targets not at 100% hp. But if you make it able to target enemies unlike heal originally worked, the hero will not not cast it on enemies but rather still looks for hurt allied targets to heal.
Well, I mean I can't find a way to change the original abilities of the default 16 heroes on the UI of the AI editor. For example, although I changed "Divine Shield" of Paladin to my custom ability which is like "Potion of Healing" on the object editor, At the tab "heroes" of the AI editor, "Divine Shield" is still there and can't be changed. So I don't know how to make the AI editor use custom hero abilities.
 

Attachments

  • Capture.PNG
    Capture.PNG
    50.1 KB · Views: 36
Level 39
Joined
Feb 27, 2007
Messages
5,019
You have to export your custom data from the object editor to the ai editor. From the OE, do this:
  • File > Export all object data
  • Save it somewhere
  • Go to the AI editor and load your AI
  • General Tab > Import (at the bottom)
  • Choose your exported data
I got it to work overwriting the original hero unit's skills with new options and by making a new hero unit entirely; you might have to import twice or reload or save or something to get it to show up properly but it 100% works this way.
 
Level 5
Joined
Oct 29, 2020
Messages
82
You have to export your custom data from the object editor to the ai editor. From the OE, do this:
  • File > Export all object data
  • Save it somewhere
  • Go to the AI editor and load your AI
  • General Tab > Import (at the bottom)
  • Choose your exported data
I got it to work overwriting the original hero unit's skills with new options and by making a new hero unit entirely; you might have to import twice or reload or save or something to get it to show up properly but it 100% works this way.
Awesome. It works. But AI hero doesn't use some abilities such as Acid Bomb, maybe the custom AI version is older than the original V1.30.4 (The Warcraft 3 version in my computer is V1.30.4, its AI will use Acid Bomb when I use trigger to make the hero learn it)?
 
Level 5
Joined
Oct 29, 2020
Messages
82
You have to export your custom data from the object editor to the ai editor. From the OE, do this:
  • File > Export all object data
  • Save it somewhere
  • Go to the AI editor and load your AI
  • General Tab > Import (at the bottom)
  • Choose your exported data
I got it to work overwriting the original hero unit's skills with new options and by making a new hero unit entirely; you might have to import twice or reload or save or something to get it to show up properly but it 100% works this way.
I tested more and found it didn't actually work.
I did as you told. Finally, I saved the AI data like this.
  • File > add to map.
  • save map.
Am I right?
 
Level 39
Joined
Feb 27, 2007
Messages
5,019
You save the .wai file in the AI Editor, then you import it into your map with the Asset Manager. Then finally you have to actually 'start' the AI by running it with a trigger:
  • AI - Start melee AI script for Player 1 (Red): war3mapimported\Test.ai
 
Level 5
Joined
Oct 29, 2020
Messages
82
You save the .wai file in the AI Editor, then you import it into your map with the Asset Manager. Then finally you have to actually 'start' the AI by running it with a trigger:
  • AI - Start melee AI script for Player 1 (Red): war3mapimported\Test.ai
Thank you so much.
However, when I put this trigger after the trigger "Melee Game - Run Melee AI Scripts (for computer players)", My custom AI doesn't work because warcraft3 runs the official melee AI.
When I put this trigger before the trigger "Melee Game - Run Melee AI Scripts (for computer players)", My custom AI does work, but it doesn't do anything, no building any structures, not to mention training any units.
Maybe My custom AI is just a record of my modification of the official melee AI, it is not the complete AI?
How to solve this?
Find the offical complete melee AI and load it and modify it? Where can I find it?
 
Level 5
Joined
Oct 29, 2020
Messages
82
I've solved this problem in the following way. I'll take the official UD melee AI file which is called undead.ai for example.
  • extract undead.ai (which is below the folder \scripts in War3x.mpq) from warcraft3 v1.29.2.
  • open undead.ai with Notepad.
  • search for keyword "set_skills".
  • replace the default skills of the hero which you wanna modify with the skill IDs of your custom skills, for example, the Skill ID of Acid Bomb is Anab, If you wanna replace Frost Nova with Acid Bomb, then you should write [set skill[ 1] = 'ANab'].
  • Disable the trigger [Melee Game - Run Melee AI Scripts (for computer players)].
  • at last, add a trigger (which is shown by the attached picture) and save the map.
 

Attachments

  • Capture.PNG
    Capture.PNG
    7.7 KB · Views: 47
Last edited:
Status
Not open for further replies.
Top