• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

mass lifesteal

Status
Not open for further replies.
Level 6
Joined
Aug 27, 2013
Messages
104
Hello,
I am testing this mass life drain spell for my boss fight. When I do it like this it works, but when I set that Lich activates Life Drain it doesn't work. How I can make it work?

  • Untitled Trigger 001
    • Events
      • Unit - Lich 0000 <gen>'s life becomes Less than 700.00
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • Unit Group - Pick every unit in (Units within 900.00 of (Position of Lich 0000 <gen>)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to Player 1 (Red)
            • Then - Actions
              • Unit - Create 1 dummy for Player 2 (Blue) at (Position of Lich 0000 <gen>) facing Default building facing degrees
              • Unit - Add Life Drain (Neutral Hostile) to (Last created unit)
              • Unit - Order (Last created unit) to Neutral Dark Ranger - Life Drain (Picked unit)
            • Else - Actions
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,896
1) Picking every unit within 900.00 range is literally picking every single unit, dead or alive.
2) Proceeding to filter the (Picked unit)'s is the correct method, but you aren't accounting for anything other than "Owned by Player 1". What about dead units, what about invulnerable units, spell immune, untargetable, etc...
3) Life Drain is a single target spell so trying to cast it on a GROUP of units doesn't make much sense.

So instead, you create your Unit Group, filter out the unwanted units, and then Order lich to cast Life Drain on a random target contained inside:
  • Untitled Trigger 001
    • Events
      • Unit - Lich 0000 <gen>'s life becomes Less than 700.00
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • Set Variable LichPoint = (Position of Lich)
      • Set Variable LichGroup = (Units within 900.00 range of LichPoint)
      • Unit Group - Pick every unit in LichGroup and do (Actions)
        • Loop - Actions
          • Set Variable LichTarget = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (LichTarget belongs to an enemy of (Owner of Lich)) Equal to True
              • (LichTarget is Alive) Equal to True
              • (LichTarget is Invulnerable) Equal to False
              • (LichTarget is Magic immune) Equal to False
            • Then - Actions
              • -------- The unit is a valid target, keep it in the unit group --------
            • Else - Actions
              • -------- The unit is dead or something, get rid of it --------
              • Unit Group - Remove LichTarget from LichGroup
      • Unit - Order Lich to Neutral Dark Ranger - Life Drain (Random unit from LichGroup)
      • Custom script: call RemoveLocation( udg_LichPoint )
      • Custom script: call DestroyGroup( udg_LichGroup )
If you still want the Dummy units, simply add them to the Then - Actions:
  • Then - Actions
    • -------- The unit is a valid target, keep it in the unit group --------
    • Unit - Create 1 dummy for Player 2 (Blue) at LichPoint facing Default building facing degrees
    • Unit - Add Life Drain (Neutral Hostile) to (Last created unit)
    • Unit - Order (Last created unit) to Neutral Dark Ranger - Life Drain LichTarget
Don't forget to get rid of these Dummy units at some point. People often use an Expiration Timer:
  • Unit - Create 1 dummy for Player 2 (Blue) at LichPoint facing Default building facing degrees
  • Unit - Add a 10.00 second generic Expiration Timer to (Last created unit)

I'm also cleaning up the memory leaks and making the trigger far more efficient with my variable usage. Another optimization -> If you know that the Owner of Lich will never change, reference that Player directly instead of (Owner of Lich) inside of the If - Conditions.

Also, I'm going to assume that your Dummy unit isn't setup properly. Here's how to create a proper Dummy unit:

Step 1: Copy and paste the Locust (undead/special).
Step 2: Set it's Movement Type to None and Speed Base to 0.
Step 3: Disable it's Attack, Model, Shadow, and anything else you don't want.
Step 4: Always make sure that the ability it uses has 0 mana cost, 99999 cast range, no requirements, proper targets allowed, etc.
 
Last edited:
Status
Not open for further replies.
Top