• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Life Drain custom spell not working properly

Level 2
Joined
May 16, 2024
Messages
5
Hi guys!
As the title says, I have a problem with my custom ability.
It is supposed to work kinda like a normal life drain, but I want it to keep the targeted unit in place and the casting unit can still move freely while keeping the effet of the ability.
Here is what I have managed to brew:
  • ReaperDeathGrip
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Death Grip
    • Actions
      • Unit Group - Add (Target unit of ability being cast) to DeathGripTarget
      • Special Effect - Create a special effect attached to the origin of (Target unit of ability being cast) using war3mapImported\Stranglehold.mdx
      • Special Effect - Play Special Effect: DeathGripSEffect, Animation: Birth
      • Set DeathGripSEffect = (Last created special effect)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is in DeathGripTarget) Equal to True
        • Then - Actions
          • Wait 7.50 seconds
          • Special Effect - Destroy DeathGripSEffect
          • Unit Group - Remove (Target unit of ability being cast) from DeathGripTarget
        • Else - Actions
          • Do nothing
And here is the trigger that is responsible for dealing damage to the target unit:

  • DeathGripLifeStealON
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DeathGripTarget is empty) Equal to True
        • Then - Actions
          • Do nothing
        • Else - Actions
          • Unit Group - Pick every unit in DeathGripTarget and do (Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 15.00))

Now the main problem is, that the "remove unit from unit group function" is not working properly (or at least I believe so),
and so the target unit that is added to a group that is supposed to take damage every second takes damage continously,
because it seems to still be in that unit group.
Also, please do not pay heed to any leaks or so, as I have just only started to learn GUI and I'm just tinkering around and exploring possibilities
(besides, I don't really know how to use custom script function yet :p )
Any help is appreciated!
 

Uncle

Warcraft Moderator
Level 65
Joined
Aug 10, 2018
Messages
6,700
Hello!

1) You can't reference (Target unit of ability being cast) after a Wait action. A lot of Event Responses won't work or won't be safe to use either. Waits are generally avoided outside of things like cinematics / setup triggers.

2) You should deal Damage to the DeathGripTarget, not subtract from it's life. Life loss doesn't grant kill credit and won't interact with the game's damage/armor system.

3) The fact that you have a Unit Group implies that you want this ability to work on more than one target at a time, but you're using non-Array variables like DeathGripSEffect which can only work one at a time.

