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

Is there a way to track a rune's ability before it is used?

Level 4
Joined
Apr 16, 2025
Messages
45
When using an item, it is easy to track the use of the item's ability through "used ability". But runes with an ability inside for some reason do not track the rune's ability.

Of course, I can track the use of a rune's ability through "picked up an item", but this method works after the ability has been used, which has its own significant drawbacks and does not allow me to implement many of my wishes.
 
Level 29
Joined
Sep 26, 2009
Messages
2,611
You can use the following to get ability code of the item's first ability:
  • Get Item First Ability
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item: (Item being manipulated)'s Boolean Field: Use Automatically When Acquired ('ipow')) Equal to True
    • Actions
      • Set VariableSet ItemAbility = (Item: (Item being manipulated)'s Ability at index: 0)
      • Custom script: set udg_AbilityCode = BlzGetAbilityId(udg_ItemAbility)
Variables:
  • ItemAbility: ability
  • AbilityCode: ability code

As far as I know, there's currently no way to get ability code from ability instance without using custom script. But the custom script is simple - basically the only thing to remember is that variables inside custom script should be prefixed with udg_, i.e ItemAbility -> udg_ItemAbility.

If, for some reason, you need to detect more spells on an item, you can use a loop that increments an integer variable (starting at value 0) and use that integer variable for "index" in the first action (instead of constant 0 that I use there). Then check if ItemAbility is null - if not, you have abilty, if yes, there are not further abilities on that item.
 
Level 4
Joined
Apr 16, 2025
Messages
45
You can use the following to get ability code of the item's first ability:
  • Get Item First Ability
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item: (Item being manipulated)'s Boolean Field: Use Automatically When Acquired ('ipow')) Equal to True
    • Actions
      • Set VariableSet ItemAbility = (Item: (Item being manipulated)'s Ability at index: 0)
      • Custom script: set udg_AbilityCode = BlzGetAbilityId(udg_ItemAbility)
Variables:
  • ItemAbility: ability
  • AbilityCode: ability code

As far as I know, there's currently no way to get ability code from ability instance without using custom script. But the custom script is simple - basically the only thing to remember is that variables inside custom script should be prefixed with udg_, i.e ItemAbility -> udg_ItemAbility.

If, for some reason, you need to detect more spells on an item, you can use a loop that increments an integer variable (starting at value 0) and use that integer variable for "index" in the first action (instead of constant 0 that I use there). Then check if ItemAbility is null - if not, you have abilty, if yes, there are not further abilities on that item.
I need to not only find the rune's ability code, but actually perform an action when it's picked up, say, changing the stats of a spell inside the rune before it's cast. Your code works fine, but Most likely, this issue is unsolvable, since "Unit - A unit Acquires an item" is triggered after the rune has produced its effect.
 
Last edited:
Level 29
Joined
Sep 26, 2009
Messages
2,611
I don't think it is possible to change stats of item's ability. The ability instance you would need to modify is stored in ItemAbility variable, however I think the trigger runs after item's spell cast has been initiated, so even if you have modified anything, it would be too late anyway.
Also, at least when modifying abilities of units, you need to force the engine to reload/refresh the ability after you've made modifications, usually by increasing/decreasing the ability level on a unit. But I don't know if anything like that exists for items.
 
Level 4
Joined
Apr 16, 2025
Messages
45
I tested it and changed the amount of health the health potion restores to 50 without much difficulty. But I did it by tracking the ability used, which is obviously calculated by the engine before the ability itself is triggered, which allows it to be changed. Logically, everything should work with the rune too, but I don't know how to catch the ability used by the rune BEFORE it is used. As I said, "Unit - A Unit Acquis an item" most likely triggers after using an ability.
 
Last edited:
Level 11
Joined
Aug 11, 2009
Messages
609
Maybe it could work if you used a dummy Rune?

You make a Rune that does nothing when picked up. Then make a trigger that when you aquire the dummy Rune it creates the real Rune on the ground. Then you edit the value of the ability of this real Rune and through triggers force the hero to pick it up and trigger its effect.

Im not sure if it works though, just a thought.

@Nichilus on the part you said about level up/down abilities to force reset, the unit one in triggers actually works for items aswell aslong as it is being carried by a unit. I had a similar issue where i needed an Aura inside an item to force refresh with new values :D this obviously does not work with items that is used when picked up though like a Rune.
 
Level 4
Joined
Apr 16, 2025
Messages
45
Maybe it could work if you used a dummy Rune?

You make a Rune that does nothing when picked up. Then make a trigger that when you aquire the dummy Rune it creates the real Rune on the ground. Then you edit the value of the ability of this real Rune and through triggers force the hero to pick it up and trigger its effect.

Im not sure if it works though, just a thought.

@Nichilus on the part you said about level up/down abilities to force reset, the unit one in triggers actually works for items aswell aslong as it is being carried by a unit. I had a similar issue where i needed an Aura inside an item to force refresh with new values :D this obviously does not work with items that is used when picked up though like a Rune.
You won't believe it, but I thought about it too. But it's impossible to change the rune's ability before picking it up, and it's too late after picking it up. However, I found one workaround: you need to force the hero to use the item's ability using the "hero activates item in first slot" trigger. To do this, the rune needs to be turned into an item with one charge. And you'll also have to throw the item out of the first slot and then instantly pick it up.
 
Top