Finding and grouping events

I have a couple of questions.

1. How do you find an event, or a list of events at a specified square, given its x and y? Say you had a square [4,10] but you wanted to find a list of the events on the square? It would return a list of the event id's on that square.

2. How would one go about giving tags to certain events? For instance, tagging certain events as crates? I think I remember seeing some sort of script where it could sense whether you put a "$" in front of an event's name, and that served as some kind of tag for an event? It's because I want to be able to group events together as event "types".

Thank you in advance!
I have split this from the Event System Support (Expert users only) because it is neither a complex event system nor an expert issue


Game_Map has several methods that will give you an array of events at a certain location.


$game_map.events_xy(x, y) will give you a list of events at that location


$game_map.events_xy_nt(x, y) will give you a list of events at that location except 'through' events.


The $ in a file name is simply an indicator to Ace that the spritesheet only contains enough cells for ONE sprite. It has nothing to do with grouping or tagging. The ! in a file name tells Ace to draw it completely aligned with the grid, not a few pixels up. Even though THIS is used for chests, it also has nothing to do with grouping or tagging.


What is your purpose for grouping events together as the same "type"? Maybe if you explain what you're trying to achieve, we can help. I suspect it will require scripting, which means you should start a NEW thread in the Script Requests forum.
If it is just for your own convenience, you can simply name the events in any way you want.


If you want to do something with those events, then you'll need scripts (especially if you're talking about a list of events on one coordinate, as that can only happen after moves during runtime of the game, the editor can only handle one event per coordinate) - and you'll need to tell us what scripts you want to use this grouping, as there are several options how those scripts would go about the problem.


Some scripts use event comments to identify which events they're supposed to control and what to do with them, others use ID lists or the names - it all depends on the scripter, there is no one way to do this.


For single events, you can use the event command "get location info" to get the ID of an event on that position - but that only works if there is only one event on that position (usually placed there in the editor)
Thanks Shaz for the $game_map.events_xy(x,y) function. It was exactly what I was looking for.

I wanted to put an event tag, or local variable on each event on map. So that you can say "What kind of event is event 005?" Is it a chest? Is it an enemy? I want to be able to put a tag on this event so that when I examine this event using scripting I can see what kind of event it is.

I'm not creating my own script, but I am using scripting in my event coding. In retrospect, this should probably have gone in the scripting help thread. I just thought since it was part of my event system that I'm creating that it required some other type of help.
There's a script called Self Data Suite. I THINK TDS wrote it (but could be wrong). You should be able to find it on the Master Script List. That might be useful.


However, you could do the same thing just with the name you give your event. Where it says EV001 in the top left corner of your event box - you can change that and call them all CHEST, or ENEMY, or whatever. Then in your script you just refer to the name property of the event (you MAY need to make that an attr_reader - I do recall it not being open to outside scripts in the past, but that may have been back in the XP days).
No, the self data suite is from PK8


http://forums.rpgmakerweb.com/index.php?/topic/1567-the-self-data-suite-self-switches-variables-and-metadata-for-everything/
ugh! Thanks - I WAS thinking PK8. I don't know what made me write TDS. At least I got the script name right 🙂
Thanks guys! That self suite script set is mind-blowing. It's so flexible and modular. This is going to help me a lot.

Cheers! I'll let you know how I go.

Original thread: https://forums.rpgmakerweb.com/threads/finding-and-grouping-events.23412/