I got thousand of events calling a common event, avoiding to manually edit all of them (+1000), is there a way to "kill" the father event that calls that common event, from the common event itself? So I can prevent the "father" event to continue.
Exiting Father Event that called the Common Event from the common event
RPG Maker MV SupportYes. Just turn on a self switch in the common event and make a new event page in the 'father' event with that self switch as condition. Whatever happens in a common event is actually tied to the map event that called it. So if self switch A is turned on in the common event, the event that called it will have it's own self switch A turned on.
I just said that father events are more than 1000... is there another way to do that?
Oh you want each to be handled separately? I guess you can handle the killing from the event itself? Like, call common event and if a certain condition is met, stop the event?
The father events are like that:
0 - Event
1 - Event
2 - Common event
3 - Event
4 - SelfSwitch A: ON
-----------------------------
If I turn on the 'A' switch from the common event, it still run the event after the common event (line 3), I need a way to prevent that.
Then put a condition in the event after the common event. If self switch A is turned OFF, it will run. If ON, it won't. Maybe that's not it but the situation is pretty hard to understand from description alone.
Oh I forgot about that XD Idk anymore. Hopefully someone will have a solution.
I don't think there's any way to do it without somehow touching each Map ("father") Event.
You can set a switch in the Common Event and add something to the body of the Map Event that calls it which looks for this switch and exits itself if that switch is ON - but that would require editing your thousands of map events. That's unfortunately just how it works when you run stuff through map events.
It might be possible to forcibly end the calling Map Event with a JavaScript script call, as I'd imagine the Event ID of the event that calls a Common Event might be passed in as an argument or stored somewhere in the Interpreter... but the timing could be messy. I don't know where to start with what that JS call would look like, but your best bet if you want to pursue that route would be to very clearly describe your dilemma in a new topic on the Learning JavaScript board, and ask what method would need to be called within the Common Event to kill the Map Event that called the Common Event.
Barring that...
If your Map Events are exactly the same as each other, you can save some time by making the change to one event, copying it, and then deleting all of the other events and pasting the copied (changed) event back into the same place that you deleted an event from. Click - Delete - CtrlV is much faster than Click - Edit - find the right event line - make all the changes - OK.
What you might be able to do in the future is move as much of the Map Event's event body into the Common Event as possible, so that any change you'd have to make down the line only needs to be made in a single place.
Another possible move for the future if it would be impractical to move Map Event content to the Common Event, would be something like @Shaz's Clone Events plugin. That will let you create a single Map Event, designate thousands of other events as clones of that event, and then you can make the change in one place if you realize something about it needs to be edited later on down the line.
You can set a switch in the Common Event and add something to the body of the Map Event that calls it which looks for this switch and exits itself if that switch is ON - but that would require editing your thousands of map events. That's unfortunately just how it works when you run stuff through map events.
It might be possible to forcibly end the calling Map Event with a JavaScript script call, as I'd imagine the Event ID of the event that calls a Common Event might be passed in as an argument or stored somewhere in the Interpreter... but the timing could be messy. I don't know where to start with what that JS call would look like, but your best bet if you want to pursue that route would be to very clearly describe your dilemma in a new topic on the Learning JavaScript board, and ask what method would need to be called within the Common Event to kill the Map Event that called the Common Event.
Barring that...
If your Map Events are exactly the same as each other, you can save some time by making the change to one event, copying it, and then deleting all of the other events and pasting the copied (changed) event back into the same place that you deleted an event from. Click - Delete - CtrlV is much faster than Click - Edit - find the right event line - make all the changes - OK.
What you might be able to do in the future is move as much of the Map Event's event body into the Common Event as possible, so that any change you'd have to make down the line only needs to be made in a single place.
Another possible move for the future if it would be impractical to move Map Event content to the Common Event, would be something like @Shaz's Clone Events plugin. That will let you create a single Map Event, designate thousands of other events as clones of that event, and then you can make the change in one place if you realize something about it needs to be edited later on down the line.
perhaps you should explain how you managed that, then we can help more.
because call common event is one-directional, you'll have to have used a different method to have a regular event as child to a common event...
Honestly, if you're gonna use over 1000 events to do similar things, you should really start thinking about making every event a common event. Use switches and variables to maximize flexibility of use of the common events, in case you want to slightly change values and commands in them.
In your common event, at the point you want to exit, put this script call:
followed by Exit Event Processing.
Code:
if (this._eventId === $gameMap._interpreter.eventId()) {
$gameMap._interpreter.command115();
}
followed by Exit Event Processing.
Original thread: https://forums.rpgmakerweb.com/threads/exiting-father-event-that-called-the-common-event-from-the-common-event.131030/