Warcraft III resources & community, 2003–2006 · archived

Can't Find Function

5 posts
#1

Can't Find Function

Which jass function would I use to find the distance between two global unit variable positions?
#2
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
#3

Re: Can't Find Function

Xander-Which jass function would I use to find the distance between two global unit variable positions?

function DistanceBetweenPoints takes location locA, location locB returns real

Example :
set some_distance = DistanceBetweenPoints(some_point, some_point2)
#4
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! :)
#5
function DistanceBetweenPoints takes location locA,location locB returns real


That is NOT the most effictave way.


    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.