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

[Spell] Life Steal and Rage

Status
Not open for further replies.
Level 6
Joined
Jul 23, 2018
Messages
243
I made an ability based on Immolation. When the hero activates the spell, he gains hit points upon attacking the enemies but also lose mana each hit. I changed the the buff to vampiric aura but it made the enemies lose health and the hero gains no hit points. Do I have to make another ability based on different ability or it has to be done through triggers?
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
Just simply changing its buff field have nothing to do with the mechanics you intended to do.
When physical hit is involved, damage engines out there can provide you a hit detection,
Make a damage event + buff condition + modify hero hp & mana per hit. So yes, it must be done by triggers.
 
Level 28
Joined
Feb 18, 2014
Messages
3,580
You have two options :

1 - Give the hero the vampiric potion ability and make him lose mana a with trigger after his cast the spell.
2 - Detect when Immolotion is enabled and give the hero the life steal ability then remove it after his disables the spell.
 
Level 6
Joined
Jul 23, 2018
Messages
243
You have two options :

1 - Give the hero the vampiric potion ability and make him lose mana a with trigger after his cast the spell.
2 - Detect when Immolotion is enabled and give the hero the life steal ability then remove it after his disables the spell

The second option is a hard one, because it does not detect when Immolation is off. I tried using finishes casting and stops casting. Also, there are multiple units who have Life Steal ability, which makes it very hard to detect who has it and who does not.
 
Last edited:
Level 28
Joined
Feb 18, 2014
Messages
3,580
The second option is a hard one, because it does not detect when Immolation is off. I tried using finishes casting and stops casting. Also, there are multiple units who have Life Steal ability, which makes it very hard to detect who has it and who does not.
  • Add Vampiric Aura
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(immolation))
    • Actions
      • Unit - Add Life Steal to (Triggering unit)
  • Remove Vampiric Aura
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(unimmolation))
    • Actions
      • Unit - Remove Life Steal from (Triggering unit)
  • Vampiric Aura out of Mana
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Immolation) Equal to FALSE
            • Then - Actions
              • Unit - Remove Life Steal from (Picked unit)
            • Else - Actions
The second trigger is kinda useless though since the third one can do the same thing.
 
Level 6
Joined
Jul 23, 2018
Messages
243
Thanks Warseeker. And if possible, can you guys help me with this? This is another ability called Rage, which gives him additional attributes or ability Attribute Bonus when his health is below 35%. The problem is there are multiple units like I said, and another thing is he keeps getting attribute bonus even though he already gets one when the trigger gives him.
  • Rage Lvl 1
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Life of (Attacking unit)) Less than or equal to ((Max life of (Attacking unit)) x 0.35)
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Attacking unit)) Equal to Death Blade
          • (Unit-type of (Attacking unit)) Equal to Death Blade (AI)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Rage for (Attacking unit)) Equal to 1
        • Then - Actions
          • Unit - Add Attribute Bonus (Death Blade) to (Attacking unit)
          • Unit - Set level of Attribute Bonus (Death Blade) for (Attacking unit) to 1
          • Special Effect - Create a special effect attached to the overhead of (Attacking unit) using Abilities\Spells\Human\Avatar\AvatarCaster.mdl
          • Trigger - Turn off (This trigger)
          • Wait 30.00 game-time seconds
          • Unit - Remove Attribute Bonus (Death Blade) from (Attacking unit)
          • Wait 270.00 game-time seconds
          • Trigger - Turn on (This trigger)
        • Else - Actions
 
Level 28
Joined
Feb 18, 2014
Messages
3,580
  • Rage
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Life of (Attacking unit)) Less than or equal to ((Max life of (Attacking unit)) x 0.35)
    • Actions
      • Set integer = (integer + 1)
      • Set unit[integer] = (Attacking unit)
      • Set level = (Level of Rage for unit[integer])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Rage for unit[integer]) Greater than 0
          • (Level of Attribute Bonus (Death Blade) for unit[integer]) Equal to 0
        • Then - Actions
          • Unit - Add Attribute Bonus (Death Blade) to unit[integer]
          • Unit - Set level of Attribute Bonus (Death Blade) for unit[integer] to level
          • Special Effect - Create a special effect attached to the overhead of unit[integer] using Abilities\Spells\Human\Avatar\AvatarCaster.mdl
        • Else - Actions
      • Wait 30.00 seconds
      • Set recycle = (recycle + 1)
      • Unit - Remove Attribute Bonus (Death Blade) from unit[recycle]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • recycle Equal to integer
        • Then - Actions
          • Set integer = 0
          • Set recycle = 0
        • Else - Actions
 
