• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Stackable bonus damage! [Solved]

Level 11
Joined
Jun 20, 2017
Messages
380
I have a tower that gains 200 damage every minute it's alive.
A total of 60 stacks.

Based on this I edited my triggers to these, now how can I make it so that it can only stack 60 times?
TD - Random builder option + Tower damage stacking trigger + Tesla tower trigger + Deal damage in AOE with an added effect
  • Tower Build
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Guard Tower
    • Actions
      • Unit Group - Add (Constructed structure) to Tower_Group
      • -------- --------
      • Trigger - Turn on Tower Add <gen>
  • Tower Subtract
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Guard Tower
    • Actions
      • Set VariableSet Tower_PN = (Player number of (Owner of (Triggering unit)))
      • Set VariableSet Tower_Count[Tower_PN] = (Tower_Count[Tower_PN] - 1)
      • -------- --------
      • -------- Adjust damage: --------
      • Set VariableSet Tower_Damage = (200 x Tower_Count[Tower_PN])
      • Unit Group - Pick every unit in Tower_Group and do (Actions)
        • Loop - Actions
          • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Item Damage Bonus (+200))'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Tower_Damage
          • Unit - Increase level of Item Damage Bonus (+200) for (Picked unit)
          • Unit - Decrease level of Item Damage Bonus (+200) for (Picked unit)
  • Tower Add
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet Tower_PN = (Player number of (Owner of (Triggering unit)))
      • Set VariableSet Tower_Count[Tower_PN] = (Tower_Count[Tower_PN] + 1)
      • -------- --------
      • -------- Adjust damage: --------
      • Set VariableSet Tower_Damage = (200 x Tower_Count[Tower_PN])
      • Unit Group - Pick every unit in Tower_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Item Damage Bonus (+200))'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Tower_Damage
              • Unit - Increase level of Item Damage Bonus (+200) for (Picked unit)
              • Unit - Decrease level of Item Damage Bonus (+200) for (Picked unit)
            • Else - Actions
 
Last edited:
Level 30
Joined
Aug 29, 2012
Messages
1,385
You could use e.g. custom value to keep track of the number of stacks. Every 2 seconds, you increase the custom value of the picked towers by 1, then in your last "if" check, add "custom value of picked unit less than 60"

If you're using custom value for something else, there are quite a few rarely used data fields that you can store information in

  • Unit - Set Unit: (Picked unit)'s Integer Field: Lumber Bounty Awarded - Base ('ulba') to Value: ((Unit: (Picked unit)'s Integer Field: Lumber Bounty Awarded - Base ('ulba')) + 1)
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
You shouldn't be using Custom Value without a Unit Indexer. Assuming you don't have one already, you should definitely import one.

Anyway, here's what I think you're trying to do. I based it on this description:
I have a tower that gains 200 damage every minute it's alive.
A total of 60 stacks.
Each tower tracks it's own time and damage.

  • Time Tower Add
    • Events
      • Unit - A unit Finishes construction
      • Unit - A unit Finishes an upgrade
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Time Tower
    • Actions
      • Set VariableSet TimeTower_Unit = (Triggering unit)
      • Set VariableSet TimeTower_CV = (Custom value of TimeTower_Unit)
      • -------- --------
      • -------- Reset data just in case --------
      • Set VariableSet TimeTower_Ticks[TimeTower_CV] = 0
      • Set VariableSet TimeTower_Damage[TimeTower_CV] = 0
      • -------- --------
      • Set VariableSet TimeTower_Count = TimeTower_Count + 1
      • Unit Group - Add TimeTower_Unit to TimeTower_UnitGroup
      • -------- --------
      • Trigger - Turn on Time Tower Loop <gen>
  • Time Tower Remove
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Time Tower
      • ((Triggering unit) is in TimeTower_UnitGroup) Equal to True
    • Actions
      • Set VariableSet TimeTower_Count = TimeTower_Count - 1
      • Unit Group - Remove (Triggering unit) from TimeTower_UnitGroup
  • Time Tower Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in TimeTower_UnitGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet TimeTower_Unit = (Picked unit)
          • Set VariableSet TimeTower_CV = (Custom value of TimeTower_Unit)
          • Set VariableSet TimeTower_Ticks[TimeTower_CV] = (TimeTower_Ticks[TimeTower_CV] + 1)
          • -------- --------
          • -------- If 60.00 seconds has passed then improve it's damage --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TimeTower_Ticks[TimeTower_CV] Equal to 60
            • Then - Actions
              • -------- Reset ticks to continue tracking how much time has passed --------
              • Set VariableSet TimeTower_Ticks[TimeTower_CV] = 0
              • -------- --------
              • -------- Adjust damage --------
              • Set VariableSet TimeTower_Damage[TimeTower_CV] = (TimeTower_Damage[TimeTower_CV] + 200)
              • -------- --------
              • Ability - Set Ability: (Unit: TimeTower_Unit's Ability with Ability Code: Time [Custom] Time Tower / Storm Hammers)'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to TimeTower_Damage[TimeTower_CV]
              • Unit - Increase level of Time [Custom] Time Tower / Storm Hammers for TimeTower_Unit
              • Unit - Decrease level of Time [Custom] Time Tower / Storm Hammers for TimeTower_Unit
              • -------- --------
              • -------- Stop increasing it's damage once it's reached the limit --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TimeTower_Damage[TimeTower_CV] Greater than or equal to 12000
                • Then - Actions
                  • Set VariableSet TimeTower_Count = TimeTower_Count - 1
                  • Unit Group - Remove TimeTower_Unit from TimeTower_UnitGroup
                • Else - Actions
            • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TimeTower_Count Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
Genius as always, thanks, solved.
No problem ;)

One quick change, just to be safe:
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Time Tower
    • ((Triggering unit) is in TimeTower_UnitGroup) Equal to True
^ Make sure we only Remove the tower if it's actually in the group. Otherwise, there's a rare chance that it gets Removed twice which will screw up the TimeTower_Count variable.
 
Top