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!
Get the angle from the position of the attacked unit to the position of the attacker. Add the resulting angle by 180° (pi if radians), and project the resulting angle from the position of the unit by a certain distance.
In pseudo-code:
Lua:
angle = atand(GetUnitY(targ)-GetUnitY(source), GetUnitX(targ)-GetUnitX(source))
-- Depending on the result, add by pi or 180
angle = angle + 180
-- angle = angle + pi
targLoc = PolarProjection(GetUnitLoc(targ), angle, dist)
Get the angle from the position of the attacked unit to the position of the attacker. Add the resulting angle by 180° (pi if radians), and project the resulting angle from the position of the unit by a certain distance.
In pseudo-code:
Lua:
angle = atand(GetUnitY(targ)-GetUnitY(source), GetUnitX(targ)-GetUnitX(source))
-- Depending on the result, add by pi or 180
angle = angle + 180
-- angle = angle + pi
targLoc = PolarProjection(GetUnitLoc(targ), angle, dist)
Under most circumstances, using the attacker's facing angle would suffice. The snippet above is likely more robust, since it doesn't depend on a unit's facing angle.
I think he wants the attacked unit to blink behind the attacker like a counter-attack move.
Set the position of the attacker as Point A (variable), then set Point B using Point with polar offset:
Set Point B = Point A offset by -100 towards facing of attacker's degrees.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.