• 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.

Ability to increase percentage AD

Status
Not open for further replies.
Level 7
Joined
Feb 23, 2020
Messages
253
Hi, i'm trying to make an ability that inreases X% per stack, a stack is gained through kills and every 5 seconds you lose 1 stack. I'm having problems to decrease the AD to its former number. Thanks in advance.

NOTE: My x 1.05 and / 1.05 is for when the ability is level 5. Just a temporary number.

  • Enrage Kill
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Killing unit)) Equal to Khan
      • (Level of Enrage for (Killing unit)) Greater than 0
    • Actions
      • Set VariableSet Enrage_Count = (Enrage_Count + 1)
      • Set VariableSet Enrage_Caster = (Killing unit)
      • Set VariableSet Enrage_Level = ((Real((Level of Enrage for Enrage_Caster))) x 0.01)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Enrage_Count Equal to 1
        • Then - Actions
          • Trigger - Turn on Enrage Loop <gen>
          • Set VariableSet Enrage_CurrentAD = (Base Damage of Enrage_Caster for weapon index 0)
        • Else - Actions
      • -------- --------
      • Set VariableSet Enrage_DmgInrease = (((Real(Enrage_CurrentAD)) x Enrage_Level) x 1.05)
      • Set VariableSet Enrage_DmgLoss = (((Real(Enrage_CurrentAD)) x Enrage_Level) / 1.05)
      • -------- --------
      • Unit - Set Base Damage of Enrage_Caster to (Integer(((Real(Enrage_CurrentAD)) + Enrage_DmgInrease))) for weapon index: 0
      • -------- --------
  • Enrage Loop
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet Enrage_Count = (Enrage_Count - 1)
      • Unit - Set Base Damage of Enrage_Caster to (Integer(((Real(Enrage_CurrentAD)) - Enrage_DmgLoss))) for weapon index: 0
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Enrage_Count Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
I recommend adding Command Aura to the Hero, hiding it's button, and then adjusting it's damage bonus based on the number of Enrage stacks. You can do this through ability level or using the Set Ability Real action.

Also, if you wanted this ability to work on multiple units at once you'd need to restructure these triggers to use some form of Indexing like Unit Indexing or a Hashtable.
 
Last edited:
Level 7
Joined
Feb 23, 2020
Messages
253
I recommend adding Command Aura to the Hero, hiding it's button, and then adjusting it's damage bonus based on the number of Enrage stacks. You can do this through ability level or using the Set Ability Real action.

Also, if you wanted this ability to work on multiple units at once you'd need to restructure these triggers to use some form of Indexing like Unit Indexing or a Hashtable.
I understand, that being said, i need to make 5 different command auras since the ability have 5 levels?

Its supposed to work for 1 unit only so its fine
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
Just one Command Aura will work and it should only need 1 level.
  • Actions
    • Ability - Set Ability: (Unit: (Killing unit)'s Ability with Ability Code: Command Aura)'s Real Level Field: Attack Damage Increase ('Cac1') of Level: 0 to 0.50
    • Unit - Increase level of Command Aura for (Killing unit)
    • Unit - Decrease level of Command Aura for (Killing unit)
Edit: Fixed some mistakes.
 
Last edited:
Level 7
Joined
Feb 23, 2020
Messages
253
Just one Command Aura will work and it should only need 1 Level.
  • Actions
    • Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: Command Aura)'s Real Level Field: Attack Damage Increase ('Cac1') of Level: ((Level of (Ability being cast) for (Triggering unit)) - 1) to 0.50
    • Unit - Increase level of Command Aura for (Triggering unit)
    • Unit - Decrease level of Command Aura for (Triggering unit)
I see, does this work the way that, ability level 1 - 1%, level 2 - 2%, etc
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
First off, this example shows how you would change Command Aura when you cast an ability. Note that I messed it up as it should be the Level of Command Aura not (Ability being cast) that gets subtracted by 1. Edit: Actually, Command Aura is always level 1 so you can just set it to 0.

I edited my previous post to match your Kill trigger and fixed my mistake.

