save file description

wanted to know if there was some kind of script or plugin that lets me add text in the box below. i was thinking of something like adding a description of what happened before the save and having status' for characters in the story.

some characters can die and i have switches for that, so another question would be if there was a way to add text if i can use switches and text colors.

edit: just to put it out there, im using the AltSaveScreen plugin by Yoji.

Your Turn to Die_ -Jackleg Partcicipants- 11_16_2022 7_33_28 AM.png
text colors might be possible with TSR_TextColorAddon plugin,
to add a description or status might be possible if you can
modofy the plugin.

if the text window is added by sekection of the info there, you might
be able to change it by adding or changing by $gameVariables.value(x).

in a common event, you can set another variable +1, and set the other variable
to a string of text to show in the savefile.

if you want it a different way, give some more information.
if you want it a different way, give some more information.
surely theres a way to add a script/plugin command after a specific save spot in the game that would be like, if player saves here then display "XYZ" over X save file
do you want the savefile, title and playtime on the same place?
or as on default, there is drawPartyFaces which I dont see on your
screenshot which I assume you change that?
do you want the savefile, title and playtime on the same place?
or as on default, there is drawPartyFaces which I dont see on your
screenshot which I assume you change that?
yea basically, the idea is to show whats already there and then have a the status of characters (i.e. alive/dead via switches) and if its possible a description of whats happening during specific save spots.

and as for the drawPartFaces, the reason its like that is because my game is more of a visual novel/point-and-click game so the characters are transparent.
bumping this just in case there is a way to do this
So, the first thing you'll need to do is modify Game_Party.prototype.charactersForSaveFile. This function defines what data about the characters gets added to every save file. Whatever additional info you want to display on the save screen should go there. All the data fields from Game_Actor will be available.

To determine death, maybe save off HP and then check if hp === 0.

In order to change the actual display, you'll want to adjust Window_SavefileList.prototype.drawItem. The data that was saved in charactersForSaveFile gets loaded as const info. Character information is in info.characters.

If you need to add other kinds of data besides what's on Game_Actor, take a look at DataManager.makeSaveFileInfo.

Assuming your code is in something that derives from Window_Base, you change the text color by calling this.changeTextColor(...). Be sure to call this.resetTextColor() when you're done, because those functions affect state globally for all windows. In order to determine what color to pass in to changeTextColor, take a look at ColorManager.
For the kind of custom status text you talk about, how would that be determined? Is it based on progression through the story?
So, the first thing you'll need to do is modify Game_Party.prototype.charactersForSaveFile. This function defines what data about the characters gets added to every save file.
where would i find Game_Party.prototype.charactersForSaveFile and when you mean characters do you mean characters as in letters/numbers or character as in character sprites.

To determine death, maybe save off HP and then check if hp === 0.
since my game is more of a visual novel i haven't touched any kind of HP or traditional RPG elements in the engine. is there anyway i could write a conditional branch with this?

For the kind of custom status text you talk about, how would that be determined? Is it based on progression through the story?
the idea is that the player can save during any spot they want in the game by going to the menu, but specific points in the game force the player to save before hand, i want thinking of giving those forced save spaces descriptions of what's about to happen.

and just to have some kind of visualization of what im trying to go for, it's supposed to kind of look like this:

(If switch X is OFF)

Ranmaru: Alive
Anzu: Alive
Kurumada: Alive
Alice: Alive

(If switch X is ON)

Ranmaru: Alive
Anzu: Dead
Kurumada: Alive
Alice: Alive
where would i find Game_Party.prototype.charactersForSaveFile and when you mean characters do you mean characters as in letters/numbers or character as in character sprites.

This is in mmz_objects.js. You'd modify its functionality with plugin code.

since my game is more of a visual novel i haven't touched any kind of HP or traditional RPG elements in the engine. is there anyway i could write a conditional branch with this?

(If switch X is OFF)

Ranmaru: Alive
Anzu: Alive
Kurumada: Alive
Alice: Alive

(If switch X is ON)

Ranmaru: Alive
Anzu: Dead
Kurumada: Alive
Alice: Alive

I see. In that case, in Window_SavefileList.prototype.drawItem, you'd want to do something like:

JavaScript:
if ($gameSwitches.value([insert switch number here])) {
    [draw character alive]
} else {
    [draw character dead]
}

the idea is that the player can save during any spot they want in the game by going to the menu, but specific points in the game force the player to save before hand, i want thinking of giving those forced save spaces descriptions of what's about to happen.

