SphereCommunity
distance from point a to point b? - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: distance from point a to point b? (/Thread-distance-from-point-a-to-point-b)



distance from point a to point b? - x77x - 04-20-2018 08:50 PM

how can i get the distance from src p to areadef p (position)
in number of tiles

how would you find and subtract an areadef p value and a players p value to get the distance from point a to point b


RE: distance from point a to point b? - evening - 04-20-2018 10:05 PM

[function dist]
serv.newitem 0eed
new.attr = attr_invis
new.p = <argv[0]> <argv[1]> <argv[2]> <argv[3]>
serv.log <src.distance <new>>
new.remove

you can use .dist 2291 1194 0 test


RE: distance from point a to point b? - x77x - 04-20-2018 10:27 PM

how in a sysmessage?

"xxx squares to center"


RE: distance from point a to point b? - evening - 04-21-2018 02:16 PM

So the def coordinates are defined in advance

So the def coordinates are defined in advance


RE: distance from point a to point b? - Coruja - 05-12-2018 05:41 AM

you can use <SRC.DISTANCE <TARG.P>> or <SRC.DISTANCE <TARG.UID>>

and make sure to also check if both objects are on the same map (eg: (<SRC.P.M> == <TARG.P.M>)) because comparing distances using P from different maps will return the max value (32767), so it makes more sense just use an msg like "the targ is on another map/facet" instead "the targ is 32767 tiles away"