Yanfly Save Engine problem

● ARCHIVED · READ-ONLY
Started by Kes 17 posts View original ↗
  1. I am using Yanfly's Ace Save Engine, which can be found here: https://github.com/Archeia/YEARepo/blob/master/Menu/Ace_Save_Engine.rb

    In addition, I am using Todd's mod to allow for an autosave function.  It consists of this, beginning at the original line 108

    module ToddAutoSaveAce #Autosave file name. AUTOSAVEFILENAME = "AutoSave" #Specify which switches to turn on and off autosave #Autosave before battle? AUTOSAVEBB = 7 #Autosave when menu opened? AUTOSAVEM = 0 #Autosave when changing map? AUTOSAVETM = 8 #Variable ID that contains the number where the sutosave file will be saved. VARIABLE = 9 endand this which is after Scene_Load and before Scene_Map  (around line 760 or so  in the original, but it's lower down in mine because of the above snippet)

    #==============================================================================# ** Autosave#------------------------------------------------------------------------------# This module contains the autosave method. This is allows you to use the# "Autosave.call" command. #==============================================================================module Autosave #-------------------------------------------------------------------------- # * Call method #-------------------------------------------------------------------------- def self.call DataManager.save_game_without_rescue($game_variables[ToddAutoSaveAce::VARIABLE])endendThe autosave function works fine - but it has, from the player's point of view, messed up the line in the save screen which notified how many saves had been made.  What happens is that autosave saves every time you enter a new map and immediately before a battle.  These saves are being added to the ordinary saves which the player makes, producing massive and nonsensical numbers.

    It seems to me that I have 3 options.  The only one I know how to do is the first.

    1. Remove the autosave function.  I am very, very reluctant to do that.
    2. Find a way of preventing the autosaves being added to the save total.  This is my preferred choice.
    3. Find a way of removing the number of times saved from the save screen so that the player isn't confused by silly figures.  I would only want to do this if (2) is not possible.

    Can anyone help me with the second or third options?

    Thanks.
  2. Well, the save count is in the command on_before_save, on Game_System.
    The script uses save_game_without_rescue, which calls it.
    I think the best solution would be, instead of calling it, making your own save command.
  3. I'm sorry to say that I have zero scripting ability so am totally unable to do what you suggest.

    Is there any chance that you, or someone else, could do it for me?
  4. Well, I haven't tested, but...

    module DataManager def self.save_not_counting(index) File.open(make_filename(index), "wb") do |file| $game_system.on_before_save_not_counting Marshal.dump(make_save_header, file) Marshal.dump(make_save_contents, file) @last_savefile_index = index end return true endendclass Game_Systen def on_before_save_not_counting @version_id = $data_system.version_id @frames_on_save = Graphics.frame_count @bgm_on_save = RPG::BGM.last @bgs_on_save = RPG::BGS.last endendThen substitute the line 800 of your Autosave script for DataManager.save_not_counting($game_variables[ToddAutoSaveAce::VARIABLE])

    I basically repeated the whole script just removing the counting though, probably someone else here could give you a more efficient one...
  5. I would just not use a variable, and use the same save file name each time (in fact, that's what we do with the Aveyond games). I can't imagine how much disk space is going to be taken up when you create a save file every single time you change maps or enter battle, and use a different file name each time! How far back would the player want to go?


    To do that, change


    $game_variables[ToddAutoSaveAce::VARIABLE]


    to


    0


    so it saves as #0 every time. Then you'll only ever have one autosave in your file list.
  6. think the variable just says the autosave will be on save file x, not that it will increase every turn... At least that's the impression line 124 gave me.
    But can't say much with just the bit of script we got...
  7. No, it's referring to a Game Variable. If it was just the number for the save file, there wouldn't be any need to use a Game_Variable for it. And this

    ksjp17 said:
    These saves are being added to the ordinary saves which the player makes, producing massive and nonsensical numbers.
    makes me think that somewhere along the line in the script, it's being incremented every time it's used.
  8. I agree that it seems useless to me too, but that's the impression the comment in the script gave me...
    And about the quote, pretty sure he meant just the counter that checks how many saves there were:

    ksjp17 said:
    The autosave function works fine - but it has, from the player's point of view, messed up the line in the save screen which notified how many saves had been made.  What happens is that autosave saves every time you enter a new map and immediately before a battle.  These saves are being added to the ordinary saves which the player makes, producing massive and nonsensical numbers.
  9. For clarity's sake, there is only one autosave file, so there's not a vast number of separate save files taking up disk space.  The script measures how many times the game has been saved, and gives a global figure.  Autosave contributes to that global figure and so inflates it beyond belief.

    And those two snippets are added to Yanfly's script, they are not stand alone, so there is nothing else.
  10. Bump

    The snippet provided by Waterguy means that the autosave doesn't work on changing maps, which rather defeats the objective of having it as an autosave.

    It isn't the fact that it saves that is the issue, it is the fact that it goes into the global count of saves made.  If there is really no way to prevent that, can anyone tell me how to remove that line from the save screen?  Here is how it looks at the moment and I have outlined the save number section in red.  That's the bit which (sadly) would have to go.

    savescreen_zpsfa64f2d2.png

    Thanks
  11. Are you sure?
    Tried loading the autosave to check? Because all it was supposed to do was not count the save, the part you circled, but do all the rest just the same...

    Keep in mind the usual File does not show save numbers though, so I am working with a piece of a script and an unknown one, maybe yours uses the variable for save count differently...
  12. Things have got a bit more obscure.

    Just substituting your snippet for line 800 i.e. 

    DataManager.save_not_counting($game_variables[ToddAutoSaveAce::VARIABLE])

    gave a SyntaxError occurred 

    module definition in method body.

    So I found that if I deleted line 799 as well i.e.

    def self.call

    then it would work.

    I started a new game (just to be sure) and changed maps, but the autosave was still showing the location as where I had been in the old game.

    So I reverted to the original version.

    Seeing your post, I tried putting your snippet back in to re-test it.  Again I got the SyntaxError occurred message, and deleted line 799.

    Game starts but on the first map transfer I'm now getting

    line 872: NoMethodError occurred

    undefined method 'call' for Autosave:Module.

    I can't remember what, if anything, I did the first time to get it to work.  so now I'm stuck.

    EDIT

    Not sure what you are referring to when you say that you are working with a piece of a script and an unknown one.

    I gave the link to Yanfly's script, and the two snippets I quoted in the op are all there are - they are inserted into Yanfly's script, not part of some separate, larger script.
  13. oh, so that's what you did.

    Ok, post this

    module DataManager def self.save_not_counting(index) File.open(make_filename(index), "wb") do |file| $game_system.on_before_save_not_counting Marshal.dump(make_save_header, file) Marshal.dump(make_save_contents, file) @last_savefile_index = index end return true endendclass Game_Systen def on_before_save_not_counting @version_id = $data_system.version_id @frames_on_save = Graphics.frame_count @bgm_on_save = RPG::BGM.last @bgs_on_save = RPG::BGS.last endendin a new script in Materials.

    Then in your old script, the one you posted up there, substitute the line

    DataManager.save_game_without_rescue($game_variables[ToddAutoSaveAce::VARIABLE])for

    DataManager.save_not_counting($game_variables[ToddAutoSaveAce::VARIABLE])And about working with codes I don't know, you already added this autosave script, which you only gave a piece of to see, and whatever script you used for your new savefile appearence.
  14. This throws up another error.  I'll explain exactly what I did.

    I removed the original line 800 which read

    DataManager.save_game_without_rescue($game_variables[ToddAutoSaveAce::VARIABLE])

    and substituted your new line which reads

    DataManager.save_not_counting($game_variables[ToddAutoSaveAce::VARIABLE])

    I then inserted the new snippet underneath Yanfly's script.

    On the first map transfer I got the error message:

    line 4: NoMethodError occurred

    undefined method 'on-before-save-not-counting' for

    #<Game-System: 0x92a4e9c>
  15. That's weird...

    I shouldn't happen on Ruby, but try this one instead then:

    class Game_System def on_before_save_not_counting @version_id = $data_system.version_id @frames_on_save = Graphics.frame_count @bgm_on_save = RPG::BGM.last @bgs_on_save = RPG::BGS.last endendmodule DataManager def self.save_not_counting(index) File.open(make_filename(index), "wb") do |file| $game_system.on_before_save_not_counting Marshal.dump(make_save_header, file) Marshal.dump(make_save_contents, file) @last_savefile_index = index end return true endendI just inverted their order. Not sure if the problem will be fixed, but worth a try.
  16. This gives every appearance of working perfectly.

    Thank you so much.  It is such a relief to know that I don't have to ditch the autosave.
  17. 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.