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

Triggering upgrades to tower defense

Level 7
Joined
Feb 23, 2020
Messages
253
Hello, im making a tower defense and i have a question if i can simply this trigger to avoid the headache since there will be A LOT more upgrades.

  • Hero Level 10 Upgrade
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Level of Hero Classification (Hidden) for (Triggering unit)) Equal to 1
    • Actions
      • -------- --------
      • -------- Archmage --------
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Archmage Lvl 1
        • Then - Actions
          • Unit - Set level of Brilliance Aura (ArchMage Hero) for (Triggering unit) to 10
          • Unit - Set Name of Hero_Unit to Archmage Lvl 10
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to Blizzard (Archmage Dummy)
            • Then - Actions
              • Unit - Remove (Ability being cast) from (Triggering unit)
              • -------- --------
              • Unit - Set Max Mana of (Triggering unit) to 70
              • -------- --------
              • Unit - Add Blizzard (Archmage) to (Triggering unit)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Ability being cast) Equal to Water (Archmage Dummy)
                • Then - Actions
                  • Unit - Remove (Ability being cast) from (Triggering unit)
                  • -------- --------
                  • Unit - Set Max Mana of (Triggering unit) to 80
                  • -------- --------
                  • Unit - Add Water (Archmage) to (Triggering unit)
                • Else - Actions
        • Else - Actions
          • -------- --------
          • -------- Firelord --------
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal to Firelord Lvl 1
            • Then - Actions
              • Unit - Set level of Flame Aura (Firelord Hero) for (Triggering unit) to 10
              • Unit - Set Name of Hero_Unit to Firelord Lvl 10
              • -------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Ability being cast) Equal to Spitting Fire (Firelord Dummy)
                • Then - Actions
                  • Unit - Remove (Ability being cast) from (Triggering unit)
                  • -------- --------
                  • Unit - Set Max Mana of (Triggering unit) to 60
                  • -------- --------
                  • Unit - Add Spitting Fire (Firelord) to (Triggering unit)
                • Else - Actions
            • Else - Actions
So, i have 12 Heroes, and the goals is for each hero, at level 10 to gain different ability paths. This trigger will just go on and on.

Thanks in advance!
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
You can use a Hashtable and store the data using the Unit-Type as the Parent Key and the Ability Level, New Name, New Mana, and New Ability as the Child keys. This is nice for keeping trigger and variable count low and is extremely dynamic.

Alternatively, you can use Variable Arrays to simplify things at the cost of organization. You'd have one trigger per Hero which manages their upgrades process and make it so the Upgrade Abilities are linked to each Trigger. Here's an example:

Let's use Arrays to link our Lvl 10 Upgrade Abilities and their associated Triggers together:
  • Events
    • Map initialization
  • Conditions
  • Actions
    • Set Variable Lvl_10_Ability[1] = Archmage Lvl 10 Upgrade Ability
    • Set Variable Lvl_10_Ability[2] = Firelord Lvl 10 Upgrade Ability
    • -------- --------
    • Set Variable Lvl_10_Trigger[1] = Archmage Lvl 10 Upgrade
    • Set Variable Lvl_10_Trigger[2] = Firelord Lvl 10 Upgrade