Here's how you can redesign the triggers to work as you'd expect. This uses a method called Dynamic Indexing that allows us to create instances of the spell which can all track their own unique data over time:
  • Death Grip Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Death Grip (Hero)
    • Actions
      • -------- Create a new instance of the spell: --------
      • Set DeathGrip_Instances = (DeathGrip_Instances + 1)
      • -------- --------
      • Set DeathGrip_Caster[DeathGrip_Instances] = (Triggering unit)
      • Set DeathGrip_Target[DeathGrip_Instances] = (Target unit of ability being cast)
      • Set DeathGrip_Ticks[DeathGrip_Instances] = 0
      • -------- --------
      • -------- Deals 10/20/30 damage per second (heals for same amount): --------
      • Set DeathGrip_Damage[DeathGrip_Instances] = (10.00 x (Real((Level of (Ability being cast) for DeathGrip_Caster[DeathGrip_Instances]))))
      • -------- --------
      • -------- Create a Dummy that will cast the drain life visual effect for us: --------
      • Set DeathGrip_Point = (Position of DeathGrip_Caster[DeathGrip_Instances])
      • Unit - Create 1 Dummy for (Triggering player) at DeathGrip_Point facing Default building facing degrees
      • Custom script: call RemoveLocation( udg_DeathGrip_Point )
      • -------- --------
      • -------- The drain life doesn't actually deal any damage, it's purely visual: --------
      • Set DeathGrip_Dummy[DeathGrip_Instances] = (Last created unit)
      • Unit - Add a 10.00 second Generic expiration timer to DeathGrip_Dummy[DeathGrip_Instances]
      • Unit - Add Death Grip (Lightning - Dummy) to DeathGrip_Dummy[DeathGrip_Instances]
      • Unit - Order DeathGrip_Dummy[DeathGrip_Instances] to Neutral Dark Ranger - Life Drain DeathGrip_Target[DeathGrip_Instances]
      • -------- --------
      • -------- Death Grip Loop should be Initially OFF: --------
      • Trigger - Turn on Death Grip Loop <gen>
  • Death Grip Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer DeathGrip_Loop) from 1 to DeathGrip_Instances, do (Actions)
        • Loop - Actions
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (DeathGrip_Caster[DeathGrip_Loop] is alive) Equal to True
              • (DeathGrip_Target[DeathGrip_Loop] is alive) Equal to True
            • Then - Actions
              • -------- Move the Dummy to the position of the Caster without interrupting it: --------
              • Set DeathGrip_Point = (Position of DeathGrip_Caster[DeathGrip_Loop])
              • Custom script: call SetUnitX( udg_DeathGrip_Dummy[udg_DeathGrip_Loop], GetLocationX( udg_DeathGrip_Point ) )
              • Custom script: call SetUnitY( udg_DeathGrip_Dummy[udg_DeathGrip_Loop], GetLocationY( udg_DeathGrip_Point ) )
              • Custom script: call RemoveLocation( udg_DeathGrip_Point )
              • -------- --------
              • -------- Track how much time has passed (1 tick = 0.05s): --------
              • Set DeathGrip_Ticks[DeathGrip_Loop] = (DeathGrip_Ticks[DeathGrip_Loop] + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (DeathGrip_Ticks[DeathGrip_Loop] mod 20) Equal to 0
                • Then - Actions
                  • -------- Another 1.00 second has passed -> Drain life: --------
                  • Unit - Cause DeathGrip_Caster[DeathGrip_Loop] to damage DeathGrip_Target[DeathGrip_Loop], dealing DeathGrip_Damage[DeathGrip_Loop] damage of attack type Spells and damage type Normal
                  • Unit - Set life of DeathGrip_Caster[DeathGrip_Loop] to ((Life of DeathGrip_Caster[DeathGrip_Loop]) + DeathGrip_Damage[DeathGrip_Loop])
                  • -------- --------
                  • -------- If 8.00 seconds in total has passed -> End the spell: --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DeathGrip_Ticks[DeathGrip_Loop] Equal to 160
                    • Then - Actions
                      • Set DeathGrip_Remove_Instance = True
                    • Else - Actions
                • Else - Actions
            • Else - Actions
              • -------- Either the caster or target died -> End the spell: --------
              • Set DeathGrip_Remove_Instance = True
          • -------- --------
          • -------- Either the duration is finished, the caster died, or the target died -> End the spell: --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DeathGrip_Remove_Instance Equal to True
            • Then - Actions
              • Set DeathGrip_Remove_Instance = False
              • -------- --------
              • -------- Remove previously created units/effects/etc: --------
              • Unit - Remove DeathGrip_Dummy[DeathGrip_Loop] from the game
              • -------- --------
              • -------- Swap current instance with the last instance: --------
              • Set DeathGrip_Caster[DeathGrip_Loop] = DeathGrip_Caster[DeathGrip_Instances]
              • Set DeathGrip_Target[DeathGrip_Loop] = DeathGrip_Caster[DeathGrip_Instances]
              • Set DeathGrip_Dummy[DeathGrip_Loop] = DeathGrip_Dummy[DeathGrip_Instances]
              • Set DeathGrip_Damage[DeathGrip_Loop] = DeathGrip_Damage[DeathGrip_Instances]
              • Set DeathGrip_Ticks[DeathGrip_Loop] = DeathGrip_Ticks[DeathGrip_Instances]
              • -------- --------
              • -------- Reduce the instances by 1, set the the Loop back a cycle, and turn this off if all instances are removed: --------
              • Set DeathGrip_Instances = (DeathGrip_Instances - 1)
              • Set DeathGrip_Loop = (DeathGrip_Loop - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DeathGrip_Instances Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
Variables used:
1715878246339.png

Object Editor data:
1715877993204.png
1715878003212.png
1715878045090.png

The Dummy unit should be created like this:
1) Copy and paste the Locust.
2) Set Model = None, Shadow = None, Attacks Enabled = None, Movement Type = None, Speed Base = 0.
 

Attachments

  • Death Grip 1.w3m
    22.3 KB · Views: 2
