Custom Armor Reduction Ability!

Level 11
Joined
Jun 20, 2017
Messages
380
I have 3 different tiers of a tower with 3 abilities, each can reduce a different amount of armor!
Reduces a target enemy hero's armor by 1 per hit (unlimited).
Reduces a target enemy hero's armor by 2 per hit (unlimited).
Reduces a target enemy hero's armor by 3 per hit (unlimited).
If I don't attack the target after 5 seconds, the effect will be lost.

I looked at this thread
how to create Attack Modifier?
and came up with these two triggers
And it works but instead of reducing/adding negative bonus armor it reduces base armor!
  • Armor Reduction
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Damage From Normal Attack) Equal to True
      • ((Damage Target) is A Hero) Equal to True
      • ((Damage Target) belongs to an enemy of (Owner of (Damage source)).) Equal to True
      • ((Damage source) is in AR_UnitGroup.) Equal to True
      • (Level of Armor Reduction Toggle for (Damage source)) Greater than 0
      • Or - Any (Conditions) are true
        • Conditions
          • (Level of Demolish [Custom] Blood Tower / Storm Hammers for (Damage source)) Greater than 0
          • (Level of Demolish [Custom] Blood Tower (Super) / Storm Hammers for (Damage source)) Greater than 0
          • (Level of Demolish [Custom] Blood Tower (Ultra) / Storm Hammers for (Damage source)) Greater than 0
    • Actions
      • -------- Set Target. --------
      • Set VariableSet AR_Target = (Damage Target)
      • -------- --------
      • -------- Set Source. --------
      • Set VariableSet AR_Source = (Damage source)
      • -------- --------
      • -------- Setup Point. --------
      • Set VariableSet AR_Point = (Position of AR_Target)
      • -------- --------
      • -------- Setup Special Effect. --------
      • Special Effect - Create a special effect attached to the origin of AR_Target using Abilities\Spells\Items\OrbCorruption\OrbCorruptionSpecialArt.mdl
      • Set VariableSet AR_SpecialEffect = (Last created special effect)
      • Special Effect - Destroy AR_SpecialEffect
      • -------- --------
      • -------- Setup Dummy. --------
      • Unit - Create 1 [Dummy] Armor Reduction for (Owner of AR_Source) at AR_Point facing Default building facing degrees
      • Unit - Add a 0.20 second Generic expiration timer to (Last created unit)
      • Unit - Add Inner Fire (Armor Reduction) to (Last created unit)
      • Unit - Order (Last created unit) to Human Priest - Inner Fire AR_Target
      • Custom script: call RemoveLocation(udg_AR_Point)
      • -------- --------
      • -------- Get the amount of armor that should be destroyed. --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of AR_Source) Equal to Blood Tower
        • Then - Actions
          • Set VariableSet AR_Amount = 1.00
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of AR_Source) Equal to Blood Tower (Super)
            • Then - Actions
              • Set VariableSet AR_Amount = 2.00
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of AR_Source) Equal to Blood Tower (Ultra)
                • Then - Actions
                  • Set VariableSet AR_Amount = 3.00
                • Else - Actions
      • -------- --------
      • -------- Calculate the total armor destroyed. --------
      • Set VariableSet AR_ArmorLost = ((Armor of AR_Target) - AR_Amount)
      • -------- --------
      • -------- Subtract the armor from the target. --------
      • Unit - Set Armor of AR_Target to AR_ArmorLost
      • -------- --------
      • -------- Deal the damage. The "Feedback_Multiplier" is the Ratio that can be found on the ability. --------
      • Unit - Cause AR_Source to damage AR_Target, dealing AR_Amount damage of attack type Spells and damage type Normal
  • Armor Reduction Toggle
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Level of Armor Reduction Toggle for (Triggering unit)) Greater than 0
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(flamingarrows))
        • Then - Actions
          • Unit Group - Add (Triggering unit) to AR_UnitGroup
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(unflamingarrows))
            • Then - Actions
              • Unit Group - Remove (Triggering unit) from AR_UnitGroup.
            • Else - Actions
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
You could probably add an Item Armor Bonus ability to the target with negative values. That should stack and affect both base armor and bonus armor the way you'd expect it to.

