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

[Spell] Life-increasing aura

Status
Not open for further replies.
Level 7
Joined
Jan 11, 2022
Messages
108
Found that there's no such post so I'm gonna ask. Is there a wait to make life-increasing aura with triggers? Tried with some ways but non worked. The idea is to make an Aura that will increase health % of units in AoE
 
Level 29
Joined
Sep 26, 2009
Messages
2,596
I kinda don't know what exactly you mean - do you mean life-increasing as in healing aura? Or do you mean an aura that increases maximum health of a unit?

In case you mean healing aura, then you could use the healing ability used by fountains of life.
In case of increasing max life, then I don't think there is anything usable out of the box, but I would encourage you to rather increase health by value than % since the increment is temporary and so losing the bonus could cause issues (like decreasing health too much, or how does it stack if you get some other health bonus)
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
Here's how you can trigger a simple Aura (requires a Unit Indexer):

For a flat amount of bonus hit points you would replace the Celerity Aura (Attack Speed) ability with an Item ability that increases Hit Points, like the one you get from Periapt of Vitality.

For a percentage you must use the Unit - Set Max HP action as others have suggested and recalculate it each time. So you would replace the adding of the ability with something like this:
  • Then - Actions
    • Set Variable Celerity_CV = (Custom value of Celerity_Target)
    • Unit - Set Max HP of Celerity_Target to (Max HP of Celerity_Target - Celerity_MaxHP[Celerity_CV]
    • Set Variable Celerity_MaxHP[Celerity_CV] = (Max HP of Celerity_Target * 0.15)
    • Unit - Set Max HP of Celerity_Target to (Max HP of Celerity_Target + Celerity_MaxHP[Celerity_CV]
    • ...
You'd need to modify a good chunk of the trigger to make it work properly since the ability has been removed, but the general concept stays the same.

If only a single unit will ever have this aura then you can simplify the triggers even more.
 
Last edited:
Level 45
Joined
Feb 27, 2007
Messages
5,578
Uncle didn't really address this directly but it is part of his solution in a way... and it definitely matters: If you add % max hp to a unit via a trigger like this and want to later remove that bonus hp you have to keep track of exactly how much hp you add to undo it. Why? Couple ways it can go wrong if you don't.

If you add x% hp, when you go to remove it and take away x% of the new total, you'll remove more than you added! Consider the simple example of adding 10% bonus hp to a unit with 200 hp. 200 x 1.10 = 220. Removing 10: 220 x 0.9 = 198. The unit lost max hp overall.

Technically you can do some arithmetic to end up back at the correct original number. If A x B = C, then A = C/B. For the example with a 10% bonus to 200 base you would compute the 'original' hp as: 220/1.10 = 200. This would be a perfectly fine thing to do if there is no other way for anything to affect total hp of a unit in your map. If there is any other way a units HP could change (increase or decrease) this method will not account for this and can improperly reduce the max hp when units leave the aura. Consider that unit upgrades, items with strength or hp, heroes leveling up, the ability to morph into a different unit type with a different max hp are all things that have the potential to break this.

Again the example of a 200 hp unit with a 10% bonus but this time assume it picks up an item that grants +50 hp while inside of the aura, and then walks away. It should have 250 hp afterward but does it? 200 x 1.10 + 50 = 270, then 270/1.10 = 245.5! Some of the +50 from the item was lost when the unit left the aura. Also consider having the item before entering the aura, then dropping it while inside the aura: 250 x 1.10 = 275, then it drops the item so 225/1.10 = 204.5. The unit would gain total hp permanently this way! If the unit picked up the item before entering the aura and never dropped it then these problems would not occur.

The only surefire way to avoid this potential issue is to calculate the bonus hp given to the unit, store that exact number in a real variable, and when you need to 'undo' the aura remove exactly that much HP again. This is what Uncle is using the Celerity_MaxHP[Celerity_CV] variable for in his example.
 
Level 7
Joined
Jan 11, 2022
Messages
108
I'll start working on it from now on, it's gonna be a challenge since i'm not experienced yet in triggering/coding so it'll take some time. But I have the way guided by Uncle, so it should be easier now, thanks yall
I had the same thought about percents, that if you add x% and then take it back, it won't return to the same amount as it was, glad you mentioned it though
 
Level 9
Joined
Mar 2, 2014
Messages
160
Seems complicated, maybe aura that increase armor would work for you too, armor technically increase max hp. It is just lazyme speaking.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
Here's a modified version of my Celerity Aura triggers made to increase Max HP. Note that it's currently setup to only support a single Max HP %. Technically you can change this by adjusting the Action that Sets GA_TargetMaxHP to include ability level in it's math. It would look something like this:
  • Set VariableSet GA_TargetMaxHP[GA_CV] = ((Max life of GA_Target) x (Level of GA_Setup_Aura for GA_Source * 0.15))
That would be a 15% increase per level. HOWEVER, there would be weird issues if you had multiple Granite Auras affecting the same unit at once which is why I didn't support this by default. If you know for a fact that you will only have a single unit with Granite Aura on the map at a time then this change would be fine.

I could maybe throw together a version that allows for proper max hp % scaling based on ability level if it was really desired.

The map requires the latest patch to open and these triggers require Bribe's Unit Indexer.

  • Granite Aura Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- The ability code for Granite Aura: --------
      • Set VariableSet GA_Setup_Aura = Granite Aura (Hero)
      • -------- --------
      • -------- The percentage increase for max hp (1.0 = 100%): --------
      • Set VariableSet GA_Setup_MaxHP = 0.15
      • -------- --------
      • -------- The Area of Effect for the Aura: --------
      • Set VariableSet GA_Setup_AoE = 900.00
  • Granite Aura Add Source
    • Events
    • Conditions
    • Actions
      • -------- How To: --------
      • -------- Set GA_Source = The unit with the Granite Aura ability and then do the following Action: Trigger - Run Granite Aura Add Source (ignoring conditions) --------
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (GA_Source is in GA_SourceGroup.) Equal to False
        • Then - Actions
          • Unit Group - Add GA_Source to GA_SourceGroup
          • Set VariableSet GA_SourceCount = (GA_SourceCount + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GA_SourceCount Equal to 1
            • Then - Actions
              • Trigger - Turn on Granite Aura Loop <gen>
            • Else - Actions
        • Else - Actions
  • Granite Aura Loop
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • -------- Reset the Max HP of units affected by Granite Aura: --------
      • Unit Group - Pick every unit in GA_TargetGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet GA_Target = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (GA_Target has buff Granite Aura ) Equal to False
            • Then - Actions
              • Set VariableSet GA_CV = (Custom value of GA_Target)
              • -------- --------
              • Set VariableSet GA_TargetLifePerc = (Percentage life of GA_Target)
              • Unit - Set Max HP of GA_Target to ((Max HP of GA_Target) - (Integer(GA_TargetMaxHP[GA_CV])))
              • Unit - Set life of GA_Target to GA_TargetLifePerc%
              • -------- --------
              • Unit Group - Remove GA_Target from GA_TargetGroup.
              • Set VariableSet GA_IsInTargetGroup[GA_CV] = False
            • Else - Actions
      • -------- --------
      • -------- Loop over all of the unit's with Granite Aura and increase the Max HP of allies near them: --------
      • Unit Group - Pick every unit in GA_SourceGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet GA_Source = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (GA_Source is alive) Equal to True
              • (Level of GA_Setup_Aura for GA_Source) Greater than 0
            • Then - Actions
              • Set VariableSet GA_Point = (Position of GA_Source)
              • -------- --------
              • Custom script: set bj_wantDestroyGroup = true
              • Unit Group - Pick every unit in (Units within GA_Setup_AoE of GA_Point.) and do (Actions)
                • Loop - Actions
                  • Set VariableSet GA_Target = (Picked unit)
                  • -------- --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (GA_Target is alive) Equal to True
                      • (GA_Target belongs to an ally of (Owner of GA_Source).) Equal to True
                      • (GA_Target is A structure) Equal to False
                    • Then - Actions
                      • Set VariableSet GA_CV = (Custom value of GA_Target)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • GA_IsInTargetGroup[GA_CV] Equal to False
                        • Then - Actions
                          • Set VariableSet GA_TargetLifePerc = (Percentage life of GA_Target)
                          • Set VariableSet GA_TargetMaxHP[GA_CV] = ((Max life of GA_Target) x GA_Setup_MaxHP)
                          • Unit - Set Max HP of GA_Target to ((Max HP of GA_Target) + (Integer(GA_TargetMaxHP[GA_CV])))
                          • Unit - Set life of GA_Target to GA_TargetLifePerc%
                          • -------- --------
                          • Unit Group - Add GA_Target to GA_TargetGroup
                          • Set VariableSet GA_IsInTargetGroup[GA_CV] = True
                        • Else - Actions
                    • Else - Actions
              • -------- --------
              • Custom script: call RemoveLocation (udg_GA_Point)
            • Else - Actions
              • -------- The Aura source is dead or lost the ability so they shouldn't be emitting an Aura anymore: --------
              • Unit Group - Remove GA_Source from GA_SourceGroup.
              • Set VariableSet GA_SourceCount = (GA_SourceCount - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • GA_SourceCount Equal to 0
                • Then - Actions
                  • Trigger - Turn off Granite Aura Loop <gen>
                • Else - Actions
  • Granite Aura DeIndex
    • Events
      • Game - UnitIndexEvent becomes Equal to 2.00
    • Conditions
    • Actions
      • -------- Reset these variables since this custom value may get recycled: --------
      • Set VariableSet GA_IsInTargetGroup[UDex] = False
      • Set VariableSet GA_TargetMaxHP[UDex] = 0.00
 

Attachments

  • Granite Aura v1.w3m
    26.7 KB · Views: 7
Last edited:
Status
Not open for further replies.
Top