Spellpack Hero: Leecher

duyen

New Member
Reaction score
214
Thanks to the mod who cleaned up all the spam.

Can't post all screenies sorry, but heres the spells.

Touch of Death

Code:
Creates a void at the a point, dealing 50/100/150/200 damage to all surrounding units.


Touch of Death
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Touch of Death 
    Actions
        Set Temp_TOD_Caster = (Triggering unit)
        Set TOD_Level = (Level of Touch of Death  for Temp_TOD_Caster)
        Set Temp_TOD_CasterPoint = (Position of Temp_TOD_Caster)
        Set Temp_TOD_CasterTarget = (Target point of ability being cast)
        Lightning - Create a Drain Life lightning effect from source Temp_TOD_CasterPoint to target Temp_TOD_CasterTarget
        Set TOD_Lightning = (Last created lightning effect)
        Special Effect - Create a special effect at Temp_TOD_CasterTarget using Abilities\Spells\Other\Charm\CharmTarget.mdl
        Unit Group - Pick every unit in (Units within 100.00 of Temp_TOD_CasterTarget) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        TOD_Level Equal to 1
                    Then - Actions
                        Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 50.00)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        TOD_Level Equal to 2
                    Then - Actions
                        Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 100.00)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        TOD_Level Equal to 3
                    Then - Actions
                        Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 150.00)
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                TOD_Level Equal to 4
                            Then - Actions
                                Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 200.00)
                            Else - Actions
                                Do nothing
        Wait 2.00 seconds
        Custom script:   call RemoveLocation (udg_Temp_TOD_CasterPoint)
        Custom script:   call RemoveLocation (udg_Temp_TOD_CasterTarget)
        Lightning - Destroy TOD_Lightning

Drain Life

drainlifescreenielz0.png


Code:
Creates a connection between the Leecher and up to 3 enemies letting the Leecher suck the life out of a unit. Level 1 - 85 damage per unit and life gained. Level 2 - 160 damage per unit and life gained. Level 3 - 250 damage per unit and life gained. Level 4 - 325 damage per unit and life gained.

Drain Life
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Drain Life 
    Actions
        Set DL_Level = (Level of Drain Life  for (Triggering unit))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                DL_Level Equal to 1
            Then - Actions
                Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 85.00)
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        DL_Level Equal to 2
                    Then - Actions
                        Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 160.00)
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                DL_Level Equal to 3
                            Then - Actions
                                Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 250.00)
                            Else - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        DL_Level Equal to 4
                                    Then - Actions
                                        Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 325.00)
                                    Else - Actions
                                        Do nothing
Sleep (Blizzard Spell)

Code:
Puts a target enemy unit to sleep. A sleeping unit can be awoken by attacking it. Level 1 - 20 second sleep for 100 mana. Level 2 - 40 second sleep for 75 mana. Level 3 - 60 second sleep for 50 mana. Level 4 - 80 second sleep for 25 mana.
Death (Ultimate)

Code:
Causes rains of death to pour down in a large area, killing enemy units for 40 hit points per second. Lasts 45 seconds.
 

Naminator

Coming Back To Life
Reaction score
76
That group you can set that as a variable and destroy like this: The red letters are the group variable.