Then, if I've understood correctly, "normal" invocations of the save screen will have no text in this status space, and on particular instances, you want to have one-off text that will be used once and only once for that invocation. In that case, I'd suggest you create a plugin command that takes the status text as a parameter. The command would invoke the save screen with that text parameter and you would modify Scene_File to include a place to display this text, but only if the variable actually has text in it.
This is in mmz_objects.js. You'd modify its functionality with plugin code.
what file exactly? i can't really find it, is it in the project file itself or in my own rpg maker folder.

I see. In that case, in Window_SavefileList.prototype.drawItem, you'd want to do something like:

JavaScript:
if ($gameSwitches.value([insert switch number here])) {
[draw character alive]
} else {
[draw character dead]
}
how would i change the text color for the Alive and Dead text?
what file exactly? i can't really find it, is it in the project file itself or in my own rpg maker folder.

It should be in the js folder of your game project.

how would i change the text color for the Alive and Dead text?

this.changeTextColor(...) You have to pass in the color to change to where the dots are. You can get a color from ColorManager. If you do a search on either of these terms in the JS source of the engine, you'll find tons of examples.
It should be in the js folder of your game project.
i believe ive found the function although im confused on where to put the code, although i found this is rpg_object.js so maybe its a different thing(?)

JavaScript:
Game_Party.prototype.charactersForSavefile = function() {
    return this.battleMembers().map(function(actor) {
        return [actor.characterName(), actor.characterIndex()];
    });
};

edit: i tried looking for Window_SavefileList.prototype.drawItem however i couldnt find it anywhere
edit2: was able to find it in rpg_windows.js, although im still confused on where to put the code
JavaScript:
Window_SavefileList.prototype.drawItem = function(index) {
    var id = index + 1;
    var valid = DataManager.isThisGameFile(id);
    var info = DataManager.loadSavefileInfo(id);
    var rect = this.itemRectForText(index);
    this.resetTextColor();
    if (this._mode === 'load') {
        this.changePaintOpacity(valid);
    }
    this.drawFileId(id, rect.x, rect.y);
    if (info) {
        this.changePaintOpacity(valid);
        this.drawContents(info, rect, valid);
        this.changePaintOpacity(true);
    }
};

edit3: ive tried plopping it in as:
JavaScript:
Window_SavefileList.prototype.drawItem = function(index) {
    var id = index + 1;
    var valid = DataManager.isThisGameFile(id);
    var info = DataManager.loadSavefileInfo(id);
    var rect = this.itemRectForText(index);
    this.resetTextColor();
    if (this._mode === 'load') {
        this.changePaintOpacity(valid);
    }
    this.drawFileId(id, rect.x, rect.y);
    if (info) {
        this.changePaintOpacity(valid);
        this.drawContents(info, rect, valid);
        this.changePaintOpacity(true);
    }
    if ($gameSwitches.value(36)) {
    [draw character alive]
    } else {
    [draw character dead]
    }
};
however when i do it gives me the error of ReferenceError Window_TitleCommand is not defined.
using github codespaces i was able to see that there isn't really any problem with the code. i replaced it so now the code is
JavaScript:
Window_SavefileList.prototype.drawItem = function(index) {
    var id = index + 1;
    var valid = DataManager.isThisGameFile(id);
    var info = DataManager.loadSavefileInfo(id);
    var rect = this.itemRectForText(index);
    this.resetTextColor();
    if (this._mode === 'load') {
        this.changePaintOpacity(valid);
    }
    this.drawFileId(id, rect.x, rect.y);
    if (info) {
        this.changePaintOpacity(valid);
        this.drawContents(info, rect, valid);
        this.changePaintOpacity(true);
    }

    if ($gameSwitches.value(36)) {
        "Anzu"
        } else {
        "Anzu"
        }
};

before doing something like Anzu: Alive / Anzu: Dead, didn't work and only showed me an error saying that Anzu was undefined, as expected. With this new code no text shows up at all, either that or it's way off screen. im unclear with javascript coding, and googling didn't work, so im unsure on how to do this. i know it's reading the code correctly because it's showing the save screen instead of an error.

any javascript guru's out there?
So, first of all, editing the core library JS files directly is not a good practice. These files need to remain pristine. If you accidentally make a mistake editing these, then your only option to fix the problem would be start deleting all your custom changes until things start working again.