Let's use Unit Indexing to track whether our Hero is ready to Upgrade or not:
  • Events
    • Unit - A Unit gains a level
  • Conditions
    • (Level of Hero Classification (Hidden) for (Triggering unit)) Equal to 1
    • (Level of (Triggering unit)) Equal to 10
  • Actions
    • Set Variable Hero_Can_Upgrade[(Custom value of (Triggering unit)] = True
Let's detect when our Hero uses one of their Upgrade Abilities:
  • Hero Level 10 Upgrade
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Level of Hero Classification (Hidden) for (Triggering unit)) Equal to 1
      • Hero_Can_Upgrade[(Custom value of (Triggering unit)] Equal to True
    • Actions
      • Set Variable Hero_Unit = (Triggering unit)
      • Set Variable Hero_CV = (Custom value of Hero_Unit)
      • Set Variable Hero_Abil = (Ability being cast)
      • -------- Make sure to update the number 2 in this Loop to be equal to your highest [index] (this will be 12 in your case) --------
      • For each integer Upg_Index from 1 to 2 do (Actions)
        • Loop - Actions
          • If - Conditions
            • Hero_Abil Equal to Lvl_10_Ability[Upg_Index]
          • Then - Actions
            • Set Variable Hero_Can_Upgrade[Hero_CV] = False
            • Unit - Remove Hero_Abil from Hero_Unit
            • Trigger - Run Lvl_10_Trigger[Upg_Index] (ignoring conditions)
          • Else - Actions
Let's begin creating the Triggers which run when the Heroes "upgrade". These are what we track in our Array:
  • Archmage Lvl 10 Upgrade
    • Events
    • Conditions
    • Actions
      • Unit - Set level of Brilliance Aura (ArchMage Hero) for Hero_Unit to 10
      • Unit - Set Name of Hero_Unit to Archmage Lvl 10
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Hero_Abil Equal to Blizzard (Archmage Dummy)
        • Then - Actions
          • Unit - Set Max Mana of Hero_Unit to 70
          • Unit - Add Blizzard (Archmage) to Hero_Unit
        • Else - Actions
          • If - Conditions
            • Hero_Abil Equal to Water (Archmage Dummy)
          • Then - Actions
            • Unit - Set Max Mana of Hero_Unit to 80
            • Unit - Add Water (Archmage) to Hero_Unit
          • Else - Actions
Then create the Firelord Lvl 10 Upgrade trigger and set it up the same way I did the Archmage Lvl 10 Upgrade trigger, customizing it however way you'd like.

Note the use of Variables to keep things efficient and organized.

The Hero_Can_Upgrade boolean array is there to make sure that our Hero Level 10 Upgrade trigger is only running it's Actions when the hero can actually upgrade (in other words, they've reached level 10 and haven't used an Upgrade Ability yet). This REQUIRES Unit Indexing, which is an amazing and lightweight system that should be in every GUI map - imo.

Keep in mind, this approach would require 15 triggers in total for 12 heroes (+1 per hero) where as the Hashtable approach would only require about 4 triggers in total, although if you're unfamiliar with Hashtables it can be a lot more challenging.
 
Last edited:
Level 7
Joined
Feb 23, 2020
Messages
253
Thank you, i'd like to use hashtables but i'm very unfamiliar with it. This approach would probably work the best for me even though all the triggers.
 
Level 7
Joined
Feb 23, 2020
Messages
253
  • Hero Level 10 Upgrade
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Level of Hero Classification (Hidden) for (Triggering unit)) Equal to 1
      • Hero_Can_Upgrade[(Custom value of (Triggering unit)] Equal to True
    • Actions
      • Set Variable Hero_Unit = (Triggering unit)
      • Set Variable Hero_CV = (Custom value of Hero_Unit)
      • Set Variable Hero_Abil = (Ability being cast)
      • -------- Make sure to update the number 2 in this Loop to be equal to your highest [index] (this will be 12 in your case) --------
      • For each integer Upg_Index from 1 to 2 do (Actions)
        • Loop - Actions
          • If - Conditions
            • Hero_Abil Equal to Lvl_10_Ability[Upg_Index]
          • Then - Actions
            • Set Variable Hero_Can_Upgrade[Hero_CV] = False
            • Unit - Remove Hero_Abil from Hero_Unit
            • Trigger - Run Lvl_10_Trigger[Upg_Index] (ignoring conditions)
          • Else - Actions

Question, what exactly is this loop used for?


Also, i could paste this Trigger aswell for you too understand my entire idea here.

  • Hero Upgrades
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Upgrade Hero (Dummy)
    • Actions
      • Unit - Move (Trained unit) instantly to (Center of Hero Upgrades <gen>)
      • -------- --------
      • Set VariableSet Hero_Unit = (Triggering unit)
      • Set VariableSet Hero_CV = (Custom value of Hero_Unit)
      • -------- --------
      • -------- --------
      • Set VariableSet Hero_DamageBonus[Hero_CV] = 20
      • Set VariableSet Hero_HealthBonus[Hero_CV] = 200
      • Set VariableSet Hero_CurrentLevel[Hero_CV] = (Hero_CurrentLevel[Hero_CV] + 1)
      • Set VariableSet Hero_AbilityLevel[Hero_CV] = (Hero_AbilityLevel[Hero_CV] + 1)
      • Set VariableSet Hero_NameInteger[Hero_CV] = (Hero_NameInteger[Hero_CV] + 1)
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Hero_AbilityLevel[Hero_CV] Equal to 1
        • Then - Actions
          • Set VariableSet Hero_AbilityLevel[Hero_CV] = 2
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Hero_NameInteger[Hero_CV] Equal to 1
        • Then - Actions
          • Set VariableSet Hero_NameInteger[Hero_CV] = 2
        • Else - Actions
      • -------- --------
      • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of Hero_Unit for weapon index 0) + Hero_DamageBonus[Hero_CV]) for weapon index: 0
      • Unit - Set Max HP of Hero_Unit to ((Max HP of Hero_Unit) + Hero_HealthBonus[Hero_CV])
      • Unit - Set life of Hero_Unit to (Max life of Hero_Unit)
      • -------- --------
      • -------- --------
      • -------- Archmage Hero --------
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of Hero_Unit) Equal to Archmage Lvl 1
        • Then - Actions
          • -------- --------
          • Unit - Set level of Brilliance Aura (ArchMage Hero) for Hero_Unit to Hero_AbilityLevel[Hero_CV]
          • Unit - Set Name of Hero_Unit to (Archmage Lvl + (String(Hero_NameInteger[Hero_CV])))
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Hero_AbilityLevel[Hero_CV] Equal to 9
            • Then - Actions
              • Unit - Add Blizzard (Archmage Dummy) to Hero_Unit
            • Else - Actions
        • Else - Actions
          • -------- --------
          • -------- Samuro Hero --------
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of Hero_Unit) Equal to Samuro Hero Lvl 1
            • Then - Actions
              • -------- --------
              • Unit - Set level of Endurance Aura (Samuro Hero) for Hero_Unit to Hero_AbilityLevel[Hero_CV]
              • Unit - Set Name of Hero_Unit to (Samuro Lvl + (String(Hero_NameInteger[Hero_CV])))
              • -------- --------
            • Else - Actions
              • -------- --------
              • -------- Lich Hero --------
              • -------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of Hero_Unit) Equal to Lich Lvl 1
                • Then - Actions
                  • -------- --------
                  • Unit - Set level of Chilling Aura (Lich Hero) for Hero_Unit to Hero_AbilityLevel[Hero_CV]
                  • Unit - Set Name of Hero_Unit to (Lich Lvl + (String(Hero_NameInteger[Hero_CV])))
                  • -------- --------
                • Else - Actions
                  • -------- --------
                  • -------- Paladin Hero --------
                  • -------- --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of Hero_Unit) Equal to Paladin Hero Lvl 1
                    • Then - Actions
                      • -------- --------
                      • Unit - Set level of Armor Aura (Paladin Hero) for Hero_Unit to Hero_AbilityLevel[Hero_CV]
                      • Unit - Set Name of Hero_Unit to (Paladin Lvl + (String(Hero_NameInteger[Hero_CV])))
                      • -------- --------
                    • Else - Actions
                      • -------- --------
                      • -------- Huntress Hero --------
                      • -------- --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of Hero_Unit) Equal to Huntress Lvl 1
                        • Then - Actions
                          • -------- --------
                          • Unit - Set level of Trueshot Aura (Huntress Hero) for Hero_Unit to Hero_AbilityLevel[Hero_CV]
                          • Unit - Set Name of Hero_Unit to (Huntress Lvl + (String(Hero_NameInteger[Hero_CV])))
                          • -------- --------
                        • Else - Actions
                          • -------- --------
                          • -------- Tauren Hero --------
                          • -------- --------
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Unit-type of Hero_Unit) Equal to Tauren Hero Lvl 1
                            • Then - Actions
                              • -------- --------
                              • Unit - Set level of Command Aura (Tauren Hero) for Hero_Unit to Hero_AbilityLevel[Hero_CV]
                              • Unit - Set Name of Hero_Unit to (Tauren Lvl + (String(Hero_NameInteger[Hero_CV])))
                              • -------- --------
                            • Else - Actions
                              • -------- --------
                              • -------- Dreadlord Hero --------
                              • -------- --------
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Unit-type of Hero_Unit) Equal to Dreadlord Hero Lvl 1
                                • Then - Actions
                                  • -------- --------
                                  • Unit - Set level of Vampiric Aura (Dreadlord Hero) for Hero_Unit to Hero_AbilityLevel[Hero_CV]
                                  • Unit - Set Name of Hero_Unit to (Dreadlord Lvl + (String(Hero_NameInteger[Hero_CV])))
                                  • -------- --------
                                • Else - Actions
                                  • -------- --------
                                  • -------- Firelord Hero --------
                                  • -------- --------
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Unit-type of Hero_Unit) Equal to Firelord Lvl 1
                                    • Then - Actions
                                      • -------- --------
                                      • Unit - Set level of Flame Aura (Firelord Hero) for Hero_Unit to Hero_AbilityLevel[Hero_CV]
                                      • Unit - Set Name of Hero_Unit to (Firelord Lvl + (String(Hero_NameInteger[Hero_CV])))
                                      • -------- --------
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • Hero_AbilityLevel[Hero_CV] Equal to 9
                                        • Then - Actions
                                          • Unit - Add Spitting Fire (Firelord Dummy) to Hero_Unit
                                        • Else - Actions
                                    • Else - Actions
                                      • -------- --------
                                      • -------- Alchemist Hero --------
                                      • -------- --------
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (Unit-type of Hero_Unit) Equal to Alchemist Hero Lvl 1
                                        • Then - Actions
                                          • -------- --------
                                          • Unit - Set level of Alchemical Aura (Alchemist Hero) for Hero_Unit to (1 + Hero_AbilityLevel[Hero_CV])
                                          • Unit - Set Name of Hero_Unit to (Alchemist Lvl + (String(Hero_NameInteger[Hero_CV])))
                                          • -------- --------
                                        • Else - Actions
                                          • -------- --------
                                          • -------- Scarab Hero --------
                                          • -------- --------
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • (Unit-type of Hero_Unit) Equal to Scarab Hero Lvl 1
                                            • Then - Actions
                                              • -------- --------
                                              • Unit - Set level of Thorns Aura (Scarab Hero) for Hero_Unit to Hero_AbilityLevel[Hero_CV]
                                              • Unit - Set Name of Hero_Unit to (Scarab Lvl + (String(Hero_NameInteger[Hero_CV])))
                                              • -------- --------
                                            • Else - Actions
                                              • -------- --------
                                              • -------- Scoundrel Hero --------
                                              • -------- --------
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • (Unit-type of Hero_Unit) Equal to Scoundrel Lvl 1
                                                • Then - Actions
                                                  • -------- --------
                                                  • Unit - Set level of Holy Aura (Scoundrel Hero) for Hero_Unit to Hero_AbilityLevel[Hero_CV]
                                                  • Unit - Set Name of Hero_Unit to (Scoundrel Lvl + (String(Hero_NameInteger[Hero_CV])))
                                                  • -------- --------
                                                • Else - Actions
                                                  • -------- --------
                                                  • -------- Banshee Hero --------
                                                  • -------- --------
                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    • If - Conditions
                                                      • (Unit-type of Hero_Unit) Equal to Banshee Lvl 1
                                                    • Then - Actions
                                                      • -------- --------
                                                      • Unit - Set level of Death Aura (Banshee Hero) for Hero_Unit to Hero_AbilityLevel[Hero_CV]
                                                      • Unit - Set Name of Hero_Unit to (Banshee Lvl + (String(Hero_NameInteger[Hero_CV])))
                                                      • -------- --------
                                                    • Else - Actions
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
I assumed your Hero was upgrading by using an Ability.