Alternatively, you could modify Inner Fire to apply the negative armor. Just use the Set Ability Field actions along with some Unit Indexing to track the Armor loss over time:
  • Events
    • Unit - A unit Takes damage
  • Conditions
    • (Level of Armor Reduction Toggle for (Damage source)) Greater than 0
    • (Damage From Normal Attack) Equal to True
    • ((Damage Target) is A Hero) Equal to True
    • ((Damage Target) belongs to an enemy of (Owner of (Damage source)).) Equal to True
    • ((Damage source) is in AR_UnitGroup.) Equal to True
  • Actions
    • Custom script: local unit target
    • Custom script: local integer armorLoss
    • -------- --------
    • -------- Get the damage source and target --------
    • Set Variable AR_Source = (Damage source)
    • Set Variable AR_Target = (Damage Target)
    • Set Variable AR_Target_CV = (Custom value of AR_Target)
    • -------- --------
    • -------- Get the amount of armor reduction --------
    • If (Unit-type of AR_Source) Equal to Blood Tower then Set Variable AR_Amount[0] = 1
    • If (Unit-type of AR_Source) Equal to Blood Tower (Super) then Set Variable AR_Amount[0] = 2
    • If (Unit-type of AR_Source) Equal to Blood Tower (Ultra) then Set Variable AR_Amount[0] = 3
    • -------- --------
    • -------- Track this data locally --------
    • Custom script: set armorLoss = udg_AR_Amount[0]
    • Custom script: set target = udg_AR_Target
    • -------- --------
    • -------- Track the total amount of reduced armor --------
    • Set Variable AR_Amount[AR_Target_CV] = AR_Amount[AR_Target_CV] - AR_Amount[0]
    • -------- --------
    • -------- Apply the reduced armor --------
    • Ability - Set Ability: (Unit: AR_Dummy's Ability with Ability Code: Inner Fire (Armor Reduction))'s Integer Level Field: Defense Increase ('Inf2') of Level: 0 to AR_Amount[AR_Target_CV]
    • Unit - Increase level of Inner Fire (Armor Reduction) for AR_Dummy
    • Unit - Decrease level of Inner Fire (Armor Reduction) for AR_Dummy
    • Unit - Order AR_Dummy to Inner Fire AR_Target
    • -------- --------
    • Wait 5.00 seconds
    • -------- --------
    • -------- Get the data safely using the local variables from before --------
    • Custom script: set udg_AR_Amount[0] = armorLoss
    • Custom script: set udg_AR_Target = target
    • Set Variable AR_Target_CV = (Custom value of AR_Target)
    • -------- --------
    • -------- Undo the armor reduction from before --------
    • Set Variable AR_Amount[AR_Target_CV] = AR_Amount[AR_Target_CV] + AR_Amount[0]
    • -------- --------
    • -------- Apply the updated armor --------
    • Ability - Set Ability: (Unit: AR_Dummy's Ability with Ability Code: Inner Fire (Armor Reduction))'s Integer Level Field: Defense Increase ('Inf2') of Level: 0 to AR_Amount[AR_Target_CV]
    • Unit - Increase level of Inner Fire (Armor Reduction) for AR_Dummy
    • Unit - Decrease level of Inner Fire (Armor Reduction) for AR_Dummy
    • Unit - Order AR_Dummy to Inner Fire AR_Target
    • -------- --------
    • Custom script: set target = null
You can create the Dummy once and keep track of it all game:
  • Events
    • Time - Elapsed game time is 0.01 seconds
  • Conditions
  • Actions
    • Unit - Create 1 Dummy for Player 1 (Red) at (Center of (playable map area))
    • Set Variable AR_Dummy = (Last created unit)
    • Unit - Add Inner Fire (Armor Reduction) to AR_Dummy
 
Last edited:
Level 45
Joined
Feb 27, 2007
Messages
5,578
Armor was used in BonusMod so probably has the same issue with setting values not updating when changed but only when the ability is removed as bonus health/mana do.

IMO recasting Inner Fire is a better way to go. @AlwaysAndForever, do you intend for this armor reduction to affect to the attack that applies it? If so you’ll need to do some DamageEngine fuckery.
 
Level 11
Joined
Jun 20, 2017
Messages
380
The problem was/is that the stack gets stuck after the first few hits and when I toggled off the ability, each hit reduced the negative bonus armor back to whatever it was!

This was the problem that prevented the stacking!
Set VariableSet AR_Amount[AR_TargetCV] = (AR_Amount[AR_TargetCV] + AR_Amount[0])

However, if I toggle the ability on and off, it starts counting from the previous remaining number!
For example, if I hit a hero 10 times and toggle the ability off and then on again, it starts counting from 10 and not 0!

you’ll need to do some DamageEngine fuckery.
Yeah sure with the knowledge I have! :D
 
Last edited:
Level 45
Joined
Feb 27, 2007
Messages
5,578
I don’t think you’ve described your objective properly, and as a result Uncle crafted something for you that doesn’t exactly do what you expected it to.

Is the armor reduction supposed to stack up on the unit no matter which tower is attacking it, or is each tower progressively growing its own stacks of armor reduction that only applies once to each enemy (at its current strength)?

In the first case, yeah deactivating auto cast would do nothing if they re-attack before the reduction expires. In the second case, all of the armor reduction tracking you’re doing is on the wrong units. What happens if two different towers attack the same unit? What has priority, or do those multiple sources stack with/refresh each other?

Not having to worry about expiration, buff tracking, and stacking rules is a huge upside to using Inner Fire as Uncle showed. But in my opinion it’s unclear what you want to have happen so we can’t really troubleshoot. Also please show your triggers if they have changed since the last time you showed them here.

Modifying pre-mitigation damage with a trigger is not difficult; you are capable. You didn’t answer my question about the desired sequence, though.
 
Level 11
Joined
Jun 20, 2017
Messages
380
Uncle made exactly what I wanted and for that I really appreciate it, but like I said stacking doesn't work properly!
Armor reduction supposed to stack up on the unit no matter which tower is attacking it, which works fine.
My problem now is that
If I attack a hero 5 times with -1 armor, the total armor should be -5 and after 5 seconds if I attack that hero again, it should be counted from 0 and not -5!
  • Armor Reduction
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Level of Toggle Armor Reduction (Neutral Hostile) [Custom] Blood Towers for (Damage source)) Greater than 0
      • (Damage From Normal Attack) Equal to True
      • ((Damage Target) is A Hero) Equal to True
      • ((Damage Target) belongs to an enemy of (Owner of (Damage source)).) Equal to True
      • ((Damage source) is in AR_UnitGroup.) Equal to True
    • Actions
      • Custom script: local unit target
      • Custom script: local integer armorLoss
      • -------- --------
      • -------- Set Source --------
      • Set VariableSet AR_Source = (Damage source)
      • -------- --------
      • -------- Set Target --------
      • Set VariableSet AR_Target = (Damage Target)
      • -------- --------
      • -------- Get the damage source and target --------
      • Set VariableSet AR_TargetCV = (Custom value of AR_Target)
      • -------- --------
      • -------- Get the amount of armor reduction --------
      • If ((Unit-type of AR_Source) Equal to Blood Tower) then do (Set VariableSet AR_Amount[0] = 1) else do (Do nothing)
      • If ((Unit-type of AR_Source) Equal to Blood Tower (Super)) then do (Set VariableSet AR_Amount[0] = 2) else do (Do nothing)
      • If ((Unit-type of AR_Source) Equal to Blood Tower (Ultra)) then do (Set VariableSet AR_Amount[0] = 3) else do (Do nothing)
      • -------- --------
      • -------- Track this data locally --------
      • Custom script: set armorLoss = udg_AR_Amount[0]
      • Custom script: set target = udg_AR_Target
      • -------- --------
      • -------- Track the total amount of reduced armor --------
      • Set VariableSet AR_Amount[AR_TargetCV] = (AR_Amount[AR_TargetCV] - AR_Amount[0])
      • -------- --------
      • -------- Apply the reduced armor --------
      • Ability - Set Ability: (Unit: AR_Dummy's Ability with Ability Code: Armor Reduction [Custom] Blood Towers / Inner Fire)'s Integer Level Field: Defense Increase ('Inf2') of Level: 0 to AR_Amount[AR_TargetCV]
      • Unit - Increase level of Armor Reduction [Custom] Blood Towers / Inner Fire for AR_Dummy
      • Unit - Decrease level of Armor Reduction [Custom] Blood Towers / Inner Fire for AR_Dummy
      • Unit - Order AR_Dummy to Human Priest - Inner Fire AR_Target
      • -------- --------
      • Wait 5.00 seconds
      • -------- --------
      • -------- Get the data safely using the local variables from before --------
      • Custom script: set udg_AR_Amount[0] = armorLoss
      • Custom script: set udg_AR_Target = target
      • Set VariableSet AR_TargetCV = (Custom value of AR_Target)
      • -------- --------
      • -------- Undo the armor reduction from before --------
      • Set VariableSet AR_Amount[AR_TargetCV] = (AR_Amount[AR_TargetCV] + AR_Amount[0])// Disabled this line due to not stacking!
      • -------- --------
      • -------- Apply the updated armor --------
      • Ability - Set Ability: (Unit: AR_Dummy's Ability with Ability Code: Armor Reduction [Custom] Blood Towers / Inner Fire)'s Integer Level Field: Defense Increase ('Inf2') of Level: 0 to AR_Amount[AR_TargetCV]
      • Unit - Increase level of Armor Reduction [Custom] Blood Towers / Inner Fire for AR_Dummy
      • Unit - Decrease level of Armor Reduction [Custom] Blood Towers / Inner Fire for AR_Dummy
      • Unit - Order AR_Dummy to Human Priest - Inner Fire AR_Target
      • -------- --------
      • Custom script: set target = null
  • Armor Reduction Dummy
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Set VariableSet CenterOfRegion = (Center of (Playable map area))
      • Unit - Create 1 [Dummy] Armor Reduction for Player 1 (Red) at CenterOfRegion facing Default building facing degrees
      • Set VariableSet AR_Dummy = (Last created unit)
      • Unit - Add Armor Reduction [Custom] Blood Towers / Inner Fire to AR_Dummy
      • Custom script: call RemoveLocation(udg_CenterOfRegion)
  • Armor Reduction Toggle
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Level of Toggle Armor Reduction (Neutral Hostile) [Custom] Blood Towers for (Triggering unit)) Greater than 0
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(flamingarrows))
        • Then - Actions
          • Unit Group - Add (Triggering unit) to AR_UnitGroup
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(unflamingarrows))
            • Then - Actions
              • Unit Group - Remove (Triggering unit) from AR_UnitGroup.
            • Else - Actions
 
