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

[Spell] Learn Hero Skills w/ less code (GUI)

Status
Not open for further replies.
Level 3
Joined
Apr 21, 2009
Messages
42
Hi,

Greetings to all. I had done some skimming/browsing/searching how would the AI learn skills. Of course I know how but it's a lengthy one considering I'm making a lot of heroes (A dota-like game)

This is the sample code
  • general learn
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • (Owner of (Leveling Hero)) Equal to computer_controlled
    • Actions
      • Hero - Learn skill for (Leveling Hero): (Learned Hero Skill)
      • Hero - Learn skill for (Leveling Hero): (Learned Hero Skill)
      • Hero - Learn skill for (Leveling Hero): Night Elf Demon Hunter - Immolation
      • Hero - Learn skill for (Leveling Hero): Night Elf Demon Hunter - Evasion
      • Hero - Learn skill for (Leveling Hero): Night Elf Demon Hunter - Immolation
      • Hero - Learn skill for (Leveling Hero): Night Elf Demon Hunter - Metamorphosis
      • Hero - Learn skill for (Leveling Hero): Human Archmage - Blizzard
      • Hero - Learn skill for (Leveling Hero): Human Archmage - Summon Water Elemental
      • Hero - Learn skill for (Leveling Hero): Human Archmage - Brilliance Aura
      • Hero - Learn skill for (Leveling Hero): Human Archmage - Mass Teleport
      • Hero - Learn skill for (Leveling Hero): Human Mountain King - Storm Bolt
      • Hero - Learn skill for (Leveling Hero): Human Mountain King - Thunder Clap
      • Hero - Learn skill for (Leveling Hero): Human Mountain King - Bash
      • Hero - Learn skill for (Leveling Hero): Human Mountain King - Avatar
      • Hero - Learn skill for (Leveling Hero): Human Paladin - Divine Shield
      • Hero - Learn skill for (Leveling Hero): Human Paladin - Holy Light
      • Hero - Learn skill for (Leveling Hero): Human Paladin - Devotion Aura
      • Hero - Learn skill for (Leveling Hero): Human Paladin - Resurrection
      • Hero - Learn skill for (Leveling Hero): Orc Blademaster - Wind Walk
      • Hero - Learn skill for (Leveling Hero): Orc Blademaster - Mirror Image
      • Hero - Learn skill for (Leveling Hero): Orc Blademaster - Critical Strike
      • Hero - Learn skill for (Leveling Hero): Orc Blademaster - Bladestorm
      • Hero - Learn skill for (Leveling Hero): Orc Far Seer - Chain Lightning
      • Hero - Learn skill for (Leveling Hero): Orc Far Seer - Far Sight
      • Hero - Learn skill for (Leveling Hero): Orc Far Seer - Feral Spirit
      • Hero - Learn skill for (Leveling Hero): Orc Far Seer - Earthquake
      • Hero - Learn skill for (Leveling Hero): Orc Tauren Chieftain - Shockwave
      • Hero - Learn skill for (Leveling Hero): Orc Tauren Chieftain - War Stomp
      • Hero - Learn skill for (Leveling Hero): Orc Tauren Chieftain - Endurance Aura
      • Hero - Learn skill for (Leveling Hero): Orc Tauren Chieftain - Reincarnation
      • Hero - Learn skill for (Leveling Hero): Undead Death Knight - Death Coil
      • Hero - Learn skill for (Leveling Hero): Undead Death Knight - Death Pact
      • Hero - Learn skill for (Leveling Hero): Undead Death Knight - Unholy Aura
      • Hero - Learn skill for (Leveling Hero): Undead Death Knight - Animate Dead
      • Hero - Learn skill for (Leveling Hero): Undead Dreadlord - Carrion Swarm
      • Hero - Learn skill for (Leveling Hero): Undead Dreadlord - Sleep
      • Hero - Learn skill for (Leveling Hero): Undead Dreadlord - Vampiric Aura
      • Hero - Learn skill for (Leveling Hero): Undead Dreadlord - Inferno
      • Hero - Learn skill for (Leveling Hero): Undead Lich - Frost Nova
      • Hero - Learn skill for (Leveling Hero): Undead Lich - Frost Armor
      • Hero - Learn skill for (Leveling Hero): Undead Lich - Dark Ritual
      • Hero - Learn skill for (Leveling Hero): Undead Lich - Death And Decay
      • Hero - Learn skill for (Leveling Hero): Night Elf Keeper Of The Grove - Entangling Roots
      • Hero - Learn skill for (Leveling Hero): Night Elf Keeper Of The Grove - Force Of Nature
      • Hero - Learn skill for (Leveling Hero): Night Elf Keeper Of The Grove - Thorns Aura
      • Hero - Learn skill for (Leveling Hero): Night Elf Keeper Of The Grove - Tranquility
      • Hero - Learn skill for (Leveling Hero): Night Elf Priestess Of The Moon - Scout
      • Hero - Learn skill for (Leveling Hero): Night Elf Priestess Of The Moon - Searing Arrows
      • Hero - Learn skill for (Leveling Hero): Night Elf Priestess Of The Moon - Trueshot Aura
      • Hero - Learn skill for (Leveling Hero): Night Elf Priestess Of The Moon - Starfall
      • Hero - Learn skill for (Leveling Hero): Special Archimonde - Dark Portal
      • Hero - Learn skill for (Leveling Hero): Special Archimonde - Rain Of Chaos
      • Hero - Learn skill for (Leveling Hero): Special Archimonde - Bash
      • Hero - Learn skill for (Leveling Hero): Special Archimonde - Finger Of Death
      • Hero - Learn skill for (Leveling Hero): Special Illidan - Metamorphosis
      • Hero - Learn skill for (Leveling Hero): Special Malganis - Dark Conversion
      • Hero - Learn skill for (Leveling Hero): Special Malganis - Soul Preservation
      • Hero - Learn skill for (Leveling Hero): Special Mannoroth - Reincarnation
      • Hero - Learn skill for (Leveling Hero): Special Sylvanas Windrunner - Cold Arrows
      • Hero - Learn skill for (Leveling Hero): Special Tichondrius - Inferno
      • Hero - Learn skill for (Leveling Hero): Special Warlock - Summon Infernal
      • Hero - Learn skill for (Leveling Hero): Special - Dark Conversion (Fast)
      • Hero - Learn skill for (Leveling Hero): Special - Dark Summoning
      • Hero - Learn skill for (Leveling Hero): Human Blood Mage - Flame Strike
      • Hero - Learn skill for (Leveling Hero): Human Blood Mage - Banish
      • Hero - Learn skill for (Leveling Hero): Human Blood Mage - Siphon Mana
      • Hero - Learn skill for (Leveling Hero): Human Blood Mage - Phoenix
      • Hero - Learn skill for (Leveling Hero): Orc Shadow Hunter - Healing Wave
      • Hero - Learn skill for (Leveling Hero): Orc Shadow Hunter - Hex
      • Hero - Learn skill for (Leveling Hero): Orc Shadow Hunter - Serpent Ward
      • Hero - Learn skill for (Leveling Hero): Orc Shadow Hunter - Big Bad Voodoo
      • Hero - Learn skill for (Leveling Hero): Undead Crypt Lord - Impale
      • Hero - Learn skill for (Leveling Hero): Undead Crypt Lord - Spiked Carapace
      • Hero - Learn skill for (Leveling Hero): Undead Crypt Lord - Carrion Beetles
      • Hero - Learn skill for (Leveling Hero): Undead Crypt Lord - Locust Swarm
      • Hero - Learn skill for (Leveling Hero): Night Elf Warden - Fan Of Knives
      • Hero - Learn skill for (Leveling Hero): Night Elf Warden - Blink
      • Hero - Learn skill for (Leveling Hero): Night Elf Warden - Shadow Strike
      • Hero - Learn skill for (Leveling Hero): Night Elf Warden - Vengeance
      • Hero - Learn skill for (Leveling Hero): Neutral Beastmaster - Summon Bear
      • Hero - Learn skill for (Leveling Hero): Neutral Beastmaster - Summon Quilbeast
      • Hero - Learn skill for (Leveling Hero): Neutral Beastmaster - Summon Hawk
      • Hero - Learn skill for (Leveling Hero): Neutral Beastmaster - Stampede
      • Hero - Learn skill for (Leveling Hero): Neutral Dark Ranger - Silence
      • Hero - Learn skill for (Leveling Hero): Neutral Dark Ranger - Black Arrow
      • Hero - Learn skill for (Leveling Hero): Neutral Dark Ranger - Life Drain
      • Hero - Learn skill for (Leveling Hero): Neutral Dark Ranger - Charm
      • Hero - Learn skill for (Leveling Hero): Neutral Naga Sea Witch - Forked Lightning
      • Hero - Learn skill for (Leveling Hero): Neutral Naga Sea Witch - Frost Arrows
      • Hero - Learn skill for (Leveling Hero): Neutral Naga Sea Witch - Mana Shield
      • Hero - Learn skill for (Leveling Hero): Neutral Naga Sea Witch - Tornado
      • Hero - Learn skill for (Leveling Hero): Neutral Pandaren Brewmaster - Breath Of Fire
      • Hero - Learn skill for (Leveling Hero): Neutral Pandaren Brewmaster - Drunken Haze
      • Hero - Learn skill for (Leveling Hero): Neutral Pandaren Brewmaster - Drunken Brawler
      • Hero - Learn skill for (Leveling Hero): Neutral Pandaren Brewmaster - Storm, Earth, And Fire
      • Hero - Learn skill for (Leveling Hero): Neutral Pit Lord - Rain Of Fire
      • Hero - Learn skill for (Leveling Hero): Neutral Pit Lord - Howl Of Terror
      • Hero - Learn skill for (Leveling Hero): Neutral Pit Lord - Cleaving Attack
      • Hero - Learn skill for (Leveling Hero): Neutral Pit Lord - Doom
      • -------- Custom --------
      • Hero - Learn skill for (Leveling Hero): Auto Blitz
      • Hero - Learn skill for (Leveling Hero): Detecting
      • Hero - Learn skill for (Leveling Hero): Cold Bolt (one target)
