[SCRIPTING] [RMVX ACE] LOAD GAME, CONDITIONAL BRANCH SCRIPT CALLS
Posts
Pages:
1
I'm attempting to use events and pictures for all of my in-game menus. I've succeeded in creating a basic inventory system this way, but I've hit a stumbling block when it comes to loading a save file.
1 - I'm using a script that bypasses the Main Title screen and goes straight to an in-game map so I can create a completely custom title screen using events.
2 - What I need is a script call that can be used in a conditional branch which checks whether a specified save slot is empty or not. Something along the lines of:
====================================
CONDITIONAL BRANCH
script call: If there is a save file in slot #1
THEN
Show picture 'Save File in Slot 1'
ELSE
Show picture 'Slot 1 EMPTY'
====================================
I'd also use this conditional branch to initiate the load itself, so I also need a script call for loading a specific slot:
====================================
CONDITIONAL BRANCH
script call: If there is a save file in slot #1
AND
slot #1 is selected by the player
THEN
script call:Load Save File in slot #1
====================================
I've got 'save' figured out for in-game use (script call: DataManager.save_game(x))
But in order for my custom 'load game' menu and all its pictures to display properly, I need to figure both of these script calls out.
tl:dr
How do I create a script call in a conditional branch that checks if there is a file in a specified save slot?
What script call can I use in an event to load a specified save file?
Thanks for your help in advance, folks.
1 - I'm using a script that bypasses the Main Title screen and goes straight to an in-game map so I can create a completely custom title screen using events.
2 - What I need is a script call that can be used in a conditional branch which checks whether a specified save slot is empty or not. Something along the lines of:
====================================
CONDITIONAL BRANCH
script call: If there is a save file in slot #1
THEN
Show picture 'Save File in Slot 1'
ELSE
Show picture 'Slot 1 EMPTY'
====================================
I'd also use this conditional branch to initiate the load itself, so I also need a script call for loading a specific slot:
====================================
CONDITIONAL BRANCH
script call: If there is a save file in slot #1
AND
slot #1 is selected by the player
THEN
script call:Load Save File in slot #1
====================================
I've got 'save' figured out for in-game use (script call: DataManager.save_game(x))
But in order for my custom 'load game' menu and all its pictures to display properly, I need to figure both of these script calls out.
tl:dr
How do I create a script call in a conditional branch that checks if there is a file in a specified save slot?
What script call can I use in an event to load a specified save file?
Thanks for your help in advance, folks.
I'm not 100% sure what you're after, but at the start of the game create a control switch. Then just have a common event / parallel process check if it exists. This control switch will not exist if a player has not began to play the game and will disappear if you don't save. Other than that you could try to force the player to save at the start of the game.
If you're going to forgo the main title screen, you could probably still use "Scene_Manager.call(Scene_Save)" or "Scene_Manager.call(Scene_Load)" for the save/load operations. Scene_Load's default processing already disallows the loading of save files that do not exist, though, it still displays 16 slots. Checking against whither or not a save file exists might look like...
...this? Though, I'm not entirely sure! I think you're right about loading a specific save file.
def save_check i = 1 while i < 16 if i < 10 text = "Save0" + i + ".rvdata2" else text = "Save" + i + ".rvdata2" end return FileTest.exist?(text) end end
...this? Though, I'm not entirely sure! I think you're right about loading a specific save file.
author=kory_toombs
I'm not 100% sure what you're after, but at the start of the game create a control switch. Then just have a common event / parallel process check if it exists. This control switch will not exist if a player has not began to play the game and will disappear if you don't save. Other than that you could try to force the player to save at the start of the game.
The problem is with loading, not saving. Since I'm skipping the default 'Main Menu' screen that appears when you open up a game (New Game, Load, Exit), it's essentially as though the game automatically starts a new game each time.
To make a 'Load Game' function work, therefore, I have to be able to use an event/script call to check for save files and then I have to be able to load a save file using an event.
Apologies, I know it's quite a complicated problem
author=Marrend
If you're going to forgo the main title screen, you could probably still use "Scene_Manager.call(Scene_Save)" or "Scene_Manager.call(Scene_Load)" for the save/load operations. Scene_Load's default processing already disallows the loading of save files that do not exist, though, it still displays 16 slots. Checking against whither or not a save file exists might look like...def save_check i = 1 while i < 16 if i < 10 text = "Save0" + i + ".rvdata2" else text = "Save" + i + ".rvdata2" end return FileTest.exist?(text) end end
...this? Though, I'm not entirely sure! I think you're right about loading a specific save file.
The problem is that I want to completely cut the Save Game window and the Load Game window and handle it all purely with events and script calls so I can create a custom interface with Pictures.
Hrm. By some chance, does this game involve autosaves, and are autosaves the only type of saving that exists? I get the sense things would be cleaner on your end with such a system.
*Edit: And by "cleaner", I mean that such systems typically only ever use one save slot, so, displaying multiple files isn't an issue.
Though, if I'm completely wrong, I think looking at the Scene_File.create_savefile_windows function might be at least helpful. Both Scene_Save and Scene_Load are children of the Scene_File class, so, they probably both use that function to display the file-listing. I would imagine that if there is additional code involved with loading games, it would be part of the Scene_Load class.
*Edit: And by "cleaner", I mean that such systems typically only ever use one save slot, so, displaying multiple files isn't an issue.
Though, if I'm completely wrong, I think looking at the Scene_File.create_savefile_windows function might be at least helpful. Both Scene_Save and Scene_Load are children of the Scene_File class, so, they probably both use that function to display the file-listing. I would imagine that if there is additional code involved with loading games, it would be part of the Scene_Load class.
author=Marrend
Hrm. By some chance, does this game involve autosaves, and are autosaves the only type of saving that exists? I get the sense things would be cleaner on your end with such a system.
*Edit: And by "cleaner", I mean that such systems typically only ever use one save slot, so, displaying multiple files isn't an issue.
Though, if I'm completely wrong, I think looking at the Scene_File.create_savefile_windows function might be at least helpful. Maybe, putting whatever modifications that would be involved into the Scene_Load class?
Yeah, I considered autosave because it'd be generally easier, but in a game that's intended to have multiple endings and various other 'things that might be missed', I don't think having only one save file that's constantly overwritten will work best for the player.
Also, I know almost as little as it's possible to know about scripting for myself, so I'm already lost in the wilderness if editing any scripts in the editor is required :S
I think I finally understand what you want to do! Though there is an issue if the player wants to restart the game they will need to manually delete the save file.
Google searched, try this perhaps...
http://www.rpgmakercentral.com/topic/27428-auto-load-skip-title-single-save-system-v1/
author=kory_toombs
I think I finally understand what you want to do! Though there is an issue if the player wants to restart the game they will need to manually delete the save file.
Google searched, try this perhaps...
http://www.rpgmakercentral.com/topic/27428-auto-load-skip-title-single-save-system-v1/
I think I've overcomplicated the issue.
There are two components to the question.
1. Can I use a script call in a conditional branch to check if Save01.rvdata2 exists?
2. Can I use a script call in a normal event to 'load' Save01.rvdata2?
I think so, try this topic perhaps...
http://www.rpgmakercentral.com/topic/27411-checking-if-file-exists-fixed/
author=kory_toombs
I think so, try this topic perhaps...
http://www.rpgmakercentral.com/topic/27411-checking-if-file-exists-fixed/
That looks like it might be the right sort of thing for the first issue, any thoughts on the second?
i.e. Using a script call to load a specified save file (eg.Save01.rvdata2)
Try this script call?
load_game(1)
from this topic:
http://forums.rpgmakerweb.com/index.php?/topic/38132-load-game-script-call/
author=kory_toombs
Try this script call?
load_game(1)
from this topic:
http://forums.rpgmakerweb.com/index.php?/topic/38132-load-game-script-call/
Hmmm. Because you can save with one line of a script call, I assumed loading would be just as easy. But nothing seems to work, and/or I know too little about scripting to make it all work the way I want it to.
I mean, that 'Checking if file exists' post looked like the sort of thing, but I think it's just a guy getting advice on a small part of a much larger script and I dunno what to do with the snippets provided there.
Maybe I'll just bite the bullet and stick to the default load/save functions
Wait, loading a specified slot was an issue? I thought you were using "DataManager.load_game(index)"?
*Edit: Looking into Scene_Title to see how that class handles the "Continue" option. What I came across was a call to Scene_Load. The more relevant functions...
...do seem to indicate that DataManager.load_game(index) isn't quite enough. Welp.
*Edit: Looking into Scene_Title to see how that class handles the "Continue" option. What I came across was a call to Scene_Load. The more relevant functions...
class Scene_Load < Scene_File #-------------------------------------------------------------------------- # * Confirm Save File #-------------------------------------------------------------------------- def on_savefile_ok super if DataManager.load_game(@index) on_load_success else Sound.play_buzzer end end #-------------------------------------------------------------------------- # * Processing When Load Is Successful #-------------------------------------------------------------------------- def on_load_success Sound.play_load fadeout_all $game_system.on_after_load SceneManager.goto(Scene_Map) end end
...do seem to indicate that DataManager.load_game(index) isn't quite enough. Welp.
author=Marrend
Wait, loading a specified slot was an issue? I thought you were using "DataManager.load_game(index)"?
*Edit: Looking into Scene_Title to see how that class handles the "Continue" option. What I came across was a call to Scene_Load. The more relevant functions...
class Scene_Load < Scene_File #-------------------------------------------------------------------------- # * Confirm Save File #-------------------------------------------------------------------------- def on_savefile_ok super if DataManager.load_game(@index) on_load_success else Sound.play_buzzer end end #-------------------------------------------------------------------------- # * Processing When Load Is Successful #-------------------------------------------------------------------------- def on_load_success Sound.play_load fadeout_all $game_system.on_after_load SceneManager.goto(Scene_Map) end end
...do seem to indicate that DataManager.load_game(index) isn't quite enough. Welp.
Yeah, I tried it and got a syntax error, one of those 'expecting ;' type of deals. I did manage to get it to load one time, but it just kept on loading, fade in, fade out, fade in, fade out, loading on an endless loop. I tried throwing a random 'end' into the script call and an 'erase event' into the event itself, but to no avail
Pages:
1















