![]() |
Distance Accuracy - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Help (/Forum-Script-Help) +--- Thread: Distance Accuracy (/Thread-Distance-Accuracy) |
Distance Accuracy - Nachtmusique - 10-17-2013 08:19 AM I'm wondering how sphere calculates "distance." I am working on a system for a turn based tactical strategy game within UO and need an accurate way of handling distance. As is is now, I have had situations where I took exactly eight steps from the target and yet DISTANCE=11 or 4 steps and DISTANCE=6. Any suggestions? RE: Distance Accuracy - Alaric - 10-17-2013 08:54 AM ![]() RE: Distance Accuracy - Nachtmusique - 10-18-2013 11:33 AM Thanks, for the explanation. If anyone wants a little script to find the "simple distance" (the minimum number of steps to reach the target), here's a script: [Function simpledist] local.xdif=<eval SQRT(<eval <eval <p.x>-<src.p.x>> * <eval <p.x>-<src.p.x>>>)> local.ydif=<eval SQRT(<eval <eval <p.y>-<src.p.y>> * <eval <p.y>-<src.p.y>>>)> IF (<local.xdif> > <local.ydif> return <eval <local.xdif>> ELSE return <eval <local.ydif>> ENDIF |