Level 6
Joined
Jul 23, 2018
Messages
243
Forgot to mention that the Rage ability is based on Reincarnation, which means after he dies, the ability goes on cooldown, making it impossible for him to rage but for some reasons, he still rages.
 
Level 28
Joined
Feb 18, 2014
Messages
3,580
Forgot to mention that the Rage ability is based on Reincarnation, which means after he dies, the ability goes on cooldown, making it impossible for him to rage but for some reasons, he still rages.
If you're using patch 1.29 or newer you can use the new natives to detect an ability's cooldown :
JASS:
native BlzGetUnitAbilityCooldownRemaining          takes unit whichUnit, integer abilId returns real
So your trigger would look like this :
  • Rage
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Life of (Attacking unit)) Less than or equal to ((Max life of (Attacking unit)) x 0.35)
      • (Level of Rage for (Attacking unit)) Greater than 0
      • (Ability Cooldown Remaining of (Attacking unit) for ability Rage) Equal to 0.00
    • Actions
Otherwise, you can use countdown timers.
 
Level 28
Joined
Feb 18, 2014
Messages
3,580
After the hero dies, check if he has the Reincarnation ability and add him to a unit group, then remove him after the cooldown is over.
  • Add Revive Group
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Level of Rage for (Triggering unit)) Greater than 0
    • Actions
      • Set integer_2 = (integer_2 + 1)
      • Set unit_2[integer_2] = (Triggering unit)
      • Unit Group - Add unit_2[integer_2] to ReviveGroup
      • Wait 180.00 seconds // Reincarnation Cooldown
      • Set recycle_2 = (recycle_2 + 1)
      • Unit Group - Remove unit_2[recycle_2] from ReviveGroup
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • recycle_2 Equal to integer_2
        • Then - Actions
          • Set integer_2 = 0
          • Set recycle_2 = 0
        • Else - Actions
After that, add a new condition to the Rage trigger : ((Attacking unit) is in ReviveGroup) Not equal to TRUE
 
Level 16
Joined
May 2, 2011
Messages
1,345
Sadly, I'm using patch 1.24. But would countdown timer work for that? And how do I use it? I never use that before.
Count Down timer would work if you only have 1 unit. but i you had many units you cant use the same timer for all.

Are "integer_2" and "recycle_2" real or integer variable?
Integer_2 is prolly integer :p
Recycle_2 = integer_2 so it should also be integer.
 
