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

Lifedrain - v0.02

  • Like
Reactions: Azsure and baassee
Similar to the normal lifedrain but triggered and with an Area of Effect.

+full MUI
+Stacks
+uber GUI performance
-the usual drain sfx does not work
(but spamming effects all around would increase lag anyway)

Keywords:
lifedrain, drain, suck, aoe, area of effect, manadrain, xaos_wizard, d4rk_g4nd4lf
Contents

Lifedrain (Map)

Reviews
12:04, 29th Dec 2009 TriggerHappy: The effect doesn't look very good in my opinion, but others may feel different. I also could not spot any leaks in the coding, or any other faults for that matter.

Moderator

M

Moderator

12:04, 29th Dec 2009
TriggerHappy:

The effect doesn't look very good in my opinion, but others may feel different.
I also could not spot any leaks in the coding, or any other faults for that matter.
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to |cffffcc00L|rifedrain
  • Actions
    • Set loc = (Target point of ability being cast)
    • Set Drain_Max = (Drain_Max + 1)
    • Set Drain_Caster[Drain_Max] = (Triggering unit)
    • -------- This is the unitgroup which contains all valid target for the cast --------
    • Set Drain_Targets[Drain_Max] = (Units within (((Real((Level of |cffffcc00L|rifedrain for (Triggering unit)))) x 50.00) + 150.00) of loc matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and (((Matching unit) belongs to an e
    • -------- The max range is equal to (what you want it to be) x (what you want it to be) --------
    • -------- In this case the max range is 1200 --------
    • Set Drain_Range[Drain_Max] = (1200.00 x 1200.00)
    • -------- This is the live drained per interval (5 + 5 per Level) --------
    • Set Drain_Value[Drain_Max] = (((Real((Level of |cffffcc00L|rifedrain for (Triggering unit)))) x 5.00) + 5.00)
    • -------- This is the start interval --------
    • Set Drain_Interval[(Drain_Max x 2)] = 0
    • -------- Life will be drained after 33 runs of the loop trigger --------
    • -------- The loop trigger runs 33 times per second --------
    • -------- So life will be drained once every second --------
    • Set Drain_Interval[((Drain_Max x 2) + 1)] = 33
    • Custom script: call RemoveLocation( udg_loc )
    • Trigger - Turn on DrainLoop <gen>
  • Events
    • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • -------- This location is used to determin the zHeight of a unit --------
    • Custom script: if udg_zLoc == null then
    • Set zLoc = (Point(0.00, 0.00))
    • Custom script: endif
    • Set i2 = 0
    • For each (Integer i) from 1 to Drain_Max, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Drain_Caster[i] Not equal to No unit
            • (Drain_Caster[i] is dead) Equal to False
            • (Current order of Drain_Caster[i]) Equal to (Order(channel))
          • Then - Actions
            • Set Drain_Interval[(i x 2)] = (Drain_Interval[(i x 2)] + 1)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Drain_Interval[(i x 2)] Equal to Drain_Interval[((i x 2) + 1)]
              • Then - Actions
                • Set Drain_Interval[(i x 2)] = 0
              • Else - Actions
            • -------- Some special effect --------
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Random integer number between 1 and 2) Equal to 1
              • Then - Actions
                • Special Effect - Create a special effect attached to the overhead of Drain_Caster[i] using Abilities\Spells\Other\Parasite\ParasiteTarget.mdl
                • Special Effect - Destroy (Last created special effect)
              • Else - Actions
            • -------- Set x and y location of the caster --------
            • -------- Cause GetUnitX returns the x-position of the caster --------
            • Custom script: set udg_x = GetUnitX( udg_Drain_Caster[udg_i] )
            • Custom script: set udg_y = GetUnitY( udg_Drain_Caster[udg_i] )
            • Unit Group - Pick every unit in Drain_Targets[i] and do (Actions)
              • Loop - Actions
                • -------- Set x and y location of the target --------
                • Custom script: set udg_x2 = GetUnitX( GetEnumUnit() )
                • Custom script: set udg_y2 = GetUnitY( GetEnumUnit() )
                • -------- Conditions: --------
                • -------- Unit must be unequal to no unit (-> not removed from the game) --------
                • -------- Unit must be alive --------
                • -------- Unit must be visible for the caster --------
                • -------- Unit must not be magic immune --------
                • -------- And within range (Pythagoras) --------
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Picked unit) Not equal to No unit
                    • ((Picked unit) is dead) Equal to False
                    • ((Picked unit) is Magic Immune) Equal to False
                    • ((Picked unit) is visible to (Owner of Drain_Caster[i])) Equal to True
                    • Drain_Range[i] Greater than or equal to (((x - x2) x (x - x2)) + ((y - y2) x (y - y2)))
                  • Then - Actions
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • Drain_Interval[(i x 2)] Equal to 0
                      • Then - Actions
                        • -------- Damage --------
                        • Unit - Cause Drain_Caster[i] to damage (Picked unit), dealing Drain_Value[i] damage of attack type Spells and damage type Normal
                        • -------- Drain Life --------
                        • Unit - Set life of Drain_Caster[i] to ((Life of Drain_Caster[i]) + Drain_Value[i])
                      • Else - Actions
                    • -------- Check if there is a lightning to use in the stack --------
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • Drain_Life_Max Equal to i2
                      • Then - Actions
                        • -------- If this is not the case: Create one --------
                        • Set loc = (Point(0.00, 0.00))
                        • Lightning - Create a Drain Life lightning effect from source loc to target loc
                        • Set Drain_Life_Lightning[i2] = (Last created lightning effect)
                        • Set Drain_Life_Max = (Drain_Life_Max + 1)
                        • Custom script: call RemoveLocation( udg_loc )
                      • Else - Actions
                    • -------- Since there is no "GetUnitZ" we have to move a location to the units position and use "GetLocationZ" instead --------
                    • -------- Actually the same as "set zLoc = Point( x, y )" but without leak --------
                    • Custom script: call MoveLocation( udg_zLoc, udg_x, udg_y)
                    • -------- Of cause we need the flying height, too --------
                    • -------- + 50 to move the lightning to the center of the unit instead of its feet --------
                    • Custom script: set udg_z = GetUnitFlyHeight( udg_Drain_Caster[udg_i] ) + GetLocationZ( udg_zLoc ) + 50
                    • Custom script: call MoveLocation( udg_zLoc, udg_x2, udg_y2)
                    • -------- Move the lightning to the two x/y/z locations we got --------
                    • -------- "true": check visiblity (do not show the lightning in fog for players who are unable to see the lightning) --------
                    • Custom script: call MoveLightningEx( udg_Drain_Life_Lightning[udg_i2], true, udg_x, udg_y, udg_z, udg_x2, udg_y2, GetUnitFlyHeight( GetEnumUnit() ) + GetLocationZ( udg_zLoc ) + 35 )
                    • Set i2 = (i2 + 1)
                  • Else - Actions
                    • -------- Remove unvalid unit from group --------
                    • Unit Group - Remove (Picked unit) from Drain_Targets[i]
            • -------- Stop instance from running if there are no units left to drain off --------
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Drain_Targets[i] is empty) Equal to True
              • Then - Actions
                • Unit - Order Drain_Caster[i] to Stop
                • Set Drain_Caster[i] = No unit
              • Else - Actions
          • Else - Actions
            • -------- Shift data to optimize performance --------
            • Unit Group - Remove all units from Drain_Targets[i]
            • Unit Group - Add all units of Drain_Targets[Drain_Max] to Drain_Targets[i]
            • Unit Group - Remove all units from Drain_Targets[Drain_Max]
            • Set Drain_Caster[i] = Drain_Caster[Drain_Max]
            • Set Drain_Range[i] = Drain_Range[Drain_Max]
            • Set Drain_Value[i] = Drain_Value[Drain_Max]
            • Set Drain_Interval[(i x 2)] = Drain_Interval[(Drain_Max x 2)]
            • Set Drain_Interval[((i x 2) + 1)] = Drain_Interval[((Drain_Max x 2) + 1)]
            • Set Drain_Max = (Drain_Max - 1)
            • Set i = (i - 1)
            • -------- Turns of the trigger if there is nothing to do anymore --------
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Drain_Max Less than 1
              • Then - Actions
                • Trigger - Turn off (This trigger)
              • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • i2 Less than Drain_Life_Max
      • Then - Actions
        • -------- If there are too many lightnings the stack will be cleared --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Drain_Max Less than 1
            • Drain_Life_Max Greater than 10
          • Then - Actions
            • -------- Destroys all lightnings to prevent lag --------
            • For each (Integer i) from 0 to (Drain_Life_Max - 1), do (Actions)
              • Loop - Actions
                • Lightning - Destroy Drain_Life_Lightning[i]
            • Set Drain_Life_Max = 0
          • Else - Actions
            • -------- Hides all unused lightnings --------
            • -------- (A lightning with a length of 0 will not be shown) --------
            • Set loc = (Point(0.00, 0.00))
            • For each (Integer i) from i2 to (Drain_Life_Max - 1), do (Actions)
              • Loop - Actions
                • Lightning - Move Drain_Life_Lightning[i] to source loc and target loc
            • Custom script: call RemoveLocation( udg_loc )
      • Else - Actions
