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

[Hashtables] Life Leak v0.02

This is my Life Leak spell.
It is a combination of Rupture and Soul Steal, which are known from DotA.
Everything was made using hashtables.

When after casting this spell, your target starts losing it's life while moving and transfering the lost life to you.
Lasts up to 8 seconds or until Caster wanders 800 range away from target.

If you use it in your map, give me credits.



  • Life Leak Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Life Leak
    • Actions
      • -------- Sets the Caster and the Target, as the Variable names say. --------
      • Set Caster = (Triggering unit)
      • Set Target = (Target unit of ability being cast)
      • -------- Sets the position of Caster and Target. --------
      • Set Points[1] = (Position of Caster)
      • Set Points[2] = (Position of Target)
      • -------- Creates a lightning and stores it into variable --------
      • -------- It starts where it finishes to avoid the messing --------
      • Lightning - Create a Drain Life lightning effect from source Points[1] to target Points[1]
      • Set Lightning = (Last created lightning effect)
      • -------- Creates an Invisible, untargetable dummy unit to allow the stacking of effect --------
      • Unit - Create 1 Dummy Unit for (Owner of Caster) at Points[1] facing Default building facing degrees
      • -------- Stores the maximum duration (in seconds) of the spell --------
      • Hashtable - Save 8.00 as 0 of (Key (Last created unit)) in Hashtable
      • -------- Stores the rate at which Target would lose health by moving. --------
      • -------- This amount is divided by 100 to store the Percentage amount. --------
      • -------- 10 of 100 units is 10% of 100 units moved; 15 of 100 - 15%; etc. --------
      • Hashtable - Save ((5.00 + (5.00 x (Real((Level of Life Leak for Caster))))) / 100.00) as 1 of (Key (Last created unit)) in Hashtable
      • -------- Stores the caster and target. --------
      • Hashtable - Save Handle OfCaster as 2 of (Key (Last created unit)) in Hashtable
      • Hashtable - Save Handle OfTarget as 3 of (Key (Last created unit)) in Hashtable
      • -------- Stores the Lightning effect. --------
      • Hashtable - Save Handle OfLightning as 4 of (Key (Last created unit)) in Hashtable
      • -------- Stores the current location of Target, to start leaking if it would move. --------
      • Hashtable - Save (X of Points[2]) as 5 of (Key (Last created unit)) in Hashtable
      • Hashtable - Save (Y of Points[2]) as 6 of (Key (Last created unit)) in Hashtable
      • -------- Creates and stores overhead effects. --------
      • Special Effect - Create a special effect attached to the overhead of Caster using Abilities\Spells\Other\Drain\DrainTarget.mdl
      • Hashtable - Save Handle Of(Last created special effect) as 7 of (Key (Last created unit)) in Hashtable
      • Special Effect - Create a special effect attached to the overhead of Target using Abilities\Spells\Other\Drain\DrainCaster.mdl
      • Hashtable - Save Handle Of(Last created special effect) as 8 of (Key (Last created unit)) in Hashtable
      • -------- Checks if currently there was any instance of spell in effect. --------
      • -------- If there isn't, turns the loop trigger. --------
      • If ((LifeLeaks is empty) Equal to True) then do (Trigger - Turn on Life Leak Loop <gen>) else do (Do nothing)
      • -------- Adds the Dummy unit to the Dummy Group. --------
      • Unit Group - Add (Last created unit) to LifeLeaks
      • -------- Clears leaks. --------
      • Custom script: call RemoveLocation(udg_Points[1])
      • Custom script: call RemoveLocation(udg_Points[2])


  • Life Leak Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in LifeLeaks and do (Actions)
        • Loop - Actions
          • -------- Stores Caster,Target and Lightning effect into variables for faster trigger-work. --------
          • Set Caster = (Load 2 of (Key (Picked unit)) in Hashtable)
          • Set Target = (Load 3 of (Key (Picked unit)) in Hashtable)
          • Set Lightning = (Load 4 of (Key (Picked unit)) in Hashtable)
          • -------- Sets current locations of the Caster and Target. --------
          • Set Points[1] = (Position of Caster)
          • Set Points[2] = (Position of Target)
          • -------- Stores the location of Target during last loop or during cast of the spell. --------
          • Set Points[3] = (Point((Load 5 of (Key (Picked unit)) from Hashtable), (Load 6 of (Key (Picked unit)) from Hashtable)))
          • -------- Counts the distance between Current position of Target and position during last Loop. --------
          • Set Real[1] = (Distance between Points[2] and Points[3])
          • -------- Stores the rate of transfering to the Variable. --------
          • Set Real[2] = (Load 1 of (Key (Picked unit)) from Hashtable)
          • -------- Counts the health that would be transfered. --------
          • Set Real[1] = (Real[1] x Real[2])
          • -------- Counts distance between Caster and Target. --------
          • Set Real[2] = (Distance between Points[1] and Points[2])
          • -------- Loads the Duration left of the spell. --------
          • Set Real[3] = (Load 0 of (Key (Picked unit)) from Hashtable)
          • -------- Reduces the duration of spell by 0.05 (The tick between loops). --------
          • Set Real[3] = (Real[3] - 0.05)
          • -------- If Duration is equals to 0 or distance between Caster and target is greater than 800 or anyone is dead... --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • Real[2] Greater than or equal to 800.00
                  • Real[3] Equal to 0.00
                  • (Caster is dead) Equal to True
                  • (Target is dead) Equal to True
            • Then - Actions
              • -------- Destroys Lightning Effect. --------
              • Lightning - Destroy Lightning
              • -------- Destroys overhead effects. --------
              • Special Effect - Destroy (Load 7 of (Key (Picked unit)) in Hashtable)
              • Special Effect - Destroy (Load 8 of (Key (Picked unit)) in Hashtable)
              • -------- Clears hashtable, removes dummy unit form Dummy group and removes the dummy unit. --------
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable
              • Unit Group - Remove (Picked unit) from LifeLeaks
              • Unit - Remove (Picked unit) from the game
            • Else - Actions
              • -------- Else... --------
              • -------- Heals target for Counted amount. --------
              • Unit - Set life of Caster to ((Life of Caster) + Real[1])
              • -------- Deals PURE damage to the Target. --------
              • Unit - Cause Caster to damage Target, dealing Real[1] damage of attack type Hero and damage type Divine
              • -------- Sets the Flying height of target and caster and adds 45+ Z of their current locations. --------
              • -------- It should be enough for lightning to reach the chest or whatever of caster and target. --------
              • Custom script: set udg_Real[0] = GetLocationZ(udg_Points[1])
              • Set Real[1] = ((Real[0] + (Current flying height of Caster)) + 45.00)
              • Custom script: set udg_Real[0] = GetLocationZ(udg_Points[2])
              • Set Real[2] = ((Real[0] + (Current flying height of Target)) + 45.00)
              • -------- Moves lightning effect. --------
              • -------- It's custom script to make it not to drag by ground. --------
              • Custom script: call MoveLightningEx(udg_Lightning, true, GetUnitX(udg_Caster), GetUnitY(udg_Caster), udg_Real[1], GetUnitX(udg_Target), GetUnitY(udg_Target), udg_Real[2])
              • -------- Saves current location of target. --------
              • Hashtable - Save (X of Points[2]) as 5 of (Key (Picked unit)) in Hashtable
              • Hashtable - Save (Y of Points[2]) as 6 of (Key (Picked unit)) in Hashtable
              • -------- Stores the duration left. --------
              • Hashtable - Save Real[3] as 0 of (Key (Picked unit)) in Hashtable
          • -------- Clears leaks. --------
          • Custom script: call RemoveLocation(udg_Points[1])
          • Custom script: call RemoveLocation(udg_Points[2])
          • Custom script: call RemoveLocation(udg_Points[3])
      • -------- Checks if there is any instance of spell active after looping all the instances currently in work. --------
      • -------- If there isn't any, then turns the loop trigger off. --------
      • If ((LifeLeaks is empty) Equal to True) then do (Trigger - Turn off (This trigger)) else do (Do nothing)




