• 🏆 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] Decreases armor per hit

Status
Not open for further replies.
Level 10
Joined
Jun 20, 2017
Messages
333
I found this map, so I edited it but I got 2 problems
1. The special effect above the tower takes a long time to remove
2. The reduced number will not be gone

And how can I put 3 towers into the trigger since I don't understand hashtable
So if I have 3 towers the first tower will decreased 1 armor per hit, second tower 2 third tower 3
Is there anyway to use other variables(integer/real or other thing) instead of hashtable?!
Can I use only 2 trigger 1 base on A unit is attacked other base on A unit Takes damage?!
  • Decreases Armor
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hashtable_DecreasesArmor = (Last created hashtable)
      • Set Abilitys_DecreasesArmor[1] = Item Armor Bonus Mod -0001
      • Set Abilitys_DecreasesArmor[2] = Item Armor Bonus Mod -0002
      • Set Abilitys_DecreasesArmor[3] = Item Armor Bonus Mod -0004
      • Set Abilitys_DecreasesArmor[4] = Item Armor Bonus Mod -0008
      • Set Abilitys_DecreasesArmor[5] = Item Armor Bonus Mod -0016
      • Set Abilitys_DecreasesArmor[6] = Item Armor Bonus Mod -0032
      • Set Abilitys_DecreasesArmor[7] = Item Armor Bonus Mod -0064
      • Set Abilitys_DecreasesArmor[8] = Item Armor Bonus Mod -0128
      • Set Abilitys_DecreasesArmor[9] = Item Armor Bonus Mod -0256
      • Set Abilitys_DecreasesArmor[10] = Item Armor Bonus Mod -0512
      • Set Abilitys_DecreasesArmor[11] = Item Armor Bonus Mod -1024
      • Set Abilitys_DecreasesArmor[12] = Item Armor Bonus Mod -2048
      • Set Abilitys_DecreasesArmor[13] = Item Armor Bonus Mod -4096
      • Set UnitGroup_DecreasesArmor = (Units in (Playable map area))
      • Unit Group - Pick every unit in UnitGroup_DecreasesArmor and do (Actions)
        • Loop - Actions
          • Trigger - Add to Decreases Armor3 <gen> the event (Unit - (Picked unit) Takes damage)
      • Custom script: call DestroyGroup(udg_UnitGroup_DecreasesArmor)
  • Decreases Armor2
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Trigger - Add to Decreases Armor3 <gen> the event (Unit - (Triggering unit) Takes damage)
  • Decreases Armor3
    • Events
    • Conditions
      • (Level of Decreases Armor2 for (Damage source)) Greater than 0
    • Actions
      • Set Integer_DecreasesArmor = (Key (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in UnitGroup_DecreasesArmor) Equal to False
        • Then - Actions
          • Unit Group - Add (Triggering unit) to UnitGroup_DecreasesArmor
          • Trigger - Turn on Decreases Armor4 <gen>
          • Special Effect - Create a special effect attached to the <Empty String> of (Triggering unit) using Abilities\Spells\Orc\CommandAura\CommandAura.mdl
          • Hashtable - Save Handle Of(Last created special effect) as 0 of Integer_DecreasesArmor in Hashtable_DecreasesArmor
        • Else - Actions
      • Hashtable - Save 5.00 as 0 of Integer_DecreasesArmor in Hashtable_DecreasesArmor
      • Set Integer_DecreasesArmor2 = ((Load 0 of Integer_DecreasesArmor from Hashtable_DecreasesArmor) + 1)
      • Hashtable - Save Integer_DecreasesArmor2 as 0 of Integer_DecreasesArmor in Hashtable_DecreasesArmor
      • For each (Integer Integer_DecreasesArmor) from 1 to 13, do (Actions)
        • Loop - Actions
          • Unit - Remove Abilitys_DecreasesArmor[Integer_DecreasesArmor] from (Triggering unit)
      • Custom script: loop
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_DecreasesArmor Greater than 0
          • Integer_DecreasesArmor2 Greater than 0
        • Then - Actions
          • Set Integer_DecreasesArmor = (Integer_DecreasesArmor - 1)
          • Set Real_DecreasesArmor = (Power(2.00, (Real(Integer_DecreasesArmor))))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Real(Integer_DecreasesArmor2)) Greater than or equal to Real_DecreasesArmor
            • Then - Actions
              • Unit - Add Abilitys_DecreasesArmor[Integer_DecreasesArmor] to (Triggering unit)
              • Set Integer_DecreasesArmor2 = (Integer_DecreasesArmor2 - (Integer(Real_DecreasesArmor)))
            • Else - Actions
        • Else - Actions
          • Custom script: exitwhen true
      • Custom script: endloop
  • Decreases Armor4
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in UnitGroup_DecreasesArmor and do (Actions)
        • Loop - Actions
          • Set Integer_DecreasesArmor = (Key (Picked unit))
          • Set Real_DecreasesArmor = ((Load 0 of Integer_DecreasesArmor from Hashtable_DecreasesArmor) - 0.10)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Real_DecreasesArmor Greater than 0.00
            • Then - Actions
              • Hashtable - Save Real_DecreasesArmor as 0 of Integer_DecreasesArmor in Hashtable_DecreasesArmor
            • Else - Actions
              • Special Effect - Destroy (Load 0 of Integer_DecreasesArmor in Hashtable_DecreasesArmor)
              • Hashtable - Clear all child hashtables of child Integer_DecreasesArmor in Hashtable_DecreasesArmor
              • Unit Group - Remove (Picked unit) from UnitGroup_DecreasesArmor
              • For each (Integer Integer_DecreasesArmor) from 1 to 13, do (Actions)
                • Loop - Actions
                  • Unit - Remove Abilitys_DecreasesArmor[Integer_DecreasesArmor] from (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (UnitGroup_DecreasesArmor is empty) Equal to True
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
 

Attachments

  • Armor Reduction.w3x
    16.6 KB · Views: 22
Last edited:
Status
Not open for further replies.
Top