Last edited:
Level 2
Joined
May 16, 2024
Messages
5
Hello!

1) You can't reference (Target unit of ability being cast) after a Wait action. A lot of Event Responses won't work or won't be safe to use either. Waits are generally avoided outside of things like cinematics / setup triggers.

2) You should deal Damage to the DeathGripTarget, not subtract from it's life. Life loss doesn't grant kill credit and won't interact with the game's damage/armor system.

3) The fact that you have a Unit Group implies that you want this ability to work on more than one target at a time, but you're using non-Array variables like DeathGripSEffect which can only work one at a time.

Here's how you can redesign the triggers to work as you'd expect. This uses a method called Dynamic Indexing that allows us to create instances of the spell which can all track their own unique data over time:
  • Death Grip Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Death Grip (Hero)
    • Actions
      • -------- Create a new instance of the spell: --------
      • Set DeathGrip_Instances = (DeathGrip_Instances + 1)
      • -------- --------
      • Set DeathGrip_Caster[DeathGrip_Instances] = (Triggering unit)
      • Set DeathGrip_Target[DeathGrip_Instances] = (Target unit of ability being cast)
      • Set DeathGrip_Ticks[DeathGrip_Instances] = 0
      • -------- --------
      • -------- Deals 10/20/30 damage per second (heals for same amount): --------
      • Set DeathGrip_Damage[DeathGrip_Instances] = (10.00 x (Real((Level of (Ability being cast) for DeathGrip_Caster[DeathGrip_Instances]))))
      • -------- --------
      • -------- Create a Dummy that will cast the drain life visual effect for us: --------
      • Set DeathGrip_Point = (Position of DeathGrip_Caster[DeathGrip_Instances])
      • Unit - Create 1 Dummy for (Triggering player) at DeathGrip_Point facing Default building facing degrees
      • Custom script: call RemoveLocation( udg_DeathGrip_Point )
      • -------- --------
      • -------- The drain life doesn't actually deal any damage, it's purely visual: --------
      • Set DeathGrip_Dummy[DeathGrip_Instances] = (Last created unit)
      • Unit - Add a 10.00 second Generic expiration timer to DeathGrip_Dummy[DeathGrip_Instances]
      • Unit - Add Death Grip (Lightning - Dummy) to DeathGrip_Dummy[DeathGrip_Instances]
      • Unit - Order DeathGrip_Dummy[DeathGrip_Instances] to Neutral Dark Ranger - Life Drain DeathGrip_Target[DeathGrip_Instances]
      • -------- --------
      • -------- Death Grip Loop should be Initially OFF: --------
      • Trigger - Turn on Death Grip Loop <gen>
  • Death Grip Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer DeathGrip_Loop) from 1 to DeathGrip_Instances, do (Actions)
        • Loop - Actions
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (DeathGrip_Caster[DeathGrip_Loop] is alive) Equal to True
              • (DeathGrip_Target[DeathGrip_Loop] is alive) Equal to True
            • Then - Actions
              • -------- Move the Dummy to the position of the Caster without interrupting it: --------
              • Set DeathGrip_Point = (Position of DeathGrip_Caster[DeathGrip_Loop])
              • Custom script: call SetUnitX( udg_DeathGrip_Dummy[udg_DeathGrip_Loop], GetLocationX( udg_DeathGrip_Point ) )
              • Custom script: call SetUnitY( udg_DeathGrip_Dummy[udg_DeathGrip_Loop], GetLocationY( udg_DeathGrip_Point ) )
              • Custom script: call RemoveLocation( udg_DeathGrip_Point )
              • -------- --------
              • -------- Track how much time has passed (1 tick = 0.05s): --------
              • Set DeathGrip_Ticks[DeathGrip_Loop] = (DeathGrip_Ticks[DeathGrip_Loop] + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (DeathGrip_Ticks[DeathGrip_Loop] mod 20) Equal to 0
                • Then - Actions
                  • -------- Another 1.00 second has passed -> Drain life: --------
                  • Unit - Cause DeathGrip_Caster[DeathGrip_Loop] to damage DeathGrip_Target[DeathGrip_Loop], dealing DeathGrip_Damage[DeathGrip_Loop] damage of attack type Spells and damage type Normal
                  • Unit - Set life of DeathGrip_Caster[DeathGrip_Loop] to ((Life of DeathGrip_Caster[DeathGrip_Loop]) + DeathGrip_Damage[DeathGrip_Loop])
                  • -------- --------
                  • -------- If 8.00 seconds in total has passed -> End the spell: --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DeathGrip_Ticks[DeathGrip_Loop] Equal to 160
                    • Then - Actions
                      • Set DeathGrip_Remove_Instance = True
                    • Else - Actions
                • Else - Actions
            • Else - Actions
              • -------- Either the caster or target died -> End the spell: --------
              • Set DeathGrip_Remove_Instance = True
          • -------- --------
          • -------- Either the duration is finished, the caster died, or the target died -> End the spell: --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DeathGrip_Remove_Instance Equal to True
            • Then - Actions
              • Set DeathGrip_Remove_Instance = False
              • -------- --------
              • -------- Remove previously created units/effects/etc: --------
              • Unit - Remove DeathGrip_Dummy[DeathGrip_Loop] from the game
              • -------- --------
              • -------- Swap current instance with the last instance: --------
              • Set DeathGrip_Caster[DeathGrip_Loop] = DeathGrip_Caster[DeathGrip_Instances]
              • Set DeathGrip_Target[DeathGrip_Loop] = DeathGrip_Caster[DeathGrip_Instances]
              • Set DeathGrip_Dummy[DeathGrip_Loop] = DeathGrip_Dummy[DeathGrip_Instances]
              • Set DeathGrip_Damage[DeathGrip_Loop] = DeathGrip_Damage[DeathGrip_Instances]
              • Set DeathGrip_Ticks[DeathGrip_Loop] = DeathGrip_Ticks[DeathGrip_Instances]
              • -------- --------
              • -------- Reduce the instances by 1, set the the Loop back a cycle, and turn this off if all instances are removed: --------
              • Set DeathGrip_Instances = (DeathGrip_Instances - 1)
              • Set DeathGrip_Loop = (DeathGrip_Loop - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DeathGrip_Instances Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
Variables used:
View attachment 473404
Object Editor data:
View attachment 473400View attachment 473401View attachment 473402
The Dummy unit should be created like this:
1) Copy and paste the Locust.
2) Set Model = None, Shadow = None, Attacks Enabled = None, Movement Type = None, Speed Base = 0.