Last edited:
Level 11
Joined
Jun 20, 2017
Messages
380
Still having the same problem and it doesn't seem to work!
  • Armor Reduction
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Level of Toggle Armor Reduction (Neutral Hostile) [Custom] Blood Towers for (Damage source)) Greater than 0
      • (Damage From Normal Attack) Equal to True
      • ((Damage Target) is A Hero) Equal to True
      • ((Damage Target) belongs to an enemy of (Owner of (Damage source)).) Equal to True
      • ((Damage source) is in AR_UnitGroup.) Equal to True
    • Actions
      • Custom script: local unit target
      • Custom script: local integer armorLoss
      • -------- --------
      • -------- Set Source --------
      • Set VariableSet AR_Source = (Damage source)
      • -------- --------
      • -------- Set Target --------
      • Set VariableSet AR_Target = (Damage Target)
      • -------- --------
      • -------- Get the damage source and target --------
      • Set VariableSet AR_TargetCV = (Custom value of AR_Target)
      • -------- --------
      • -------- Add the targeted unit to a unit group --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (AR_Target has buff Armor Reduction [Custom] Blood Towers) Equal to True
        • Then - Actions
          • Unit Group - Add AR_Target to AR_BuffUnitGroup
        • Else - Actions
          • Unit Group - Remove AR_Target from AR_BuffUnitGroup.
      • -------- --------
      • -------- Get the amount of armor reduction --------
      • If ((Unit-type of AR_Source) Equal to Blood Tower) then do (Set VariableSet AR_Amount[0] = 1) else do (Do nothing)
      • If ((Unit-type of AR_Source) Equal to Blood Tower (Super)) then do (Set VariableSet AR_Amount[0] = 2) else do (Do nothing)
      • If ((Unit-type of AR_Source) Equal to Blood Tower (Ultra)) then do (Set VariableSet AR_Amount[0] = 3) else do (Do nothing)
      • -------- --------
      • -------- Track this data locally --------
      • Custom script: set armorLoss = udg_AR_Amount[0]
      • Custom script: set target = udg_AR_Target
      • -------- --------
      • -------- Track the total amount of reduced armor --------
      • Set VariableSet AR_Amount[AR_TargetCV] = (AR_Amount[AR_TargetCV] - AR_Amount[0])
      • -------- --------
      • -------- Apply the reduced armor --------
      • Ability - Set Ability: (Unit: AR_Dummy's Ability with Ability Code: Armor Reduction (Neutral Hostile) [Custom] Blood Towers / Inner Fi)'s Integer Level Field: Defense Increase ('Inf2') of Level: 0 to AR_Amount[AR_TargetCV]
      • Unit - Increase level of Armor Reduction (Neutral Hostile) [Custom] Blood Towers / Inner Fi for AR_Dummy
      • Unit - Decrease level of Armor Reduction (Neutral Hostile) [Custom] Blood Towers / Inner Fi for AR_Dummy
      • Unit - Order AR_Dummy to Human Priest - Inner Fire AR_Target
      • -------- --------
      • Wait 5.00 seconds
      • -------- --------
      • Trigger - Turn on Armor Reduction Loop <gen>
      • Trigger - Turn on Armor Reduction Loop2 <gen>
      • Trigger - Turn on Armor Reduction Loop3 <gen>
  • Armor Reduction Loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in AR_BuffUnitGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet AR_Amount[0] = 0
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in AR_BuffUnitGroup) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • Armor Reduction Loop3
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in AR_BuffUnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Armor Reduction [Custom] Blood Towers) Equal to False
            • Then - Actions
              • Set VariableSet AR_Amount[0] = 0
              • Unit Group - Remove (Picked unit) from AR_BuffUnitGroup.
            • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in AR_BuffUnitGroup) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions


