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

Ability Selection System

Status
Not open for further replies.
Level 7
Joined
Sep 9, 2007
Messages
253
I would love some advice on how to implement my idea for hero ability selection. I want the player to end up choosing 4 out of the 8 available abilities for their hero.

I want for the hero to start with 8 abilities to choose from but they can only learn 4. Using the below image to illustrate the following example, If i were to choose the light blue ability as my first ability then it would go into slot 2 and the dark blue ability would be permenantly disabled. Once I git level 2 I might choose to upgrade the red ability and the pink ability will be permenantly disabled. Once an ability is chosen for a slot it may be upgraded upon gaining additional skill points and at level 6 the hero can choose between 2 ultimate abilities in the same way.

ability.png


Currently I am using the triggers below but I think that they are very clumsy and I would much rather find a cleaner way of doing this. A spellbook perhaps? but I haven't been able to work out how to use upgradable hero abilities in spellbooks. Could anyone lend a suggestion? is this possible? How would you go about accomplishing this objective?

(these triggers will have mistakes or be incomplete as I have not finished this system, I am instead looking for a more tidy way to execue this plan)
  • refresh
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • (Unit-type of (Leveling Hero)) Equal to Pandaren Seer
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Hero level of (Leveling Hero)) Equal to 4
              • (Hero level of (Leveling Hero)) Equal to 7
        • Then - Actions
          • If ((Level of Mend for (Leveling Hero)) Equal to 1) then do (Player - Make Mend (Panda) Available for training/construction by (Owner of (Leveling Hero))) else do (Do nothing)
          • If ((Level of Conductive Wisdom for (Leveling Hero)) Equal to 1) then do (Player - Make Conductive Wisdom (Panda) Available for training/construction by (Owner of (Leveling Hero))) else do (Do nothing)
          • If ((Level of Electrify for (Leveling Hero)) Equal to 1) then do (Player - Make Electrify (Panda) Available for training/construction by (Owner of (Leveling Hero))) else do (Do nothing)
          • If ((Level of Lightning Bolt for (Leveling Hero)) Equal to 1) then do (Player - Make Lightning (Panda) Available for training/construction by (Owner of (Leveling Hero))) else do (Do nothing)
          • If ((Level of Twisted Altruism for (Leveling Hero)) Equal to 1) then do (Player - Make Twisted Altruism (Panda) Available for training/construction by (Owner of (Leveling Hero))) else do (Do nothing)
          • If ((Level of Divine Judgement (dummy) for (Leveling Hero)) Equal to 1) then do (Player - Make Divine Judgement (Panda) Available for training/construction by (Owner of (Leveling Hero))) else do (Do nothing)
        • Else - Actions
          • Do nothing
      • 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
          • Player - Make Inspiration (Panda) Available for training/construction by (Owner of (Trained unit))
          • Player - Make Overload (Panda) Available for training/construction by (Owner of (Trained unit))
        • Else - Actions
          • Do nothing
  • Mend
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Mend (Panda)
    • Actions
      • Unit - Remove (Trained unit) from the game
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Mend for Hero[(Player number of (Owner of (Trained unit)))]) Greater than or equal to 1
        • Then - Actions
          • Unit - Increase level of Mend for Hero[(Player number of (Owner of (Trained unit)))]
        • Else - Actions
          • Unit - Add Mend to Hero[(Player number of (Owner of (Trained unit)))]
          • Player - Make Mend (Panda) Unavailable for training/construction by (Owner of (Trained unit))
          • Player - Make Conductive Wisdom (Panda) Unavailable for training/construction by (Owner of (Trained unit))
  • Conductive Wisdom
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Conductive Wisdom (Panda)
    • Actions
      • Unit - Remove (Trained unit) from the game
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Conductive Wisdom for Hero[(Player number of (Owner of (Trained unit)))]) Greater than or equal to 1
        • Then - Actions
          • Unit - Increase level of Conductive Wisdom for Hero[(Player number of (Owner of (Trained unit)))]
        • Else - Actions
          • Unit - Add Conductive Wisdom to Hero[(Player number of (Owner of (Trained unit)))]
          • Player - Make Conductive Wisdom (Panda) Unavailable for training/construction by (Owner of (Trained unit))
          • Player - Make Mend (Panda) Unavailable for training/construction by (Owner of (Trained unit))
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
To fix the abilities slot, just do it in the X,Y fields in the object editor, in the ability data. Add the same X/Y position to the abilities that are supposed to fit the same slot.

I'd like to know how does your unit selects the wanted skill. It should be easy, since "If unit gets the Light Blue ability, Make player unavailable to select the Dark Blue".
 
I suggest you to use dialog buttons.
I can't show you how right now, but I will upload test map tomorrow.

Idea is to add 3 normal and 1 ultimate ability to hero with descriptions that will describe both abilities.

When you learn ability for 1st time, dialog button can be show to owning player and he will pick Ability 1 or Ability 2, each next time ability level will be increased normally :)
You can improve it with additional abilities that can be added with triggers so you have different tooltips for different abilities.
 
Level 7
Joined
Sep 9, 2007
Messages
253
To fix the abilities slot, just do it in the X,Y fields in the object editor, in the ability data. Add the same X/Y position to the abilities that are supposed to fit the same slot.

