Event removing another event?

Hey I'm looking for a solution where one event can remove another event (can be a plugin if neccessary). I will be really thankful if someone will tell me step by step how to do it.

Let's say I have two events, one called X1 and another called Y2.

X1 - is a image of an item on the floor.
Y2 - is an image above the X1 item which describes the attributes of the item.

I want to make a scenario where player approaches X1 item on the floor, gets asked if wants to purchase this item, if yes then item gets added to the inventory and both X1 and Y2 events are removed.

What is the easiest way to do it? Thank you for help!
As soon, as you say "yes", activate a Switch, like "Item X1 gone".
Set up an empty event page at the end of both events, and set Switch "Item X1 gone" as a condition on the left.

1736361165516.png
You can remotely toggle another event's self switch with
Code:
$gameSelfSwitches.setValue([$gameMap._mapId, this._eventId, switchName], switchValue);
As soon, as you say "yes", activate a Switch, like "Item X1 gone".
Set up an empty event page at the end of both events, and set Switch "Item X1 gone" as a condition on the left.

View attachment 328370

This is exactly what I needed! Thank you very much for help.

Original thread: https://forums.rpgmakerweb.com/threads/event-removing-another-event.174536/