• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Can't Find Function

Status
Not open for further replies.
Level 4
Joined
Feb 12, 2006
Messages
99
Which jass function would I use to find the distance between two global unit variable positions?
 
Level 6
Joined
Feb 18, 2005
Messages
263
try the gui to find it.

easiest way:
condition - real - math - istance between points - distance of unit

try using the gui more often and you'll quickly realise that it is often more usefull than jass - i do 1/2 o fmy triggers with the gui making them easier to understand...

- Raszul
 
Level 4
Joined
Feb 12, 2006
Messages
99
I think I'll use Lord Raszul's way. I thoroughly checked the gui, and was unable to find that. Thanks to both of you! :)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
JASS:
function DistanceBetweenPoints takes location locA,location locB returns real

That is NOT the most effictave way.

JASS:
    SquareRoot((xto - yfrom)*(xto - yfrom)+(yto - xfrom)*(yto - xfrom))

xto = X location of position your measuring from
yto = Y location of position your measuring from
xfrom = X location of position your measuring to
yfrom = Y location of position your measuring to

Using this will save you having to remove the location and creating a local location since it takes reals (x and y).

I recomend you use jass since propper jass can be less laggy than GUI since GUI calls unesesary BJ calls and creats functions for conditions that are NOT nesesary.

Also non jass aided GUI will leak when using groups, locations, and forces.

I strongly reccomend you program MOST triggers in jass since you can reduce not only the number of lines the script takes up but write it more efectivly.

A good example of GUI triggering is the parasite chain.
It leaks badly, is very buggy, extremely laggy, and a ---- load of unessary function and BJ calls.

I write every trigger in my maps in jass.
 
Status
Not open for further replies.
Top