Yep yep, I'm all over that. I have the pink and red abilities set for the same slot, same for the blue ones etc etc. The hero doesn't have any of these abilities according to the object editor, they are given to him with triggers once he chooses from the shop.

I'd like to know how does your unit selects the wanted skill. It should be easy, since "If unit gets the Light Blue ability, Make player unavailable to select the Dark Blue".
I have a shop (it's a building with 8 units which each cost 1 lumber) where abilities are chosen from, when he chooses an ability another one is disabled like this......
  • Player - Make Conductive Wisdom (Panda) Unavailable for training/construction by (Owner of (Trained unit))
This is very messy in my eyes, I want to find a streamlined process for this and I would also prefer if the hero clicks on the "learn new ability" button rather than going to a shop each time.

I suggest you to use dialog buttons.
I can't show you how right now, but I will upload test map tomorrow.

Idea is to add 3 normal and 1 ultimate ability to hero with descriptions that will describe both abilities.

When you learn ability for 1st time, dialog button can be show to owning player and he will pick Ability 1 or Ability 2, each next time ability level will be increased normally :)
You can improve it with additional abilities that can be added with triggers so you have different tooltips for different abilities.

So I give him 4 "description" abilities which don't do anything.... then when he chooses his ability I can remove the corresponding description ability and add the proper ability to the hero using triggers? same happens at level 2 and level 3. then at level 4 can he upgrade those abilities as normal?

I have never used dialog buttons before. Would the player still be able to view the descriptions while the dialog is open?
 
Level 7
Joined
Sep 9, 2007
Messages
253
3am. Nice, that's the time I was up until last night working on my map but I'm in Australia so it's currently 1pm here. Well I look forward to seeing what you come up with coz you seem to know your stuff. Thanks.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
I would set the values depending on slot, and save it into hashtable.

2 First spell goes for "Hashtable - Save 1 as 1 of YourUnitId in YourHashtable"

Then, if your unit buys another ability, check first if that ability slot number in the hashtable is already higher than your minimum value (0 or 1). If it's, it means the unit already has the skill. Then restore the spent resources, and display a message to let the player know he can't learn that skill.

Since you have 4 groups of abilities, you can use Save 1 as 1, 2, 3, 4 (Slot number) of YourUnitId in YourHashtable. The condition to learn the ability is having the slot = 0.
 
Level 7
Joined
Sep 9, 2007
Messages
253
If you need the abilities to be upgradable via the normal hero means, you would need to do the Engineering upgrade trick so that you can add learnable hero abilities to the hero...

What is this trick? I've not heard of it.


I would set the values depending on slot, and save it into hashtable.

This sounds promising but I will have to look at some hashtable tutorials to understand what you've said... I've never used them. Looking at tutorial now.

Thanks for the help everyone, this is the only problem on the map I can't solve. After It's solved It's just a matter of creating all the abilities, items etc.
 
Level 7
Joined
Sep 9, 2007
Messages
253
I think that the main problem I'm having is that when I give a hero an ability using my triggers he can use it but if he gets a level-up and tries to spend a skill point the ability does not show up in abilities to be learned.

My hero doesn't have any abilities in the object editor. How can I use triggers to give him a hero ability which then becomes level-able.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Use the action "Unit - Add ability" or "Unit - Set level of ability"

I think you don't need the Hero Skill button. You can manage the hero skill points with integers, or wood, and make some kind of "Skill Master" or "Trainer" around that sells the skill. That way you can have an additional slot for anything you may want in the future. You can create a trigger with "-train" that moves your unit to a Trainer/Master/School where buy skill/upgrades.

Btw, hashtables are not hard at all :) Think of it like a table with cells. Where you have a big category as column, and add values to that category in rows.
 
Level 7
Joined
Sep 9, 2007
Messages
253
You've actually described the system I have in place right now. I have a building which trains units that correspond to abilities. I listed a few of the triggers in one of my first posts (the second two is a pair of abilities and the first one is a trigger which manages the ability progression). It seems to be working well enough I was just hoping to implement a cleaner system because it seemed a little messy to me. I'm using "make unit available/unavailable for training" to control when I want that ability to be available. I don't like it how the unit takes 1 second to train (minimum) and the ability is gained after that one second instead of instantly.

Learning Hashtables is definately on my list of things to do!

Thanks so much for the help once again. I think I will just have to run with what I have for now.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
You don't really need to train units... You can sell items and remove them inmediatly after being sold :) Or make them PowerUps, so they consume automatically.
 
Level 7
Joined
Sep 9, 2007
Messages
253
Hmmm this has given me some ideas. Thanks. The only thing is... Is it possible to remove an item from a shop or make it unavailable? Because my system must disable an abiliy when another is learned.
 
Last edited:
Greenwhy said:
I think that the main problem I'm having is that when I give a hero an ability using my triggers he can use it but if he gets a level-up and tries to spend a skill point the ability does not show up in abilities to be learned.

My hero doesn't have any abilities in the object editor. How can I use triggers to give him a hero ability which then becomes level-able.

that's what the Engineering upgrade method is for... TO ADD LEVELABLE HERO ABILITIES to heroes
 
Status
Not open for further replies.
Top