• 🏆 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] Absorb Damage Problem

Status
Not open for further replies.
Level 2
Joined
Apr 21, 2014
Messages
16
I used this system: http://www.hiveworkshop.com/forums/spells-569/gui-damage-engine-v2-2-1-0-a-201016/

And I was able to create a shield that completely absorbs damage. Here's the trigger:

  • Arcane Shield
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • DamageEventOverride Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DamageEventTarget has buff MG Arcane Shield ) Equal to True
        • Then - Actions
          • Set DamageEventAmount = 0.00
        • Else - Actions
But I can't set the amount of damage that can be absorbed. For example, the shield will absorbs only 750 damage.

How to count that amount of damage and then remove the buff from the unit when the quota is overloaded?
 
Level 12
Joined
May 20, 2009
Messages
822
I THINK you'll need to index it. Hold on, I'll make a trigger real quick.

This should KINDA help you get on the right track (I hope):

  • Index Shielded Unit
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to YOUR_ABILITY
        • Then - Actions
          • Set MaxIndex = (CloakLevelMaxIndex + 1)
          • Set ShieldedUnit[MaxIndex] = (Target unit of ability being cast)
          • Set ShieldsAmount[MaxIndex] = 250.00
        • Else - Actions
  • Shielded Unit Calc
    • Events
      • Game - GDD_Event becomes Equal to 0.00 //Just the DDS I use, your DDS should work fine.
    • Conditions
    • Actions
      • For each (Integer Init) from 1 to MaxIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GDD_DamagedUnit Equal to ShieldedUnit[Init]
              • (GDD_DamagedUnit has buff YOUR_BUFF) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ShieldsAmount[CloakClockInit] Greater than GDD_Damage
                • Then - Actions
                  • Unit - Set life of GDD_DamagedUnit to ((Life of GDD_DamagedUnit) + GDD_Damage)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ShieldsAmount[CloakClockInit] Less than GDD_Damage
                    • Then - Actions
                      • Unit - Set life of GDD_DamagedUnit to ((Life of GDD_DamagedUnit) + (GDD_Damage - ShieldsAmount[Init]))
                      • Set ShieldsAmount[Init] = (ShieldsAmount[Init] - GDD_Damage)
                    • Else - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ShieldsAmount[Init] Less than 1.00
            • Then - Actions
              • Set ShieldedUnit[Init] = ShieldedUnit[MaxIndex]
              • Set ShieldedUnit[MaxIndex] = No unit
              • Set ShieldsAmount[Init] = ShieldsAmount[MaxIndex]
              • Set ShieldsAmount[MaxIndex] = 0.00
            • Else - Actions
 
Level 2
Joined
Apr 21, 2014
Messages
16
It works! I modified the trigger like this:
  • Arcane Shield Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mage - Arcane Shield
    • Actions
      • Set HR_A_MG_AS_MaxIndex = (HR_A_MG_AS_MaxIndex + 1)
      • Set HR_A_MG_AS_Unit[HR_A_MG_AS_MaxIndex] = (Target unit of ability being cast)
      • Set HR_A_MG_AS_Amount[HR_A_MG_AS_MaxIndex] = 750.00
  • Arcane Shield Active
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • DamageEventOverride Equal to False
    • Actions
      • For each (Integer HR_A_MG_AS_CurIndex) from 1 to HR_A_MG_AS_MaxIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DamageEventTarget Equal to HR_A_MG_AS_Unit[HR_A_MG_AS_CurIndex]
              • (DamageEventTarget has buff MG Arcane Shield ) Equal to True
            • Then - Actions
              • Set HR_A_MG_AS_Amount[HR_A_MG_AS_CurIndex] = (HR_A_MG_AS_Amount[HR_A_MG_AS_CurIndex] - DamageEventAmount)
              • Set DamageEventAmount = 0.00
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • HR_A_MG_AS_Amount[HR_A_MG_AS_CurIndex] Less than or equal to 1.00
            • Then - Actions
              • Unit - Remove MG Arcane Shield buff from HR_A_MG_AS_Unit[HR_A_MG_AS_CurIndex]
              • Set HR_A_MG_AS_Unit[HR_A_MG_AS_CurIndex] = HR_A_MG_AS_Unit[HR_A_MG_AS_MaxIndex]
              • Set HR_A_MG_AS_Unit[HR_A_MG_AS_MaxIndex] = No unit
              • Set HR_A_MG_AS_Amount[HR_A_MG_AS_CurIndex] = HR_A_MG_AS_Amount[HR_A_MG_AS_MaxIndex]
              • Set HR_A_MG_AS_Amount[HR_A_MG_AS_MaxIndex] = 0.00
            • Else - Actions
thanks :)
 
Level 12
Joined
May 20, 2009
Messages
822
Be sure that it functions correctly, in that if the shields only have 25 "HP" left, and the unit is attacked with 50 damage, only 25 of the damage is absorbed and the other 25 is dealt as damage to the unit.

Also, do note that this will NOT stop 1-hit kill attacks. Like, a unit has 10 HP and 200 shields, and it is attacked with 20 damage. The unit will still die.

But honestly, your damage system SHOULD allow you to prevent that from happening.
 
Level 12
Joined
May 20, 2009
Messages
822
You need a life/hitpoint ability to add to the unit as damage is dealt so it can't be one-shotted like that. a 99,999 life ability in items works.

If you add that ability AFTER the unit is attacked/damaged, it won't matter...

That is why I say his Damage System might be able to do it, because it's what does the damage in the first place, therefore he can easily pick up on it.
 
Status
Not open for further replies.
Top