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

[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,258
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