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

2 Simple Questions

Status
Not open for further replies.
Level 9
Joined
Jan 11, 2009
Messages
282
HI,
I have 2 Simple Questions:

1. If you have two points, how could you find out, how big the Range between them is ? (Picture 1)

2. If you target a point with a spell, how can you create some the nearest Points on a ring going trough the Casters Position and the Targeted Point ? (Picture 2)

My Drawing Skills are not good at all, but I hope they will help you to get my Problems.
 

Attachments

  • Point Range.jpg
    Point Range.jpg
    24.6 KB · Views: 135
  • Points Create.jpg
    Points Create.jpg
    27.4 KB · Views: 134
Level 37
Joined
Mar 6, 2006
Messages
9,240
1) Set the points to variables. Then use distance between points function: math - distance between points in GUI.


  • Actions
    • Set Temp_Loc_1 = (Position of (Triggering unit))
    • Set Temp_Loc_2 = (Target point of ability being cast)
    • Set Temp_Real_1 = (Distance between Temp_Loc_1 and Temp_Loc_2)
    • ....
    • *do something here*
    • ....
    • clear the points at the end of the trigger:
    • Custom script: call RemoveLocation(udg_Temp_Loc_1)
    • Custom script: call RemoveLocation(udg_Temp_Loc_2)

2) Like that in your picture:

Point1 = position of casting unit
Point2 = target point of ability being cast
Point3 = Position of casting unit offset by ((distance between Point1 and Point2)/2 towards (angle from Point1 to Point2)

Then do a loop:
  • Set Temp_Reall_1 = 0
  • From 1 to 12
    • Loop
      • Set Temp_Loc = Point3 offset by 256 towards Temp_Real angle
      • Create something at Temp_Loc
      • Temp_Real = Temp_Real + (360/12)
      • custom script_ call RemoveLocation(udg_Temp_Loc)
then clear point1, point2 and point 3 at the end of the trigger.

That creates 12 points in a circle. If you want something else like only those two points, you just need to calculate them with basic trigonometry.
 
Status
Not open for further replies.
Top