LOAD CONDITION FOR RM2K3
Create a condition which lets you know if the game has been loaded
- Kazesui
- 10/11/2010 03:47 PM
- 6361 views
Do you have a custom menu in rpg maker 2003 which includes a "save" option, and you want to stay in the menu after having saved, but go directly in game when you're loading?
Or maybe you want to allow the player to save at the end of the game to create a new game+ file and then go back to the title screen without starting the new game+ right away?
To do this, you have to check if the game has been loaded, and I have a trick I use to find out if it has.
Right after you manually open the save menu, have one branch check if the bgm has been played through once. The inside of this bit will be empty, but in the else handler you will have a variable set to "midi tick", found in "other" in the variable operation menu. This will be used to check if it's below a certain value, indicating the start of the bgm. The bgm always resets whenever you load the game, making it perfect for this purpose.
Generally the code for the condition itself could look something like this
"The game has been saved" comments indicate that the game has been saved normally if they're accessed, while the other comment indicates that the game has been loaded.
The midi ticks check how far into the midi you already are, given by some interesting formula I'm not all to familiar with, but I've found that 1000 generally works fine for a number of midis. It tells that the midi has recently started and usually leaves the player with too little time to trigger the load condition by saving very fast at the start of a midi. The branch checking if the bgm has been played through once is to prevent the load condition from happening in once the bgm has started over (resets midi tick to 0).
The rate of the midi ticks varies with the tempo of the midi, so you might have the adjust the values for whatever you're using as a bgm at the moment. If you're using mp3 for bgm, the midi tick will be counting how far you're in the song in seconds, meaning you'll have to check it against a considerably lower value.
If you switch a lot between mp3 and midi, or have midi's with lot of varying tempo, you might want to store the upper limit of the midi tick in a variable, and test out what values you should use.
And now you should be able to figure out if you've just saved the game, or if you have loaded it from the title screen.
Or maybe you want to allow the player to save at the end of the game to create a new game+ file and then go back to the title screen without starting the new game+ right away?
To do this, you have to check if the game has been loaded, and I have a trick I use to find out if it has.
Right after you manually open the save menu, have one branch check if the bgm has been played through once. The inside of this bit will be empty, but in the else handler you will have a variable set to "midi tick", found in "other" in the variable operation menu. This will be used to check if it's below a certain value, indicating the start of the bgm. The bgm always resets whenever you load the game, making it perfect for this purpose.
Generally the code for the condition itself could look something like this
"The game has been saved" comments indicate that the game has been saved normally if they're accessed, while the other comment indicates that the game has been loaded.
The midi ticks check how far into the midi you already are, given by some interesting formula I'm not all to familiar with, but I've found that 1000 generally works fine for a number of midis. It tells that the midi has recently started and usually leaves the player with too little time to trigger the load condition by saving very fast at the start of a midi. The branch checking if the bgm has been played through once is to prevent the load condition from happening in once the bgm has started over (resets midi tick to 0).
The rate of the midi ticks varies with the tempo of the midi, so you might have the adjust the values for whatever you're using as a bgm at the moment. If you're using mp3 for bgm, the midi tick will be counting how far you're in the song in seconds, meaning you'll have to check it against a considerably lower value.
If you switch a lot between mp3 and midi, or have midi's with lot of varying tempo, you might want to store the upper limit of the midi tick in a variable, and test out what values you should use.
And now you should be able to figure out if you've just saved the game, or if you have loaded it from the title screen.
Posts
Pages:
1
Yeah, this is actually pretty brilliant. Trying to think of some cool ideas to use with this. The best thing I can think of is maybe a "re-cap" of what has most recently got done, and where to go next.
post=210291
In VXP you can just have loading the game turn on a switch, but that's too easy. ::D
Indeed.
Pages:
1