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

[Solved] Damage Between Two Points

Status
Not open for further replies.
Level 30
Joined
Feb 18, 2014
Messages
3,623
How can I pick every units between two points and deal damage to them? Let's say I have Point A and Point B, I want any unit that crosses the red line between those two points to die instantly like in the example below :
example1-png.336141

I know some of you will say : why don't you just use regions? Well, that's because it's not like those two points will always be horizontal/vertical, this is just an example. What I am planning to do is to make a spell that creates a circle around the caster that kills all units that tries to enter/leave the circle. Like in the example below :
example2-gif.336142

Now, I do know how to make circular damage using the trigger below. But I don't want it to be a circle because one of the dummies (Banshee) may get killed before they reach the caster which will then make that area safe. Let's say B dies, then the area between (B - A) and (B - C) will be safe to cross.
  • Call of the Highborne Loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set COH_MoveRange = (COH_MoveRange - 5.00)
      • Set COH_DamageRange = (COH_DamageRange - 5.00)
      • Unit - Move COH_Dummy[1] instantly to ((Position of COH_Caster) offset by COH_MoveRange towards 315.00 degrees), facing COH_CasterLoc
      • Unit - Move COH_Dummy[2] instantly to ((Position of COH_Caster) offset by COH_MoveRange towards 270.00 degrees), facing COH_CasterLoc
      • Unit - Move COH_Dummy[3] instantly to ((Position of COH_Caster) offset by COH_MoveRange towards 225.00 degrees), facing COH_CasterLoc
      • Unit - Move COH_Dummy[4] instantly to ((Position of COH_Caster) offset by COH_MoveRange towards 180.00 degrees), facing COH_CasterLoc
      • Unit - Move COH_Dummy[5] instantly to ((Position of COH_Caster) offset by COH_MoveRange towards 135.00 degrees), facing COH_CasterLoc
      • Unit - Move COH_Dummy[6] instantly to ((Position of COH_Caster) offset by COH_MoveRange towards 90.00 degrees), facing COH_CasterLoc
      • Unit - Move COH_Dummy[7] instantly to ((Position of COH_Caster) offset by COH_MoveRange towards 45.00 degrees), facing COH_CasterLoc
      • Unit - Move COH_Dummy[8] instantly to ((Position of COH_Caster) offset by COH_MoveRange towards 0.00 degrees), facing COH_CasterLoc
      • Lightning - Move COH_Lightning[1] to source (Position of COH_Dummy[1]) and target (Position of COH_Dummy[2])
      • Lightning - Move COH_Lightning[2] to source (Position of COH_Dummy[2]) and target (Position of COH_Dummy[3])
      • Lightning - Move COH_Lightning[3] to source (Position of COH_Dummy[3]) and target (Position of COH_Dummy[4])
      • Lightning - Move COH_Lightning[4] to source (Position of COH_Dummy[4]) and target (Position of COH_Dummy[5])
      • Lightning - Move COH_Lightning[5] to source (Position of COH_Dummy[5]) and target (Position of COH_Dummy[6])
      • Lightning - Move COH_Lightning[6] to source (Position of COH_Dummy[6]) and target (Position of COH_Dummy[7])
      • Lightning - Move COH_Lightning[7] to source (Position of COH_Dummy[7]) and target (Position of COH_Dummy[8])
      • Lightning - Move COH_Lightning[8] to source (Position of COH_Dummy[8]) and target (Position of COH_Dummy[1])
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within COH_DamageRange of COH_CasterLoc matching ((Unit-type of (Matching unit)) Different than Banshee)) and do (Actions)
        • Loop - Actions
          • Set COH_PickedUnits = (Picked unit)
          • Set COH_PickedUnitsLoc = (Position of COH_PickedUnits)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between COH_CasterLoc and COH_PickedUnitsLoc) Greater than or Equal to COH_MoveRange
            • Then - Actions
              • Unit - Kill (Picked unit)
              • Custom script: call RemoveLocation (udg_COH_PickedUnitsLoc)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • COH_MoveRange Equal to 100.00
        • Then - Actions
          • Custom script: call RemoveLocation (udg_COH_CasterLoc)
          • For each (Integer A) from 1 to 8, do (Unit - Remove COH_Dummy[(Integer A)] from the game)
          • For each (Integer A) from 1 to 8, do (Lightning - Destroy COH_Lightning[(Integer A)])
          • Unit - Make COH_Caster Vulnerable
          • Unit - Unpause COH_Caster
          • Animation - Reset COH_Caster's animation
          • Trigger - Turn off (This trigger)
        • Else - Actions
 

Attachments

  • Example1.png
    Example1.png
    780.5 KB · Views: 152
  • Example2.gif
    Example2.gif
    844.7 KB · Views: 201
Level 30
Joined
Feb 18, 2014
Messages
3,623
Line Segment Enumeration .v2.1a

Have a look at the "How to use" trigger, you can define 2 points and the allowed offset/width of the line, and then pick units inside it.
Thanks! This is exactly what I was looking for! :D One problem though, if I want to make more than just 2 points like A,B,C,D, Do I have to create four loop for for each two of them? I tried to create two more copies of the LSE_Loc variable but it didn't work and I honestly didn't understand anything in that jass trigger. :p
 
Level 30
Joined
Feb 18, 2014
Messages
3,623
Yeah, I think I got it. I'm just changing the position of the points for each line like :
  • Loc1 = A | Loc2 = B
  • Loc1 = B | Loc2 = C
  • Loc1 = C | Loc2 = D
  • Loc1 = D | Loc2 = A
Then I use a boolean to check whether the point is active or not. It seems to work just fine that way but I don't know if it's safe though.
 
Status
Not open for further replies.
Top