Well as you can see, it's a very long list. Is there any way to shorten this? Thanks for all the help
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
So, you wan't the computer to learn all that when it levels? Even the abilities that are repeated?

Whenever you use "A unit gains a level" you can use "Triggering unit" instead of "Leveling Hero" it's code-faster.
 
Level 3
Joined
Apr 21, 2009
Messages
42
What I'm trying to do is that the computer-controlled heroes will learn their skills when they level up. The only way I can think of having all the heroes of different computer players learn hero skills is thru this... a very tiresome thing to do especially I have a hundred custom skills, more than 30+ heroes.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Doing it using Integer A would require setting each ability, one by one, as 1, 2, 3, 4.. etc. A bit easier, but still job demanding.
 
Level 3
Joined
Apr 21, 2009
Messages
42
afaik, if it's not hard, it's almost impossible to use AI editor to have the AI learn the skills. That what I read in other boards. Though, I think I know how I can use of it.

My Theory is, first create an AI file for each hero on AI editor. Run a trigger check what hero did the AI pick, then apply the Ai setting. (In this way I can make the AI learn the skills in the order I wished to)

One of my problem is, from time to time I'm changing the skill set of the hero for balance purposes. Using the "manual style" (w/c is shown above) or using the "Integer A" style would require me to check from time to time to make sure that the new skill is added on the list and edit it as necessary. So what do you think?