Level 6
Joined
Jul 23, 2018
Messages
243
I'm currently working on a map with my cousin, and he forced me to use 1.29 because of an Action "Set Unit Base Damage" so I have to use 1.29
Final triggers for anyone who searched this thread
Life Steal
  • Life Steal on
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(immolation))
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Ordered unit)) Equal to Death Blade
          • (Unit-type of (Ordered unit)) Equal to Death Blade (AI)
    • Actions
      • Unit - Add Life Steal (Death Blade, NI) to (Ordered unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Life Steal (Death Blade) for (Ordered unit)) Equal to 1
        • Then - Actions
          • Unit - Set level of Life Steal (Death Blade, NI) for (Ordered unit) to 1
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Life Steal (Death Blade) for (Ordered unit)) Equal to 2
            • Then - Actions
              • Unit - Set level of Life Steal (Death Blade, NI) for (Ordered unit) to 2
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Life Steal (Death Blade) for (Ordered unit)) Equal to 3
                • Then - Actions
                  • Unit - Set level of Life Steal (Death Blade, NI) for (Ordered unit) to 3
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Life Steal (Death Blade) for (Ordered unit)) Equal to 4
                    • Then - Actions
                      • Unit - Set level of Life Steal (Death Blade, NI) for (Ordered unit) to 4
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Level of Life Steal (Death Blade) for (Ordered unit)) Equal to 5
                        • Then - Actions
                          • Unit - Set level of Life Steal (Death Blade, NI) for (Ordered unit) to 5
                        • Else - Actions
  • Life Steal off
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(unimmolation))
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Ordered unit)) Equal to Death Blade
          • (Unit-type of (Ordered unit)) Equal to Death Blade (AI)
    • Actions
      • Unit - Remove Life Steal (Death Blade, NI) from (Ordered unit)
  • Life Steal check
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Vampiric Aura) Equal to False
            • Then - Actions
              • Unit - Remove Life Steal (Death Blade, NI) from (Ordered unit)
              • Unit - Order (Attacking unit) to Night Elf Demon Hunter - Deactivate Immolation
            • Else - Actions
  • Life Steal mana
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Attacking unit)) Equal to Death Blade
          • (Unit-type of (Attacking unit)) Equal to Death Blade (AI)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Life Steal (Death Blade, NI) for (Attacking unit)) Equal to 1
        • Then - Actions
          • Unit - Set mana of (Attacking unit) to ((Mana of (Attacking unit)) - 3.00)
          • Special Effect - Create a special effect attached to the chest of (Attacked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Life Steal (Death Blade, NI) for (Attacking unit)) Equal to 3
            • Then - Actions
              • Unit - Set mana of (Attacking unit) to ((Mana of (Attacking unit)) - 8.00)
              • Special Effect - Create a special effect attached to the chest of (Attacked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Life Steal (Death Blade, NI) for (Attacking unit)) Equal to 4
                • Then - Actions
                  • Unit - Set mana of (Attacking unit) to ((Mana of (Attacking unit)) - 12.00)
                  • Special Effect - Create a special effect attached to the chest of (Attacked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Life Steal (Death Blade, NI) for (Attacking unit)) Equal to 5
                    • Then - Actions
                      • Unit - Set mana of (Attacking unit) to ((Mana of (Attacking unit)) - 17.00)
                      • Special Effect - Create a special effect attached to the chest of (Attacked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Level of Life Steal (Death Blade, NI) for (Attacking unit)) Equal to 1
                        • Then - Actions
                          • Unit - Set mana of (Attacking unit) to ((Mana of (Attacking unit)) - 20.00)
                          • Special Effect - Create a special effect attached to the chest of (Attacked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
                        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Mana of (Attacking unit)) Less than or equal to 0.00
        • Then - Actions
          • Unit - Order (Attacking unit) to Night Elf Demon Hunter - Deactivate Immolation
        • Else - Actions
Rage
  • joinminus.gif
    events.gif
    Events
    • line.gif
      joinbottom.gif
      unit.gif
      Unit - A unit Is attacked
  • joinminus.gif
    cond.gif
    Conditions
    • line.gif
      joinbottom.gif
      if.gif
      (Life of (Attacking unit)) Less than or equal to ((Max life of (Attacking unit)) x 0.35)
  • joinbottomminus.gif
    actions.gif
    Actions
    • empty.gif
      join.gif
      set.gif
      Set integer = (integer + 1)
    • empty.gif
      join.gif
      set.gif
      Set unit[integer] = (Attacking unit)
    • empty.gif
      join.gif
      set.gif
      Set level = (Level of Rage for unit[integer])
    • empty.gif
      joinminus.gif
      if.gif
      If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • empty.gif
        line.gif
        joinminus.gif
        cond.gif
        If - Conditions
        • empty.gif
          line.gif
          line.gif
          join.gif
          if.gif
          (Level of Rage for unit[integer]) Greater than 0
        • empty.gif
          line.gif
          line.gif
          joinbottom.gif
          if.gif
          (Level of Attribute Bonus (Death Blade) for unit[integer]) Equal to 0
      • empty.gif
        line.gif
        joinminus.gif
        actions.gif
        Then - Actions
        • empty.gif
          line.gif
          line.gif
          join.gif
          unit.gif
          Unit - Add Attribute Bonus (Death Blade) to unit[integer]
        • empty.gif
          line.gif
          line.gif
          join.gif
          unit.gif
          Unit - Set level of Attribute Bonus (Death Blade) for unit[integer] to level
        • empty.gif
          line.gif
          line.gif
          joinbottom.gif
          ani.gif
          Special Effect - Create a special effect attached to the overhead of unit[integer] using Abilities\Spells\Human\Avatar\AvatarCaster.mdl
      • empty.gif
        line.gif
        joinbottom.gif
        actions.gif
        Else - Actions
    • empty.gif
      join.gif
      zzz.gif
      Wait 30.00 seconds
    • empty.gif
      join.gif
      set.gif
      Set recycle = (recycle + 1)
    • empty.gif
      join.gif
      unit.gif
      Unit - Remove Attribute Bonus (Death Blade) from unit[recycle]
    • empty.gif
      joinbottomminus.gif
      if.gif
      If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • empty.gif
        empty.gif
        joinminus.gif
        cond.gif
        If - Conditions
        • empty.gif
          empty.gif
          line.gif
          joinbottom.gif
          if.gif
          recycle Equal to integer
      • empty.gif
        empty.gif
        joinminus.gif
        actions.gif
        Then - Actions
        • empty.gif
          empty.gif
          line.gif
          join.gif
          set.gif
          Set integer = 0
        • empty.gif
          empty.gif
          line.gif
          joinbottom.gif
          set.gif
          Set recycle = 0
      • empty.gif
        empty.gif
        joinbottom.gif
        actions.gif
        Else - Actions
