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

Obtain point variable

Status
Not open for further replies.
Level 4
Joined
May 12, 2022
Messages
22
Can someone please help me obtain a point variable?

I made a drawing in paint to better explain what I need
Capture.JPG


Basically, I need the point between the triggering unit and the point at which an ability is being casted (at max range of said ability)
I've tried to mess with the variables but I'm not very good with these kind of functions (distance between points, angle, min, max. etc.)

If anyone knows how to do this please let me know.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
You need to compute the angle between the caster and target point and then use "Point with polar offset". Also avoid point leaks.
  • Set TempPoint1 = (Position of Triggering Unit)
  • Set TempPoint2 = (Target point of ability being cast)
  • Set TempPoint3 = (TempPoint1 offset by ABILITY_RANGE toward (Angle from TempPoint1 to TempPoint2) degrees)
  • -------- do whatever with TempPoint3 --------
  • Custom script: call RemoveLocation(udg_TempPoint1) //change names to match your variables but keep the udg_ prefix
  • Custom script: call RemoveLocation(udg_TempPoint2)
  • Custom script: call RemoveLocation(udg_TempPoint3)


(I win this time, Uncle!)
 
Last edited by a moderator:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
Should be possible in 2 steps.
  1. Resolve angle from triggering to ordered point.
  2. Polar offset from triggering unit location using resolved angle with an offset (radius) of maximum range.
If the ordered point is closer than the maximum range an additional logic path may be needed depending on your requirements that simply...
  • If distance from triggering unit location to ordered point is less than or equal to maximum range, use ordered point.
Without this additional logic, the computed point would end up behind the ordered point which may or may not be desireable.
 
Status
Not open for further replies.
Top