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

[General] AttributeStatSteal_TriggerHelp

Level 7
Joined
Oct 6, 2022
Messages
135
Hello, I'm Trying to create an Attribute Steal(Passive Skill) where each hit of the attacker to the targeted hero, the attacker's attribute increases by 4 then the targeted hero's attribute decreases by 4 and has the limit of 50 attribute that can be stole from the targeted hero. if the attacker stops attacking the hero within 10 sec it returns the attribute that the attacker stole.

concept: the Attacker attacks the targeted hero 5 times and stole "20" of its attribute from those 5 attacks, then the Attacker stopped attacking that targeted hero for 10 seconds and returned that stolen "20" attribute from that targeted hero. if it where to use damage engine which is this.
  • Damage Engine Config
    • Events
    • Conditions
      • (UDexUnits[UDex] is A structure) Equal to False
    • Actions
      • -------- - --------
      • -------- This trigger's conditions let you filter out units you don't want detection for. --------
      • -------- NOTE: By default, units with Locust will not pass the check. --------
      • -------- TIP: The unit is called UDexUnits[UDex] and its custom value is UDex --------
      • -------- - --------
      • -------- Copy the Cheat Death Ability from Object Editor into your map and set the following variable respectively: --------
      • -------- - --------
      • Set DamageBlockingAbility = Cheat Death Ability (+500,000)
      • -------- - --------
      • -------- Copy the Detect Spell Damage Ability from Object Editor into your map and set the following variable respectively: --------
      • -------- - --------
      • Set SpellDamageAbility = Detect Spell Damage
      • -------- - --------
      • -------- You can add extra classifications here if you want to differentiate between your triggered damage --------
      • -------- Use DamageTypeExplosive (or any negative value damage type) if you want a unit killed by that damage to explode --------
      • -------- - --------
      • Set DamageTypeExplosive = -1
      • Set DamageTypeCriticalStrike = 1
      • Set DamageTypeHeal = 2
      • Set DamageTypeReduced = 3
      • Set DamageTypeBlocked = 4
      • -------- - --------
      • -------- Leave the next Set statement disabled if you modified the Spell Damage Reduction item ability to 1.67 reduction --------
      • -------- Otherwise, if you removed that ability from Runed Bracers, you'll need to enable this line: --------
      • -------- - --------
      • Set DmgEvBracers = Runed Bracers
      • -------- - --------
      • -------- Set the damage multiplication factor (1.00 being unmodified, increasing in damage over 1.00 and at 0 damage with 0.00) --------
      • -------- NOTE. With the default values, Runed Bracers is reduces 33%, Elune's Grace reduces 20% and Ethereal increases 67% --------
      • -------- - --------
      • Set DAMAGE_FACTOR_BRACERS = 0.67
      • Set DAMAGE_FACTOR_ELUNES = 0.80
      • Set DAMAGE_FACTOR_ETHEREAL = 1.67
      • -------- - --------
      • -------- Added 25 July 2017 to allow detection of things like Bash or Pulverize or AOE spread --------
      • -------- - --------
      • Set DamageEventAOE = 1
      • Set DamageEventLevel = 1
      • -------- - --------
      • -------- Do not enable any of the following lines as they are simply variable declarations to make copying easier --------
      • -------- - --------
      • Set AfterDamageEvent = (DamageEvent + (AOEDamageEvent + DamageModifierEvent))
      • Set ClearDamageEvent = (This trigger)
      • Set DamageEventAmount = DamageEventPrevAmt
      • Set DamageEventOverride = NextDamageOverride
      • Set DamageEventSource = DamageEventTarget
      • Set DamageEventTrigger = DmgEvTrig
      • Set DamageEventType = (LastDmgPrevType[0] + NextDamageType)
      • Set DamageEventsWasted = DmgEvRecursionN
      • Set DmgEvRunning = DmgEvStarted
      • Set IsDamageSpell = LastDmgWasSpell[0]
      • Set LastDamageHP = (Elapsed time for DmgEvTimer)
      • Set LastDmgPrevAmount[0] = LastDmgValue[0]
      • Set LastDmgSource[0] = LastDmgTarget[0]
      • Set HideDamageFrom[0] = False
      • Set UnitDamageRegistered[0] = False
      • Unit Group - Add EnhancedDamageTarget to DamageEventAOEGroup
  • Set Damage
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DamageEventTarget has buff (Elaina) DmgBlock ) Equal to True
        • Then - Actions
          • If ((Level of (Elaina) Magical Barrier for DamageEventTarget) Equal to 1) then do (Set Elaina_HPRegenLVL = (0.00 - 20.00)) else do (Do nothing)
          • If ((Level of (Elaina) Magical Barrier for DamageEventTarget) Equal to 2) then do (Set Elaina_HPRegenLVL = (0.00 - 30.00)) else do (Do nothing)
          • If ((Level of (Elaina) Magical Barrier for DamageEventTarget) Equal to 3) then do (Set Elaina_HPRegenLVL = (0.00 - 40.00)) else do (Do nothing)
          • If ((Level of (Elaina) Magical Barrier for DamageEventTarget) Equal to 4) then do (Set Elaina_HPRegenLVL = (0.00 - 50.00)) else do (Do nothing)
          • If ((Level of (Elaina) Magical Barrier for DamageEventTarget) Equal to 1) then do (Set Elaina_HPRegenLVL_txt = 20) else do (Do nothing)
          • If ((Level of (Elaina) Magical Barrier for DamageEventTarget) Equal to 2) then do (Set Elaina_HPRegenLVL_txt = 30) else do (Do nothing)
          • If ((Level of (Elaina) Magical Barrier for DamageEventTarget) Equal to 3) then do (Set Elaina_HPRegenLVL_txt = 40) else do (Do nothing)
          • If ((Level of (Elaina) Magical Barrier for DamageEventTarget) Equal to 4) then do (Set Elaina_HPRegenLVL_txt = 50) else do (Do nothing)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of DamageEventTarget) Less than (Real((Max HP of DamageEventTarget)))
            • Then - Actions
              • Set DamageEventAmount = Elaina_HPRegenLVL
              • Set DamageEventType = DamageTypeHeal
              • Floating Text - Create floating text that reads (String(Elaina_HPRegenLVL_txt)) above DamageEventTarget with Z offset 10.00, using font size 10.00, color (50.00%, 100.00%, 50.00%), and 0.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to -50.00 towards -50.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 3.50 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 1.40 seconds
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of DamageEventTarget) Equal to (Real((Max HP of DamageEventTarget)))
            • Then - Actions
              • Set DamageEventAmount = 0.00
              • Set DamageEventType = DamageTypeBlocked
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DamageEventTarget has buff (Escanor) DmgBlock ) Equal to True
        • Then - Actions
          • Set DamageEventAmount = 0.00
          • Set DamageEventType = DamageTypeBlocked
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (CA Buff PassiveTrig <gen> is on) Equal to True
              • (DamageEventTarget has buff Bloodlust) Equal to True
        • Then - Actions
          • Set DamageEventAmount = 0.00
          • Set DamageEventType = DamageTypeBlocked
          • Floating Text - Create floating text that reads BLOCKED above DamageEventTarget with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 0.01 seconds
        • Else - Actions