Edit
I found this topic, it works but when I edit these lines, editing the numbers doesn't work!
Need help...About Armor Reduction.
First attack reduces armor by -1, the second and subsequent attacks reduces armor by -2!
Set VariableSet AR_Reduction = ((Load 0 of AR_I from AR_Hashtable.) + 1)
Set VariableSet AR_R = (Power(2.00, (Real(AR_I))))

I somehow want to add these actions to it, so each tower has its own value! How can I do this?
  • Events
  • Conditions
  • Actions
    • -------- --------
    • -------- Get the amount of armor reduction --------
    • If ((Unit-type of (Triggering unit)) Equal to Blood Tower) then do (Set VariableSet AR_Reduction = ((Load 0 of AR_I from AR_Hashtable.) + 1)) else do (Do nothing)
    • If ((Unit-type of (Triggering unit)) Equal to Blood Tower (Super)) then do (Set VariableSet AR_Reduction = ((Load 0 of AR_I from AR_Hashtable.) + 2)) else do (Do nothing)
    • If ((Unit-type of (Triggering unit)) Equal to Blood Tower (Ultra)) then do (Set VariableSet AR_Reduction = ((Load 0 of AR_I from AR_Hashtable.) + 3)) else do (Do nothing)
    • -------- --------
  • AR Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set VariableSet AR_Hashtable = (Last created hashtable)
      • -------- --------
      • Set VariableSet AR_Ability[0] = Item Armor Bonus (-0001) [Custom] Item
      • Set VariableSet AR_Ability[1] = Item Armor Bonus (-0002) [Custom] Item
      • Set VariableSet AR_Ability[2] = Item Armor Bonus (-0004) [Custom] Item
      • Set VariableSet AR_Ability[3] = Item Armor Bonus (-0008) [Custom] Item
      • Set VariableSet AR_Ability[4] = Item Armor Bonus (-0016) [Custom] Item
      • Set VariableSet AR_Ability[5] = Item Armor Bonus (-0032) [Custom] Item
      • Set VariableSet AR_Ability[6] = Item Armor Bonus (-0064) [Custom] Item
      • Set VariableSet AR_Ability[7] = Item Armor Bonus (-0128) [Custom] Item
      • Set VariableSet AR_Ability[8] = Item Armor Bonus (-0256) [Custom] Item
      • Set VariableSet AR_Ability[9] = Item Armor Bonus (-0512) [Custom] Item
      • Set VariableSet AR_Ability[10] = Item Armor Bonus (-1024) [Custom] Item
      • Set VariableSet AR_Ability[11] = Item Armor Bonus (-2048) [Custom] Item
      • Set VariableSet AR_Ability[12] = Item Armor Bonus (-4096) [Custom] Item
      • Set VariableSet AR_Ability[13] = Item Armor Bonus (-8192) [Custom] Item
      • Set VariableSet AR_Ability[14] = Item Armor Bonus (-16384) [Custom] Item
      • Set VariableSet AR_Ability[15] = Item Armor Bonus (-32768) [Custom] Item
      • Set VariableSet AR_Ability[16] = Item Armor Bonus (-65536) [Custom] Item
      • Set VariableSet AR_Ability[17] = Item Armor Bonus (-131072) [Custom] Item
      • -------- --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Trigger - Add to AR <gen> the event (Unit - (Picked unit) Takes damage)
  • AR Add
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Trigger - Add to AR <gen> the event (Unit - (Triggering unit) Takes damage)
  • AR
    • Events
    • Conditions
      • ((Triggering unit) has buff Armor Reduction [Custom] Blood Towers) Equal to True
      • (Level of Armor Reduction for (Damage source)) Greater than 0
    • Actions
      • Set VariableSet AR_I = (Key (Triggering unit).)
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in AR_UnitGroup.) Equal to False
        • Then - Actions
          • Unit Group - Add (Triggering unit) to AR_UnitGroup
          • Trigger - Turn on AR Loop <gen>
          • Special Effect - Create a special effect attached to the chest of (Triggering unit) using Abilities\Spells\Undead\Cripple\CrippleTarget.mdl
          • Hashtable - Save Handle Of(Last created special effect) as 0 of AR_I in AR_Hashtable.
        • Else - Actions
      • -------- --------
      • Hashtable - Save 5.00 as 0 of AR_I in AR_Hashtable.
      • Set VariableSet AR_Reduction = ((Load 0 of AR_I from AR_Hashtable.) + 1)
      • Hashtable - Save AR_Reduction as 0 of AR_I in AR_Hashtable.
      • -------- --------
      • For each (Integer AR_I) from 0 to 17, do (Actions)
        • Loop - Actions
          • Unit - Remove AR_Ability[AR_I] from (Triggering unit)
      • -------- --------
      • Custom script: loop
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AR_I Greater than 0
          • AR_Reduction Greater than 0
        • Then - Actions
          • Set VariableSet AR_I = (AR_I - 1)
          • Set VariableSet AR_R = (Power(2.00, (Real(AR_I))))
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Real(AR_Reduction)) Greater than or equal to AR_R
            • Then - Actions
              • Unit - Add AR_Ability[AR_I] to (Triggering unit)
              • Set VariableSet AR_Reduction = (AR_Reduction - (Integer(AR_R)))
            • Else - Actions
        • Else - Actions
          • Custom script: exitwhen true
      • Custom script: endloop
  • AR Loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in AR_UnitGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet AR_I = (Key (Picked unit).)
          • Set VariableSet AR_R = ((Load 0 of AR_I from AR_Hashtable.) - 0.10)
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • AR_R Greater than 0.00
            • Then - Actions
              • Hashtable - Save AR_R as 0 of AR_I in AR_Hashtable.
            • Else - Actions
              • Special Effect - Destroy (Load 0 of AR_I in AR_Hashtable.)
              • Hashtable - Clear all child hashtables of child AR_I in AR_Hashtable.
              • Unit Group - Remove (Picked unit) from AR_UnitGroup.
              • -------- --------
              • For each (Integer AR_I) from 0 to 17, do (Actions)
                • Loop - Actions
                  • Unit - Remove AR_Ability[AR_I] from (Picked unit)
              • -------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (AR_UnitGroup is empty) Equal to True
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
 

