• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Giving a Hero a spell/abilty he can learn

Status
Not open for further replies.
Hi, I'm trying to give a hero an ability to be learned but when i use Unit - Add Ability it makes the hero have the ability from the start. I want the hero to be able to learn the ability like in Custom HLW.

  • AddAbility
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit - Add Black Arrow to Paladin 0028 <gen>
I also know how to write in Jass so if it can only be done in Jass then that's ok.
Please tell me what I use to do this =]
 
Hmm...
i have a better idea. make an item that does nothing(just nothing :p ) onl make a description. than make it auto aplies whe you pick it. and when you pick it your hero gains a spell. ill make u a trigger just a sec

something like that:
  • SpellinItem
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • ((Triggering unit) has an item of type <your item here>) Equal to True
    • Actions
      • Unit - Add <your spell here> to (Triggering unit)
 
Level 7
Joined
Oct 5, 2007
Messages
118
It's pretty simple: Just give your hero dummy hero skills (which do nothing than exist). Then you can use 'Engineering Upgrade' to modifie the hero skills to whatever you want.

I'm sure you don't want every hero to have 5 engineering upgrades after getting all skills. But there's also a little workaround... just read this text by PitzerMike about the famous engineering upgrade:
ANeg (Engineering Upgrade): The engineering upgrade finally solves the problem of not levelable trigger added hero skills. It allows to add hero skills with triggers and to still have them in the levelup menu. Therefore the hero needs to have dummy hero skills that can then be replaced by the actual skills. The placeholder skills need to have the same amount of levels and level skip requirements that's why you will probably need one for ultimates and one for normal hero skills. I usually base my placeholder skills off of Arpb (Replenish) but the base skill really shouldn't matter. The placeholder with 3 levels and 2 levels skip can simply be given to the hero several times. Then the placeholder skills must be disabled for all players at map initialization, so they don't show up in the levelup menu at first. Then you will just need an adder ability based off of engineering upgrade for each skill that you might want to have on the hero. The upgrade will replace the skills in the order of their ability upgrade field when it's added, and replace them backwards when it's removed. So if you want to abuse the engineering upgrade but don't want the passive upgrade icon on the unit you can simply have an engineering upgrade with the abilities B, A in the upgrade field and then when you add and remove it on a unit that has A it will then have B. That's because adding it will do nothing as B is not there, but removing it will replace A with B. As soon as a hero ability has been added that way it will be learnable in the levelup menu. Note that replacing skills only works well for unlearned hero skills. Replacing learned skills or normal unit skills will not actually replace them, it will just update the fields like range, area of effect, duration, icon, targets allowed, and so on, but will not change the hardcoded part of the ability. For example changing an aura to the heal ability will only change the icon, tooltips, range and probably some other fields, but it will still be an aura. If the ability that is being replaced is disabled at the time the results become even weirder and you can never know what you will get. Also the engineering upgrade only works for heroes, adding it to normal units will crash the game for some reason. Another weird bug with it is, that you have to specify all four upgraded abilities, otherwise it might not work. If you only want to upgrade one ability, you can simply specify ability ids that the unit will never have for the rest. Also dynamic tooltips like <dataA5> are flawed above level 3. Also the default buff shouldn't be replaced, but it doesn't show up anyway, so that's not really an issue.
I hope this helps you :)
 
Level 9
Joined
Oct 17, 2007
Messages
547
Well i don't know Jass, but wat i would do to get the same effect is as follows. I think i showed someone here how to do it but i forgot the thread, so here it is again.

-Make a dummy blank spell book call it Abilities with the same looking icon as the one that appear when your hero learn a skill.(make sure location of the button matches too.
-Then make another spell book, call it "black arrow(spell book)" so u know what it is.
-Add a dummy skill to that spell book that has all the description and the detail you want in the learning tool tip of your real skill.
-Disable that spell book with the dummy learn skill button.
-Whenever you want to allow your hero to learn the ability, just add that "black arrow(spell book)" to the hero.
-Make a trigger that add the working "black arrow lv1" to the hero when that dummy button is clicked, and remove the "black arrow(spell book)" skill.

As for skill points i think they can be triggered but im not sure, never tried it. You can keep adding dummy learn buttons so the player can click if he/she wants to lv up the skill.
Hope that helps.
 
Level 21
Joined
Aug 9, 2006
Messages
2,384
First question: how learn heroes spells in custom hlw?

Well, when i look at the topic, you could do it following: Add every spell at start and deactivate them with the following function:

  • Player - Deactivate The Spell Name for Player 1 (Red)
And when you need the spell (added) you can activate it simply, and you can learn it then normally.

Well you should consider that the spells need to be hero flagged

Good thing is, when the spell is disabled it takes no place, so you can add VERY many spells.
 
Level 7
Joined
Oct 5, 2007
Messages
118
Please test that method. You will see that hero abilites can added, of course, but they can definitely not be skilled. Just check it.
 
Status
Not open for further replies.
Top