Boy I had hard time naming this. I have not posted in the forms for awhile sorry this might not be exactlly in the right spot(also doing from my first time and it is being a pain). I have a point in my demo where one section is primarlly auto save. When the player leaves and saves again the auto save is removed. Now to my question when I open the save menue it goes to this save(which is outside my file selection for it being just outside max save files) so I have found nurmous code in the defualt and yanfly save script that looked like they would fix this but I have come up empty. I know I need to put disabling code I just don't know where.
(Solved)Save window not being on last save
RGSSx Script SupportHow did you do the autosave and the removal of the autosave file? I suspect you'll need to save the "last savefile number" before creating the autosave the first time, and then reset it after the autosave is removed, but how you do that will depend on how you've done the creation and removal of autosaved.
So I auto save with a script that saves on player transfer and I have it delete the save when the player saves their game as usual which is in my yanfly script in def on_action_save.
I guessed that you probably had a script, but unless you tell us what it is (or post it here, if it's one you wrote yourself), we won't be able to help you much.
Moderator note: Moving to RGSSx Script Support
Moderator note: Moving to RGSSx Script Support
Sorry I ment to in case but it was late and was away from my computer here the link to it https://www.rpgmakercentral.com/topic/18917-basic-autosave/
This works.
storing the last file index then returning it to the DataManager.last_savefile_index
Ruby:
module DataManager
def self.last_save(index)
@last_savefile_index = index
end
end
class Scene_Map
alias auto_post_transfer post_transfer
def post_transfer
auto_post_transfer
return unless AUTOSAVE_ON_MAP
last_file = DataManager.last_savefile_index
if Module.const_defined?(:Game_Options)
DataManager.save_game(0) if $game_options.auto_save
else
DataManager.save_game(0) if $auto_save
end
DataManager.last_save(last_file)
end
end
module BattleManager
def self.battle_end(result)
@phase = nil
@event_proc.call(result) if @event_proc
$game_party.on_battle_end
$game_troop.on_battle_end
SceneManager.exit if $BTEST
return unless AUTOSAVE_AFTER_BATTLE
last_file = DataManager.last_savefile_index
if Module.const_defined?(:Game_Options)
DataManager.save_game(0) if $game_options.auto_save
else
DataManager.save_game(0) if $auto_save
end
DataManager.last_save(last_file)
end
end
Or just take the few lines I used and put them in Vlue's autosave script.
Oh was not expecting to be given re-written code. That happily surprised me. Even more so that it did not need me to touch my yanfly script. There is a small problem. So when I need to load the autosave then leave the area and save normally the problem comes back. My guess is the index is not getting saved in the auto save
What are you using to load the autosave?
The last_savefile_index is automatically set to the last loaded save file after loading it, and that would be your autosave file in this case.
You can add a check to see if it is the autosave file, and if it is, set the index to the 2nd latest savefile instead (if there are any other files, that is), or just skip the line that sets the last_savefile_index variable.
In the DataManager class:
Replace the 0 on the edited line there with the savefile index you use for the autosave feature.
Should work, but not tested.
You can add a check to see if it is the autosave file, and if it is, set the index to the 2nd latest savefile instead (if there are any other files, that is), or just skip the line that sets the last_savefile_index variable.
In the DataManager class:
Code:
def self.load_game_without_rescue(index)
File.open(make_filename(index), "rb") do |file|
Marshal.load(file)
extract_save_contents(Marshal.load(file))
reload_map_if_updated
@last_savefile_index = index unless index == 0 # Edited line!
end
return true
end
Should work, but not tested.
I am using the primary load method DataManger.load_game(autosave) and the post loading needed for it to work right. They are loaded from the gameover and when the game starts.
This did the trick
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/solved-save-window-not-being-on-last-save.134035/