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

[Spell] How Can You Detect if an Ability is a Hero/Unit/Item Ability?

Status
Not open for further replies.
Level 4
Joined
Nov 20, 2006
Messages
71
Here's on example of where you might want to do this.

You have a mana refund item that heroes can pick up. When they have it, they gain 10 mana whenever they use an ability. The problem is that if your only trigger condition is "When a unit starts the effect of an ability" this will also trigger when you use something like healing salves.

So, how can you add a condition that will filter out everything except learned hero abilities?

Thanks.
 
Level 11
Joined
Nov 23, 2013
Messages
665
Here is my guess.
Is that mana item pickable by any hero, in a map/campaign with many of them? Or is it usable by only 1 to 3 heroes? If so, you may use the Ability Comparison and use it as many times as necessary, depending on the number of hero abilities you have.
If you have too many heroes, it's still possible I suppose, but it is going to be very tedious to create a condition for every single hero ability.
 
Level 4
Joined
Nov 20, 2006
Messages
71
I had thought of that actually and in my case the items will be used by many heroes with many abilities, so it would be a ton of work for a simple effect. It would also add the burden of adding any new spells to that list any time I add something to the game. Not fun :(
 
item activations can be identified by orderId:
JASS:
local integer spellOrder = GetUnitCurrentOrder(caster)
local boolean itemSpell = ( spellOrder >= 852008 and spellOrder <= 852013)

Hero Skills:
one could mark learned abilities in an hashtable for units in the learn event, only valid if all hero skills have to be learned. Then on activation check, if there is an saved entry for the used skill. (hmm, GUI and Abilities as key is not nice to do)

Normal skills would be if not itemSpell and not Hero SKill.

There is also an way shown by triggerhappay: how to read from dynamically-retrieve-object-editor-fields by Trigger. That way you also could read the fields you set in editor:
<abilityId,hero> == 1 hero ability flag was set.
<abilityId,item> == 1, item ability flag was set.
if both are 0 then it is an normal unit ability.
 
Last edited:
Status
Not open for further replies.
Top