I know these exist but all I found is some custom script that allow to do that but I know its possible by default with an event script call. I think it should be something like: datamanager.load_savegame (1) and datamanager.save_savegame(1).
Script call for load and saving a game?
RPG Maker VXAce SupportDataManager, not datamanager. Code of any kind is picky about capitalization.
But I don't think DataManager is what you want to use. This is what I see when looking at load_savegame:
-load_game executes load_game_without_rescue, but if it fails (no save data), it returns false
-load_game_without_rescue only loads data from make_savefile(index) ("Save" + index + ".rvdata2") and then returns true.
So load_game and save_game only loads and writes the savefile. Instead, let's look at Scene_Load and Scene_Save:
-Both have similar on_savefile_ok where it checks
if DataManager.load/save_game(@index) and either runs on_load/save_success or it returns a sound; the true/false already comes from load_game and load_game_without_rescue.
-on_save_success returns to the previous scene, usually the map. So pretty much it does nothing else after saving.
-on_load_success has a $game_system.on_after_load and then
goes to the map.
But I don't think DataManager is what you want to use. This is what I see when looking at load_savegame:
-load_game executes load_game_without_rescue, but if it fails (no save data), it returns false
-load_game_without_rescue only loads data from make_savefile(index) ("Save" + index + ".rvdata2") and then returns true.
So load_game and save_game only loads and writes the savefile. Instead, let's look at Scene_Load and Scene_Save:
-Both have similar on_savefile_ok where it checks
if DataManager.load/save_game(@index) and either runs on_load/save_success or it returns a sound; the true/false already comes from load_game and load_game_without_rescue.
-on_save_success returns to the previous scene, usually the map. So pretty much it does nothing else after saving.
-on_load_success has a $game_system.on_after_load and then
goes to the map.
You may need multiple script calls.
SceneManager.goto(Scene_Load) would go to the Load screen, but I guess you don't want that. If you are looking for something like an automated save/load thing aka direct loading, then these are the calls:
Code:
if DataManager.load_game(0)
$game_system.on_after_load
SceneManager.goto(Scene_Map)
end
DataManager.save_game(0)
It dont work for loading (nothing happend and there is a save) I have a title script and the first automatic event is:
Conditional branch script File.file?('Save01.rvdata2')
Script
if DataManager.load_game(1)
$game_system.on_after_load
SceneManager.goto(Scene_Map)
end
What i do wrong?
Part my fault and part your fault. My fault is that make_savefile already adds 1 to the filename, so load_game(1) and save_game(1) is actually looking for Save2.rvdata2. So what I want is 0 instead of 1.
Anyway, What is that conditional branch all about? Well, I hid my rant in a spoiler, but DataManager.load_game already checks for a savefile, so there's no need for your File.file conditional branch. In case I am wrong again, Check and see if it's actually Save01 or Save1.
I'll have to test the call for myself when I get home.
---
Edit: I tried the two script calls (with 0 index) and they work. Saved automatically and loaded automatically. No need for that File.file condition at all.
I don't know how to access a method from a Scene via script call for the fadeout_all, so instead, I'll use Graphics.fadeout(Graphics.frame_rate) to transition to black and
to stop the noise.
Anyway, What is that conditional branch all about? Well, I hid my rant in a spoiler, but DataManager.load_game already checks for a savefile, so there's no need for your File.file conditional branch. In case I am wrong again, Check and see if it's actually Save01 or Save1.
I'll have to test the call for myself when I get home.
---
Edit: I tried the two script calls (with 0 index) and they work. Saved automatically and loaded automatically. No need for that File.file condition at all.
I don't know how to access a method from a Scene via script call for the fadeout_all, so instead, I'll use Graphics.fadeout(Graphics.frame_rate) to transition to black and
Code:
RPG::BGM.fade(60)
RPG::BGS.fade(60)
RPG::ME.fade(60)
RPG::BGM.stop
RPG::BGS.stop
RPG::ME.stop
to stop the noise.
Um, if they want to do it through events, can't you just use the fadeout screen command? (I'm sorry if I'm being an idiot.)
Thanks it worked!
(Also if you curious the conditional branch was because auto load is toggelable).
Original thread: https://forums.rpgmakerweb.com/threads/script-call-for-load-and-saving-a-game.75965/