MZ Scene_load/save modify (MZ)

Hi guys i hope you can help me, i am new at js.
After reading all the .js files, i successfully modified scene_load and scene_save, as i needed to. My problem is, i cannot find and modify the "savefile" boxes background. In addition to this, I need to eliminate the intermittence of the selector. I hope everythinh is clear. Attached you can find a screenshot.

Thank you!!

Spoiler: spoiler
Cattura.PNG
For that, you need to look at the Window_SavefileList class in rmmz_windows.js.
hello it's still me.
I was able to find a way to change the background color, but I can't figure out how to insert an image.
can someone help me? thank you
Please help me, I would like to make something similar to the attached image, but I cannot upload the image I would like to the save list.

prova.png

@Prandwood, please do not bump your topic unless it has been 24 hours later since your last post. You can review our forum rules here. Thank you.

Also, since this is a scripting question and you want to learn how to do this yourself:

I've moved this thread to Learning JavaScript. Thank you.

You could make an image for the background of 1 item, then override Window_SavefileList#drawItemBackground. E.g. (untested):
JavaScript:
/*:
 * @target MZ
 * @plugindesc Use img/pictures/SaveFileBG.png as the save file item background.
 */
Window_SavefileList.prototype.drawItemBackground = function(index) {
  // get rectangle for this item
  const rect = this.itemRect(index);
  // load img/pictures/SaveFileBG.png
  const bmp = ImageManager.loadPicture('SaveFileBG');
  // blit it whole to the window background at this item's position
  this.contentsBack.blt(bmp, 0, 0, bmp.width, bmp.height, rect.x, rect.y);
};
(Alternatively you could try doing some windowskin manipulations; I'm not sure if there's a way to leverage the existing codebase to do that neatly or not...)

Note that it's often better to do core script edits via plugins. Plugins load after the core scripts and therefore can override methods from the core scripts. Plugins are easier to track and enable/disable mid-development. Also, direct edits to the core script files will be erased if/when you update your project's core script version.
It works! thanks a lot!

Sorry for bumpin too soon
Great, no worries!

Do you have any other questions about this? If not, I'll close the thread~
Great, no worries!

Do you have any other questions about this? If not, I'll close the thread~
yes thank you, I would like to know if it is possible to insert the map name.
For that you would need 2 things:
  1. Add the map name to the global save data;
  2. Draw the map name on Window_SavefileList.
Suggestions (untested):
  1. Patch DataManager.makeSavefileInfo, e.g.
    JavaScript:
    (alias => {
      DataManager.makeSavefileInfo = function() {
        const contents = alias.apply(this, arguments);
        contents.mapName = $gameMap.displayName();
        return contents;
      };
    })(DataManager.makeSavefileInfo);
  2. Patch (or override) Window_SavefileList.prototype.drawContents (cf rmmz_windows.js) so that it draws info.mapName where you want it.
Spoiler: Quote
For that you would need 2 things:
  1. Add the map name to the global save data;
  2. Draw the map name on Window_SavefileList.
Suggestions (untested):
  1. Patch DataManager.makeSavefileInfo, e.g.
    JavaScript:
    (alias => {
      DataManager.makeSavefileInfo = function() {
        const contents = alias.apply(this, arguments);
        contents.mapName = $gameMap.displayName();
        return contents;
      };
    })(DataManager.makeSavefileInfo);
  2. Patch (or override) Window_SavefileList.prototype.drawContents (cf rmmz_windows.js) so that it draws info.mapName where you want it.
