• 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] Points around unit.

Status
Not open for further replies.
Level 5
Joined
Oct 12, 2007
Messages
159
What I am trying to accomplish is setting out points around a unit in a specific pattern, I'll show you.

2j1sq4o.png


with a range of 40 or 50ish between the points, but I can't get the math figured out on where to place these points.

Some help is much appreciated.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Is that point need all of them at once or jumps from one another (not all at a time) ?

What I meant was, do you need 18 points all together or make it only 1 point, but there is interval per execution where the point use only 1 (in this case, we use 1 variable instead of 18 or array) and will be replaced/overwrite once the point1 has been used, it goes to point2, making point1 = point2 now

Hmmm I hope you understand my question, was more like... statement..
 
Level 7
Joined
Apr 21, 2011
Messages
93
Basically, what I would do is first calculate three of the points that follow the unit's facing and use them as anchor points. (I know this might be slightly complex but -) Use the euclidean theorem to calculate the angle and distance for these three anchor points. Then when you have these three points, just add the 9 other points via "point with polar offset" by calculating the angle of the unit +/- the required angle and adding your desired distance amount.

...you know what, I'll trigger what I have in mind and post it ^^
 
Level 7
Joined
Apr 21, 2011
Messages
93
Okay so I've found a way to avoid the maths.

  • Actions
    • -------- Anchor Points --------
    • Set AnchorPoint[0] = ((Position of YourUnit) offset by -40.00 towards (Facing of YourUnit) degrees)
    • Set AnchorPoint[1] = (Position of YourUnit)
    • Set AnchorPoint[2] = ((Position of YourUnit) offset by 40.00 towards (Facing of YourUnit) degrees)
    • -------- Your desired points --------
    • -------- UNIT'S RIGHT --------
    • Set YourPoint[0] = (AnchorPoint[0] offset by 20.00 towards ((Facing of YourUnit) + 90.00) degrees)
    • Set YourPoint[1] = (AnchorPoint[0] offset by 60.00 towards ((Facing of YourUnit) + 90.00) degrees)
    • Set YourPoint[2] = (AnchorPoint[0] offset by 100.00 towards ((Facing of YourUnit) + 90.00) degrees)
    • Set YourPoint[3] = (AnchorPoint[1] offset by 20.00 towards ((Facing of YourUnit) + 90.00) degrees)
    • Set YourPoint[4] = (AnchorPoint[1] offset by 60.00 towards ((Facing of YourUnit) + 90.00) degrees)
    • Set YourPoint[5] = (AnchorPoint[1] offset by 100.00 towards ((Facing of YourUnit) + 90.00) degrees)
    • Set YourPoint[6] = (AnchorPoint[2] offset by 20.00 towards ((Facing of YourUnit) + 90.00) degrees)
    • Set YourPoint[7] = (AnchorPoint[2] offset by 60.00 towards ((Facing of YourUnit) + 90.00) degrees)
    • Set YourPoint[8] = (AnchorPoint[2] offset by 100.00 towards ((Facing of YourUnit) + 90.00) degrees)
    • -------- UNIT'S LEFT --------
    • Set YourPoint[9] = (AnchorPoint[0] offset by -20.00 towards ((Facing of YourUnit) + 90.00) degrees)
    • Set YourPoint[10] = (AnchorPoint[0] offset by -60.00 towards ((Facing of YourUnit) + 90.00) degrees)
    • Set YourPoint[11] = (AnchorPoint[0] offset by -100.00 towards ((Facing of YourUnit) + 90.00) degrees)
    • Set YourPoint[12] = (AnchorPoint[1] offset by -20.00 towards ((Facing of YourUnit) + 90.00) degrees)
    • Set YourPoint[13] = (AnchorPoint[1] offset by -60.00 towards ((Facing of YourUnit) + 90.00) degrees)
    • Set YourPoint[14] = (AnchorPoint[1] offset by -100.00 towards ((Facing of YourUnit) + 90.00) degrees)
    • Set YourPoint[15] = (AnchorPoint[2] offset by -20.00 towards ((Facing of YourUnit) + 90.00) degrees)
    • Set YourPoint[16] = (AnchorPoint[2] offset by -60.00 towards ((Facing of YourUnit) + 90.00) degrees)
    • Set YourPoint[17] = (AnchorPoint[2] offset by -100.00 towards ((Facing of YourUnit) + 90.00) degrees)
Also:
For the left-hand points, instead of changing the offset to negative (-20, -60, -100), you can also change the facing degrees to:
((Facing of YourUnit) + 270) degrees




Anchorpoints.png
AnchorpointsNO.png



pointsfinal.png

pointsfinalNO.png
 
  • Set YourPoint[0] = (AnchorPoint[0] offset by 20.00 towards ((Facing of YourUnit) + 90.00) degrees)
  • Set YourPoint[1] = (AnchorPoint[0] offset by 60.00 towards ((Facing of YourUnit) + 90.00) degrees)
  • Set YourPoint[2] = (AnchorPoint[0] offset by 100.00 towards ((Facing of YourUnit) + 90.00) degrees)
->
  • Set Face = ((Facing of (Triggering unit)) + 90.00)
  • For each (Integer A) from 1 to 3, do (Actions)
    • Loop - Actions
      • Set Point1 = (Point offset by ((40 x (Real(IntegerA))) - 20) towards Face degrees)
      • //Actions
      • Custom script: call RemoveLocation (udg_Point1)
 
Status
Not open for further replies.
Top