Exit game goes to specific map

Hello,

I am looking for a script that allows the player to go back to "a map", either by name or by id when they press Exit game button.
I tried to look up myself, but unfortunately, every edit i tried failed (i'm not good at all in scripting).

I tried looking for the
JavaScript:
Scene_Map.prototype.create = function() {
    Scene_Base.prototype.create.call(this);
    this._transfer = $gamePlayer.isTransferring();
    var mapId = this._transfer ? $gamePlayer.newMapId() : $gameMap.mapId();
    DataManager.loadMapData(mapId);
along with
JavaScript:
Scene_Gameover.prototype.gotoTitle = function() {
    SceneManager.goto(Scene_Map.mapId)
    DataManager.loadMapData(mapId);
};

I'm asuming it has something to do with those functions, but as I said, I'm not good at this. 🙁

The point is that, when a player press "Exit Game" the game returns to the title screen.
I would like it to return to a map instead where there are events, etc...

Bonus would be to be able to choose wether or not the player is transparent or not.
JavaScript:
$gamePlayer.setTransparent(false);
$gamePlayer.setTransparent(true);

Asuming this would be the key.

This does not include other ways of getting to the title screen (like a regular gameover)
WARNING: it's the first time ever I try to help somebody with Javascript, so if you got issues, I'm sorry ><
Try saving this bit of code here and put it in your project as a new plugin:

Code:
Scene_GameEnd.prototype.commandToTitle = function() {
    this.fadeOutAll();
    SceneManager.goto(Scene_Map);
$gamePlayer.reserveTransfer(mapId, x, y, direction, 0);
$gamePlayer.setTransparent($gameSwitches._data[x])
};

Change mapId, x, Y and direction with the info you need (for direction, look at the numbers on your numpad! 8 if you need up, 2 for down etc)

As for the transparency, I tied it to a switch! Chose one that controls it and change the X in $gameSwitches._data[x] to the number of the switch you're using.
The direction refers to the character ? Because if he is transparent, it doesn't matter, does it ?

Switches can only be on or off, so I'm not really sure how to bind a transparent ON to a switch, sorry.

Thanks for trying, i'll try this out as soon as I figured out what you mean with the switch. ^^

Edit: I could bind an action in parallele to a switch, but doing so would make my character dissapear when he arrives on the map (not really smooth).
Or i'm missing something. ^^

Edit 2: Script is working flawlessly. 😀
Although I needed to scotch that transparence problem with events.
I hope you can explain me more about that last line of code, because I don't really understand what it does.


Last Edit :
I manage to get what I needed by changing
JavaScript:
$gamePlayer.setTransparent($gameSwitches._data[x])
to
$gamePlayer.setTransparent(true)
or 
$gamePlayer.setTransparent(false)

So thank you, I have what I needed, but I'm still willing to understand how that gameSwitches._date[x] worked in your idea. 🙂
The direction refers to the character ? Because if he is transparent, it doesn't matter, does it ?
No, it doesn't! Just pick a random number between 2, 4, 8 or 6

Switches can only be on or off, so I'm not really sure how to bind a transparent ON to a switch, sorry.
Choose a switch that you will use to decide whether the character will be transparent or not (es: number 1). Change the code to substitute the x with the Switch number, like this:
Code:
$gamePlayer.setTransparent($gameSwitches._data[1])

If the switch is ON, the character will be transparent. If it's OFF, it will be visible. Hope everything is clear now!
No, it doesn't! Just pick a random number between 2, 4, 8 or 6


Choose a switch that you will use to decide whether the character will be transparent or not (es: number 1). Change the code to substitute the x with the Switch number, like this:
Code:
$gamePlayer.setTransparent($gameSwitches._data[1])

If the switch is ON, the character will be transparent. If it's OFF, it will be visible. Hope everything is clear now!

Yes I get the idea.
But it only makes it more teadeous to use a switch that has to be on the target map running in parrallele or automatic (with an erase event to make it reusable).
While you could just use :

JavaScript:
$gamePlayer.setTransparent(true)
or
$gamePlayer.setTransparent(false)

Anyway, thanks alot for your help. 🙂
I fear I'm not following you. Do you want the player to ALWAYS be transparent? If so, just use $gamePlayer.setTransparent(true) instead of using a switch.
Or do you want to be able to choose wheter the player is transparent or not? According to what?

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/exit-game-goes-to-specific-map.94440/