Visustella Events and Move Core

Hey guys, need help implementing a mechanic in my game kinda just seeing if you guys have any ideas on how I would implement this.

When my Player defeats enemies they collect "Essence" this essence is stored in a Variable they can then later use to upgrade their character and level up and such. Now if they are defeated they drop all their essence they have collected. I use the Events and Move Core to Spawn an Event where they lost and transport them back to a safe location. The spawned can restore their dropped essence if they can get back to it and interact with it, then it will despawn itself. Here is the Event:

DroppedsoulsEvent.png


All of this works great so far, my issue is if the player loses again I want this spawned event to de-spawn, no matter what map the current player is on. I'm thinking this could be done with a global switch and a parallel common event but if the switch turns back on whats to stop the old spawned events from turning back on. Just kinda stuck on how to solve this issue as every de-spawn plug in command has to be done on the same map as the spawned event. Any ideas would be greatly appreciated.
It sounds as if you could use a plugin for for post battle events. In case no one suggests one written written specifically for MZ, here is one for MV:

https://someran.dev/rpgmaker/plugins/mv/SRD_BattleEndEvents.js/

I haven't tried it with MZ, but quite a lot of MV plugins work with MZ, and it might be worth trying. I notice that this plugin has plugin commands. You might find that you need FOSSIL to get this plugin to work fully.

'FOSSIL' is a plugin that lets you run a lot of MV plugins in MZ. It is especially good for letting you use their plugin commands in MZ. However, the original version of FOSSIL ceased to work with later MZ updates. You have to use one of the later versions that weren't created by the original author.

Here is a link to page 31 of the FOSSIL thread. I would work backwards (page 30, then page 29 etc.) from it and try the first updated version that you find that works for you:

https://forums.rpgmakerweb.com/thre...s-in-mz-300-plugins-fossilized.135523/page-31

Good luck!
I also assume it works if you manipulate the $gameSystem._MapSpawnedEventData from another map. Like to get rid of a spawned event imitating how the plugin sets them to null:

const index = $gameSystem._MapSpawnedEventData[mapId].length - 1;
$gameSystem._MapSpawnedEventData[mapId][index] = null;

So I guess you can check if the player is on the map where the spawn is and then use the despawn plugin command, if the player is on another map then use that script. But yeah, haven't really tested it.

EDIT: So you need to change mapId to where your spawn is (can be variable).
I also assume it works if you manipulate the $gameSystem._MapSpawnedEventData from another map. Like to get rid of a spawned event imitating how the plugin sets them to null:

const index = $gameSystem._MapSpawnedEventData[mapId].length - 1;
$gameSystem._MapSpawnedEventData[mapId][index] = null;

So I guess you can check if the player is on the map where the spawn is and then use the despawn plugin command, if the player is on another map then use that script. But yeah, haven't really tested it.

EDIT: So you need to change mapId to where your spawn is (can be variable).
So for example if my Variable was 94 it would look something like:

Code:
const index = $gameSystem._MapSpawnedEventData[$gameVariables.value(94)].length - 1;
$gameSystem._MapSpawnedEventData[$gameVariables.value(94)][index] = null;
Yeah.
But just to be clear, when you use it like that, it sets to null the last spawned event in that map. So if you spawn stuff outside that mechanic, you need to change it. And also a map needs to be visited for it to add the map index (but you'd have no purpose in manipulating that before visiting a map, so that shouldn't be a problem).
Yeah.
But just to be clear, when you use it like that, it sets to null the last spawned event in that map. So if you spawn stuff outside that mechanic, you need to change it. And also a map needs to be visited for it to add the map index (but you'd have no purpose in manipulating that before visiting a map, so that shouldn't be a problem).
That's a great tidbit! I just tested it with storing the map variable on battle loss and it works flawlessly. Thank you so much.

Original thread: https://forums.rpgmakerweb.com/threads/visustella-events-and-move-core.182676/