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

[Trigger] Refer to changed attributes in game

Status
Not open for further replies.
Level 6
Joined
Jul 23, 2018
Messages
243
Hello everyone,
Thank you in advance for reading this thread and help with my problems
I made a trigger that makes the spell damage scale with hero's attributes when detecting spell damage from a certain Hero through a spell. The trigger did adjust the damage scaling with the DamageEventSource's attributes. However, two problem I encountered are when the hero kills the unit with his spell, he didn't gain any attribute from the trigger and second, when the spell didn't kill the target, the tome of Strength is still created. Maybe "wait" action is at fault? And another problem is that when the current strength attribute in game changes, the amount of damage doesn't change at all even though it scales with the base strength attribute. I'm currently using Bribe's Damage Engine 3.8.0.0 and 3A.0.0.0.
  • Veigar
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • (Unit-type of DamageEventSource) Equal to Elderwood/Mage
      • IsDamageSpell Equal to True
    • Actions
      • Set DamageEventAmount = (DamageEventAmount x (Real(((Strength of DamageEventSource (Include bonuses)) / 100))))
      • Game - Display to (All players) the text: ((String((Unit-type of DamageEventTarget))) + ( takes + ((String(DamageEventAmount)) + ( from + (String((Unit-type of DamageEventSource)))))))
      • Wait 0.01 game-time seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DamageEventTarget is dead) Equal to True
        • Then - Actions
          • Hero - Create Tome of Strength and give it to DamageEventSource
          • Game - Display to (All players) the text: add 1 to Veigar's S...
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Cherry Blossom for DamageEventSource) Equal to 3
            • Then - Actions
              • Hero - Modify Strength of DamageEventSource: Add 1
              • Game - Display to (All players) the text: add 2 to Veigar's ...
            • Else - Actions
        • Else - Actions
+Rep to anyone helping
 
Last edited:

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,456
Whenever a unit takes damage the system updates all of it's Variables. In this case it Sets DamageEventSource to the unit that dealt the damage and DamageEventTarget to the unit that was damaged.

With this in mind, understand that there's nothing guaranteeing that these two DamageEvent units will be the same after the Wait. This is because the Wait opens up room for another DamageEvent to go off, and when that happens the variables will be changed to something else. There's also potential that the Damage Engine itself nulls/resets these variables after the damage is dealt, so again, the Wait is problematic.

