[VX] Actor Face in default SaveFile

Hello guys.
I tried to show Faces under the Sprites in the SaveFile, but I failed.

Can someone help please?
can you confirm that you're using VX instead of VXA?
There aren't many people who are still using VX, and only very few scripts are compatible between VX (RGSS2) and VXA (RGSS3)
Yes, VX not Ace.
I don't personally use VX, so I can't personally recommend any particular script for it. There are probably some that already exist that can do it, but I don't know what they would be called.

What I can give you is some tips on how to achieve this if you plan on making a script for it yourself.

The class you are looking at modifying is Window_SaveFile.

The way that the default Window_SaveFile operates is that it partially loads the save file, opening the first 8 things in your save files and then uses that data to draw the stuff you see in visible save slots.

There are 14 different things in total that are stored in a VX save file, you can see what they are in Scene_File's "write_save_data" method. These are pretty self-explanatory for the most part:
Spoiler
Ruby:
  def write_save_data(file)
    characters = []
    for actor in $game_party.members
      characters.push([actor.character_name, actor.character_index])
    end
    $game_system.save_count += 1
    $game_system.version_id = $data_system.version_id
    @last_bgm = RPG::BGM::last
    @last_bgs = RPG::BGS::last
    Marshal.dump(characters,           file)
    Marshal.dump(Graphics.frame_count, file)
    Marshal.dump(@last_bgm,            file)
    Marshal.dump(@last_bgs,            file)
    Marshal.dump($game_system,         file)
    Marshal.dump($game_message,        file)
    Marshal.dump($game_switches,       file)
    Marshal.dump($game_variables,      file)
    Marshal.dump($game_self_switches,  file)
    Marshal.dump($game_actors,         file)
    Marshal.dump($game_party,          file)
    Marshal.dump($game_troop,          file)
    Marshal.dump($game_map,            file)
    Marshal.dump($game_player,         file)
  end
The 10 "$game_xxxx" variables all correspond to instances of the same "Game_Xxxx" classes you see in the script editor. @last_bgm and @last_bgs is obvious, it's the filename of the music that was playing when you saved the game.
"Graphics.frame_count" is actually your playtime, the game just stores it as total number of frames ever run and converts it into hours/minutes/second format by dividing the frame count by the game's frames-per-second framerate.

Lastly, "characters" is what the game uses to display the party sprites in Window_SaveFile. It stores the spritesheet filenames and the index numbers (i.e. which one out of the possible 8 sprites on a full sheet) the party members were using.

So just from this, you may see the problem here already:

The first 8 things in the save file don't actually contain any data on which faces the party members were assigned.

That data can be gotten from $game_actors and $game_party, but they are the 10th and 11th things in the save file and not one of the things opened by Window_SaveFile when it peeks at the file to draw the slots.

So you will either have to modify Window_SaveFile to load more of the save files, in order to read the party face data. Or else change Scene_File and how it makes the save files, so that instead of storing spritesheet names/indices in "character", it stores the faceset name and indices instead. Or some hybrid method, like making the save files contain some new variable ala "character" just to remember the facesets and then make Window_SaveFile load that.

And then after that, you can finally call "draw_face" or some similar method to display the face instead of how the window uses "draw_party_characters" to draw the sprites by default.
Thats good informations, but how to modify?
I know there is something missing, but I'm not a scripter and I tried, but all I become is error,
because I don't know to modify.
If you don't know how to, you will have to check some tutorials or guides on Ruby and then look at the VX script editor to see how the RGSS2 code is written (or look up guides specifically meant for scripting with VX). Because even if you already know Ruby all of the stuff in the "Window_Xxx" classes and all their methods like draw_face are specific to the RPGMaker VX.

As I said before, I don't use VX - I use VXAce. I can only tell you about the save files because I happen to know that VXAce does it the same way for in its own save menu.

However the other stuff like the Windows and their drawing methods may not be the same in VXAce as what it is in VX (Ace uses RGSS3, VX uses RGSS2) so unfortunately, if you want detailed specifics or a step by step on how to modify the actual code, you will need to find someone who has VX or a guide for VX/RGSS2 scripting.
Thanks for answer.

I found a script by Moghunter and searched for the missing code.
Yes, there was something.
So, I tried again to modify and was sure it's good now... but error.
7dczlqrz.png


Ok I give up.
If someone want to help, here is what I tried:

pastebin
Because I don't have VX, I can't test this for sure. But I think the problem may be this:
Code:
face_name = @characters[0][3]
face_index = @characters[0][4]
Arrays are indexed starting from 0, so if you are calling for the index 4 item, you are actually checking the 5th item in the array.

But there is no 5th item in the array, there's only 4 (which are "actor.character_name", "actor.character_index", "actor.face_name" and "actor.face_index").

Try using @characters[0][2] and @characters[0][3] instead.

Also, if you are using old/outdated save files, they won't have the faceset filename data in it. So you will get errors trying to read old saves. Remember that only new save files created after using the script will have the right data stored in them.
Holy hell! IT WORKS!
And yes "old save files" my bad, that was the problem.

Thank you, Traverse! really good help and that without VX :LZYsmile:

Edit: Okay, last problem.
The character sprite is behind the face.
When you draw multiple images in the same place on the screen, they newest graphic is drawn ontop of the oldest. It's current being drawn in order of sprites then playtime then faces (if your playtime was being drawn in the same place as the sprites and faces it would actually be ontop of the sprites and underneath the faces).

So if you want the character sprite to be drawn ontop of the face you need to rearrange the code to call your "draw_face_save" first, then "draw_party_characters" after.
Oh my.... thanks again, for all the informations and your time.
It's done now and the thread can be closed.

Original thread: https://forums.rpgmakerweb.com/threads/vx-actor-face-in-default-savefile.130084/