[Spell] Where in the triggers can I set the % of healing?

Level 15
Joined
Jul 19, 2007
Messages
825
I have imported a spell from a spellpack into my map but I'm not sure the triggers of it is correct because I can't see where in the triggers I can set the amount percent of healing it should do to friendly units when an allied unit dies.

Stand and Fight; If a friendly unit dies under effect of the Aura. A percent of the max health of the unit will be spreaded among the other friendly units which are under the effect of the Aura.|n|n|cffffcc00Level 1|r - Heals 10% of the dying unit's max health.|n|cffffcc00Level 2|r - Heals 20% of the dying unit's max health.|n|cffffcc00Level 3|r - Heals 30% of the dying unit's max health.|n|cffffcc00Level 4|r - Heals 40% of the dying unit's max health.|n|n|cffFF0000AOE: |r 800|n|cff0000FFMana Cost: |r 40/50/60/70|n|cff99ccffCooldown: |r 0 seconds.

  • AuraNAct
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Stand and Fight
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Triggering unit)) Equal to (Player((Integer A)))
            • Then - Actions
              • Set VariableSet AS_Hero[(Integer A)] = (Triggering unit)
              • Set VariableSet AS_HeroPos[(Integer A)] = (Position of (Triggering unit))
              • Unit - Create 1 Dummy (SaF) for (Owner of (Triggering unit)) at AS_HeroPos[(Integer A)] facing Default building facing degrees
              • Unit - Hide (Last created unit)
              • Set VariableSet AS_Dummy[(Integer A)] = (Last created unit)
              • Custom script: call RemoveLocation(udg_AS_HeroPos[bj_forLoopAIndex])
            • Else - Actions
  • AuraNDeact
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (AS_Hero[(Integer A)] has buff Stand and Fight Caster ) Equal to True
            • Then - Actions
              • Set VariableSet AS_HeroPosMove[(Integer A)] = (Position of AS_Hero[(Integer A)])
              • Unit - Move AS_Dummy[(Integer A)] instantly to AS_HeroPosMove[(Integer A)]
              • Custom script: call RemoveLocation(udg_AS_HeroPosMove[bj_forLoopAIndex])
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • AS_Dummy[(Integer A)] Not equal to No unit
                • Then - Actions
                  • Unit - Remove AS_Dummy[(Integer A)] from the game
                  • Set VariableSet AS_Dummy[(Integer A)] = No unit
                • Else - Actions
  • AuraNDeter
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Dying unit)) Equal to (Player((Integer A)))
            • Then - Actions
              • Set VariableSet AS_MaxHP[(Integer A)] = (Integer((Max life of (Dying unit))))
              • Set VariableSet AS_DyingUnitPos[(Integer A)] = (Position of (Dying unit))
              • Set VariableSet AS_TmpGroup1[(Integer A)] = (Units within 800.00 of AS_DyingUnitPos[(Integer A)] matching (((Matching unit) belongs to an ally of (Owner of (Dying unit)).) Equal to True).)
              • Unit Group - Pick every unit in AS_TmpGroup1[(Integer A)] and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Stand and Fight for (Picked unit)) Greater than or equal to 1
                    • Then - Actions
                      • Set VariableSet AS_Hero[(Integer A)] = (Picked unit)
                      • Set VariableSet AS_HeroPos[(Integer A)] = (Position of AS_Hero[(Integer A)])
                      • Set VariableSet AS_AbilityLVL[(Integer A)] = (Level of Stand and Fight for AS_Hero[(Integer A)])
                      • Set VariableSet AS_TmpGroup2[(Integer A)] = (Units within 800.00 of AS_HeroPos[(Integer A)] matching (((Matching unit) has buff Stand and Fight ) Equal to True).)
                      • Set VariableSet AS_UnitCount[(Integer A)] = (Number of units in AS_TmpGroup2[(Integer A)])
                      • Set VariableSet AS_HpAdd[(Integer A)] = (AS_MaxHP[(Integer A)] / AS_UnitCount[(Integer A)])
                      • If (AS_AbilityLVL[(Integer A)] Equal to 1) then do (Set VariableSet AS_HpAdd[(Integer A)] = (AS_HpAdd[(Integer A)] / 4)) else do (Do nothing)
                      • If (AS_AbilityLVL[(Integer A)] Equal to 2) then do (Set VariableSet AS_HpAdd[(Integer A)] = (AS_HpAdd[(Integer A)] / 2)) else do (Do nothing)
                      • If (AS_AbilityLVL[(Integer A)] Equal to 3) then do (Set VariableSet AS_HpAdd[(Integer A)] = (AS_HpAdd[(Integer A)] / (Integer(1.33)))) else do (Do nothing)
                      • If (AS_AbilityLVL[(Integer A)] Equal to 4) then do (Set VariableSet AS_HpAdd[(Integer A)] = (AS_HpAdd[(Integer A)] / 1)) else do (Do nothing)
                      • Special Effect - Create a special effect at AS_DyingUnitPos[(Integer A)] using Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Unit Group - Pick every unit in AS_TmpGroup2[(Integer A)] and do (Actions)
                        • Loop - Actions
                          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (Real(AS_HpAdd[(Integer A)])))
                          • Set VariableSet AS_PickedUnit[(Integer A)] = (Position of (Picked unit))
                          • Special Effect - Create a special effect at AS_PickedUnit[(Integer A)] using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
                          • Special Effect - Destroy (Last created special effect)
                          • Custom script: call RemoveLocation(udg_AS_PickedUnit[bj_forLoopAIndex])
                      • Custom script: call DestroyGroup(udg_AS_TmpGroup2[bj_forLoopAIndex])
                    • Else - Actions
              • Custom script: call RemoveLocation(udg_AS_HeroPos[bj_forLoopAIndex])
              • Custom script: call RemoveLocation(udg_AS_DyingUnitPos[bj_forLoopAIndex])
              • Custom script: call DestroyGroup(udg_AS_TmpGroup1[bj_forLoopAIndex])
            • Else - Actions
 
