Hi folks,
I have a custom plugin set up to add some commands to streamline certain things. It is mostly working fine, but I am having an issue with getting any "erase event" script call to work when run within the plugin.
Here is my code for the command:
This runs a plugin command from an event spawner plugin to delete the spawned event from memory, but I still need to also erase the event normally after that to fully remove the event.
Getting this._eventId is working, and using that in the ritter script call works fine, but using $gameMap.event(eventId).erase(); gives a crash (Cannot read property 'erase' of undefined). I have also tried it with this.erase(); but that doesn't seem to work at all when run from a plugin command.
Changing the order of these script calls doesn't fix the problem, so it is not an issue of the ritter script erasing the event before the 'erase' script is run. I get the same crash either way, and when only running the 'erase' command and not the ritter one.
Is there some way I can run a "erase event" script within a plugin command to erase the event which is running said command?
Thanks!
I have a custom plugin set up to add some commands to streamline certain things. It is mostly working fine, but I am having an issue with getting any "erase event" script call to work when run within the plugin.
Here is my code for the command:
JavaScript:
PluginManager.registerCommand('SpawnEventCommands', 'EventEraseSelf', (args) => {
const eventId = this._eventId;
Ritter.unspawnEvent(eventId, true);
$gameMap.event(eventId).erase();
});
This runs a plugin command from an event spawner plugin to delete the spawned event from memory, but I still need to also erase the event normally after that to fully remove the event.
Getting this._eventId is working, and using that in the ritter script call works fine, but using $gameMap.event(eventId).erase(); gives a crash (Cannot read property 'erase' of undefined). I have also tried it with this.erase(); but that doesn't seem to work at all when run from a plugin command.
Changing the order of these script calls doesn't fix the problem, so it is not an issue of the ritter script erasing the event before the 'erase' script is run. I get the same crash either way, and when only running the 'erase' command and not the ritter one.
Is there some way I can run a "erase event" script within a plugin command to erase the event which is running said command?
Thanks!