• 🏆 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!

Line Damage.

Status
Not open for further replies.
Level 14
Joined
Jul 12, 2011
Messages
1,370
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
781
  • 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 25
Joined
Sep 26, 2009
Messages
2,390
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