Second off, I'm setting the Attack Damage Increase of Command Aura at Level X to 50% (0.50). The levels are indexed starting at 0 because Reforged devs wanted to confuse us. So by doing (Level of ability - 1) it'll always reference the current level of the ability.

Finally, I increase/decrease the level of Command Aura to fix a bug. We call this "refreshing" the ability and it causes the stat changes to update immediately. It's only necessary for passive skills as far as I know.
 
Last edited:
Level 7
Joined
Feb 23, 2020
Messages
253
First off, this example shows how you would change Command Aura when you cast an ability. Note that I messed it up as it should be the Level of Command Aura not (Ability being cast) that gets subtracted by 1.

I edited my previous post to match your Kill trigger and fixed my mistake.

Second off, I'm setting the Attack Damage Increase of Command Aura at Level X to 50% (0.50). The levels are indexed starting at 0 because Reforged devs wanted to confuse us. So by doing (Level of ability being cast - 1) it'll always reference the current level of the ability.

Finally, I increase/decrease the level of Command Aura to fix a bug. We call this "refreshing" the ability and it causes the stat changes to update immediately. It's only necessary for passive skills as far as I know.
Alright i understand, thank you mate!
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
I made some more mistakes. Since the ability is an Aura you need to take extra steps to make it work. I got it working like this:
  • Enrage Example
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Level of Enrage for (Killing unit)) Greater than 0
    • Actions
      • Set VariableSet Enrage_Stacks = (Enrage_Stacks + 1)
      • -------- --------
      • Set VariableSet Enrage_Killer = (Killing unit)
      • Set VariableSet Enrage_Level = (Level of Enrage for Enrage_Killer)
      • Set VariableSet Enrage_DamagePerStack = (0.01 x (Real(Enrage_Level)))
      • Set VariableSet Enrage_CurrentDamage = ((Real(Enrage_Stacks)) x Enrage_DamagePerStack)
      • -------- --------
      • Ability - Set Ability: (Unit: Enrage_Killer's Ability with Ability Code: Enrage Dmg )'s Real Level Field: Attack Damage Increase ('Cac1') of Level: 0 to Enrage_CurrentDamage
      • Unit - Increase level of Enrage Dmg for Enrage_Killer
      • Unit - Decrease level of Enrage Dmg for Enrage_Killer
      • Unit - For Enrage_Killer, Ability Enrage Dmg , Disable ability: True, Hide UI: True
      • Unit - For Enrage_Killer, Ability Enrage Dmg , Disable ability: False, Hide UI: True
Enrage Dmg is the Command Aura ability.

If you wanted to you could base Enrage on Command Aura and remove the need for the extra ability. Also, you could disable/remove Enrage Dmg while you don't have any Stacks and then add/enable it once you do, this way the Buff doesn't show all of the time.
 

Attachments

  • Enrage Example.w3m
    18.1 KB · Views: 16
Last edited:
Level 7
Joined
Feb 23, 2020
Messages
253
I made some more mistakes. Since the ability is an Aura you need to take extra steps to make it work. I got it working like this:
  • Enrage Example
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Level of Enrage for (Killing unit)) Greater than 0
    • Actions
      • Set VariableSet Enrage_Stacks = (Enrage_Stacks + 1)
      • -------- --------
      • Set VariableSet Enrage_Killer = (Killing unit)
      • Set VariableSet Enrage_Level = (Level of Enrage for Enrage_Killer)
      • Set VariableSet Enrage_DamagePerStack = (0.01 x (Real(Enrage_Level)))
      • Set VariableSet Enrage_CurrentDamage = ((Real(Enrage_Stacks)) x Enrage_DamagePerStack)
      • -------- --------
      • Ability - Set Ability: (Unit: Enrage_Killer's Ability with Ability Code: Enrage Dmg )'s Real Level Field: Attack Damage Increase ('Cac1') of Level: 0 to Enrage_CurrentDamage
      • Unit - Increase level of Enrage Dmg for Enrage_Killer
      • Unit - Decrease level of Enrage Dmg for Enrage_Killer
      • Unit - For Enrage_Killer, Ability Enrage Dmg , Disable ability: True, Hide UI: True
      • Unit - For Enrage_Killer, Ability Enrage Dmg , Disable ability: False, Hide UI: True
Enrage Dmg is the Command Aura ability.

If you wanted to you could base Enrage on Command Aura and remove the need for the extra ability. Also, you could disable/remove Enrage Dmg while you don't have any Stacks and then add/enable it once you do, this way the Buff doesn't show all of the time.
Alright thanks dude, and to remove the stacks i can use the same 5 second timer to just Set VariableSet Enrage_Stacks = (Enrage_Stacks - 1) instead?

And to turn it on the same way i just did?
 
Level 7
Joined
Feb 23, 2020
Messages
253
Yeah, you're correct. Subtract 1 from the stacks every 5 seconds and adjust the abilities Attack Damage Increase using the same method used before.
  • Enrage Loop
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet Enrage_Stacks = (Enrage_Stacks - 1)
      • -------- --------
      • Ability - Set Ability: (Unit: Enrage_Killer's Ability with Ability Code: Enrage Dmg )'s Real Level Field: Attack Damage Increase ('Cac1') of Level: 0 to Enrage_CurrentDamage
      • Unit - Increase level of Enrage Dmg for Enrage_Killer
      • Unit - Decrease level of Enrage Dmg for Enrage_Killer
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Enrage_Stacks Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Unit - Remove Enrage Dmg from Enrage_Killer
        • Else - Actions
Seems like i've done something wrong, it does not remove 1 stack every 5 seconds. Instead it removes all of them when the stacks equal to 0 when i remove the ability. I tried putting all the variables inside the loop but does not work either.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
You're setting the Ability damage to Enrage_CurrentDamage which is equal to whatever you last set it to. You need ALL of the variables to make it work.

You also forgot to disable/enable the ability. All of those Actions are required to make it work properly.
 
Level 7
Joined
Feb 23, 2020
Messages
253
Good catch, yes it does work, but its very laggy when it decreases the number. But i guess that'll do if i cant do any better.
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
It shouldn't be laggy, what do you mean by that?

Here's how it should look:
  • Enrage Loop
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet Enrage_Stacks = (Enrage_Stacks - 1)
      • Set VariableSet Enrage_Killer = (Your Hero)
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Enrage_Stacks Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Unit - Remove Enrage Dmg from Enrage_Killer
          • Unit - Remove Enrage Buff from Enrage_Killer
        • Else - Actions
          • Set VariableSet Enrage_Level = (Level of Enrage for Enrage_Killer)
          • Set VariableSet Enrage_DamagePerStack = (0.01 x (Real(Enrage_Level)))
          • Set VariableSet Enrage_CurrentDamage = ((Real(Enrage_Stacks)) x Enrage_DamagePerStack)
          • -------- --------
          • Ability - Set Ability: (Unit: Enrage_Killer's Ability with Ability Code: Enrage Dmg )'s Real Level Field: Attack Damage Increase ('Cac1') of Level: 0 to Enrage_CurrentDamage
          • Unit - Increase level of Enrage Dmg for Enrage_Killer
          • Unit - Decrease level of Enrage Dmg for Enrage_Killer
          • Unit - For Enrage_Killer, Ability Enrage Dmg , Disable ability: True, Hide UI: True
          • Unit - For Enrage_Killer, Ability Enrage Dmg , Disable ability: False, Hide UI: True
And if you want to make it more efficient you can calculate Enrage_DamagePerStack when your hero learns Enrage instead of every kill/every 5 seconds.
 
Last edited:
Level 7
Joined
Feb 23, 2020
Messages
253
I'm not too sure why but it works perfectly in my map. Can you open my map and look for differences between our Command Aura abilities?

Or try to find some other differences... Very confusing.
Its pretty weird but i guess i can work with this. Thanks a lot for all the help
 
Level 7
Joined
Feb 23, 2020
Messages
253
No problem, and feel free to send me your map or if you're uncomfortable with that you could make a demo map of just those triggers/abilities, and I'll see if I can debug them. It really should work.
I can send you the map if you like. Lots of rookie cooding though :p
 
Status
Not open for further replies.
Top