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

Finding the Units Behind

Status
Not open for further replies.
Level 6
Joined
Aug 20, 2009
Messages
95
Hello, I have a question, how is it that you may find the units behind a target, if they're facing you, however if they're not, then its the front of them, in a straight line, EX
.....o
.....t
....|.|
....|.|
....|.|
....|.|

The target is facing the caster or not facing him, the point is the angle has to be away, and I need to pick units in like a 200 radius throughout that angle at X range.
 

Deleted member 177737

D

Deleted member 177737

Can you re-word the entire post, it makes no sense atm.
 
Level 6
Joined
Aug 20, 2009
Messages
95
I'm making a skill, where (Its either a passive or a spell) When cast/triggered, the "Vampire" blinks to all units behind the unit dealing damage, and I thought this over, however, when the vampire is running from the attacker, it is going to look funny blinking back to other units behind you, therefore, I need the angle to change when he is not facing you, and therefore, the angle will be + 180 if hes not facing you, and + 180 if he is, but I want the units within say 200 radius throughout the angle. Like a rectangle.
 

Deleted member 177737

D

Deleted member 177737

Ok so basically you want the vampire to blink through a chain of enemies behind him and deal damage to each, and you want the units to stay within 200 of the vampire?
 
Level 6
Joined
Aug 20, 2009
Messages
95
Sort of, I want the vampire to blink to enemies behind his attacking enemy if the enemy is facing him (Generally facing to speak) If they enemy is running it'd be queer to teleport to enemies behind him, as the vampire would just be delayed more. The 200 units thing, I was saying, If I got an angle STRAIGHT behind the attacked unit, (Or in front, whichever whatever) And I drew a line from that to 800 range behind it, then looped 1-800 and got units in range (200) of offset towards angle offset by 1 each time, and got units, then it would get those units, thats what I meant by the 200. See main post for example.

EDIT: Attached what Im looking to do, the black is the attacker with this ability, the red is the attacled, the arrow shows which way the red is facing.
 

Attachments

  • Facing.png
    Facing.png
    10.2 KB · Views: 101
Last edited:

Deleted member 177737

D

Deleted member 177737

Hmm... Well I'm not quite sure how I'd go about making that either, sorry =/
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Sorry, I can't understand the problem, but if you want to find the units behind the caster, you get the caster's facing angle, also get the angle between the caster and the enemy units, then calculate the arc length between the caster and the units you enumerated. If the arc length is greater than 120 and less than 240 then the said unit is at the caster's back.
 
Level 11
Joined
May 31, 2008
Messages
698
So if the vampire is attacked, and the attacking unit is facing the vampire, you want the vampire to blink to the closest enemy behind the unit that attacked him?

Or is this supposed to go off when the vampire attacks an enemy?
 
Level 6
Joined
Aug 20, 2009
Messages
95
When the vampire attacks an enemy, theres a chance that he will blink to every unit within 800 range behind the enemy unit. When the enemy unit is facing him it will be behind him. When the unit is not facing him, it will be in front.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Oh now I get it, that's easy, get the targets unit facing then add 180, after that polar project x distance away from the target. Now to make the vampire face the target's back, get the angle between the vampire and the target. That should work.
 
Level 11
Joined
May 31, 2008
Messages
698
set facing = facing of (attacked unit)
set loc[0] = position of (attacked unit)
loop 1-80
set dist = dist +10
set loc = polar offset(loc[0], by distance(dist), at angle(facing + 180)
custom script: call RemoveLocation(loc[1])
endloop
custom script: call RemoveLocation(loc[0])

Thats how you get the locations, just pick units in range of the loc and stuff and add them to a group
 
Status
Not open for further replies.
Top