As for kill credits and armor/damage interaction, I simply do not need them, as this ability will be used by a boss controlled by the AI (which will also be a regular unit, not a hero), hence the simple life substraction. Also not sure if relevant but the skill (the base one) itself is based off of Firebolt for the stun effect, for I will ad some custom special effects to it..
Anyway, thank you for your quick reply and triggers! I'll try to implement it and maybe even modify it for fun tomorrow
and let know how it went!
 

Uncle

Warcraft Moderator
Level 65
Joined
Aug 10, 2018
Messages
6,700
As for kill credits and armor/damage interaction, I simply do not need them, as this ability will be used by a boss controlled by the AI (which will also be a regular unit, not a hero), hence the simple life substraction. Also not sure if relevant but the skill (the base one) itself is based off of Firebolt for the stun effect, for I will ad some custom special effects to it..
Anyway, thank you for your quick reply and triggers! I'll try to implement it and maybe even modify it for fun tomorrow
and let know how it went!
Makes sense for the kill credit, but do you not want your Hero's to be able to reduce this damage? Magic/Spell resistance, skills like Berserk that amplify damage taken, etc. None of these will work if you subtract life.

The Hero ability is based on Storm Bolt, so I think we had the same idea there.
 
Last edited:
Level 2
Joined
May 16, 2024
Messages
5
Makes sense for the kill credit, but do you not want your Hero's to be able to reduce this damage? Magic/Spell resistance, skills like Berserk that amplify damage taken, etc. None of these will work if you subtract life.

The Hero ability is based on Storm Bolt, so I think we had the same idea there.
Yeah, the non-reducible damage is actually intended :)
Thanks again for the reply!
 
Level 2
Joined
May 16, 2024
Messages
5
Hello!

1) You can't reference (Target unit of ability being cast) after a Wait action. A lot of Event Responses won't work or won't be safe to use either. Waits are generally avoided outside of things like cinematics / setup triggers.