The For Loop checks which ability was used and runs a trigger based on that. It's the basic method for avoiding long nested If Then Else statements.

If ability = A then run trigger A
If ability = B then run trigger B
If ability = C then run trigger C

etc...
 
Level 7
Joined
Feb 23, 2020
Messages
253
I assumed your Hero was upgrading by using an Ability.

The For Loop checks which ability was used and runs a trigger based on that. It's the basic method for avoiding long nested If Then Else statements.

If ability = A then run trigger A
If ability = B then run trigger B
If ability = C then run trigger C

etc...
Its upgraded by training a unit, as you can see in my trigger above they all use the same Upgrade Dummy Unit.

For the final level, from 9-10, they will gain X amount of dummy abilities to be selected as their final upgrade. Once chosen, for example the Blizzard dummy spell, the gain the actuall blizzard spell etc.

Does the setup with the loop work when there are multiple of dummy abilities for the same unit then?
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
Do you understand what the For Loop is doing? It doesn't need to check an Ability, you can change it to use any kind of Event/Variables you want:
  • Hero Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Variable Upgrade_Hero_Type[1] = Archmage
      • Set Variable Upgrade_Trigger[1] = Archmage Upgraded
      • Set Variable Upgrade_Hero_Type[2] = Firelord
      • Set Variable Upgrade_Trigger[2] = Firelord Upgraded
  • Hero Upgrade
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Upgrade Hero (Dummy)
    • Actions
      • Set Variable Hero_Unit = (Triggering unit)
      • Set Variable Hero_Type = (Unit-type of Hero_Unit)
      • -------- The loop should go from your Array range X -> Y where X is the lowest [index] and Y is the highest [index] --------
      • For each integer Upg_Index from 1 to 2 do (Actions)
        • Loop - Actions
          • If - Conditions
            • Hero_Type Equal to Upgrade_Hero_Type[Upg_Index]
          • Then - Actions
            • -------- Put generic Actions here that will happen for every Hero --------
            • Trigger - Run Upgrade_Trigger[Upg_Index] (ignoring conditions)
          • Else - Actions