A possible solution (haven't tested it yet), use this Event to detect when your Mage deals lethal Spell Damage to a unit.
  • example
    • Events
      • Game - LethalDamageEvent becomes Equal to 1.00
    • Conditions
      • IsDamageSpell Equal to True
      • (Unit-type of DamageEventSource) Equal to Elderwood/Mage
    • Actions
      • -------- Add strength to DamageEventSource --------
Do NOT modify the DamageEventAmount in this new trigger, do it in your previous trigger. So you'll have two triggers, your first one which modifies the Spell Damage dealt, and this new one which runs when a unit is killed by this damage (adding strength).

Some random notes:

Wait 0.01 seconds is misleading. The length of Waits is not precise and they're even slower in multiplayer. I think the average minimum Wait time is something like 0.20 seconds.

You can Modify a Hero's Attribute through triggers. You don't need to Create a Tome and give it to the Hero.
 
Last edited:
Level 6
Joined
Jul 23, 2018
Messages
243
Whenever a unit takes damage the system updates all of it's Variables. In this case it Sets DamageEventSource to the unit that dealt the damage and DamageEventTarget to the unit that was damaged.

With this in mind, understand that there's nothing guaranteeing that these two DamageEvent units will be the same after the Wait. This is because the Wait opens up room for another DamageEvent to go off, and when that happens the variables will be changed to something else. There's also potential that the Damage Engine itself nulls/resets these variables after the damage is dealt, so again, the Wait is problematic.

A possible solution (haven't tested it yet), use this Event to detect when your Mage deals lethal Spell Damage to a unit.
  • example
    • Events
      • Game - LethalDamageEvent becomes Equal to 1.00
    • Conditions
      • IsDamageSpell Equal to True
      • (Unit-type of DamageEventSource) Equal to Elderwood/Mage
    • Actions
      • -------- Add strength to DamageEventSource --------
Do NOT modify the DamageEventAmount in this new trigger, do it in your previous trigger. So you'll have two triggers, your first one which modifies the Spell Damage dealt, and this new one which runs when a unit is killed by this damage (adding strength).

Some random notes:

Wait 0.01 seconds is misleading. The length of Waits is not precise and they're even slower in multiplayer. I think the average minimum Wait time is something like 0.20 seconds.

You can Modify a Hero's Attribute through triggers. You don't need to Create a Tome and give it to the Hero.
Ah, I see, thank you. I forgot this event exist.
Edit: Then how do I deal with changing attributes in game? It seems like the event only has my base attributes. It doesn't recognize a different amount of attributes, just base attribute.
Edit 2: I just found out that LethalDamageEvent variable does not exist in Damage Engine 3.8.0.0. Can I use AfterDamageEvent instead?
Edit 3: It seems like the hero can gain attributes through kill now, but the problem is that the damage stays the same after the attribute changed in game
 
Last edited:

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,456
Post your trigger.

Also, are you sure the math is correct:
  • Set DamageEventAmount = (DamageEventAmount x (Real(((Strength of DamageEventSource (Include bonuses)) / 100))))

Say the Hero has 50 Strength and deals 100.0 damage:

100.0 damage * (50.0 strength/100.0) = 50.0 damage dealt

Until you break over 100 Strength you won't be dealing increased damage and will instead deal reduced damage.
 
Last edited:
Level 6
Joined
Jul 23, 2018
Messages
243
Post your trigger.

Also, are you sure the math is correct:
  • Set DamageEventAmount = (DamageEventAmount x (Real(((Strength of DamageEventSource (Include bonuses)) / 100))))

Say the Hero has 50 Strength and deals 100.0 damage:

100.0 damage * (50.0 strength/100.0) = 50.0 damage dealt

Until you break over 100 Strength you won't be dealing increased damage and will instead deal reduced damage.
The attributes were set to look like a percentage, that's why there's a "divide by 100" in there
  • Veigar Spell
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • (Unit-type of DamageEventSource) Equal to Elderwood/Mage
      • IsDamageSpell Equal to True
    • Actions
      • Set CV = (Custom value of DamageEventSource)
      • Set SpellPower[CV] = (Real(((Strength of DamageEventSource (Include bonuses)) / 100)))
      • Set DamageEventAmount = (DamageEventAmount x SpellPower[CV])
      • Game - Display to (All players) the text: ((String((Unit-type of DamageEventTarget))) + ( takes + ((String(DamageEventAmount)) + ( from + (String((Unit-type of DamageEventSource)))))))
      • Game - Display to (All players) the text: (Veigar's total spell power is + (String((Strength of DamageEventSource (Include bonuses)))))
      • Game - Display to (All players) the text: (Veigar's total spell power in variable is + (String(SpellPower[CV])))
  • Veigar Gain
    • Events
      • Game - AfterDamageEvent becomes Equal to 1.00
    • Conditions
      • (DamageEventTarget is dead) Equal to True
      • IsDamageSpell Equal to True
    • Actions
      • Hero - Modify Strength of DamageEventSource: Add 1
      • Game - Display to (All players) the text: add 1 to Veigar's S...
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Cherry Blossom for DamageEventSource) Equal to 3
        • Then - Actions
          • Hero - Modify Strength of DamageEventSource: Add 1
          • Game - Display to (All players) the text: add 2 to Veigar's ...
        • Else - Actions
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,456
  • Don't forget to add the Elderwood/Mage Unit-type condition to the Veigar Gain trigger. Otherwise, it can go off for other units.
  • You can optimize Veigar Gain by putting the first two Actions in the ELSE - ACTIONS part of your If Then Else statement. Then adjust the Strength gain for Level 3 Cherry Blossom to Add 2 instead of 1. This way it does one or the other, not one or both.

How much Strength does your Hero start out with? How much Strength are you testing with?
I'm still confused about this setup. If Strength is anything less than 100 then you're dealing reduced damage.

Anyway, try setting DamageEventAmount to like 999999 and see if that works. Maybe the variable can't be changed at this stage of the system. Otherwise, your Arithmetic in SpellPower[CV] is somehow wrong. I wonder if you need to convert the Strength to a Real and the 100 to a Real as well.
 
Status
Not open for further replies.
Top