2) You should deal Damage to the DeathGripTarget, not subtract from it's life. Life loss doesn't grant kill credit and won't interact with the game's damage/armor system.

3) The fact that you have a Unit Group implies that you want this ability to work on more than one target at a time, but you're using non-Array variables like DeathGripSEffect which can only work one at a time.

Here's how you can redesign the triggers to work as you'd expect. This uses a method called Dynamic Indexing that allows us to create instances of the spell which can all track their own unique data over time:
  • Death Grip Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Death Grip (Hero)
    • Actions
      • -------- Create a new instance of the spell: --------
      • Set DeathGrip_Instances = (DeathGrip_Instances + 1)
      • -------- --------
      • Set DeathGrip_Caster[DeathGrip_Instances] = (Triggering unit)
      • Set DeathGrip_Target[DeathGrip_Instances] = (Target unit of ability being cast)
      • Set DeathGrip_Ticks[DeathGrip_Instances] = 0
      • -------- --------
      • -------- Deals 10/20/30 damage per second (heals for same amount): --------
      • Set DeathGrip_Damage[DeathGrip_Instances] = (10.00 x (Real((Level of (Ability being cast) for DeathGrip_Caster[DeathGrip_Instances]))))
      • -------- --------
      • -------- Create a Dummy that will cast the drain life visual effect for us: --------
      • Set DeathGrip_Point = (Position of DeathGrip_Caster[DeathGrip_Instances])
      • Unit - Create 1 Dummy for (Triggering player) at DeathGrip_Point facing Default building facing degrees
      • Custom script: call RemoveLocation( udg_DeathGrip_Point )
      • -------- --------
      • -------- The drain life doesn't actually deal any damage, it's purely visual: --------
      • Set DeathGrip_Dummy[DeathGrip_Instances] = (Last created unit)
      • Unit - Add a 10.00 second Generic expiration timer to DeathGrip_Dummy[DeathGrip_Instances]
      • Unit - Add Death Grip (Lightning - Dummy) to DeathGrip_Dummy[DeathGrip_Instances]
      • Unit - Order DeathGrip_Dummy[DeathGrip_Instances] to Neutral Dark Ranger - Life Drain DeathGrip_Target[DeathGrip_Instances]
      • -------- --------
      • -------- Death Grip Loop should be Initially OFF: --------
      • Trigger - Turn on Death Grip Loop <gen>
  • Death Grip Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer DeathGrip_Loop) from 1 to DeathGrip_Instances, do (Actions)
        • Loop - Actions
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (DeathGrip_Caster[DeathGrip_Loop] is alive) Equal to True
              • (DeathGrip_Target[DeathGrip_Loop] is alive) Equal to True
            • Then - Actions
              • -------- Move the Dummy to the position of the Caster without interrupting it: --------
              • Set DeathGrip_Point = (Position of DeathGrip_Caster[DeathGrip_Loop])
              • Custom script: call SetUnitX( udg_DeathGrip_Dummy[udg_DeathGrip_Loop], GetLocationX( udg_DeathGrip_Point ) )
              • Custom script: call SetUnitY( udg_DeathGrip_Dummy[udg_DeathGrip_Loop], GetLocationY( udg_DeathGrip_Point ) )
              • Custom script: call RemoveLocation( udg_DeathGrip_Point )
              • -------- --------
              • -------- Track how much time has passed (1 tick = 0.05s): --------
              • Set DeathGrip_Ticks[DeathGrip_Loop] = (DeathGrip_Ticks[DeathGrip_Loop] + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (DeathGrip_Ticks[DeathGrip_Loop] mod 20) Equal to 0
                • Then - Actions
                  • -------- Another 1.00 second has passed -> Drain life: --------
                  • Unit - Cause DeathGrip_Caster[DeathGrip_Loop] to damage DeathGrip_Target[DeathGrip_Loop], dealing DeathGrip_Damage[DeathGrip_Loop] damage of attack type Spells and damage type Normal
                  • Unit - Set life of DeathGrip_Caster[DeathGrip_Loop] to ((Life of DeathGrip_Caster[DeathGrip_Loop]) + DeathGrip_Damage[DeathGrip_Loop])
                  • -------- --------
                  • -------- If 8.00 seconds in total has passed -> End the spell: --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DeathGrip_Ticks[DeathGrip_Loop] Equal to 160
                    • Then - Actions
                      • Set DeathGrip_Remove_Instance = True
                    • Else - Actions
                • Else - Actions
            • Else - Actions
              • -------- Either the caster or target died -> End the spell: --------
              • Set DeathGrip_Remove_Instance = True
          • -------- --------
          • -------- Either the duration is finished, the caster died, or the target died -> End the spell: --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DeathGrip_Remove_Instance Equal to True
            • Then - Actions
              • Set DeathGrip_Remove_Instance = False
              • -------- --------
              • -------- Remove previously created units/effects/etc: --------
              • Unit - Remove DeathGrip_Dummy[DeathGrip_Loop] from the game
              • -------- --------
              • -------- Swap current instance with the last instance: --------
              • Set DeathGrip_Caster[DeathGrip_Loop] = DeathGrip_Caster[DeathGrip_Instances]
              • Set DeathGrip_Target[DeathGrip_Loop] = DeathGrip_Caster[DeathGrip_Instances]
              • Set DeathGrip_Dummy[DeathGrip_Loop] = DeathGrip_Dummy[DeathGrip_Instances]
              • Set DeathGrip_Damage[DeathGrip_Loop] = DeathGrip_Damage[DeathGrip_Instances]
              • Set DeathGrip_Ticks[DeathGrip_Loop] = DeathGrip_Ticks[DeathGrip_Instances]
              • -------- --------
              • -------- Reduce the instances by 1, set the the Loop back a cycle, and turn this off if all instances are removed: --------
              • Set DeathGrip_Instances = (DeathGrip_Instances - 1)
              • Set DeathGrip_Loop = (DeathGrip_Loop - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DeathGrip_Instances Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
Variables used:
View attachment 473404
Object Editor data:
View attachment 473400View attachment 473401View attachment 473402
The Dummy unit should be created like this:
1) Copy and paste the Locust.
2) Set Model = None, Shadow = None, Attacks Enabled = None, Movement Type = None, Speed Base = 0.
Hey, just wanted to let you know that it works like a charm! I alos learned quite a bit from it, so thanks a lot!