Attachments

  • Screenshot_4.png
    Screenshot_4.png
    88.1 KB · Views: 4
  • Screenshot_5.png
    Screenshot_5.png
    95.4 KB · Views: 5
  • Screenshot_6.png
    Screenshot_6.png
    90.2 KB · Views: 4
  • Screenshot_7.png
    Screenshot_7.png
    95.4 KB · Views: 5
Last edited:
Level 11
Joined
Jun 20, 2017
Messages
380
Ok, so I got it working perfectly, but there's just one problem!
Regardless of which tower attacks it, it must stack on the unit! How can I do this?
  • SAR On Damage
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • (Level of Toggle Armor Reduction (Neutral Hostile) [Custom] Blood Towers 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
      • (DamageEventSource is in SAR_UnitGroup.) Equal to True
    • Actions
      • Set VariableSet SAR_CV = (Custom value of DamageEventSource)
      • -------- --------
      • -------- Reset if it's a new target OR if the tower is upgrading --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • SAR_AttackTarget[SAR_CV] Not equal to DamageEventTarget
              • SAR_IsUpgrading[SAR_CV] Equal to True
        • Then - Actions
          • Set VariableSet SAR_ArmorReduction[SAR_CV] = 0
        • Else - Actions
      • -------- --------
      • -------- Store the target --------
      • Set VariableSet SAR_AttackTarget[SAR_CV] = DamageEventTarget
      • -------- --------
      • -------- Add the armor reduction ability if it doesn't exist --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Toggle Armor Reduction (Neutral Hostile) [Custom] Blood Towers for DamageEventSource) Equal to 0
        • Then - Actions
          • Unit - Add Toggle Armor Reduction (Neutral Hostile) [Custom] Blood Towers to DamageEventSource
        • Else - Actions
      • -------- --------
      • -------- Get how much armor reduction we're going to add --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of DamageEventSource) Equal to Blood Tower
        • Then - Actions
          • Set VariableSet SAR_Amount = 1
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of DamageEventSource) Equal to Blood Tower (Super)
            • Then - Actions
              • Set VariableSet SAR_Amount = 2
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of DamageEventSource) Equal to Blood Tower (Ultra)
                • Then - Actions
                  • Set VariableSet SAR_Amount = 3
                • Else - Actions
      • -------- --------
      • -------- Decrease the bonus armor reduction variable by this amount --------
      • Set VariableSet SAR_ArmorReduction[SAR_CV] = (Min((SAR_ArmorReduction[SAR_CV] - SAR_Amount), 1000000000))
      • -------- --------
      • -------- Apply armor reduction to the ability --------
      • Ability - Set Ability: (Unit: SAR_Dummy's Ability with Ability Code: Armor Reduction (Neutral Hostile) [Custom] Blood Towers / Inner Fi)'s Integer Level Field: Defense Increase ('Inf2') of Level: 0 to (SAR_ArmorReduction[SAR_CV] x 1)
      • Unit - Increase level of Armor Reduction (Neutral Hostile) [Custom] Blood Towers / Inner Fi for SAR_Dummy
      • Unit - Decrease level of Armor Reduction (Neutral Hostile) [Custom] Blood Towers / Inner Fi for SAR_Dummy
      • Unit - Order SAR_Dummy to Human Priest - Inner Fire SAR_AttackTarget[SAR_CV]
      • -------- --------
      • Game - Display to (All players) for 3.00 seconds the text: ((Name of DamageEventSource) + ( Armor Reduction: + (String(SAR_ArmorReduction[SAR_CV]))))
      • -------- --------
      • -------- Use the "GST system" to start a 10.00 second timer (or restart the existing one) --------
      • Set VariableSet GST_Trigger = SAR Reset Armor Reduction <gen>
      • Set VariableSet GST_RestartKey = SAR_CV
      • Custom script: call GST_Unit( udg_DamageEventSource, false, 10.00 )
  • SAR Toggle
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Level of Toggle Armor Reduction (Neutral Hostile) [Custom] Blood Towers for (Triggering unit)) Greater than 0
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(flamingarrows))
        • Then - Actions
          • Unit Group - Add (Triggering unit) to SAR_UnitGroup
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(unflamingarrows))
            • Then - Actions
              • Unit Group - Remove (Triggering unit) from SAR_UnitGroup.
            • Else - Actions
  • SAR Reset Armor Reduction
    • Events
    • Conditions
    • Actions
      • -------- This trigger is using the "GST system". It's hooked up to a timer that will expire after 10.00 seconds --------
      • -------- "GST_Unit1" = The DamageEventSource from "SAR On Damage" --------
      • -------- --------
      • -------- Reset the bonus armor reduction variable --------
      • Set VariableSet SAR_CV = (Custom value of GST_Unit1)
      • Set VariableSet SAR_ArmorReduction[SAR_CV] = 0
      • Set VariableSet SAR_AttackTarget[SAR_CV] = No unit
      • -------- --------
      • -------- Apply armor reduction to the ability --------
      • Ability - Set Ability: (Unit: GST_Unit1's Ability with Ability Code: Armor Reduction (Neutral Hostile) [Custom] Blood Towers / Inner Fi)'s Integer Level Field: Defense Increase ('Inf2') of Level: 0 to 0
      • Unit - Increase level of Armor Reduction (Neutral Hostile) [Custom] Blood Towers / Inner Fi for GST_Unit1
      • Unit - Decrease level of Armor Reduction (Neutral Hostile) [Custom] Blood Towers / Inner Fi for GST_Unit1
  • SAR Reset On Upgrade
    • Events
      • Unit - A unit Begins an upgrade
      • Unit - A unit Finishes an upgrade
      • Unit - A unit Cancels an upgrade
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Blood Tower
          • (Unit-type of (Triggering unit)) Equal to Blood Tower (Super)
          • (Unit-type of (Triggering unit)) Equal to Blood Tower (Ultra)
    • Actions
      • -------- Reset the bonus armor reduction variable --------
      • Set VariableSet SAR_CV = (Custom value of (Triggering unit))
      • Set VariableSet SAR_ArmorReduction[SAR_CV] = 0
      • Set VariableSet SAR_AttackTarget[SAR_CV] = No unit
      • -------- --------
      • -------- Apply armor reduction to the ability --------
      • Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: Armor Reduction (Neutral Hostile) [Custom] Blood Towers / Inner Fi)'s Integer Level Field: Defense Increase ('Inf2') of Level: 0 to 0
      • Unit - Increase level of Armor Reduction (Neutral Hostile) [Custom] Blood Towers / Inner Fi for (Triggering unit)
      • Unit - Decrease level of Armor Reduction (Neutral Hostile) [Custom] Blood Towers / Inner Fi for (Triggering unit)
  • SAR 1
    • Events
      • Unit - A unit Begins an upgrade
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Blood Tower
          • (Unit-type of (Triggering unit)) Equal to Blood Tower (Super)
          • (Unit-type of (Triggering unit)) Equal to Blood Tower (Ultra)
    • Actions
      • Set VariableSet SAR_IsUpgrading[(Custom value of (Triggering unit))] = True
      • -------- --------
      • Unit - Remove Toggle Armor Reduction (Neutral Hostile) [Custom] Blood Towers from (Triggering unit)
  • SAR 2
    • Events
      • Unit - A unit Finishes an upgrade
      • Unit - A unit Cancels an upgrade
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Blood Tower
          • (Unit-type of (Triggering unit)) Equal to Blood Tower (Super)
          • (Unit-type of (Triggering unit)) Equal to Blood Tower (Ultra)
    • Actions
      • Set VariableSet SAR_IsUpgrading[(Custom value of (Triggering unit))] = False
      • -------- --------
      • Unit - Add Toggle Armor Reduction (Neutral Hostile) [Custom] Blood Towers to (Triggering unit)
  • SAR Dummy
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Set VariableSet CenterOfRegion = (Center of (Playable map area))
      • Unit - Create 1 [Dummy] Armor Reduction for Player 1 (Red) at CenterOfRegion facing Default building facing degrees
      • Set VariableSet SAR_Dummy = (Last created unit)
      • Unit - Add Armor Reduction (Neutral Hostile) [Custom] Blood Towers / Inner Fi to SAR_Dummy
      • Custom script: call RemoveLocation(udg_CenterOfRegion)
 
Last edited:
Top