Jump to content
Lord Vectra

eventing Detect Distance Between Player and Object

Recommended Posts

I am Vectra. The Master Eventor. I've gotten a request from a friend to do this. I did this for someone else a a week ago so i figured I'll make a tutorial for all who wants to know how.


Here's what you need:

4 Variables

2 Conditional Branches


What are the 4 variables?:






Let's say you want to detect the distance between the player and a rock:


1 is Player and 2 is the rock.

X-Coord = X coordinate

Y-Coord = Y coordinate




The multiplying by -1 is so that the number will be positive. In mathematics, distance cannot be a negative number. Due to you X-Coord and Y-Coord check needing to be 1, the system checks for diagonals too.



You minus the rock's coordinates with the player's coordinates. If the answer is 1 or 0 then they're touching. If you want it like have it where if the rock is 5 steps away then you simply make the condition branches 5 or less instead of 1 or less.


It'll look like this:





This checks if it's 5 steps away horizontally and then checks vertically.




Wait, but what if I want distance between two events?

Then you replace player with whatever. For example, If i wanted the distance between 2 rocks then I simply replace X and Y Coord1 with another event's X and Y Coord instead. If you want to know the distance of more than 2 events then every event added needs 2 variables(X & Y Coord).



Only difference is you scrap the Y-Coord PL check and add X-Coord and Y-Coord right before the proximity (which is now distance) check.

SUB-TUTORIAL: Projectiles
Description: I have left numerous comments (using the "comment" event command) to show you how to create projectiles. You will need extra switches and extra commands which will be shown and explained in the demo. You need to know the above first before proceeding to this.

Partial Credit goes to Retnuh

If you have ANY questions plz ask.



Edited by Lord Vectra

Share this post

Link to post
Share on other sites

Your content will need to be approved by a moderator

You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.