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

Line Damage.

Status
Not open for further replies.
Level 14
Joined
Jul 12, 2011
Messages
1,371
Could you be more specific?


Edit:
Here's the trigger:
  • Shadow Blink
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Shadow Blink
    • Actions
      • Set Point015 = (Position of (Triggering unit))
      • Set Point016 = (Target point of ability being cast)
      • Unit Group - Pick every unit in (Units in (Region(Point015, Point016))) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True
            • Then - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 100.00 damage of attack type Spells and damage type Normal
              • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Human\Feedback\ArcaneTowerAttack.mdl
              • Special Effect - Destroy (Last created special effect)
              • Custom script: call RemoveLocation (udg_Point015)
              • Custom script: call RemoveLocation (udg_Point016)
            • Else - Actions
              • Custom script: call RemoveLocation (udg_Point015)
              • Custom script: call RemoveLocation (udg_Point016)
 
Level 11
Joined
Nov 15, 2007
Messages
800
  • Line Damage
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Line Damage
    • Actions
      • Set a = (Position of (Triggering unit))
      • Set b = (Target point of ability being cast)
      • Set areagroup = (Units within (Distance between a and b) of a)
      • Set angle = (Angle from a to b)
      • Custom script: call RemoveLocation(udg_b)
      • Unit Group - Pick every unit in areagroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Triggering player)) Equal to True
            • Then - Actions
              • Set b = (Position of (Picked unit))
              • Set c = (a offset by (Distance between a and b) towards angle degrees)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between b and c) Less than or equal to 100.00
                • Then - Actions
                  • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 100.00 damage of attack type Spells and damage type Normal
                • Else - Actions
              • Custom script: call RemoveLocation(udg_b)
              • Custom script: call RemoveLocation(udg_c)
            • Else - Actions
      • Custom script: call RemoveLocation(udg_a)
      • Custom script: call DestroyGroup(udg_areagroup)
There's probably a more efficient way to do this but I don't remember anything about geometric equations. Basically it draws a line and determines if any targets within range of the ability are within 100 distance of the line.
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
I think it may be better efficiency-wise to pick all units within range of center the line and check if their X and Y coordinates are close to any X and Y coordinate on the line. (As I understand it, "pick every unit" action takes a lot of power)

edit: or you could simply calculate the distance between point and a line and if that distance is less than or equal to *your AoE range*, you damage unit.
 
Last edited:
Status
Not open for further replies.
Top