Code:
Touch of Death
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Touch of Death 
    Actions
        Set Temp_TOD_Caster = (Triggering unit)
        Set TOD_Level = (Level of Touch of Death  for Temp_TOD_Caster)
        Set Temp_TOD_CasterPoint = (Position of Temp_TOD_Caster)
        Set Temp_TOD_CasterTarget = (Target point of ability being cast)
        [COLOR="Red"]Set Group_TOD = (Units within 100.00 of Tempo_TOD_CasterTarget) Matching condition..(Is an enemy or whatever you want.)[/COLOR]
        Lightning - Create a Drain Life lightning effect from source Temp_TOD_CasterPoint to target Temp_TOD_CasterTarget
        Set TOD_Lightning = (Last created lightning effect)
        Special Effect - Create a special effect at Temp_TOD_CasterTarget using Abilities\Spells\Other\Charm\CharmTarget.mdl
        Unit Group - Pick every unit in [B](Units within 100.00 of Temp_TOD_CasterTarget)[/B] and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        TOD_Level Equal to 1
                    Then - Actions
                        Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 50.00)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        TOD_Level Equal to 2
                    Then - Actions
                        Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 100.00)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        TOD_Level Equal to 3
                    Then - Actions
                        Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 150.00)
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                TOD_Level Equal to 4
                            Then - Actions
                                Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 200.00)
                            Else - Actions
                                Do nothing
        Wait 2.00 seconds
        Custom script:   call RemoveLocation (udg_Temp_TOD_CasterPoint)
        Custom script:   call RemoveLocation (udg_Temp_TOD_CasterTarget)
        [COLOR="Red"]Custom script:   call DestroyGroup (udg_Group_TOD)[/COLOR]
        Lightning - Destroy TOD_Lightning
 

H34DhUnT3r

Ultra Cool Member
Reaction score
36
~Gals~, READ!

Tysm

(Thank you so much)

And for the spells

why is it everywhere:
Code:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        TOD_Level Equal to 1
                    Then - Actions
                        Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 50.00)
                    Else - Actions
and not with "for each integer"?
 

Tinki3

Special Member
Reaction score
418
Touch of Death

Please take a look at the text in bold:
Code:
Touch of Death
    Events
        [B]Unit - A unit Begins casting an ability[/B]
    Conditions
        (Ability being cast) Equal to Touch of Death 
    Actions
        Set Temp_TOD_Caster = (Triggering unit)
        Set TOD_Level = (Level of Touch of Death  for Temp_TOD_Caster)
        Set Temp_TOD_CasterPoint = (Position of Temp_TOD_Caster)
        Set Temp_TOD_CasterTarget = (Target point of ability being cast)
        Lightning - Create a Drain Life lightning effect from source Temp_TOD_CasterPoint to target Temp_TOD_CasterTarget
        Set TOD_Lightning = (Last created lightning effect)
        [B]Special Effect - Create a special effect at Temp_TOD_CasterTarget using Abilities\Spells\Other\Charm\CharmTarget.mdl[/B]
        [B]Unit Group - Pick every unit in (Units within 100.00 of Temp_TOD_CasterTarget) and do (Actions)[/B]
            Loop - Actions
                [B]If (All Conditions are True) then do (Then Actions) else do (Else Actions)[/B]
                    If - Conditions
                        TOD_Level Equal to 1
                    Then - Actions
                        [B]Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 50.00)[/B]
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        TOD_Level Equal to 2
                    Then - Actions
                        Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 100.00)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        TOD_Level Equal to 3
                    Then - Actions
                        Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 150.00)
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                TOD_Level Equal to 4
                            Then - Actions
                                Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 200.00)
                            Else - Actions
                                [B]Do nothing[/B]
        Wait 2.00 seconds
        Custom script:   call RemoveLocation (udg_Temp_TOD_CasterPoint)
        Custom script:   call RemoveLocation (udg_Temp_TOD_CasterTarget)
        Lightning - Destroy TOD_Lightning
Unit - A unit Begins casting an ability -> We use "Unit - A unit Starts the effect of an ability" here.
For the simple reason that mana has already been used and cooldown has started. Begins happens before mana/cooldown.
On communal maps, or some minor b.net lag, it's almost always possible to cancel
the spell before you use any mana, but you still get the effect from the trigger,
which is rigged, basically imba, and most of all, not wanted.

Special Effect - Create a special effect at Temp_TOD_CasterTarget using.. -> This line leaks a special effect.
All it needs, is a "Special Effect - Destroy (Last created special effect)" line directly afterwards.

