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

[Solved] Check if "Ability Being Cast" is Hero/Unit/Item Abilty?

Level 3
Joined
Oct 11, 2017
Messages
24
Greetings, everyone!

I'm currently working in a "Arcane Sense" aura that notifies it's owner when a Hero unit is using one of it's abilities, however, the aura is activating even when a enemy hero uses an active item (mostly because, after all, the item IS a ability).

Is it possible through non-indexing methods to check if an ability being cast is a item ability?
 
Level 12
Joined
Jan 10, 2023
Messages
191
I think that does work, but if it doesn't, would it be possible to use the FourCC's first digit?

A capital first digit ('X000') marks a hero ability, a lower ('x000') marks a non-hero ability.
Same with Units.
With abilities, it may be possible to force a Hero ability to have a lowercase 1st digit, if you choose a specific FourCC value when making the ability, but I haven't tried. With units, if you copy a peasant ('hpea') but change the new peasant's FourCC to 'Hpea' it will make a copy but as a hero.
Abilities may force the change to Hero-type as well, but they do have a boolean for this so it may be simply a convention and not something that actually changes anything.

Anyway, if that is true that they are designated by the first digit, you could detect Hero/non-Hero by the FourCC abilcode value.
 
Level 12
Joined
Jan 10, 2023
Messages
191
One can also do some OrderId comparing to know if the ability was used from within an item
Lua:
local spellOrder = GetUnitCurrentOrder(unit)
local itemSpell = ( spellOrder >= 852008 and spellOrder <= 852013)
Do those integers refer to the item slots? Noticed there were six of them..
 
Level 3
Joined
Oct 11, 2017
Messages
24
On 1.31+ you can check if it's an Item Ability using a Boolean comparison:
  • (Ability: (Unit: (Triggering unit)'s Ability with Ability Code: (Ability being cast))'s Boolean Field: Item Ability ('aite')) Equal to True
Not sure if it works though.
This one worked perfectly, and is by far the simplest method that fit my purposes.

Thanks everyone for your suggestions!
 
Top