So here I am detecting when a Hero upgrades and I am running a trigger based on their unit-type. This trigger will be specific to the hero.

My other example was showing how you could detect which Ability Path was chosen by using Ability Events/Variables.

You want to use both of these so that you can detect when they Upgrade as well as when they choose an Ability Path.

The final result:
You'll have two setup triggers where you define your data using Arrays at map initialization. When you add a new hero to the game you would want to add their data to these triggers as well. Or you could combine these into one trigger if you'd like.

You'll have two core triggers, one which runs when a hero upgrades (trains a dummy) and one which runs when a hero chooses an ability path (casts an ability from said path). The above Hero Upgrade trigger is an example of a core trigger for upgrading the hero.

You'll have two custom triggers per hero, an upgrade trigger specific to them and an ability path trigger specific to them. These are what run from the core triggers and vary based on the hero-type or ability-type.

This allows you to create unique triggers for each Hero which can then be organized into their own Hero folders. Then you can create one folder dedicated to the Hero Upgrade System or whatever you want to call it where you can put the Setup/Core triggers.
 
Last edited:
Level 7
Joined
Feb 23, 2020
Messages
253
Sorry.. i'm having problem putting it all together

First off, when i set up multiple dummy abilities for the same unit, it does not work with the loop as intended

Second, when casting the dummy ability, only the casted ability gets removed. All of the dummy abilities are supposed to be removed which is intended as you can only choose one path for your hero and not multiple ones. But maybe the only option is to manually make actions to remove all of them individually?

  • Hereo Level 10 inst
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet Hero_Lvl10_Ability[1] = Blizzard (Archmage Dummy)
      • Set VariableSet Hero_Lvl10_Ability[2] = Water (Archmage Dummy)
      • Set VariableSet Hero_Lvl10_Ability[3] = Barrage (Archmage Dummy)
      • Set VariableSet Hero_Lvl10_Ability[4] = Spitting Fire (Firelord Dummy)
      • -------- --------
      • Set VariableSet Hero_Lvl10_Trigger[1] = Archmage Lvl 10 Upgrade <gen>
      • Set VariableSet Hero_Lvl10_Trigger[2] = Firelord Lvl 10 Upgrade <gen>
