• 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.

Spell Target Registration

Status
Not open for further replies.
Level 7
Joined
May 15, 2009
Messages
192
Hey everyone, I was just wondering if there was any way to detect the targets of a forked lightning for a trigger(I want to damage the targets of the spell through a trigger, rather than using the ability itself for that)


Something like:
Cause (Casting Unit) to damage (Units in Hit_By_Spell_Group) dealing (bla,bla,bla damage).
 
You can do it after a "Timer(0)" wait.

Basically : when the spell is casted, you register the units that may be hitted by the spell for the event "Unit is damaged" and starts a timer that will expires in 0 second (a "Wait 0.00 seconds" wouldn't be fast enough). When the timer expires, you destroy/disable/recycle the trigger : every unit that has triggered it has been hitted by the spell.

In GUI, it's something like that (I didn't care about leaks but you should :p) :
  • Init
    • Events
      • Unit - A unit starts the effect of a spell
    • Conditions
      • (Ability being cast) is Forked Lightning
    • Actions
      • Unit Group - Remove all units from GroupDamaged
      • Unit Group - Pick every unit in (Units within 500.00 of (Position of (Target unit of ability being cast)) matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) is TRUE)) and do (Actions)
        • Loop - Actions
          • Trigger - Add to Register Unit <gen> the event (Unit - (Picked unit) is damaged)
      • Trigger - Turn on Register Unit <gen>
      • Timer - Start ForkedTimer once that will expire in 0.00 seconds
  • Timer
    • Events
      • Time - ForkedTimer expires
    • Conditions
    • Actions
      • Trigger - Turn off Register Unit <gen>
      • Unit Group - Pick every unit in GroupDamaged and do (Actions)
        • Loop - Actions
          • Game - Display to (All players) the text: ((Name of (Picked unit)) + has been targeted by forked lightning.)
  • Register Unit
    • Events
    • Conditions
    • Actions
      • Unit Group - Add (Triggering unit) to GroupDamaged
This method should work even if forked's damages are 0, but it has drawbacks... Unless you're lazy or don't want to make something too much complicated, I suggest you to use a custom spell system.
 
Status
Not open for further replies.
Top