A handy reference for which event responses are wait-safe (and the degree of safety they have): Event Response Myths
And also thank you too, you fine gentleman. The link is quite useful!
 
Level 2
Joined
May 16, 2024
Messages
5
Makes sense for the kill credit, but do you not want your Hero's to be able to reduce this damage? Magic/Spell resistance, skills like Berserk that amplify damage taken, etc. None of these will work if you subtract life.

The Hero ability is based on Storm Bolt, so I think we had the same idea there.
Quick question, how do I implement a custom special effect in the same trigger?
I figured that I probably need to just reference those variables but turns out, I don't understand some of them so I got a bit confused.

(Sorry for the double post, I didn't want to create another topic just for this.)
 

Uncle

Warcraft Moderator
Level 65
Joined
Aug 10, 2018
Messages
6,700
Quick question, how do I implement a custom special effect in the same trigger?
I figured that I probably need to just reference those variables but turns out, I don't understand some of them so I got a bit confused.

(Sorry for the double post, I didn't want to create another topic just for this.)
The Array variables act as your "trackable data", which is what we want to keep track of over time. So whenever you want to keep track of something new you will simply add a new Array variable of your desired type. In this case you want to track a Special Effect variable.

We create and track the Special Effect in our Cast trigger:
  • Special Effect - Create a special effect attached to the origin of (Target unit of ability being cast) using war3mapImported\Stranglehold.mdx
  • Set DeathGrip_Sfx[DeathGrip_Instances] = (Last created special effect)
Then we need to destroy this effect and swap it when an instance ends, which occurs at the bottom of our Loop trigger:
  • -------- Remove previously created units/effects/etc: --------
  • Special Effect - Destroy DeathGrip_Sfx[DeathGrip_Loop]
  • -------- --------
  • -------- Swap current instance with the last instance: --------
  • Set DeathGrip_Sfx[DeathGrip_Loop] = DeathGrip_Sfx[DeathGrip_Instances]
^ Note that I've gotten rid of the other Actions in the above examples, but you should NOT get rid of anything. You're simply adding these new Actions.
 
Top