Shutdown button

Hi !

When I click the game end button in the menu, I want to shut down the game literally, rather than appearing the option to go to the title.

I made a separate map with titles, so it shouldn't go back to the game's title with the game end button.

How can i do this?
You can use any plugin that allows options to modify the menu. And call this script:

SceneManager.exit();
You can use any plugin that allows options to modify the menu. And call this script:

SceneManager.exit();
I'm testing in YEP_main menu manager plugin

AAAA.png



like this?


but this gives an error.
It's been a while since I've used this plugin. What error does it return? Could you post a print?
It's been a while since I've used this plugin. What error does it return? Could you post a print?

Oh, I got an error saying ")" is missing, and I removed the ";" after ")" and it works fine.

But there is one more problem.

If you do this, just open the menu and it will end immediately.

I'd like to use a way to load common events, but that's not possible in my game.
Oh, I got an error saying ")" is missing, and I removed the ";" after ")" and it works fine.

But there is one more problem.

If you do this, just open the menu and it will end immediately.

I'd like to use a way to load common events, but that's not possible in my game.

With this plugin you can call common events, that surely would be easier.
But if it is not an option, I don't really know...
I have it on my backups from before it went to itch.io, I'll test it here and edit this post soon.
With this plugin you can call common events, that surely would be easier.
But if it is not an option, I don't really know...
I have it on my backups from before it went to itch.io, I'll test it here and edit this post soon.

No, calling a common event works fine, but in my game, I have to use the menu while the event is triggering on the map, so when I call another common event, the option does not appear.
(It is possible to force a script to be closed by calling a script from a common event, but I want to prevent accidental clicks.)
So, yeah. I could not figure it out. I'm sorry. :LZSsad:
Maybe someone else can help, so I'm answering to help bump the post.
So, yeah. I could not figure it out. I'm sorry. :LZSsad:
Maybe someone else can help, so I'm answering to help bump the post.

Yes, but thanks for trying to help.
For Yanfly's Main Menu Manager plugin, you can use this for the Main Bind field:
JavaScript:
SceneManager.exit.bind(SceneManager)
Technical explanation: SceneManager.exit is a function, but putting brackets after a function causes it to evaluate. That's why your game was closing whenever the menu scene loaded. The bind part is there because otherwise the function would run in the context of the menu scene, rather than the SceneManager. 😴
For Yanfly's Main Menu Manager plugin, you can use this for the Main Bind field:
JavaScript:
SceneManager.exit.bind(SceneManager)
Technical explanation: SceneManager.exit is a function, but putting brackets after a function causes it to evaluate. That's why your game was closing whenever the menu scene loaded. The bind part is there because otherwise the function would run in the context of the menu scene, rather than the SceneManager. 😴

Thank you very much! This works great!
If so, is it necessary to use a common event to display a confirmation message at the end of the game?

As I wrote above, I cannot use common events.
When I press the game exit button, a confirmation message to the title appears. In this case, the current event is ignored and displayed, but when the common event is loaded, the option is not completely ignored.
Thank you very much! This works great!
If so, is it necessary to use a common event to display a confirmation message at the end of the game?
Well, this approach won't display a confirmation message. The default "To Title"/"Cancel" dialogue is a separate scene, so is unaffected by Yanfly's Main Menu Manager plugin. 😴

If you just wanted to replace the "To Title" behaviour, import this as a plugin~
JavaScript:
Scene_GameEnd.prototype.commandToTitle = function() {
    this.fadeOutAll();
    SceneManager.exit();
};
Then you can adjust the "To Title" text on the Terms tab in the Database. 😮‍💨
Well, this approach won't display a confirmation message. The default "To Title"/"Cancel" dialogue is a separate scene, so is unaffected by Yanfly's Main Menu Manager plugin. 😴

If you just wanted to replace the "To Title" behaviour, import this as a plugin~
JavaScript:
Scene_GameEnd.prototype.commandToTitle = function() {[/INDENT]
[INDENT]    this.fadeOutAll();[/INDENT]
[INDENT]    SceneManager.exit();[/INDENT]
[INDENT]};
Then you can adjust the "To Title" text on the Terms tab in the Database. 😮‍💨

Thx!
Thank you for always helping.😂

Original thread: https://forums.rpgmakerweb.com/threads/shutdown-button.123203/