I'm attempting to write a Plugin even though I'm new to MV. I want to be able to create a comic bubble over an Event. I have created a plugin command called SAY whose first parameter is the name of the event. However, I don't know how to find the event object that is associated with that event name. I tried directly referencing $dataMap.events[event name] but that was undefined. Can anyone help me? Thanks.
Finding an Event
Javascript/Plugin Support$gameMap.event(id);
Thanks. That got me close but that Id is the index of the event. I'm looking for something that will take a event name such as 'EV001' and return the event object.
I can see the field in the JSON files and it is called name. However, when I try event.name, I get undefined.
I can see the field in the JSON files and it is called name. However, when I try event.name, I get undefined.
I strongly advise against doing this, but if you want it that way:
This returns a list of all events with the given name. Names aren't unique, so there might be more than one.
Code:
$gameMap._events.filter(function(event) { return event.event().name === 'EV001'; });
Ok. So using Name may not be the best idea. But that answers my question. Thanks.
Original thread: https://forums.rpgmakerweb.com/threads/finding-an-event.49450/