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
40
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
36,682
Reaction score
9,859
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
734
Reaction score
605
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
40
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
19
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
 

Latest Threads

Latest Profile Posts

More words of wisdom: Trying to make everyone happy will just make you miserable.
Ads: "Up to 90% off"
Reality: 9 items at 10% Off, one item at 90% off
if you were working on a rhythm-based retro fighting game, would you rather have the jumps take up two beats (one for jumping, one for landing) or just one?
Only 3 more days to get your copy of Move That Box! with -15% discount!

Forum statistics

Threads
124,381
Messages
1,163,234
Members
163,180
Latest member
Viking
Top