• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Random Hero Ability Draft via Triggers

Status
Not open for further replies.
Level 5
Joined
Oct 5, 2012
Messages
73
Hi, I want to create a map where a hero gets 4 random abilities out of a pool of abilities at the beginning. The abilities should be learnable like normal hero abilities. This doesn't seem easy to do in the world editor, but I wondered what is the fastest & easiest way to implement it?
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
The problem is simply that the only skills that can be leveled are those present on the unit in the Object Editor, not any skills added to the units once in-game. In order to make them levelable from the skills menu you have two options:

1. Use 4 hidden dummy abilities that can never be cast whose only purpose is to detect the leveling. There is an event for this, and then you can level up the correct skill correspondingly. You will need some sort of data structure to store which abilities for which units correspond to which fake leveling abilities. vJASS/Lua would make that easy, but it can be done in GUI too.

2. Use a TON of Engineering Upgrade abilities to transform each base skill into each other possible skill. For this to work properly you have to transform abilities with the same targeting type (to transform into holy light you need a unit targeted base spell, to transform into Fan of Knives you need a no-target base spell). This means you need a base skill of each targeting type for each ‘ability slot’, as well as an EU that transforms each of those skills into each other skill they could be. Once transformed there is nothing more you need to do, but it’s more OE work to get set up.

I think there’s a good thread about properly using EU to transform abilities in the tutorials section. On mobile so I’m not going to look for it right now.
 
Level 5
Joined
Oct 5, 2012
Messages
73
Very sad that there isn't a simple way to do this. I don't like working with dummy abilities, so I resorted to leveling up the abilities automatically via triggers when the hero levels up.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Very sad that there isn't a simple way to do this. I don't like working with dummy abilities, so I resorted to leveling up the abilities automatically via triggers when the hero levels up.
Custom UI could manage this as well, of course far from simple although it's really not that difficult of a concept.

Here's a more advanced system showing what I mean: TasHeroLearnEx

Also, relying on Dummy abilities is far from difficult as well. A Hashtable that maps the Player Id and Skill Slot (Q = 1, W = 2, E = 3, R = 4) of the skill that was learned would give you quick access to the different Abilities.

It could really boil down to two triggers that handle EVERYTHING if you did it correctly, and it would be extremely easy to add new heroes/abilities to the system. The first trigger would be contain all of the data like mapping Dummy Ability 1 for Player X to Learn Ability 1. The second trigger would run when a skill is learned and simply use the Player that learned the skill as the key to get get the necessary data from the Hashtable.
 
Level 5
Joined
Oct 5, 2012
Messages
73
Thanks for your input.

I want to give the players random abilities, so I'd have to adjust the icons to display that specific ability which isn't simple to do, I think.

I know how to work with hashtables and I agree that besides that it wouldn't be to difficult otherwise. I need to keep track on what the max levels of the abilities are too, because I think there is no way to access that and leveling a ability above max level leads to the ability becoming unusable.

Also, it is just a funmod within the map, so I don't want to use a custom UI (or only for that specific mod).
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Thanks for your input.

I want to give the players random abilities, so I'd have to adjust the icons to display that specific ability which isn't simple to do, I think.

I know how to work with hashtables and I agree that besides that it wouldn't be to difficult otherwise. I need to keep track on what the max levels of the abilities are too, because I think there is no way to access that and leveling a ability above max level leads to the ability becoming unusable.

Also, it is just a funmod within the map, so I don't want to use a custom UI (or only for that specific mod).
That's fair.

But if you're storing any kind of data for an ability in a Hashtable then you could probably store everything about it as well.

I attached an example map showcasing a basic random ability system (without custom UI) using a Hashtable. Buy an item to unlock an ability, then spend a skill point in it's respective Dummy skill to increase the level of the unlocked ability.

I figured you didn't need to track Levels in the Hashtable since your basic/ultimate abilities mostly likely share the same level caps - thus the Dummy abilities get the job done with their own level caps. But maybe you want each "real" ability to have a flexible Level that could be different from the Dummy abilities max level. In that case you would need to give the Dummy abilities a high enough Level to cover any level cap and then add some extra logic to Disable the Dummy ability upon reaching the desired level cap.

Also, getting the Icon is possible with a function called BlzGetAbilityIcon(). Despite it's name, it works for more than just Abilities. You feed the ID of an object into the parenthesis and it'll return the string path to that object's icon path. If you want the disabled icon you can then create or find an existing function that converts a BTN to DISBTN. This function would add the words "Disabled" and "DIS" to the existing BTN string and return the updated path. So you can use these functions to easily get icons for your custom UI, if that was something you were interested in.
 

Attachments

  • Random Ability Draft 1.w3m
    21.9 KB · Views: 9
Last edited:
Status
Not open for further replies.
Top