• 🏆 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] Detecting when a heroes attributes change (level up, item gain/loss)

Status
Not open for further replies.

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,511
Hello, here are two triggers that I was hoping would work. I have custom variables for each attribute and I want to adjust these when a unit acquires/loses an item, levels up, etc.

However, it seems that there is a delay between when the "Loses an item" event fires and when a unit's stats actually update. So when I "Set Stats_SpellDamage[TempInteger1] = ((Real((Intelligence of TempUnit1 (Include bonuses)))) x 1.00)" after losing an item-let's say a Mantle of Intelligence +3, it's still including the +3 Intelligence from the item in the equation even though it's no longer equipped. I was wondering if anyone knew a way around this without having to detect every single item type and manually adding/removing attributes via triggers.

  • Set Attributes
    • Events
      • Unit - A unit Gains a level
      • Unit - A unit Acquires an item
      • Unit - A unit Loses an item
    • Conditions
    • Actions
      • Set TempUnit1 = (Triggering unit)
      • Trigger - Run Set Attributes Run <gen> (ignoring conditions)
  • Set Attributes Run
    • Events
    • Conditions
    • Actions
      • Set TempInteger1 = (Custom value of TempUnit1)
      • Set Stats_SpellDamage[TempInteger1] = ((Real((Intelligence of TempUnit1 (Include bonuses)))) x 1.00)
      • Game - Display to (All players) for 30.00 seconds the text: (String(Stats_SpellDamage[TempInteger1]))

EDIT SOLUTION: I added the unit to a UG and then ran a 0.00 second timer, adjusting the stats of every unit in that UG after the timer expired.
 
Last edited:
Status
Not open for further replies.
Top