Unit Group - Pick every unit in (Units within 100.00 of Temp_TOD_CasterTarget) -> This line leaks a unit group.
Add a Custom Script containing, "set bj_wantDestroyGroup = true" directly
before that action. That way, it's destroyed after use, which is what we want.

If (All Conditions are True) then do (Then Actions) else do (Else Actions) -> This big, messy, ugly, bulging mass of "Ifs" and "Elses" really
is not needed. I'll explain how to remove it further forward.

Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 50.00) -> Setting the life of units to damage them is not "right" - its wrong :).
The caster will not gain bounty or exp from the units that it "killed" with the spell. Use the "Unit - Damage Target" action - that will award those things.

Do nothing -> You don't need to fill up that extra space with a Do nothing
action - it's doing nothing anyway! It's a function defined in Blizzard.j:
JASS:
function DoNothing takes nothing returns nothing
endfunction

As you can see... it's not doing much.
Basically, you waste time on a function call that adds no value.

Now, we can come back to the messy bunch of "Ifs" and "Elses" :)
Delete them all, and simply add a "Unit - Cause Temp_TOD_Caster to damage (Picked unit), dealing (50.00 x (Real(TOD_Level))) damage of attack type Spells and damage type Normal" line instead.

It does the same thing, but saves all those lines, and makes your code look
more efficient. Not to mention it is more efficient. Much more efficient.
You should use formulas like the one I showed you above in future.

Your optimized/leakless trigger:
Code:
Touch of Death Fixed
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Touch of Death 
    Actions
        Set Temp_TOD_Caster = (Triggering unit)
        Set TOD_Level = (Level of Touch of Death  for Temp_TOD_Caster)
        Set Temp_TOD_CasterPoint = (Position of Temp_TOD_Caster)
        Set Temp_TOD_CasterTarget = (Target point of ability being cast)
        Lightning - Create a Drain Life lightning effect from source Temp_TOD_CasterPoint to target Temp_TOD_CasterTarget
        Set TOD_Lightning = (Last created lightning effect)
        Special Effect - Create a special effect at Temp_TOD_CasterTarget using Abilities\Spells\Other\Charm\CharmTarget.mdl
        Special Effect - Destroy (Last created special effect)
        Custom script:   set bj_wantDestroyGroup = true
        Unit Group - Pick every unit in (Units within 100.00 of Temp_TOD_CasterTarget) and do (Actions)
            Loop - Actions
                Unit - Cause Temp_TOD_Caster to damage (Picked unit), dealing (50.00 x (Real(TOD_Level))) damage of attack type Spells and damage type Normal
                [COLOR="Green"]//You could also add SFX to the picked units here[/COLOR]
        Wait 2.00 seconds
        Custom script:   call RemoveLocation (udg_Temp_TOD_CasterPoint)
        Custom script:   call RemoveLocation (udg_Temp_TOD_CasterTarget)
        Lightning - Destroy TOD_Lightning

Drain Life

Again, the big bunch of Ifs and Elses aren't needed.
Instead, a single variable with an array size of 1 can do the trick.

Your whole trigger can be simplified down to this:
Code:
Drain Life
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Drain Life 
    Actions
        Set DL_Amount[1] = 85.00
        Set DL_Amount[2] = 160.00
        Set DL_Amount[3] = 250.00
        Set DL_Amount[4] = 325.00
        Set DL_Level = (Level of Drain Life  for (Triggering unit))
        Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + DL_Amount[DL_Level])
Which makes me wonder.. "is it worth it"?
I've also already made a life drain spell very similar. Find it here.
 

duyen

New Member
Reaction score
214
Now, we can come back to the messy bunch of "Ifs" and "Elses"
Delete them all, and simply add a "Unit - Cause Temp_TOD_Caster to damage (Picked unit), dealing (50.00 x (Real(TOD_Level))) damage of attack type Spells and damage type Normal" line instead.

I tried that, wouldn't let me add Reals.
 

emjlr3

Change can be a good thing
Reaction score
395
graveyarded due to lack of an update
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top