EDIT: I forgot one thing, do I have to enable array in order to make this MUI? Because I think integer and recycle from your triggers shared between units.
 
Last edited:
Level 6
Joined
Jul 23, 2018
Messages
243
One more problem I encountered with Rage
I cannot remove or add ability when the hero reincarnated with Reincarnation ability
  • Extreme Rage
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Level of Rage (Death Blade) for (Dying unit)) Greater than 0
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Dying unit)) Equal to Death Blade (Melee)
          • (Unit-type of (Dying unit)) Equal to Death Blade (Range)
          • (Unit-type of (Dying unit)) Equal to Death Blade (AI) (Melee)
          • (Unit-type of (Dying unit)) Equal to Death Blade (AI) (Range)
    • Actions
      • Unit - Remove Attribute Bonus (Death Blade,Normal) from (Dying unit)
      • Unit - Remove Rage (Buff) from (Dying unit)
      • Unit - Add Attribute Bonus (Death Blade,Extreme) to (Dying unit)
      • Unit - Add Extreme Rage (Buff) to (Dying unit)
      • Set CV = (Custom value of (Dying unit))
      • Set AbilLvl[CV] = (Level of Rage (Death Blade) for (Dying unit))
      • Unit - Set level of Attribute Bonus (Death Blade,Normal) for (Dying unit) to AbilLvl[CV]
      • Unit - Set level of Extreme Rage (Buff) for (Dying unit) to AbilLvl[CV]
      • Wait 15.00 seconds
      • Unit - Remove Attribute Bonus (Death Blade,Extreme) from (Dying unit)
      • Unit - Remove Extreme Rage (Buff) from (Dying unit)

Abilities:

Attributes Bonus (Death Blade,Normal) = ability based on Attributes Bonus for when hero is under a certain HP and Reincarnation has not been passively activated
Attributes Bonus (Death Blade,Extreme) = For when hero is killed and has more increased attributes than the normal one and Reincarnation is on cooldown
Rage (buff) = Ability based on Devotion Aura, which serves the purpose of showing only buff
Extreme Rage (buff) = same as Rage

Variables:

CV = integer
AbilLvl = integer array

Note: I'm using Unit indexer made by Bribe.

 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
It would look something like this:
  • Events:
  • DeathEvent Becomes Equal to 0.50
  • Conditions:
  • Actions:
  • Set Variable EventUnit = UDexUnits[UDex]
  • If Unit-Type of EventUnit equal to Death Blade (Melee) then do stuff
UDexUnits[UDex] is the unit that fired the Event (similar to Triggering Unit). I set it to EventUnit to make it easier to reference in the rest of your trigger.

Note that this isn't MUI and nor is your Extreme Rage trigger.

