Hi. I'm trying to change the name of events spawned by Galv's event spawner using the following code (where $gameVariables.value(50) contains what I want to set the name to - which is a number that goes up per event spawned so the first event is 0, 2nd is 1, 3rd is 2, etc -- so each event should be named the number it was generated). Whenever I do this, then try to access the name through the code below to test it in a script attached to each event based on the template event - EVERY event EVER spawned only has the latest event name (so if I spawned 4 events - EVERY event will be named (3)) -- How do I fix this?! It's driving me mad.
JavaScript:
var lastEventId = $gameMap.events().length;
var newEvent = $gameMap.event(lastEventId);
if (newEvent) {
newEvent.event().name = $gameVariables.value(50);
alert($gameVariables.value(50));
$gameMap.requestRefresh();
}
JavaScript:
alert(this.character(0).event().name);
alert($gameMap.event(this._eventId).event().name);