v0.02: made target drain vanish if the target becomes invisible, changed destroy limit, changed one line of custom text to GUI, added a little more comments


and the triggers will stay here until someone improves the editing capabilitys of the upload text box
 
Last edited:
Level 15
Joined
Sep 3, 2009
Messages
1,521
ok here are the pros and cons
(+) MUI.
(+) one of my favorite kinds of spells :D mass drain.
(+) nicely triggered.
(o) ok special effects
(-) not original.
(-) might be confusing with all the custom scripts for beginning GUI'ers.
maybe add some extra effects to the spell.
Overall good job 4/5
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
I really dont get how you can get your call movelightning fucntion to actually WORK when mine DONT DONT DONT :mad:

this shouldnt have been to complicated, you made a lightning system for goodness sake but the conds I actually found, not big deal but

- Does checking order channel work since I've seen multiple problems using that.

- What will happen if a unit turns invisble? Cause I can only see that it checks dead.

That's all for now, prob wont find anymore, great spell as always!
 
Level 1
Joined
Apr 10, 2009
Messages
3
I've got a question / wonder. I've been tinkering with this spell trying to get the lightning effects to work. The only thing i've concluded is that removing the fog of war makes it work to an extent. And if the mobs are close enough to the middle of the effect (altho i havn't quite tinkered that part yet I'll repost (or just edit) when i see if theres a simple way to fix that) Nyway what i'm wondering is there anyway to maybe turn off the check visibility? I've tried to do it myself but I'm pretty new to coding for this stuff so i'm not sure what i'm doing and even if i'm doin it right lol... Again my question is. Is there anyway to turn off the checking of visibility? or is there a way to bypass it to make the lightning effects work. Cause as of right now I havn't found a way around it. Any help would be muchly and deeply appreciated. :confused:
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
I've got a question / wonder. I've been tinkering with this spell trying to get the lightning effects to work. The only thing i've concluded is that removing the fog of war makes it work to an extent. And if the mobs are close enough to the middle of the effect (altho i havn't quite tinkered that part yet I'll repost (or just edit) when i see if theres a simple way to fix that) Nyway what i'm wondering is there anyway to maybe turn off the check visibility? I've tried to do it myself but I'm pretty new to coding for this stuff so i'm not sure what i'm doing and even if i'm doin it right lol... Again my question is. Is there anyway to turn off the checking of visibility? or is there a way to bypass it to make the lightning effects work. Cause as of right now I havn't found a way around it. Any help would be muchly and deeply appreciated. :confused:
D4RK_G4ND4LF said:
  • -------- "true": check visiblity (do not show the lightning in fog for players who are unable to see the lightning) --------
    • Custom script: call MoveLightningEx( udg_Drain_Life_Lightning[udg_i2], true, udg_x, udg_y, udg_z, udg_x2, udg_y2, GetUnitFlyHeight( GetEnumUnit() ) + GetLocationZ( udg_zLoc ) + 35 )
