Hmm, there might be some built in way to do it. A problem is that even when you retrieve the event, you're out of luck because the event name is located in a private class variable. So here, try this:
#========================================================================
# ** Game_Event
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# new method : data
#========================================================================
class Game_Event < Game_Character
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Data
#----------------------------------------------------------------------------------------------------------------------------
# Allows public, read-only access to the class variable, @event
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def data
return @event.dup
end
end
#========================================================================
# ** Game_Map
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# new method - check_for_events
#========================================================================
class Game_Map
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Check for Events
# x : the x coordinate of the square you want to check
# y : the y coordinate of the square you want to check
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def check_for_events (x, y)
# Make an array to store all events on that square
events_on_square = []
# Determine which, if any, events are located at [x, y]
@events.each_value { |i| events_on_square.push (i.data) if i.x == x && i.y == y }
return events_on_square
end
end
That will return in an array all of the events located at [x, y]. Keep in mind it only returns the base data since that is all you asked for. The code below will return everything related to the event, but to get to the base data you will need to use the code event.data
#========================================================================
# ** Game_Event
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# new method : data
#========================================================================
class Game_Event < Game_Character
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Data
#----------------------------------------------------------------------------------------------------------------------------
# Allows public, read-only access to the class variable, @event
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def data
return @event.dup
end
end
#========================================================================
# ** Game_Map
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# new method - check_for_events
#========================================================================
class Game_Map
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Check for Events
# x : the x coordinate of the square you want to check
# y : the y coordinate of the square you want to check
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def check_for_events (x, y)
# Make an array to store all events on that square
events_on_square = []
# Determine which, if any, events are located at [x, y]
@events.each_value { |i| events_on_square.push (i.dup) if i.x == x && i.y == y }
return events_on_square
end
end
Also, data is probabably a poor name for the method, but you can play around with it.