• 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.

Spellbook question {How to enable/disable abilities for a hero type?}

Status
Not open for further replies.
Level 2
Joined
Jul 12, 2011
Messages
25
I know that there are a lot of tutorials for spell books but im unsure if anywould answer this question: Im making an RPG with a hero tavern. how would I disable/enable abilities for a certain hero type? if not i also had another idea to buy the skills from a vendor maybe?
 
Disable/enable abilities action do not refer to just hero, but whole Player's forces. You better use add/remove ability action.

So, your tavern could have some dummy spells - which do nothing, just when you click on it, you get new spell according to what you have clicked on. Dummy spells represent the buyable spells themselves with desription/informations ect.
For unlearing you can always use: Type -unlearn {ability} followed by removing typed ability.

Acions, that should be usefull for you:
  • Custom script: call UnitAddAbility (udg_u, udg_i)
  • Custom script: call UnitRemoveAbility (udg_u, udg_i)
Where 'u' is your unit and 'i' represents the rawcode of given ability. To get rawcode enter Object editor, head to abilities and click Ctrl + D, ability's Id (rawcode) will replace spell's name.
 
Level 2
Joined
Jul 12, 2011
Messages
25
Everyone time I use a custom script it causes my map to be unopenable.
the units to they require the raw code or do I just use unit name?
and the rawcode say is (A00B:Aens) is that the entire code or do i use a portion of it?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
"A00B" is the actual rawcode of the spell, "Aens" is the rawcode of the ability you based it on (here: Ensnare, or "Ability ENSnare" --> "Aens").
Every rawcode is only 4 characters long, that's how you can recognize them.

And then you're using custom scripts ( = JASS) in a wrong way :p
Well, GUI has "unit add/remove ability" as well though. So you don't have to use those custom scripts.

Spinnaker's method is correct though (for buying abilities from a merchant).
 
ap0calypse don't negate using better functions :DD

@xXxScoxXx
If Id of your custom spell A00B:Aens you can see that its made from two pieces, explained by ap0calypse already but once again: 1st part -> Id of your spell, 2nd part -> Id of spell you have based custom one on.
So you need just A00B :p

Actually if you want to write A00b in place of udg_i which is here an integer variable you have to type it between ' ', like 'A00B'. Using custom scripts it should be something like this:
  • Custom script: call UnitAddAbility (udg_u, 'A00B')
  • Custom script: call UnitRemoveAbility (udg_u, 'A00B')
However, (just to inform you) you can also use this:
  • Custom script: set udg_i = 'A00B'
And then again:
  • Custom script: call UnitAddAbility (udg_u, udg_i)
  • Custom script: call UnitRemoveAbility (udg_u, udg_i)
Just if you were curious. :S
 
Level 2
Joined
Jul 12, 2011
Messages
25
I figured it out like 10 seconds after i asked my question lol
I had another question while im here, im using a dummy area of effect ability but when it kills a target my hero gets no exp?
 
Level 2
Joined
Jul 12, 2011
Messages
25
Yes, I have it creating the dummy for owner of the unit and deal damage to an area, but it kills and gives my hero no experience.
 
Level 2
Joined
Jul 12, 2011
Messages
25
If you dont mind can you also check my ThunderClap based trigger. its damaging the hero and allied players as well.
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,243
Level 2
Joined
Jul 12, 2011
Messages
25
Im sorry for the stupid questions but i cant seem to find how to set the trigger for the owner of matching unit is an enemy of owner of triggering unit.
 
Status
Not open for further replies.
Top