Level 29
Joined
Aug 29, 2012
Messages
1,325
It's this action

1723629599037.png


  • Unit - Set life of (Picked unit) to ((Percentage life of (Picked unit)) + 30.00)%
 

Uncle

Warcraft Moderator
Level 72
Joined
Aug 10, 2018
Messages
7,641
Bottom of the last trigger:
  • Unit Group - Pick every unit in AS_TmpGroup2[(Integer A)] and do (Actions)
    • Loop - Actions
      • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (Real(AS_HpAdd[(Integer A)])))
Also, these triggers are absolutely awful, lol. Here's how you can fix them up:
  • AuraNAct
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Stand and Fight
    • Actions
      • Set Variable AS_Hero = (Triggering unit)
      • Unit Group - Add AS_Hero to AS_CasterGroup
      • Unit - Add AS Aura (Ability) to AS_Hero
      • Trigger - Turn on AuraNDeact <gen>
      • Trigger - Turn on AuraNDeter <gen>
^ Just add the Aura to the hero that casts the ability. You can hide it's icon by setting it's Art - Button positions to 0, -11.
  • AuraNDeact
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in AS_CasterGroup and do (Actions)
        • Loop - Actions
          • Set Variable AS_Hero = (Picked unit)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (AS_Hero has buff Stand and Fight Caster ) Equal to False
              • Then - Actions
                • Unit Group - Remove AS_Hero from AS_CasterGroup
                • Unit - Remove AS Aura (Ability) from AS_Hero
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Number of units in AS_CasterGroup Equal to 0)
                  • Then - Actions
                    • Trigger - Turn off AuraNDeter <gen>
                    • Trigger - Turn off (this trigger)
                  • Else - Actions
              • Else - Actions
^ This should be Initially OFF.
  • AuraNDeter
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set VariableSet AS_MaxHP = (Max life of (Dying unit))
      • Set VariableSet AS_DyingUnitPos = (Position of (Dying unit))
      • Unit Group - Pick every unit in AS_CasterGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet AS_Hero = (Picked unit)
          • Set VariableSet AS_HeroPos = (Position of AS_Hero)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between AS_DyingUnitPos and AS_HeroPos) Less than or equal to 800.00
            • Then - Actions
              • Set VariableSet AS_AbilityLVL = (Level of Stand and Fight for AS_Hero)
              • Set VariableSet AS_TmpGroup = (Units within 800.00 of AS_HeroPos matching (((Matching unit) has buff Stand and Fight ) Equal to True).)
              • Set VariableSet AS_UnitCount = (Real(Number of units in AS_TmpGroup))
              • If (AS_UnitCount Less than 1.00) then do (Set VariableSet AS_UnitCount = 1.00 else do (Do nothing)
              • Set VariableSet AS_HpAdd = (AS_MaxHP / AS_UnitCount)
              • If (AS_AbilityLVL Equal to 1) then do (Set VariableSet AS_HpAdd = (AS_HpAdd / 4.00)) else do (Do nothing)
              • If (AS_AbilityLVL Equal to 2) then do (Set VariableSet AS_HpAdd = (AS_HpAdd / 2.00)) else do (Do nothing)
              • If (AS_AbilityLVL Equal to 3) then do (Set VariableSet AS_HpAdd = (AS_HpAdd / 1.33)) else do (Do nothing)
              • If (AS_AbilityLVL Equal to 4) then do (Set VariableSet AS_HpAdd = (AS_HpAdd / 1.00)) else do (Do nothing)
              • Special Effect - Create a special effect at AS_DyingUnitPos using Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl
              • Special Effect - Destroy (Last created special effect)
              • Unit Group - Pick every unit in AS_TmpGroup and do (Actions)
                • Loop - Actions
                  • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + AS_HpAdd))
                  • Set VariableSet AS_PickedUnit = (Position of (Picked unit))
                  • Special Effect - Create a special effect at AS_PickedUnit using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Custom script: call RemoveLocation(udg_AS_PickedUnit)
              • Custom script: call DestroyGroup(udg_AS_TmpGroup)
            • Else - Actions
            • Custom script: call RemoveLocation(udg_AS_HeroPos)
      • Custom script: call RemoveLocation(udg_AS_DyingUnitPos)
^ This should be Initially OFF.
 
Last edited:
Top