The recommended way to do this is to create a plugin that redefines or extends the functionality of a given function.

Here's the basic, minimal structure of a plugin for MZ:
JavaScript:
/*:
 * @target MZ
 * @plugindesc [INSERT PLUGIN NAME HERE]
 * @author [INSERT YOUR NAME HERE]
 * @url [INSERT YOUR WEBSITE HERE]
 * @help
 * [INSERT TEXT DESCRIPTION OF YOUR PLUGIN HERE]
*/

(function() {
    'use strict';
    
    //[INSERT CODE HERE]
    
})();

By doing it this way, if things go sideways, you can turn off your plugin in the editor and the code in core JS library will be guaranteed to work correctly.

That said, if you ever need an example of how something works, doing a search on the core libraries is a good way to learn stuff.

I recommend taking your custom modifications to Window_SavefileList.prototype.drawItem and putting them in a plugin.

Now, next issue. Dropping a string in the if statement is valid Javascript, but it won't have any effect on the game's behavior. Do you want to have the character's name appear as text? We're in a Window class, so the function for that is this.drawText(text, x, y, width, alignment) (reference).

Also, I recommend moving this code into the if (info) block. That block is essentially guarding against the case that this function gets called with null or undefined save file info, in which case, trying to use any of its data would cause a crash.
The recommended way to do this is to create a plugin that redefines or extends the functionality of a given function.

Here's the basic, minimal structure of a plugin for MZ:
JavaScript:
/*:
 * @target MZ
 * @plugindesc [INSERT PLUGIN NAME HERE]
 * @author [INSERT YOUR NAME HERE]
 * @url [INSERT YOUR WEBSITE HERE]
 * @help
 * [INSERT TEXT DESCRIPTION OF YOUR PLUGIN HERE]
*/

(function() {
    'use strict';
 
    //[INSERT CODE HERE]
 
})();

I recommend taking your custom modifications to Window_SavefileList.prototype.drawItem and putting them in a plugin.
if thats the case, do i just have the plugin look like
JavaScript:
/*:
 * @target MZ
 * @plugindesc [INSERT PLUGIN NAME HERE]
 * @author [INSERT YOUR NAME HERE]
 * @url [INSERT YOUR WEBSITE HERE]
 * @help
 * [INSERT TEXT DESCRIPTION OF YOUR PLUGIN HERE]
*/

(function() {
    'use strict'

if ($gameSwitches.value(36)) {
        this.drawText("Anzu: Alive", 32, 32, 420, "left")
        } else {
        this.drawText("Anzu: Dead", 32, 32, 420, "left")
        }

if i understand this correctly, wouldn't this just show the text anywhere? the idea is to only show it on the save screen, im really sorry if im misunderstanding, this is all just bewildering.

Do you want to have the character's name appear as text? We're in a Window class, so the function for that is this.drawText(text, x, y, width, alignment) (reference).
yes, the basic idea is to just have text where the text box is saying the character's name along with their status of being alive or dead, then dependent on a switch i use for each of them whether its on or off will determine if the text says alive or dead (varying in color of course).

i can try to provide a visual if it'll help.

Also, I recommend moving this code into the if (info) block. That block is essentially guarding against the case that this function gets called with null or undefined save file info, in which case, trying to use any of its data would cause a crash.
my apologies, i have no clue on how to set up an if (info) block is. googling doesn't necessarily help

edit: just want to clarify that editing rpg_windows.js wouldnt have gotten anywhere as because after going down beyond a point text disappears, and it disappears before it can even reach the text box. in hindsight this kind of makes sense
@matthewwells an alternative way im thinking about adding this is maybe a series of images to act as text? like 2 separate images for each of the characters' name where both either say alive or dead.

if theres a way to add images and have them load above the text box then it would be easy, only problem would be to add the same line of code saying "if switch 36 is on, show this image instead"
bumping this one last time
I wish I could help you, but he tell things in MZ while some of the MZ functions
dont work in MV as how MZ is written (as most require MV 1.6.x for ES6 code).

it require some knowledge of coding though and it's best to avoid "function() { }"
to start if you want to alias/overwrite a function or it doesn't work either.

as I still get better in JS for being better in it.

I hope someone could alter your save plugin or addon to make it work
the way you want it to be.

Good luck on your project and hopefully the some advanced coder to help
you out on this issue 🙂

Original thread: https://forums.rpgmakerweb.com/threads/save-file-description.152711/