Returning the X,Y Coordinates of an event on the map? (Get Location help)

JLowther

Veteran
Veteran
Joined
Feb 20, 2016
Messages
327
Reaction score
38
First Language
English
Primarily Uses
I'm trying to find the coordinates of an event on the map (and ideally assign them to variables as X,Y as well).

But I'm very confused as to how to do this using the "Get Location" command.

Alternatively, is there a JS call that can assign the X,Y coords to variables? I found this:

"$gameMap.eventIdXy(x, y);"

...but I'm not sure how to turn that into usable coordinates.

Thanks in advance!
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,370
Reaction score
7,678
First Language
German
Primarily Uses
RMMV
But I'm very confused as to how to do this using the "Get Location" command.
That is no wonder, because you can't get the coordinates of an event with "get location info". For get location info you need to have the XY and can then check what is there, but not the other way around.

You need to use control variable for what you want.
1) Make two variables for event x and event y
2) use control variable on event x variable, select "game data" from the data options (it defailts to map id, but that is not what you want).
3) hit the button to the right of "map data" to open up the game data options, select "character" as the next step
4) change from player to the event you want the data from, select map x as the detail
5) repeat 2-4 for "Map Y"
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
722
Reaction score
578
First Language
French
Primarily Uses
Use:
Control variables > Game Data > Character > Select your event in the drop down menu > Map X
The get location event command cannot do that.

The script call you're trying to use will give you the ids of the events that are at x,y. Not their coordinates.
If you need to do it with a script call, you can use:
Code:
$gameMap.event(eventId).x
$gameMap.event(eventId).y
Edit: ninjas everywhere I tell you.
 

JLowther

Veteran
Veteran
Joined
Feb 20, 2016
Messages
327
Reaction score
38
First Language
English
Primarily Uses
Thanks, both!

I had completely forgotten about the game data dropdown menu!
 

PKirkby

Veteran
Veteran
Joined
Oct 26, 2019
Messages
157
Reaction score
18
First Language
english
Primarily Uses
RMMV
That is no wonder, because you can't get the coordinates of an event with "get location info". For get location info you need to have the XY and can then check what is there, but not the other way around.

You need to use control variable for what you want.
1) Make two variables for event x and event y
2) use control variable on event x variable, select "game data" from the data options (it defailts to map id, but that is not what you want).
3) hit the button to the right of "map data" to open up the game data options, select "character" as the next step
4) change from player to the event you want the data from, select map x as the detail
5) repeat 2-4 for "Map Y"
I know this was 2 years ago, but once I've done this, how do I go about putting in a conditional branch to check if an event hits those coordinates it will be destroyed? Thanks in advance
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

A bit of a "sparkle" update to the lower portion of the world map. :LZSexcite:
attack on titan final season is airing tomorrow, I'm excited and scared at the same time!

Forum statistics

Threads
105,882
Messages
1,017,230
Members
137,607
Latest member
Maddo
Top