What to do with this?, here's my code:
  • Snatch
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • ((Attacked unit) belongs to an enemy of (Owner of (Attacking unit))) Equal to True
          • (Level of (Ban) Snatch for (Attacking unit)) Greater than 0
          • ((Attacked unit) is A Hero) Equal to True
    • Actions
      • Set Ban_Caster[1] = (Attacking unit)
      • If ((Level of (Ban) Snatch for Ban_Caster[1]) Equal to 1) then do (Set Ban_Count[1] = 5.00) else do (Do nothing)
      • If ((Level of (Ban) Snatch for Ban_Caster[1]) Equal to 2) then do (Set Ban_Count[1] = 10.00) else do (Do nothing)
      • If ((Level of (Ban) Snatch for Ban_Caster[1]) Equal to 3) then do (Set Ban_Count[1] = 15.00) else do (Do nothing)
      • If ((Level of (Ban) Snatch for Ban_Caster[1]) Equal to 4) then do (Set Ban_Count[1] = 20.00) else do (Do nothing)
      • Hero - Modify Strength of (Attacked unit): Subtract 4
      • Hero - Modify Strength of Ban_Caster[1]: Add 4
      • -------- --------
      • -------- --------
      • -------- to be continued --------
      • Countdown Timer - Start Ban_Timer as a One-shot timer that will expire in 10.00 seconds
      • -------- --------
      • -------- --------
  • Snatch Dur
    • Events
      • Time - Ban_Timer expires
    • Conditions
    • Actions
      • Hero - Modify Strength of (Attacked unit): Add 4
      • Hero - Modify Strength of Ban_Caster[1]: Subtract 4
