[RMXP] Get Event ID from X and Y with Script Call

Status
Not open for further replies.

Windyhouser

Veteran
Veteran
Joined
Oct 6, 2015
Messages
50
Reaction score
32
First Language
English
Primarily Uses
RMMV
I'm working on a very aggravating system in XP, and I've run into a case where I know an X and a Y, and need to know the event ID on that tile. In MV, I'd use Get Location Info. But unless I've missed something, XP doesn't have an equivalent, and I'm not good enough with Ruby to spin one up.
Thanks! :cutesmile:
 

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
173
Reaction score
62
First Language
English
Primarily Uses
RMXP
It's already in Game_Map:
Code:
  #--------------------------------------------------------------------------
  # * Get Designated Position Event ID
  #     x          : x-coordinate
  #     y          : y-coordinate
  #--------------------------------------------------------------------------
  def check_event(x, y)
    for event in $game_map.events.values
      if event.x == x and event.y == y
        return event.id
      end
    end
  end
Code:
$game_map.check_event(x, y)
 
Last edited:

Windyhouser

Veteran
Veteran
Joined
Oct 6, 2015
Messages
50
Reaction score
32
First Language
English
Primarily Uses
RMMV
Oh my gosh, thank you so much! It works perfectly. :D
 

hiddenone

Lurker Extraordinaire
Global Mod
Joined
Feb 19, 2014
Messages
2,391
Reaction score
5,109
First Language
english
Primarily Uses
RMMV

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

I bought a gaiter with Meijer printed on it.

I'm still a Walmart worker, and I wore it today for work.
Trying out new carpet autotiles and I can't decide if it's working or not. Pixeling soft carpets is hard
It seems like this is going to be another remote semester. RIP.
I don't like linear gear progression in games. I'd like to see more gear be useful from start to finish. This is also true for skills. I also like finding overpowered gear, and don't enjoy games that are too balanced.
Framework is getting closer to completion. Adding more QoL changes for users.

Forum statistics

Threads
99,515
Messages
966,321
Members
131,146
Latest member
jakobhenerey309
Top