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

Custom Learneable Skills for Heroes??? (The Great Strategy TGS style)

Status
Not open for further replies.
Level 3
Joined
Jan 1, 2008
Messages
29
Hi!

I want to make a map where you can choose your hero Model,
and after that you can pick some abilities for your Hero.

I tried with the Unit- Add Abillity and Hero - Learn Abillity triggers, but
both of them are bugging.
Unit - Add Abillity is only adding one level , and after the hero
leveling you cannot spend points on the bought abbillity to increase it.

The Hero - Learn Abillity - just simply not doing anything.


I saw many nice maps where you can buy custom abillities for your heroes,
So my question is: How to do that ?
 
Level 5
Joined
Jul 4, 2007
Messages
166
Hi!

I want to make a map where you can choose your hero Model,
and after that you can pick some abilities for your Hero.

I tried with the Unit- Add Abillity and Hero - Learn Abillity triggers, but
both of them are bugging.
Unit - Add Abillity is only adding one level , and after the hero
leveling you cannot spend points on the bought abbillity to increase it.

The Hero - Learn Abillity - just simply not doing anything.


I saw many nice maps where you can buy custom abillities for your heroes,
So my question is: How to do that ?

This is technically feasible if you're not too picky.

It is possible to add one level of an ability, or to level an ability. The easiest way to do this would be to give them a spellbook with X number of spells, where X is the number of spells you want them to be able to learn. Have the spells called 'Level Ability One' 'Level Ability Two' etc. Then have the tooltips for each spell say which level they are allowed to learn the next level of that spell.

Next you need to set up a trigger to follow through with this. I'll take you through step by step.

I'm going to assume that you are choosing abilities by buying items from a shop. I don't have the editor in front of my right now, so some of this may be off slightly. For the purposes of this trigger, it will only show how to code four abilities.

  • Add/Level Ability
    • Events
      • Unit - A unit acquires an item.
    • Conditions
      • Or - Any (Conditions) are true
        • (Item-type of (Item Being Manipulated)) Equal to Flame Strike (Item).
        • (Item-type of (Item Being Manipulated)) Equal to Banish (Item).
        • (Item-type of (Item Being Manipulated)) Equal to Mana Siphon (Item).
        • (Item-type of (Item Being Manipulated)) Equal to Phoenix (Item).
    • Actions
      • Item - Remove (Item Being Manipulated).
      • If / Then / Else - If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item Being Manipulated)) Equal to Phoenix (Item).
        • Then - Actions
          • Unit - Add (Phoenix) to (Hero Manipulating Item).
        • Else - Actions
          • Do Nothing.
      • If / Then / Else - If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item Being Manipulated)) Equal to Banish (Item).
        • Then - Actions
          • Unit - Add (Banish) to (Hero Manipulating Item).
        • Else - Actions
          • Do Nothing.
      • If / Then / Else - If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item Being Manipulated)) Equal to Mana Siphon (Item).
        • Then - Actions
          • Unit - Add (Mana Siphon) to (Hero Manipulating Item).
        • Else - Actions
          • Do Nothing.
      • If / Then / Else - If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item Being Manipulated)) Equal to Flame Strike (Item).
        • Then - Actions
          • Unit - Add (Flame Strike) to (Hero Manipulating Item).
        • Else - Actions
          • Do Nothing.
If memory serves, the way the WE code is written, if you try to add a hero ability to a unit that already has it, it will increase the level by one, if there is another level available. If this doesn't work, tell me, because there's an easy alternative solution.

Now when they buy the item from your shop, they will learn the skill. Any time you want them to level, they can be given the item to level that skill again. My next section will cover that. First you need to make an Array of Integers that defaults to 0. Make the size equal to the number of players. I'm going to call mine "SkillPoints".

  • Add Skill Points
    • Events
      • Hero - A hero gains a level.
    • Conditions
    • Actions
      • Set SkillPoints[Player Number of (Owner of (Leveling Hero))] = SkillPoints[Player Number of (Owner of (Leveling Hero))] + 1
  • Up Skills
    • Events
      • Unit - A unit finishes casting an ability.
    • Conditions
      • Or - Any (Conditions) are true
        • (Ability Being Cast) equal to (Level Up One)
        • (Ability Being Cast) equal to (Level Up Two)
        • (Ability Being Cast) equal to (Level Up Three)
        • (Ability Being Cast) equal to (Level Up Four)
      • SkillPoints[Player Number of (Owner of (Casting Unit))] is greater than 0.
    • Actions
      • SkillPoints[Player Number of (Owner of (Casting Unit))] = SkillPoints[Player Number of (Owner of (Casting Unit))] -1
      • //Remaining code not shown, multiple options
You have a few options for the action here, which vary from tracking which ability is which by a separate array of item data or by simply checking which skill they have from the "ability one" shop, if you choose to separate them in that way.

All you have to do is call your earlier code (the one that first added the ability) by giving the hero the item of the type of their ability, which should increase the level automatically.

If you found this helpful, don't be shy! +rep!
 
Last edited:
Level 3
Joined
Jan 1, 2008
Messages
29
Oh my god..

Thanks guys you are helped a lot!
I didnt tought it will be so complicated :S

Blizzard .. :(
 
Level 5
Joined
Jul 4, 2007
Messages
166
Looks good, but you should delete the Do Nothings and just Loop the Add/Level Ability Trigger to save memory

Yeah-- I suggested looping the Add/Level in the last section of code. It's okay, it was easy to miss! XD

Oh my god..

Thanks guys you are helped a lot!
I didnt tought it will be so complicated :S

Blizzard .. :(

Well, on the bright side, if you try to learn how this code works, rather than just copying it, you will have learned a more complex skill that will help you in your growth as a map maker.
 
Status
Not open for further replies.
Top