0.01 - First realeased
---Updated Description for IsNotDotaPlayers---
0.02 - Fixed the Z location bug (Thanks for D4RK)


Keywords:
Life, Leak, Drain, Steal, Heal, Run, Away, Lightning, Green, Rupture
Contents

Life leak v0.02 (Map)

Reviews
13:08, 17th Jun 2010 The_Reborn_Devil: The triggering looks ok. Well documented too. Status: Approved Rating: Useful

Moderator

M

Moderator

13:08, 17th Jun 2010
The_Reborn_Devil:

The triggering looks ok. Well documented too.


Status: Approved
Rating: Useful
 
Level 6
Joined
Dec 9, 2007
Messages
208
I'm a little confused. Is your spell basicly a Life Drain where you can move at the same time? or does it drain life when the enemy is moving, since you refer to Rupture?
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
if you are using MoveLightningEx you should also use GetLocationZ else this might happen:

attachment.php


I'm a little confused. Is your spell basicly a Life Drain where you can move at the same time? or does it drain life when the enemy is moving, since you refer to Rupture?

it's not channeling (you can cast it multiple times and run around while doing so)
 

Attachments

  • screenshot.jpg
    screenshot.jpg
    168.2 KB · Views: 2,181
Level 18
Joined
Jan 21, 2006
Messages
2,552
I couldn't find a single thing wrong with this spell, for GUI users that is.

Everything is cleaned up appropriately, and there are no limitations on the insatiability due to the use of your dummy-unit that is created so that a unique handle-ID can be used to store the components of the spell. Very well done.
 
Top