And oh, can you give me a sample trigger code (in GUI) so that I can take it from there. Thanks
 
Level 3
Joined
Apr 21, 2009
Messages
42
WOW! Really?? That's amazing!

Can you give me a sample code, pretty please? I really have no slightest clue how to make use of that Integer A. Thank you :)
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
On map init do:

Set Skills[1] = Whatever
Set Skills[2] = Whatever
Set Skills[3] = Whatever
Set Skills[4] = Whatever
... etc.

And the learning trigger is "For each integer A from 1 to (Your max skill #)" do
- Hero - Learn skill for (Leveling Hero): Skill[(Integer A)]

Whatever you replace with "Integer A" will happen for each one of the numbers you set in the Integer A loop. If your Integer A is from 1 to 5, it will learn Skil[1, 2, 3, 4, 5]
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
You should actually assign the abilities to your heroes. Just looping through everything and expecting the engine to handle invalid skill learnings is very bruteforcing. You may say that picking up data in triggers takes effort but you had to write the very same values in the object editor. That is also the reason why more technically-advanced projects use tools such as ObjectMerger or GMSI to combine object editor data with trigger data or the creators write their own special macros to simplify the process.

If you want to stay bruteforce, you can also use a little jass script and iterate through the whole id area of abilities.
 
Level 3
Joined
Apr 21, 2009
Messages
42
Thanks for all the advice. Ok, I'll do your advice. Thanks for the sample code. Btw, what do you think of my idea using AI editor (Applying .wai file for each hero)? Is that more convenient and efficient?
 
Status
Not open for further replies.
Top