How do I...make another event completely erase itself because of another event?

Scene:

So I have 2 NPC's in the same area (NPC A and NPC B that have their own dialogue...)

When you talk to NPC B, it triggers an auto-run event where NPC B chases down NPC A, and they both go "off screen" (I set their movement route to meet the edge of the map, and turn their "image" to none, so it looks like they went off-the-map.) A self-switch is then activated for NPC B to completely disappear, but...

Problem is, I can't seem to find an appropriate manner for NPC A to completely disappear after this chase scene. I tried using a switch that would get triggered from the chase scene, and fit into a conditional branch for NPC A, but every time I try it, I keep finding that when I go to another map, and return to the same area...NPC A is still there even though NPC B is gone. When I try the conditional-branch switch thing, NPC A finally disappears...but only after I talk to them again, which shouldn't happen lul.

I feel like I'm not approaching the problem correctly. Any suggestions?
you can control both movements in 1 event, so in 1 event, you can control the other.
than use scripcall: $gameSelfSwitches.value([8,24,'A'])

8 = MapID
24 = Event ID
A = the selfswitch (when true) (can be A, B, C or D

like above is always true, when making it false use:
$gameSelfSwitches.value([8,24,'A'], false) or else: $gameSelfSwitches.value([8,24,'A'], true)

whatever you approach is up to you. see what fits you.
@ShadowDragon but isn't $gameSelfSwitches.value([8,24,'A']) used in conditional branches?

Wouldn't it be easier to just make both NPC's disappear on self switch D or something and then use the "movement event" to flip the self-switches from the outside?

script call:
$gameSelfSwitches.setValue([8,24,'D'], true);
$gameSelfSwitches.setValue([8,25,'D'], true);
If you have an event, then set that event's last page to blank and put the condition as 'switch x is ON'.

Then whenever that switch gets turned ON, your event will essentially disappear. It's the the same logic behind using a self switch "erase" the event.

So for instance, if you're using one event to control a dialogue/action scene between other NPC events, then you could have this master event turn switch x ON whenever it has run its course. If you've set all the NPC events to have their last page blank and the condition set to 'switch x is ON' then they will all disappear.

You shouldn't need conditional branches for using a switch to turn OFF other events as long as you set it up the way I've described. Also, you shouldn't need script calls either.
However, the best way to make these action scenes work is to have one master event that controls everything - meaning all the other events that you have moving around. When you start trying to spread the controls out to different events, you will start running into errors and problems with the events interacting properly.
@ScorchedGround yes, you are correct, you need teh scriptcall to set its value.
for the event itself in the map iself, you can also do:

for current NPC
$gameSelfSwitches.setValue([$gameMap.mapId(), this.eventId(), 'A'], true);

and for the EVENTID (place id of the other event)
$gameSelfSwitches.setValue([$gameMap.mapId(), EVENTID, 'A'], true);

than again, A can be A, B, C, D, and "true" can be "false" as well.
but there might be other methodes as well. see how you approach it.
If you have an event, then set that event's last page to blank and put the condition as 'switch x is ON'.

Then whenever that switch gets turned ON, your event will essentially disappear. It's the the same logic behind using a self switch "erase" the event.

So for instance, if you're using one event to control a dialogue/action scene between other NPC events, then you could have this master event turn switch x ON whenever it has run its course. If you've set all the NPC events to have their last page blank and the condition set to 'switch x is ON' then they will all disappear.

You shouldn't need conditional branches for using a switch to turn OFF other events as long as you set it up the way I've described. Also, you shouldn't need script calls either.
However, the best way to make these action scenes work is to have one master event that controls everything - meaning all the other events that you have moving around. When you start trying to spread the controls out to different events, you will start running into errors and problems with the events interacting properly.

Ahh this is what I was looking for. The switch X is OFF worked! Thank you 😀

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-make-another-event-completely-erase-itself-because-of-another-event.124281/