For Extreme Rage, if you changed Dying unit to Triggering unit then it will be MUI. It still won't work with Reincarnation though. This is because Triggering unit is "special", and works like a local variable.

local udg_
^ This method can help with making my above trigger MUI.
 
Last edited:
Level 6
Joined
Jul 23, 2018
Messages
243
Sorry for late response, I was sleepy. So the trigger would be like this?
  • Extreme Rage
    • Events
      • Game - DeathEvent becomes Equal to 2.00
    • Conditions
    • Actions
      • Set EventUnit = UDexUnits[UDex]
      • Set local_Unit = EventUnit
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of local_Unit) Equal to Death Blade (AI) (Melee)
              • (Unit-type of local_Unit) Equal to Death Blade (AI) (Range)
              • (Unit-type of local_Unit) Equal to Death Blade (Melee)
              • (Unit-type of local_Unit) Equal to Death Blade (Range)
        • Then - Actions
        • Else - Actions
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
Here's a better example, it should look like this:
  • Example
    • Events
      • Game - DeathEvent becomes Equal to 0.50
    • Conditions
    • Actions
      • Custom script: local unit udg_EventUnit
      • Set VariableSet EventUnit = UDexUnits[UDex]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of EventUnit) Equal to Footman
              • (Unit-type of EventUnit) Equal to Knight
              • (Unit-type of EventUnit) Equal to Rifleman
        • Then - Actions
          • Unit - Add Animate Dead to EventUnit
          • Unit - Set level of Animate Dead for EventUnit to (Level of Avatar for EventUnit)
          • Wait 15.00 seconds
          • Unit - Remove Animate Dead from EventUnit
        • Else - Actions
      • Custom script: set udg_EventUnit = null
EventUnit is turned into a local variable using this method.

What's important to note is that pseudo local variables like this do not work properly in GUI Condition Blocks.

This can easily be solved by globalizing the local again.

That being said, in this particular case I THINK we don't have to worry about this issue. That's because our Conditions are done BEFORE the Wait.
I think the problem arises if you reference EventUnit in a Conditions Block AFTER the use of a Wait.

I may be wrong though, and if so, here's an alternate version that should fix the issue:
  • Example Alt
    • Events
      • Game - DeathEvent becomes Equal to 0.50
    • Conditions
    • Actions
      • Custom script: local unit udg_LocalUnit
      • Set VariableSet EventUnit = UDexUnits[UDex]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of EventUnit) Equal to Footman
              • (Unit-type of EventUnit) Equal to Knight
              • (Unit-type of EventUnit) Equal to Rifleman
        • Then - Actions
          • Set VariableSet LocalUnit = UDexUnits[UDex]
          • Unit - Add Animate Dead to LocalUnit
          • Unit - Set level of Animate Dead for LocalUnit to (Level of Avatar for LocalUnit)
          • Wait 15.00 seconds
          • Unit - Remove Animate Dead from LocalUnit
        • Else - Actions
      • Custom script: set udg_LocalUnit = null
So in this second version, I use two unit variables. EventUnit is treated like a normal Global variable, and LocalUnit is the one that we're "localizing".
 
