• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

Spell Target Registration

Status
Not open for further replies.
Level 6
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).
 
Level 12
Joined
Jul 11, 2010
Messages
422
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