• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Spell Target Registration

Status
Not open for further replies.
Level 7
Joined
May 15, 2009
Messages
191
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