change "true" to "false"
but the lightning will also be shown if the enemy can't see it
if you add custom script like
  • Custom script: if IsUnitVisible(udg_Drain_Caster[udg_i], GetLocalPlayer() then
  • Custom script: set udg_b = true
  • Custom script: else
  • Custom script: set udg_b = false
  • Custom script: endif
  • Custom script: call MoveLightningEx(....., udg_b, ......)
you will have to create a boolean variable called b for this
might be buggy if yes switch some variables until it fits :grin:
 
Level 1
Joined
Apr 10, 2009
Messages
3
change "true" to "false"
but the lightning will also be shown if the enemy can't see it

if you add custom script like
  • Custom script: if IsUnitVisible(udg_Drain_Caster[udg_i], GetLocalPlayer() then
  • Custom script: set udg_b = true
  • Custom script: else
  • Custom script: set udg_b = false
  • Custom script: endif
  • Custom script: call MoveLightningEx(....., udg_b, ......)
you will have to create a boolean variable called b for this
might be buggy if yes switch some variables until it fits :grin:

Well I tried that. That didn't work still got the same result. The hero does his casting animation and is channeling the units are takeing damage but the lightning effect isnt showing up at all unless i still disable the fog-of-war and blackmask on the map.

And as for the coding I wasn't really sure where to put it in the script (I tried several places and things altho again not sure where it was supposed to go. Sorry if this is a bother I'm extremely new to this stuff lol... honestly just started makeing one of my first ever maps.)

I even tried makeing a trigger that would enable all visibility during the duration that didn't help much either still get the same old result of damage/channel but no lightning.
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
You can bug this spell if you cast it on one group and while channeling, you cast it on another area, if there are targets, it wont interrupt this order "channeling".

lifedrain bug.jpg

Also is it possible to add like max units target? Else this can happen according to the bug above.

lifedrain max instance.jpg

EDIT:

Basiclly because I got a 500 shit server error my attachments only were shown for myself
 
Last edited:
Level 19
Joined
Feb 4, 2009
Messages
1,313
You can bug this spell if you cast it on one group and while channeling, you cast it on another area, if there are targets, it wont interrupt this order "channeling".

View attachment 83681

Also is it possible to add like max units target? Else this can happen according to the bug above.

View attachment 83682

EDIT:

Basiclly because I got a 500 shit server error my attachments only were shown for myself

that's supposed to happen
usually you will have cooldown anyway and if the duration is smaller than the cooldown nobody will care about
else it's a nice feature
and if someone really wants to stop it it would take a loop which removes the previous instance if there is one on cast
 
Level 6
Joined
Aug 5, 2015
Messages
202
doesnt work on my map, sad
the damage, and the caster animation is worked
but the lightning effect doesnt show up, i already perfected all variable, triggers
something is wrong here


for some odd reason.. EVERYTHING works but the effect isnt shown.. meaning the damage is done, the life is stolen, but the green lazah beam isnt there


we have same problem, here i thought i have found AoE life drain :(
 
Level 6
Joined
Dec 24, 2019
Messages
19
Looking for fix to lightning showing up in 2020? The reason the lightning effect will not show up in fog of war is because in:

set VariableSet Drain_Life_Lightning[i2] = create special effect from source loc to target loc

For whatever reason, that function actually calls AddLightningEx(...) with the CHECKVISIBILITY parameter automatically set to True. For reasons I am unaware of, doing so makes the lightning effect invisible if fog of war is on, even if the CHECKVISIBILITY parameter is set to False in MoveLightningEx(...). Solution below, replace the original with that exactly and you are good to go

In copy paste format:
set udg_Drain_Life_Lightning[udg_i2] = AddLightningEx("DRAL", false, GetLocationX(udg_loc), GetLocationY(udg_loc), GetLocationZ(udg_loc), GetLocationX(udg_loc), GetLocationY(udg_loc), GetLocationZ(udg_loc))

Hope that helped!

Screenshot - e369f761df6d8c7d3fef08fbc7ef7567 - Gyazo
 
Top