MZ Am I able to erase an event from a common event?

I seem to be having a lot of trouble and am seriously just about to resort to random battles. I have an onscreen enemy event, that uses the following VisuStella EncounterEffects plugin comments:
1629338935483.png

When the sentry gets alerted it goes to common event 105, which is:
1629339015279.png

I basically want to make it so that once you are spotted, there is no running away from the event. The only problem is when I put erase event after the battle processing in the common event, it seems like the common event doesn't know which event to erase. Is there any way to erase my main event using erase event from the common event so that the sprite is still not standing there when the battle is done? I also tried using self switches in the common event but that didn't seem to work either. I've spent two days trying to fix this and am at a total loss.
Maybe set condition (else), and place the run common event in there and stop event after common event battle?
Maybe set condition (else), and place the run common event in there and stop event after common event battle?
Thanks for the idea, I think if I did an else for that conditional statement it might only apply if the event were to actually touch the player. I got it working using normal switches but this means I would need to make a separate switch for each map enemy to change from the common event. I was looking at script calls for erase event but not sure how all of that works.
You should be able to just use a regular switch in your common event. Set switch xyz ON in your common event and then add a page to your event that is blank with no image for switch xyz on.

If you need to erase the event completely, you could make that new event page a parallel process running erase event so it erases as soon as it triggers.
You should be able to just use a regular switch in your common event. Set switch xyz ON in your common event and then add a page to your event that is blank with no image for switch xyz on.

If you need to erase the event completely, you could make that new event page a parallel process running erase event so it erases as soon as it triggers.
Yeppers, this is what it ended up looking like
1629342476107.png

1629342438341.png

So that the event can respawn if you come back onto the map. Looks like I'll be making 21 new switches 😀
Lol I didn't realize you needed to do this so many times

On each of your paladins you could have:

$gameVariables.setValue(100, this.eventId());
that fires right before you hand everything over to your common event (replacing 100 with whatever variable number id you want to use).

Then your common event could include

$gameMap.eraseEvent($gameVariables.value(100));

That should work really well since you want your guys to respawn every time you re-enter the map (they will with this method)
Moved to: Plugin Support
Lol I didn't realize you needed to do this so many times

On each of your paladins you could have:

$gameVariables.setValue(100, this.eventId());
that fires right before you hand everything over to your common event (replacing 100 with whatever variable number id you want to use).

Then your common event could include

$gameMap.eraseEvent($gameVariables.value(100));

That should work really well since you want your guys to respawn every time you re-enter the map (they will with this method)
This is what I was looking for, thanks!! Yeah so far I have 3 dungeon maps with 7 spawns each, want to make them the same because running from the events can cause some glitchiness. This will save me a lot of work.

Original thread: https://forums.rpgmakerweb.com/threads/am-i-able-to-erase-an-event-from-a-common-event.139718/