Title Screen Modifications?

Darzoni

Villager
Member
Joined
Nov 10, 2017
Messages
8
Reaction score
2
First Language
English
Primarily Uses
RMMV
I'm not looking to create a plugin so much as alter the basic package that my MV projects start with. I'd like to add a Quit Game and a Credits option to the title screen menu without the use of plugins, and I'm struggling to piece together how exactly to do that.

I've found some relevant lines of code in the rpg_windows.js and rpg_managers.js, mind you. But I have not coded in JS before and this feels a bit like bellyflopping into the deep end. So help and advice would be appreciated!
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,115
First Language
English
Primarily Uses
RMMV
Well, you want to do it via a plugin. If you directly edit the rpg_windows.js file, then you'll lose all of your updates whenever you upgrade the engine.

Plugins also have the benefit that you can turn them off. If you really screw something up and crash the game, you can turn it off to work on other aspects of the game and come back to work on the plugin later. But if you've directly edited the core files, you're stuck.
So you can think of plugins as both "mods" and "new features".

To the question:

I'll start you with some help and then point you in the right direction.

1.) Find "Window_TitleCommand.prototype.makeCommandList" inside rpg_windows.js.

2.) Copy/paste the entire function into a new .js file. Save it as whatever, and activate it in your Plugin Manager.

3.) Test play the game, if you did it right it should look exactly the same.

4.) Now to modify it. Add some more commands to the function (the one in your plugin, not in rpg_windows.js !)
It might look like this:
Code:
Window_TitleCommand.prototype.makeCommandList = function() {
   this.addCommand(TextManager.newGame, 'newGame');
   this.addCommand(TextManager.continue_, 'continue', this.isContinueEnabled());
   this.addCommand(TextManager.options, 'options');
   this.addCommand("Credits", 'credits');
   this.addCommand("Quit Game", 'quit');
};
5.) Now test play again. The new commands will be there, but they won't do anything.

6.) The next place to look is "Scene_Title.prototype.createCommandWindow" in the rpg_scenes.js folder. Paste that entire function into your plugin, and see what you can do from there.
 

Darzoni

Villager
Member
Joined
Nov 10, 2017
Messages
8
Reaction score
2
First Language
English
Primarily Uses
RMMV
So if I understand you correctly, plugins are replacements/extensions to the existing engine? Because that's a piece of the puzzle I was missing, at least concept-wise. I appreciate the help, Aloe Guvner.
 

IguanaGuy

Developing I.C.B.M. :Unleashed!
Veteran
Joined
Mar 26, 2016
Messages
159
Reaction score
689
First Language
English
Primarily Uses
RMMV
There is a Hime Pre Title Events Plugin out there that you can use to make a regular map screen into your title screen ( Or use as a cutscene before your title screen) With that option basically any graphic and event process you can do on a map becomes useful on a Title screen including your own choice menu design. In addition to that I watched one of Echo's tutorials how to bind the choice to a game process such as exit game, credits, load game, etc. If you want to see example of using the Hime pre title events plugin, look at the first 20 seconds of my vid on my profile page. That's a map that loads instantly when the game starts.
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,115
First Language
English
Primarily Uses
RMMV
So if I understand you correctly, plugins are replacements/extensions to the existing engine?
Exactly.
Best to leave the core files as they are, and modify whatever you want with a separate "plugin" file.
 

Darzoni

Villager
Member
Joined
Nov 10, 2017
Messages
8
Reaction score
2
First Language
English
Primarily Uses
RMMV
There is a Hime Pre Title Events Plugin out there that you can use to make a regular map screen into your title screen ( Or use as a cutscene before your title screen) With that option basically any graphic and event process you can do on a map becomes useful on a Title screen including your own choice menu design. In addition to that I watched one of Echo's tutorials how to bind the choice to a game process such as exit game, credits, load game, etc. If you want to see example of using the Hime pre title events plugin, look at the first 20 seconds of my vid on my profile page. That's a map that loads instantly when the game starts.
Thanks for the pointers, I'll definitely look at the Hime Pre-Title plugin to see how it alters things and hunt down Echo's tutorial for this kind of thing. The idea here is to get my feet wet with smaller projects before tackling the much larger and more extensive one. Standard operating procedure when learning a new codebase or coding language.
 

Darzoni

Villager
Member
Joined
Nov 10, 2017
Messages
8
Reaction score
2
First Language
English
Primarily Uses
RMMV
Having finally had the energy and patience to sit down and work at this, I thought I'd share what I learned so others can benefit from it. I've only gotten the exit command working at the moment, so I'll talk about that.

Aloe Guvner's pointers were very helpful! If you're looking to make a plugin that adds items from the title menu, follow his directions upthread. However! Here's some additional explanation.

For each command you want to add, you need to add a line in Scene_Title.prototype.createCommandWindow and Window_titleCommand.prototype.makeCommandList that corresponds to that command.
So in the Window_titleCommand.prototype.makeCommandList section, I have to add:
this.addCommand("Quit", 'quit');
You place the new command among the existing commands in the order you want. I put my Quit command at the bottom, below Options.

Next you have to add a line to Scene_Title.prototype.createCommandWindow that lines up with your new command. This needs to go above the line that reads this.addWindow(this._commandWindow); and below the line that reads this._commandWindow = new Window_TitleCommand();. But the same placement in the command order applies. Once you've done this, your game will not run until you've completed the next step. Because all the stuff you add in this section is called but not defined. Basically you've created a pointer to a new chunk of code that you create in the next step.
Continuing my quest to have a Quit option at the title screen, I put
this._commandWindow.setHandler('quit', this.commandQuit.bind(this));
between the line for Options and the .addWindow line.

Next you actually have to write the code that your new command does. The name of your new command's code chunk is going to be the bit in the middle. In my example, it's commandQuit. So the general form will be:
Scene_Title.prototype.<Your Command Name> = function() {
<Code bits here.>
};

I replace <Your Command Name> with commandQuit to finish this. At this point it's a matter of research, writing code, and testing to get your new command to work right. Knowing from my day job as a programmer that most languages have a fairly simple snippet of code to terminate the program, I found the answer to closing the game. The general form is <base object>.close(), so for stock RMMV it ends up being window.close().
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,115
First Language
English
Primarily Uses
RMMV
Yes! Awesome.
You figured it out, it's not enough just to add a command to a window. The command has to actually do something.
You correctly deduced that the command must call a function from the scene, and you must set a handler of that function.

Using window.close() is 100% correct. Though I might point you towards SceneManager.exit() as an alternative because it does a few more things before closing the window. Still, it accomplishes the same thing. Good job.
 

Darzoni

Villager
Member
Joined
Nov 10, 2017
Messages
8
Reaction score
2
First Language
English
Primarily Uses
RMMV
Aloe Guvner: Is that because SceneManager.exit() triggers all the destructors for RMMV's Javascript classes?

EDIT: For those who don't know what a destructor is, a brief explanation. Destructors are a piece of code called when a program tells something to stop existing. They're extremely important when you start using memory address pointers because you need to tell the system to free up the memory address your code is pointing to. Failing to do so is one way to cause what are called memory leaks.
 
Last edited:

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,115
First Language
English
Primarily Uses
RMMV
More or less, yeah. Memory management in JS isn't as manual as in other compiled languages (C, C++, etc.) but there are functions that the devs wrote into RMMV that I try to use whenever possible (since I assume they wrote it for a reason). Sometimes it's for cross-browser compatibility.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,476
Members
137,824
Latest member
dobratemporal
Top