Last edited:
Level 6
Joined
Jul 23, 2018
Messages
243
Everything works perfectly fine if you don't use AtkUnit[integer] from Rage trigger. Because it causes the recent raged unit to have the abilities instead.
  • Extreme Rage
    • Events
      • Game - DeathEvent becomes Equal to 2.00
    • Conditions
    • Actions
      • Custom script: local unit udg_local_local_Unit
      • Set EventUnit = UDexUnits[UDex]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of EventUnit) Equal to Death Blade (AI) (Melee)
              • (Unit-type of EventUnit) Equal to Death Blade (AI) (Range)
              • (Unit-type of EventUnit) Equal to Death Blade (Melee)
              • (Unit-type of EventUnit) Equal to Death Blade (Range)
        • Then - Actions
          • Set local_Unit = UDexUnits[UDex]
          • Special Effect - Create a special effect attached to the origin of local_Unit using Abilities\Spells\Other\Doom\DoomDeath.mdl
          • Special Effect - Set Scale of (Last created special effect) to 1.50
          • Special Effect - Destroy (Last created special effect)
          • Unit - Remove Attribute Bonus (Death Blade,Normal) from local_Unit
          • Unit - Remove Rage (Buff) from local_Unit
          • Unit - Remove Rage buff from local_Unit
          • Unit - Add Attribute Bonus (Death Blade,Extreme) to local_Unit
          • Unit - Add Extreme Rage (Buff) to local_Unit
          • Set CV = (Custom value of local_Unit)
          • Set AbilLvl[CV] = (Level of Rage (Death Blade) for local_Unit)
          • Unit - Set level of Attribute Bonus (Death Blade,Extreme) for local_Unit to AbilLvl[CV]
          • Unit - Set level of Extreme Rage (Buff) for local_Unit to AbilLvl[CV]
          • Wait 15.00 seconds
          • Unit - Remove Attribute Bonus (Death Blade,Extreme) from local_Unit
          • Unit - Remove Extreme Rage (Buff) from local_Unit
        • Else - Actions
      • Custom script: set udg_local_Unit = null
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
In this case it'd be more efficient to just use a normal Integer variable like this:
  • Set AbilityLevel = (Level of Rage (Death Blade) for local_Unit)
  • Unit - Set level of Attribute Bonus (Death Blade,Extreme) for local_Unit to AbilityLevel
  • Unit - Set level of Extreme Rage (Buff) for local_Unit to AbilityLevel
The Unit Indexer stuff with CV and AbilLvl[CV] is not needed for something like this.

Also, and this may be partially my fault for how I created those example triggers, but wouldn't you want to just remove the Rage stuff when the unit reincarnates? Why would it gain Rage again?
 
Level 6
Joined
Jul 23, 2018
Messages
243
because AbilLvl is shared throughout the other triggers so I thought it needs Unit Indexer or that'll only create leaks?
The Rage I remove is a normal one, and the one I add is extreme, which means stronger than normal rage.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
A global Integer variable will never create a leak, nor would a situation like this cause leaks in the first place.

Things That Leak

What a Unit Indexer is useful for is saving information to a unit that will be referenced between Triggers/Waits. The way you're using it now works, but is entirely pointless.

By setting the variable AbilityLevel immediately before using it, there's no opportunity for the Variable to change, so it's perfectly fine to do so.

And you don't even need AbilityLevel in the first place, it's simply a shortcut. Instead, you could just do this:
  • Set level of Attribute Bonus (Death Blade,Extreme) for local_Unit to (Level of Rage (Death Blade) for local_Unit)
Now if you were to set AbilityLevel, use a Wait, and THEN reference AbilityLevel there would be potential for problems.

That's because during the Wait the variable AbilityLevel could get changed to something else-say if another trigger that sets AbilityLevel goes off.

///

And if it's intentional to add rage again then no worries, I was just curious.
 
Last edited:
Level 6
Joined
Jul 23, 2018
Messages
243
A global Integer variable will never create a leak, nor would a situation like this cause leaks in the first place.

Things That Leak

What a Unit Indexer is useful for is saving information to a unit that will be referenced between Triggers/Waits. The way you're using it now works, but is entirely pointless.

By setting the variable AbilityLevel immediately before using it, there's no opportunity for the Variable to change, so it's perfectly fine to do so.

And you don't even need AbilityLevel in the first place, it's simply a shortcut. Instead, you could just do this:
  • Set level of Attribute Bonus (Death Blade,Extreme) for local_Unit to (Level of Rage (Death Blade) for local_Unit)
Now if you were to set AbilityLevel, use a Wait, and THEN reference AbilityLevel there would be potential for problems.

That's because during the Wait the variable AbilityLevel could get changed to something else-say if another trigger that sets AbilityLevel goes off.

///

And if it's intentional to add rage again then no worries, I was just curious.
I need that shortcut though, too tired of look for Level of Ability for Unit.
And yes, we intended to add rage again but stronger.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
I need that shortcut though, too tired of look for Level of Ability for Unit.
And yes, we intended to add rage again but stronger.
Shortcuts are nice, I just wanted to make it clear that it could work without it, therefore it will work fine with it as well. No leaks, no issue of it changing since there's no Waits, etc....
 
Status
Not open for further replies.
Top