I know this works(haven't tested this code, but know how to add to the global save info), but feels excessive. I would say just set the map name to a $gameVariable and then show the variable on the save screen. To each their own I suppose 😀

Screenshot from my game where I used a variable as the map name, hence the "0" in the location window in save slot 1 where I was just quick saving without doing a map transfer to a named map
Save.png
I would say just set the map name to a $gameVariable and then show the variable on the save screen.
I don't see how that would work, at least not without other plugin(s). Can you elaborate?

By default the save window only has access to the global save info, i.e.
  • title - the game title;
  • characters - character sheet name/index for each party member;
  • faces - faceset name/index for each party member;
  • playtime - playtime formatted as "hh:mm:ss"; and
  • timestamp - when the save info was generated, i.e. real save time.
As you can see, game variables are not present. If you referenced a variable value then that value would be specific to the current playthrough, unless you have another plugin for syncing variables across saves...which is essentially another "global save info" route. 😴
Screenshot from my game where I used a variable as the map name, hence the "0" in the location window in save slot 1 where I was just quick saving without doing a map transfer to a named map
In your screenshot I notice that all slots except the first (index 0) show the same map name. I can't say for sure without seeing the code behind it, but my guess would be that you tried to get game variable ID 0 (non-existent) for the first slot, 1 for the second, etc. $gameVariables.value(0) returns 0 because the ID is out of range.
Oh, Jesus, you're right... I had added the variables to my save data info. I had just woken up when I made that post above and forgot I had already modified my save info, as you can see the dates I had lasted tested my save screen edits on.

So yeah... that is seriously my bad. I was calling you out for wanting to edit the save data (not in a rude way though ;p), but I did the same thing myself and had forgotten due to it being so long ago.

I had added a LOT more to it back when I made the initial edit...
Code:
DataManager.makeSavefileInfo = function() {
    const info = {}
    info.title         = $dataSystem.gameTitle
    info.characters    = $gameParty.charactersForSavefile()
    info.faces         = $gameParty.facesForSavefile()
    info.playtime      = $gameSystem.playtimeText()
    info.timestamp     = Date.now()
    info.members       = $gameParty.members().length
    info.actor1        = $gameActors._data[1]
    info.actor2        = $gameActors._data[2]
    info.actor3        = $gameActors._data[3]
    info.actor4        = $gameActors._data[4]
    info.fire          = $gameVariables.value(8)
    info.wind          = $gameVariables.value(9)
    info.water         = $gameVariables.value(10)
    info.earth         = $gameVariables.value(11)
    info.location      = $gameVariables.value(22)
    info.fireOrb       = $gameSwitches.value(3)
    info.windBall      = $gameSwitches.value(4)
    info.waterGlobe    = $gameSwitches.value(5)
    info.earthSphere   = $gameSwitches.value(6)
    info.eletome       = $gameSwitches.value(7)
    info.prisonKey     = $gameSwitches.value(8)
    info.artifactOne   = $gameSwitches.value(9)
    info.artifactTwo   = $gameSwitches.value(10)
    info.skeletonKey   = $gameSwitches.value(11)
    info.ultimateKey   = $gameSwitches.value(12)
    info.candle        = $gameSwitches.value(13)
    info.blazingBeacon = $gameSwitches.value(14)
    info.time1         = new Date().toString().substr(4, 11)
    info.time2         = new Date().toLocaleString('en-US', { hour: 'numeric', minute: 'numeric', second: 'numeric', hour12: true }).substr(0, 8)
    info.time3         = new Date().toLocaleString('en-US', { hour: 'numeric', minute: 'numeric', second: 'numeric', hour12: true }).substr(8, 12)
    return info
}

and in the save screen...
Code:
this.drawText(info.location, rect.x + 5, rect.y + 38, 568, 'center')

Dont hurt me @caethyril! I didn't mean to! 😮

Another screenshot as well, to show the variable does work. I chose to use Variables instead of mapName because I use several indoor areas on a single map, spaced apart far enough the player wouldn't know to conserve total MapID's, so I need each "room" to have its own name.
Spoiler: Screenshot
1648068307239.png
you're right... I had added the variables to my save data info.
Mistakes happen, it's OK! I was curious to see if there was a simpler way to do things. Good to know it's not a problem with your system~ 🙏
The only issue I foresee with trying to add location to the default save menu is those windows are also very small, part of why I went ahead and just went crazy with the re-write of the scene for my game. The default windows are so minimalist sometimes it can be confusing, esp if you have multiple people who play on the same PC, even more so if there are only the same 4 characters you can find for your party... all save slots would look the same once players get so far into the game and have a full party.

edit: mainly noting this due to the size of the 1st character in their screenshot from above. If all members are the same height where exactly would you want to squeeze in the map names and not have possible overlap? Unless map name and sprites overlapping doesn't bother you.
Thanks a lot to everyone.
This method (maybe I compiled the code wrong) I can't get it to work.
For that you would need 2 things:
  1. Add the map name to the global save data;
  2. Draw the map name on Window_SavefileList.
Suggestions (untested):
  1. Patch DataManager.makeSavefileInfo, e.g.
    JavaScript:
    (alias => {
      DataManager.makeSavefileInfo = function() {
        const contents = alias.apply(this, arguments);
        contents.mapName = $gameMap.displayName();
        return contents;
      };
    })(DataManager.makeSavefileInfo);
  2. Patch (or override) Window_SavefileList.prototype.drawContents (cf rmmz_windows.js) so that it draws info.mapName where you want it.


This method works perfectly
Oh, Jesus, you're right... I had added the variables to my save data info. I had just woken up when I made that post above and forgot I had already modified my save info, as you can see the dates I had lasted tested my save screen edits on.

So yeah... that is seriously my bad. I was calling you out for wanting to edit the save data (not in a rude way though ;p), but I did the same thing myself and had forgotten due to it being so long ago.

I had added a LOT more to it back when I made the initial edit...
Code:
DataManager.makeSavefileInfo = function() {
    const info = {}
    info.title         = $dataSystem.gameTitle
    info.characters    = $gameParty.charactersForSavefile()
    info.faces         = $gameParty.facesForSavefile()
    info.playtime      = $gameSystem.playtimeText()
    info.timestamp     = Date.now()
    info.members       = $gameParty.members().length
    info.actor1        = $gameActors._data[1]
    info.actor2        = $gameActors._data[2]
    info.actor3        = $gameActors._data[3]
    info.actor4        = $gameActors._data[4]
    info.fire          = $gameVariables.value(8)
    info.wind          = $gameVariables.value(9)
    info.water         = $gameVariables.value(10)
    info.earth         = $gameVariables.value(11)
    info.location      = $gameVariables.value(22)
    info.fireOrb       = $gameSwitches.value(3)
    info.windBall      = $gameSwitches.value(4)
    info.waterGlobe    = $gameSwitches.value(5)
    info.earthSphere   = $gameSwitches.value(6)
    info.eletome       = $gameSwitches.value(7)
    info.prisonKey     = $gameSwitches.value(8)
    info.artifactOne   = $gameSwitches.value(9)
    info.artifactTwo   = $gameSwitches.value(10)
    info.skeletonKey   = $gameSwitches.value(11)
    info.ultimateKey   = $gameSwitches.value(12)
    info.candle        = $gameSwitches.value(13)
    info.blazingBeacon = $gameSwitches.value(14)
    info.time1         = new Date().toString().substr(4, 11)
    info.time2         = new Date().toLocaleString('en-US', { hour: 'numeric', minute: 'numeric', second: 'numeric', hour12: true }).substr(0, 8)
    info.time3         = new Date().toLocaleString('en-US', { hour: 'numeric', minute: 'numeric', second: 'numeric', hour12: true }).substr(8, 12)
    return info
}
I know this works(haven't tested this code, but know how to add to the global save info), but feels excessive. I would say just set the map name to a $gameVariable and then show the variable on the save screen. To each their own I suppose 😀

Screenshot from my game where I used a variable as the map name, hence the "0" in the location window in save slot 1 where I was just quick saving without doing a map transfer to a named mapView attachment 220765
Hi, it's me again.
I noticed that in your save_scene you added icons too.
I tried to add icons using the method you gave me to draw location, but in my save scene i can only see textual information (\I[74] instead of the icon).
I guess there must be a different way to achieve that.
Can you help me? Thanks a lot
@Prandwood

You would need to draw icons using this script
Code:
this.drawIcon(59, rect.x + 363, rect.y + 255)

The 59 in this case is the ID of the icon from the icon sheet, and then you would need to fine tune the "rect.x + number" and "rect.y + number" values to move the icon to the exact location so it will appear properly in each save screen info box.
@Prandwood

You would need to draw icons using this script
Code:
this.drawIcon(59, rect.x + 363, rect.y + 255)

The 59 in this case is the ID of the icon from the icon sheet, and then you would need to fine tune the "rect.x + number" and "rect.y + number" values to move the icon to the exact location so it will appear properly in each save screen info box.
It works perfectly, thanks

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/scene_load-save-modify-mz.145772/