MV Common event triggered by quitting game?

Hi everybody,

what is the easier way to trigger an event by selecting "Quit game" in the Game menu? To make that somethig happens between hitting "Quit game" and going back to the Main menu?
I found many solutions, but nothing really easy.
Thanks in advice!
you'll need a plugin for changing either the menu command or the function for quitting, there is no way around that with pure eventing.

and if you're with a plugin anyway, it might be easier to tell what should happen and program it directly into the plugin instead of going to an event.
I have another plugin that change the language in the game (Samuel Divinium's DynamicLanguage plugin). I just want the game to go back to the original language when quitting and going back to the menu.
than change how GameEnd works by adding a common event,
reset the language to default, than return, depending on how
the language plugin works, and how to alter the gameEnd that
works for you.
than change how GameEnd works by adding a common event,
reset the language to default, than return, depending on how
the language plugin works, and how to alter the gameEnd that
works for you.

Problem is that I do not exactly know how to "change how GameEnd".
I just had to give a plugin command, that's all.
Thanks as always, you all already are in my game's credits.
if you want a plugin command rather than a common event,
it should be altered how it functions, because it's not possible at
default.

do you have any gameEnd plugins that you use?
if not, I can add a option to run a common event before closing,
so you can set the language to default when going to title scene.

I think there was also a comfirm window before closing, which
can be altered too, but I cannot recall the plugin though.

EDIT:
if you create a common event to make it back to default language or
other things as well along the way, paste this into a file and save it as .js

JavaScript:
Scene_GameEnd.prototype.commandToTitle = function() {
    this.fadeOutAll();
    $gameTemp.reserveCommonEvent(ID);
    SceneManager.goto(Scene_Title);
};

change ID to the number of your common event that you want to run.
this overwrite the GameEnd ToTitle command.

if you have another one, you can set the "$gameTemp.reserveCommonEvent(ID)"
into that plugin for the GameEnd if not for Game Over if that return to title as well.

but I dont think you want to set it back to default language if you have
multiple if they want to keep their language that way.
No, I have no GameEnd plugins. I'll try your ASAP, I'll tell you how is it.
Thanks!

EDIT: nope, it doesn't work. Or, maybe, I did something wrong. I:
- created a common event containing just the plugin command I need, number is 109
- copy-and-pasted your code in a file called GameEnd.js, and changed ID to 109 (do I have to put 0109 instead?)
- put the GameEnd.js file in the plugin directory, and set the plugin ON in the game.
But when I quit the game and go back to the main screen, language is set to 2nd (it has to be the 1st).
Am I doing it right?
Thanks!

if you want a plugin command rather than a common event,
it should be altered how it functions, because it's not possible at
default.

do you have any gameEnd plugins that you use?
if not, I can add a option to run a common event before closing,
so you can set the language to default when going to title scene.

I think there was also a comfirm window before closing, which
can be altered too, but I cannot recall the plugin though.

EDIT:
if you create a common event to make it back to default language or
other things as well along the way, paste this into a file and save it as .js

JavaScript:
Scene_GameEnd.prototype.commandToTitle = function() {
    this.fadeOutAll();
    $gameTemp.reserveCommonEvent(ID);
    SceneManager.goto(Scene_Title);
};

change ID to the number of your common event that you want to run.
this overwrite the GameEnd ToTitle command.

if you have another one, you can set the "$gameTemp.reserveCommonEvent(ID)"
into that plugin for the GameEnd if not for Game Over if that return to title as well.

but I dont think you want to set it back to default language if you have
multiple if they want to keep their language that way.
I dont know what's going on though, this mostly run the script.
it is possible that there need another function added.

but in order to reset it directly, do you have a link to the plugin?
and screenshot of your common event setup?
I dont know what's going on though, this mostly run the script.
it is possible that there need another function added.

but in order to reset it directly, do you have a link to the plugin?
and screenshot of your common event setup?
Do you mean a link to the localization/change language plugin I use in the game? There it is: https://forums.rpgmakerweb.com/index.php?threads/dynamic-language-change.53458/#post-527582
I know it isn't the best localization plugin out there, but it is the first I learned to use in my project (I had to change language at some point in the game, automaticlly, not by player's choice).
Here I attach also an image of the plugin made with your code, and another one of the Common event setup (very minimal).
Also: I tried the plugin command in another event, just to be sure it works, in the map, and it works.
I sure the problem is in something I did.
Link doesn't work there, but it seems there need to be
some extra functions added that alter the default.

I forgot a common event cannot be run if the switch is OFF,
but only works that is targetted by items, weapons, events etc.

so it need to turn on the switch before closing it and it turns off
either inside the event or by the plugin (not that it doesn't matter
while it will be off after that.

I cannot check the plugin to set it to default, so I cannot help
you further, because this could be the easiest solution to get it
to work. so maybe someone else (better coder) can give you
the best approach or solution.

the main solution what you can try, inside of the plugin command.
set ID to 109 inside the plugin, and set a choice list of 3 parts,
yes, no, maybe and leave the rest blank inside empty, see if it
will trigger it, if not, than a function must be added, but I dont know
how to make a subwindow as comfirm to target that common event,
otherwise it continue the game.
I forgot a common event cannot be run if the switch is OFF,
but only works that is targetted by items, weapons, events etc.
I see, this must be the problem!
This is the plugin, if you want to have a look (er.. the pluginS...).
Link:
https://forums.rpgmakerweb.com/index.php?threads/dynamic-language-change.53458/
Isn't there a possibility to put in your code the ability to turn the Common event switch on?
That could fix the problem, right?
OR:
Is it possible to launch the language plugin command inside your GameEnd plugin?
This could be another solution.
Please forgive me if I'm saying silly things, I a m not a programmer, just trying to be helpful...
so far I see it, default switch = always true, so in order to make it work
to default language is that the switches aren't persistent, so far I can
understand is that if you restart the game, it is automatically resetted
to default language.

if this IS not the case, the only thing I see, is to replace the switches
as he set in the plugin on gameEnd function, so the switches you use
to false, and 1 is ON as default.

if it can change in the option menu or during gameplay,, that might be
the the only way.

I dont know if that is the best way, but I do know, there are some other
ways to deal it with.

do you have a techDemo so I can test a few things out?
otherwise, it need to wait till tomorrow, but I think a better coder
have applied by than hopefully.
@Fufi_Saintz please remove all those plugins from your earlier post, and provide a link to the plugin thread instead.

Moved to: Plugin Requests
do you have a techDemo so I can test a few things out?
otherwise, it need to wait till tomorrow, but I think a better coder
have applied by than hopefully.

Hello, sorry for not posting anything in the last days, I've benn quite busy.
@ShadowDragon I just prepared the demo, Is it right if I share a Google link with you via private message? Please let me know and I'll do it asap
An many, many thanks
sure, go ahead, than I cn see what can be done once I figure it out.

Original thread: https://forums.rpgmakerweb.com/threads/common-event-triggered-by-quitting-game.142117/