Hope you guys could help.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,580
Attributes can't go below 1, unless you manually Set them to 0 in the Object Editor. So you have to decide what it means to "steal" attributes, do you always gain 4 regardless of how much the opponent loses? Or do you literally steal the amount that is drained. For example, the enemy hero has 2 Strength, you damage it and it loses 1 strength. Do you gain 4 strength or 1 strength in this situation?

Anyway, since you have a Damage Engine and shouldn't be using this Event anymore:
  • Unit - A unit Is attacked
With that in mind, something like this might work:
  • Snatch Damage
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • (Level of (Ban) Snatch for DamageEventSource) Greater than 0
      • IsDamageAttack Equal to True
      • (DamageEventTarget is A Hero) Equal to True
      • (DamageEventTarget belongs to an enemy of (Owner of DamageEventSource)) Equal to True
    • Actions
      • Set Snatch_Source = DamageEventSource
      • Set Snatch_Target = DamageEventTarget
      • Set Snatch_CV = (Custom value of Snatch_Target)
      • -------- --------
      • Set Snatch_Duration[Snatch_CV] = (5.00 x (Real(Level of (Ban) Snatch for Snatch_Source))
      • Unit Group - Add Snatch_Target to Snatch_Group
      • Trigger - Turn on Snatch Loop
      • -------- --------
      • Set Snatch_Current_Strength = (Strength of Snatch_Target (exclude bonuses))
      • If all conditions are true then do actions
        • If - Conditions
          • Snatch_Current_Strength Greater than 4
        • Then - Actions
          • Set Snatch_Current_Strength = 4
        • Else - Actions
          • Set Snatch_Current_Strength = (Snatch_Current_Strength - 1)
          • If all conditions are true then do actions
            • If - Conditions
              • Snatch_Current_Strength Less than or equal to 0
            • Then - Action
              • Skip remaining actions
            • Else - Actions
      • -------- --------
      • Set Snatch_Stolen_Strength[Snatch_CV] = (Snatch_Stolen_Strength[Snatch_CV] + Snatch_Current_Strength)
      • Hero - Modify Strength of Snatch_Target: Subtract Snatch_Current_Strength
      • Hero - Modify Strength of Snatch_Source: Add Snatch_Current_Strength
  • Snatch Loop
    • Events
      • Time - Every 0.05 seconds of game-time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Snatch_Group and do actions
        • Loop - Actions
          • Set Snatch_Target = (Picked unit)
          • Set Snatch_CV = (Custom value of Snatch_Target)
          • -------- --------
          • Set Snatch_Duration[Snatch_CV] = (Snatch_Duration[Snatch_CV] - 0.05)
          • -------- --------
          • If all conditions are true then do actions
            • If - Conditions
              • Snatch_Duration[Snatch_CV] Less than or equal to 0.01
            • Then - Actions
              • Hero - Modify Strength of Snatch_Target: Add Snatch_Stolen_Strength[Snatch_CV]
              • Hero - Modify Strength of Snatch_Source: Subtract Snatch_Stolen_Strength[Snatch_CV]
              • -------- --------
              • Set Snatch_Duration[Snatch_CV] = 0.00
              • Set Snatch_Stolen_Strength[Snatch_CV] = 0
              • -------- --------
              • Unit Group - Remove Snatch_Target from Snatch_Group
                • If all conditions are true then do actions
                  • If - Conditions
                    • (Number of units in Snatch_Group) Equal to 0
                  • Then - Actions
                    • Trigger - Turn off (this trigger)
Notes:
  • This uses Unit Indexing.
  • Make sure Snatch Loop is initially OFF. We don't want it running unless there is a unit in Snatch_Group.
  • I made it add Strength equal to the amount that was Subtracted, but it always resets the timer regardless.
  • I made it last 5/10/15/20 seconds. (+5 sec per level).
  • I believe this only works on base Strength. You may need to use a negative Attribute Bonus ability to include bonus Stength as well.
  • This will only work for one single Snatch ability at a time. If two or more units have this ability then the triggers will break.
  • If you want it to be MUI then you'd probably have to incorporate a Hashtable and manage multiple values from different sources on different units.
 
Last edited:
Level 7
Joined
Oct 6, 2022
Messages
135
Attributes can't go below 1, unless you manually Set them to 0 in the Object Editor. So you have to decide what it means to "steal" attributes, do you always gain 4 regardless of how much the opponent loses? Or do you literally steal the amount that is drained. For example, the enemy hero has 2 Strength, you damage it and it loses 1 strength. Do you gain 4 strength or 1 strength in this situation?

Regarding the rest of your triggers, you have a Damage Engine, you shouldn't be using this Event anymore:
  • Unit - A unit Is attacked
The whole point of the Damage Engine is to allow you to detect the exact moment when your attack hits the enemy.

With that in mind, something like this might work:
  • Snatch Damage
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • (Level of (Ban) Snatch for DamageEventSource) Greater than 0
      • IsDamageAttack Equal to True
      • (DamageEventTarget is A Hero) Equal to True
      • (DamageEventTarget belongs to an enemy of (Owner of DamageEventSource)) Equal to True
    • Actions
      • Set Snatch_Source = DamageEventSource
      • Set Snatch_Target = DamageEventTarget
      • Set Snatch_CV = (Custom value of Snatch_Target)
      • -------- --------
      • Set Snatch_Duration[Snatch_CV] = (5.00 x (Real(Level of (Ban) Snatch for DamageEventSource))
      • Unit Group - Add Snatch_Target to Snatch_Group
      • Trigger - Turn on Snatch Loop
      • -------- --------
      • Set Snatch_Current_Strength = (Strength of Snatch_Target (exclude bonuses))
      • If all conditions are true then do actions
        • If - Conditions
          • Snatch_Current_Strength Greater than 4
        • Then - Actions
          • Set Snatch_Current_Strength = 4
        • Else - Actions
          • Set Snatch_Current_Strength = (Snatch_Current_Strength - 1)
          • If all conditions are true then do actions
            • If - Conditions
              • Snatch_Current_Strength Less than or equal to 0
            • Then - Action
              • Skip remaining actions
            • Else - Actions
      • -------- --------
      • Set Snatch_Stolen_Strength[Snatch_CV] = (Snatch_Stolen_Strength[Snatch_CV] + Snatch_Current_Strength)
      • Hero - Modify Strength of Snatch_Target: Subtract Snatch_Current_Strength
      • Hero - Modify Strength of Snatch_Source: Add Snatch_Current_Strength
  • Snatch Loop
    • Events
      • Time - Every 0.05 seconds of game-time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Snatch_Group and do actions
        • Loop - Actions
          • Set Snatch_Target = (Picked unit)
          • Set Snatch_CV = (Custom value of Snatch_Target)
          • -------- --------
          • Set Snatch_Duration[Snatch_CV] = (Snatch_Duration[Snatch_CV] - 0.05)
          • -------- --------
          • If all conditions are true then do actions
            • If - Conditions
              • Snatch_Duration[Snatch_CV] Less than or equal to 0.01
            • Then - Actions
              • Hero - Modify Strength of Snatch_Target: Add Snatch_Stolen_Strength[Snatch_CV]
              • Hero - Modify Strength of Snatch_Source: Subtract Snatch_Stolen_Strength[Snatch_CV]
              • -------- --------
              • Set Snatch_Duration[Snatch_CV] = 0.00
              • Set Snatch_Stolen_Strength[Snatch_CV] = 0
              • -------- --------
              • Unit Group - Remove Snatch_Target from Snatch_Group
                • If all conditions are true then do actions
                  • If - Conditions
                    • (Number of units in Snatch_Group) Equal to 0
                  • Then - Actions
                    • Trigger - Turn off (this trigger)
Make sure Snatch Loop is initially OFF. We don't want it running unless there is a unit in Snatch_Group.

I believe this only works on base Strength though. You may need to use a negative Attribute Bonus ability to affect bonus Stength as well.
yeah it literally steal the amount that is drained, target hero's agility: 64, the attacker steals 4 from the target hero's agility, the target hero's agility would be 60. it attacked again it'll be 56, 52, and so on. Until the snatch skill reach the limit of 50 of the attribute that you could only steal.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,580
I forgot to include the limit, but you can track that in the first trigger using the same Unit Indexing method I use to track Snatch_Stolen_Strength.
  • Set Snatch_Strength_Limit[custom value of source] = Snatch_Strength_Limit[custom value of source] + X
  • If Snatch_Strength_Limit[custom value of source] Greater than or equal to 50 then
    • Set Snatch_Strength_Limit[custom value source] = 50
    • Skip remaining actions
Also, subtract from this variable in the Loop trigger when the Hero loses their bonus Strength.
 
Last edited:
Level 7
Joined
Oct 6, 2022
Messages
135
Hello again, sorry for the late response. did i do it right? i've set/change some of it into "Array" for me to not make more variables.

  • Snatch Copy
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • (Level of (Ban) Snatch for DamageEventSource) Greater than 0
      • IsDamageAttack Equal to True
      • (DamageEventTarget is A Hero) Equal to True
      • (DamageEventTarget belongs to an enemy of (Owner of DamageEventSource)) Equal to True
    • Actions
      • Set Ban_Unit[1] = DamageEventSource
      • Set Ban_Unit[2] = DamageEventTarget
      • Set Ban_CV = (Custom value of Ban_Unit[2])
      • -------- --------
      • Set Ban_Dur[Ban_CV] = (5.00 x (Real((Level of (Ban) Snatch for Ban_Unit[1]))))
      • Unit Group - Add Ban_Unit[2] to Ban_Group[1]
      • Trigger - Turn on Snatch Dur Copy <gen>
      • -------- --------
      • -------- to be continued --------
      • Set Ban_Attri = (Strength of Ban_Unit[2] (Exclude bonuses))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Ban_Attri Greater than 4
        • Then - Actions
          • Set Ban_Attri = 4
        • Else - Actions
          • Set Ban_Attri = (Ban_Attri - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Ban_Attri Less than or equal to 0
            • Then - Actions
              • Skip remaining actions
            • Else - Actions
      • Set Ban_Snatch_Limit[Ban_CV] = (Ban_Snatch_Limit[Ban_CV] + 5)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Ban_Snatch_Limit[Ban_CV] Greater than or equal to 20
        • Then - Actions
          • Set Ban_Snatch_Limit[Ban_CV] = 20
          • Skip remaining actions
        • Else - Actions
      • -------- --------
      • -------- --------
      • Set Ban_Snatch[Ban_CV] = (Ban_Snatch[Ban_CV] + Ban_Attri)
      • Hero - Modify Strength of Ban_Unit[2]: Subtract Ban_Attri
      • Hero - Modify Strength of Ban_Unit[1]: Add Ban_Attri


  • Snatch Dur Copy
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Ban_Group[1] and do (Actions)
        • Loop - Actions
          • Set Ban_Unit[2] = (Picked unit)
          • Set Ban_CV = (Custom value of Ban_Unit[2])
          • -------- - --------
          • Set Ban_Dur[Ban_CV] = (Ban_Dur[Ban_CV] - 0.05)
          • -------- - --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Ban_Dur[Ban_CV] Less than or equal to 0.01
            • Then - Actions
              • Hero - Modify Strength of Ban_Unit[2]: Add Ban_Snatch[Ban_CV]
              • Hero - Modify Strength of Ban_Unit[1]: Subtract Ban_Snatch[Ban_CV]
              • -------- - --------
              • Set Ban_Dur[Ban_CV] = 0.00
              • Set Ban_Snatch[Ban_CV] = 0
              • -------- - --------
              • Unit Group - Remove Ban_Unit[2] from Ban_Group[1]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in Ban_Group[1]) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
          • -------- - --------
 
Top