I do understand the setup is incorrect to the loop, but i'm not sure how to correctly set it up.

  • Hero Level 10 Upgrade
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Level of Hero Classification (Hidden) for (Triggering unit)) Equal to 1
      • Hero_CanUpgrade[(Custom value of (Triggering unit))] Equal to True
    • Actions
      • Set VariableSet Hero_Unit = (Triggering unit)
      • Set VariableSet Hero_CV = (Custom value of Hero_Unit)
      • Set VariableSet Hero_Ability = (Ability being cast)
      • -------- --------
      • For each (Integer Hero_LoopInteger) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Hero_Ability Equal to Hero_Lvl10_Ability[Hero_LoopInteger]
            • Then - Actions
              • Set VariableSet Hero_CanUpgrade[Hero_CV] = False
              • Unit - Remove Hero_Ability from Hero_Unit
              • Trigger - Run Hero_Lvl10_Trigger[Hero_LoopInteger] (ignoring conditions)
            • Else - Actions
  • Archmage Lvl 10 Upgrade
    • Events
    • Conditions
    • Actions
      • -------- --------
      • Unit - Set level of Brilliance Aura (ArchMage Hero) for (Triggering unit) to 10
      • Unit - Set Name of Hero_Unit to Archmage Lvl 10
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Hero_Ability Equal to Blizzard (Archmage Dummy)
        • Then - Actions
          • Unit - Remove (Ability being cast) from (Triggering unit)
          • -------- --------
          • Unit - Set Max Mana of (Triggering unit) to 70
          • -------- --------
          • Unit - Add Blizzard (Archmage) to (Triggering unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Hero_Ability Equal to Holy Chain (Archmage Dummy)
            • Then - Actions
              • Unit - Remove (Ability being cast) from (Triggering unit)
              • -------- --------
              • Unit - Set Max Mana of (Triggering unit) to 70
              • -------- --------
              • Unit - Add Holy Chain (Archmage) to (Triggering unit)
            • Else - Actions
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
Here's an example map. Remember to use the variables and not rely on Event Responses that have already been stored as variables.

You'll need to modify the HUS Setup, HUS Upgrade Chosen, and HUS Ability Path Chosen triggers to use your desired Conditions since I'm doing things like this:
  • (Trained unit-type) Equal to Footman
Obviously you want that to be your Upgrade Hero (Dummy) instead.

Then inside of the folders for the Paladin and Archmage you would customize those Upgrade and Ability Path triggers to do whatever you want for those specific heroes. Again, your map may not have a Paladin so you would rename that to match a Hero that does exist, it's just an example.

But maybe the only option is to manually make actions to remove all of them individually?
It's not the only option but I think it's a perfectly reasonable option. You can also use a For Loop to remove them, you'll just need to make sure you use the correct index range associated with the Abilities array (loop from X to Y).
 

Attachments

  • Hero Upgrade System 1.w3m
    18.8 KB · Views: 1
Last edited:
Level 7
Joined
Feb 23, 2020
Messages
253
I'm very grateful!

So in the HUS Upgrade trigger you will upgrade the hero aura ability, damage, health etc. and the ability path trigger is the "final" one, when they reach level 10 and gets to chose an ability?

Therefore this trigger is no longer needed?

  • Hero Upgrades
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Upgrade Hero (Dummy)
    • Actions
      • Unit - Move (Trained unit) instantly to (Center of Hero Upgrades <gen>)
      • -------- --------
      • Set VariableSet Hero_Unit = (Triggering unit)
      • Set VariableSet Hero_CV = (Custom value of Hero_Unit)
      • -------- --------
      • -------- --------
      • Set VariableSet Hero_DamageBonus[Hero_CV] = 20
      • Set VariableSet Hero_HealthBonus[Hero_CV] = 200
      • Set VariableSet Hero_CurrentLevel[Hero_CV] = (Hero_CurrentLevel[Hero_CV] + 1)
      • Set VariableSet Hero_AbilityLevel[Hero_CV] = (Hero_AbilityLevel[Hero_CV] + 1)
      • Set VariableSet Hero_NameInteger[Hero_CV] = (Hero_NameInteger[Hero_CV] + 1)
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Hero_AbilityLevel[Hero_CV] Equal to 1
        • Then - Actions
          • Set VariableSet Hero_AbilityLevel[Hero_CV] = 2
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Hero_NameInteger[Hero_CV] Equal to 1
        • Then - Actions
          • Set VariableSet Hero_NameInteger[Hero_CV] = 2
        • Else - Actions
      • -------- --------
      • Unit - Set Base Damage of (Triggering unit) to ((Base Damage of Hero_Unit for weapon index 0) + Hero_DamageBonus[Hero_CV]) for weapon index: 0
      • Unit - Set Max HP of Hero_Unit to ((Max HP of Hero_Unit) + Hero_HealthBonus[Hero_CV])
      • Unit - Set life of Hero_Unit to (Max life of Hero_Unit)
      • -------- --------
      • -------- Archmage Hero --------
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of Hero_Unit) Equal to Archmage Lvl 1
        • Then - Actions
          • -------- --------
          • Unit - Set level of Brilliance Aura (ArchMage Hero) for Hero_Unit to Hero_AbilityLevel[Hero_CV]
          • Unit - Set Name of Hero_Unit to (Archmage Lvl + (String(Hero_NameInteger[Hero_CV])))
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Hero_AbilityLevel[Hero_CV] Equal to 10
            • Then - Actions
              • Set VariableSet Hero_CanUpgrade[Hero_CV] = True
              • Unit - Add Blizzard (Archmage Dummy) to Hero_Unit
              • Unit - Add Holy Chain (Scoundrel Dummy) to Hero_Unit
            • Else - Actions
        • Else - Actions
          • -------- --------
          • -------- Samuro Hero --------
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of Hero_Unit) Equal to Samuro Hero Lvl 1
            • Then - Actions
              • -------- --------
              • Unit - Set level of Endurance Aura (Samuro Hero) for Hero_Unit to Hero_AbilityLevel[Hero_CV]
              • Unit - Set Name of Hero_Unit to (Samuro Lvl + (String(Hero_NameInteger[Hero_CV])))
              • -------- --------
            • Else - Actions
              • -------- --------
              • -------- Lich Hero --------
              • -------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of Hero_Unit) Equal to Lich Lvl 1
                • Then - Actions
                  • -------- --------
                  • Unit - Set level of Chilling Aura (Lich Hero) for Hero_Unit to Hero_AbilityLevel[Hero_CV]
                  • Unit - Set Name of Hero_Unit to (Lich Lvl + (String(Hero_NameInteger[Hero_CV])))
                  • -------- --------
                • Else - Actions
                  • -------- --------
                  • -------- Paladin Hero --------
                  • -------- --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of Hero_Unit) Equal to Paladin Hero Lvl 1
                    • Then - Actions
                      • -------- --------
                      • Unit - Set level of Armor Aura (Paladin Hero) for Hero_Unit to Hero_AbilityLevel[Hero_CV]
                      • Unit - Set Name of Hero_Unit to (Paladin Lvl + (String(Hero_NameInteger[Hero_CV])))
                      • -------- --------
                    • Else - Actions
                      • -------- --------
                      • -------- Huntress Hero --------
                      • -------- --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of Hero_Unit) Equal to Huntress Lvl 1
                        • Then - Actions
                          • -------- --------
                          • Unit - Set level of Trueshot Aura (Huntress Hero) for Hero_Unit to Hero_AbilityLevel[Hero_CV]
                          • Unit - Set Name of Hero_Unit to (Huntress Lvl + (String(Hero_NameInteger[Hero_CV])))
                          • -------- --------
                        • Else - Actions
                          • -------- --------
                          • -------- Tauren Hero --------
                          • -------- --------
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Unit-type of Hero_Unit) Equal to Tauren Hero Lvl 1
                            • Then - Actions
                              • -------- --------
                              • Unit - Set level of Command Aura (Tauren Hero) for Hero_Unit to Hero_AbilityLevel[Hero_CV]
                              • Unit - Set Name of Hero_Unit to (Tauren Lvl + (String(Hero_NameInteger[Hero_CV])))
                              • -------- --------
                            • Else - Actions
                              • -------- --------
                              • -------- Dreadlord Hero --------
                              • -------- --------
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Unit-type of Hero_Unit) Equal to Dreadlord Hero Lvl 1
                                • Then - Actions
                                  • -------- --------
                                  • Unit - Set level of Vampiric Aura (Dreadlord Hero) for Hero_Unit to Hero_AbilityLevel[Hero_CV]
                                  • Unit - Set Name of Hero_Unit to (Dreadlord Lvl + (String(Hero_NameInteger[Hero_CV])))
                                  • -------- --------
                                • Else - Actions
                                  • -------- --------
                                  • -------- Firelord Hero --------
                                  • -------- --------
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Unit-type of Hero_Unit) Equal to Firelord Lvl 1
                                    • Then - Actions
                                      • -------- --------
                                      • Unit - Set level of Flame Aura (Firelord Hero) for Hero_Unit to Hero_AbilityLevel[Hero_CV]
                                      • Unit - Set Name of Hero_Unit to (Firelord Lvl + (String(Hero_NameInteger[Hero_CV])))
                                      • -------- --------
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • Hero_AbilityLevel[Hero_CV] Equal to 9
                                        • Then - Actions
                                          • Set VariableSet Hero_CanUpgrade[Hero_CV] = True
                                          • Unit - Add Spitting Fire (Firelord Dummy) to Hero_Unit
                                        • Else - Actions
                                    • Else - Actions
                                      • -------- --------
                                      • -------- Alchemist Hero --------
                                      • -------- --------
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (Unit-type of Hero_Unit) Equal to Alchemist Hero Lvl 1
                                        • Then - Actions
                                          • -------- --------
                                          • Unit - Set level of Alchemical Aura (Alchemist Hero) for Hero_Unit to (1 + Hero_AbilityLevel[Hero_CV])
                                          • Unit - Set Name of Hero_Unit to (Alchemist Lvl + (String(Hero_NameInteger[Hero_CV])))
                                          • -------- --------
                                        • Else - Actions
                                          • -------- --------
                                          • -------- Scarab Hero --------
                                          • -------- --------
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • (Unit-type of Hero_Unit) Equal to Scarab Hero Lvl 1
                                            • Then - Actions
                                              • -------- --------
                                              • Unit - Set level of Thorns Aura (Scarab Hero) for Hero_Unit to Hero_AbilityLevel[Hero_CV]
                                              • Unit - Set Name of Hero_Unit to (Scarab Lvl + (String(Hero_NameInteger[Hero_CV])))
                                              • -------- --------
                                            • Else - Actions
                                              • -------- --------
                                              • -------- Scoundrel Hero --------
                                              • -------- --------
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • (Unit-type of Hero_Unit) Equal to Scoundrel Lvl 1
                                                • Then - Actions
                                                  • -------- --------
                                                  • Unit - Set level of Holy Aura (Scoundrel Hero) for Hero_Unit to Hero_AbilityLevel[Hero_CV]
                                                  • Unit - Set Name of Hero_Unit to (Scoundrel Lvl + (String(Hero_NameInteger[Hero_CV])))
                                                  • -------- --------
                                                • Else - Actions
                                                  • -------- --------
                                                  • -------- Banshee Hero --------
                                                  • -------- --------
                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    • If - Conditions
                                                      • (Unit-type of Hero_Unit) Equal to Banshee Lvl 1
                                                    • Then - Actions
                                                      • -------- --------
                                                      • Unit - Set level of Death Aura (Banshee Hero) for Hero_Unit to Hero_AbilityLevel[Hero_CV]
                                                      • Unit - Set Name of Hero_Unit to (Banshee Lvl + (String(Hero_NameInteger[Hero_CV])))
                                                      • -------- --------
                                                    • Else - Actions
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
Maybe I don't understand what you want but all of my triggers should be necessary.

The Upgrade stuff is for when you Upgrade your Hero at Level 10.
The Ability stuff is for choosing your Ability Path.

You shouldn't need any other triggers besides the ones I provided. Of course additional Hero specific triggers will be necessary as you add more heroes to the system.
 
Top