Save-Point
Distance Checking - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Archives (https://www.save-point.org/forum-105.html)
+--- Forum: Creation Asylum Archives (https://www.save-point.org/forum-90.html)
+---- Forum: Scripts & Code Snippets (https://www.save-point.org/forum-92.html)
+----- Forum: RPG Maker VX Code (https://www.save-point.org/forum-101.html)
+----- Thread: Distance Checking (/thread-7072.html)



Distance Checking - DrakoShade - 03-05-2008

Distance Checking

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


I have updated this method, which now only ever uses up to 3 arguments. What it does is simple: use it as a script call in an event to get the distance between two objects. Some examples:
[ruby]$game_variables[1] = get_distance()[/ruby]This line in a Call Script will set Variable 1 to the distance between the player and the event that called it, rounding to the nearest whole number. Best used within the Script command in an event.
[ruby]get_distance(-1, 3) > 7[/ruby]This line will return true if Event ID 3 is more than 7 tiles distant from the player. Best used within a conditional, inside any event on the same map as the Event ID 3 you want to compare against.

The Script

Screenshots
None needed.

FAQ
Do I need one?

Compatibility Issues
None known yet.