MV no main menu to title screen, and no force close the game

I want my game to lock the player inside it. Players can only exit the game is by going to the title screen and shutting down from there. but I don't want players can control the 'to the title screen'. request:

1. hide the 'to title screen' from main menu

Players has 3 ways to go to the title screen:
  • from the save point,
  • losing certain battle or by event,
  • or the last dread. kill yourself.
save point, player can 'return to the title screen'. and losing or/and died will automatically force the player to the title screen.

the next is the shutdown. I'm only aware that there are 3 ways to exit the game, and think can create a plugin to deny them?

2. no 'alt + F4' close the game
3. no using the top right corner X (close button) to close the game
4. no using 'task manager' to close the game

if impossible, think can a plugin that runs a common event every time they close the game not through the title screen?
before they close the game, the game run event that increases variable and switch (they're global) and do 'DataManager.saveSyncData()'
2. no 'alt + F4' close the game
3. no using the top right corner X (close button) to close the game
I'll need to try this before I can say whether it's possible or not.

Blocking Alt+F4 isn't going to be possible, because this combination is processed by the OS instead of the application. The same applies to the close button.

However, applications can tell the OS that they refuse to be closed. This is used to warn the user about unsaved changed, and to give the user the opportunity to save their work before closing (or not closing in the first place).

I'll need to do some research to find out whether this can be done in NWJS and how to do it.

4. no using 'task manager' to close the game
That's impossible.

Task Manager doesn't "close" apps. It "kills" them. This is used when an app has become unresponsive, like when it's caught in an infinite loop and can no longer respond to "close" requests. Nothing you do can prevent a "kill" command, because the OS will simply remove your app from the scheduler (the CPU won't execute any more code from your app) and free up all memory used by your app.

The only apps that can't be killed by Task Manager are either extremely privileged OS processes, or malware. You do not want to do anything that makes you look like a virus, trust me.



That said, I think this is an example of the XY problem. You have a problem X that you want solved, you believe that X can be solved with Y, and now you're asking how to solve Y, instead of asking how to solve X.

Are you trying to stop the player from cheating through save-scumming (warning, tvtropes link)? In that case, there are other, better, less intrusive solutions. Many games with "ironman" mode will automatically save when the player tries to close the game, and will automatically delete the save game as soon as it's loaded.
@Nolonar - I don't have access to MV right now, but... This code wouldn't work preventing game to be closed with alt + f4?
Code:
window.addEventListener('keydown', (e) => {
    const { key, altKey } = e;
    if (key === 'F4' && altKey) {
        e.preventDefault();   
    }
});
That said, I think this is an example of the XY problem. You have a problem X that you want solved, you believe that X can be solved with Y, and now you're asking how to solve Y, instead of asking how to solve X.

Are you trying to stop the player from cheating through save-scumming (warning, tvtropes link)? In that case, there are other, better, less intrusive solutions. Many games with "ironman" mode will automatically save when the player tries to close the game, and will automatically delete the save game as soon as it's loaded.

I want to make the game tied to the player. when we player done playing, we would close the game. but immediately close the game, leaving the mc not in the save zone & without warning. secret but every time the player force closes the game, the mc will kill himself, separate his soul from the game + increase the variable.

the second is to watch failure. your companion can die with no way to revive. some players know it's a failure and will close the game to reset, but won't know that there's more what ahead.

for example this. the moment mc is possessed, we would go shut the game as we mostly think it's a bad end. but I want to make them keep watching till the end + it add variable & switch.
or when a companion of you died, you know you have failed.

I want to keep them playing. either watch the aftermath of the failure, or a new quest to complete in your next loop.
I think you're going about this the wrong way.
I want to keep them playing. either watch the aftermath of the failure, or a new quest to complete in your next loop.
In my opinion, you're resorting to the cheapest of tricks here - trying to physically prevent a player from quitting a game when they think they're getting a bad ending.

In actuality, you'll have two situations with your game:
1 - The player doesn't care about anything but perfection. You manhandling them and trying to force them into persevering through a bad ending or situation isn't going to accomplish your goal of making them play more, it's going to make them delete your game.

2 - The player will find your story sufficiently interesting to watch through whatever happens. Look at things like Chrono Trigger, Suikoden games, good visual novels - people get to a bad ending, watch it because it's still an interesting piece of story, then replay to get a different ending because it's just that well-done.

I would suggest you focus on making your game be done well rather than trying to force a player to do what you want. Short of some kind of mind control technology, it's simply impossible - someone who wants to quit can quit, and I know if I played a game that made it hard for me to stop playing when I wanted to, I would delete it right away.

Original thread: https://forums.rpgmakerweb.com/threads/no-main-menu-to-title-screen-and-no-force-close-the-game.143296/