Yanfly Save Engine problem

Status
Not open for further replies.

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
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.
 
Last edited by a moderator:

YoraeRasante

Veteran
Veteran
Joined
Jun 6, 2014
Messages
1,643
Reaction score
420
First Language
Portuguese
Primarily Uses
RMMV
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.
 
Last edited by a moderator:

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
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?
 

YoraeRasante

Veteran
Veteran
Joined
Jun 6, 2014
Messages
1,643
Reaction score
420
First Language
Portuguese
Primarily Uses
RMMV
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...
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 

YoraeRasante

Veteran
Veteran
Joined
Jun 6, 2014
Messages
1,643
Reaction score
420
First Language
Portuguese
Primarily Uses
RMMV
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...
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 

YoraeRasante

Veteran
Veteran
Joined
Jun 6, 2014
Messages
1,643
Reaction score
420
First Language
Portuguese
Primarily Uses
RMMV
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:

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.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
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.
 
Last edited by a moderator:

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
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.



Thanks
 

YoraeRasante

Veteran
Veteran
Joined
Jun 6, 2014
Messages
1,643
Reaction score
420
First Language
Portuguese
Primarily Uses
RMMV
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...
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
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.
 
Last edited by a moderator:

YoraeRasante

Veteran
Veteran
Joined
Jun 6, 2014
Messages
1,643
Reaction score
420
First Language
Portuguese
Primarily Uses
RMMV
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.
 
Last edited by a moderator:

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
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>
 

YoraeRasante

Veteran
Veteran
Joined
Jun 6, 2014
Messages
1,643
Reaction score
420
First Language
Portuguese
Primarily Uses
RMMV
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.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
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.
 

Celianna

Tileset artist
Veteran
Joined
Mar 1, 2012
Messages
10,557
Reaction score
5,592
First Language
Dutch
Primarily Uses
RMMV
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.
 
Status
Not open for further replies.

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

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,078
Members
137,580
Latest member
Snavi
Top