So on my world map I have a night-day cycle, in time with an overworld theme I composed. A variable stores whether it's day or night, then a script handles which of two tracks (one starting with the day section and the other starting with night) to play as the BGM. A parallel process common event only runs on my world map (transfer events to it turn on a switch and it only runs if that switch is on) that has a wait command for the duration of the day section, then a tint screen command to make it look more like night, then another wait for the duration of the night section, then a tint screen to make it look day, etc. (it can also start with night). The problem is, if a player saves on the world map, however long the event has waited is stored, and the event begins from that number when you load that file. The song starts from the beginning however. Is it possible to reset those wait commands when the player loads a save file with a script?
Reset parallel process common event when loading file
RGSS3 Script RequestsI'm not 100% sure I'm reading your problem correctly, but it sounds like everything is working correctly for you when you Load except for the music starting over?
If that's the case, you'll be interested in the following script command:
Audio.bgm_play("path/name", volume, pitch, start point)
For example, in one of my menus I want to start "Playing for Pinks" about 30 seconds into the track, so I use the script line:
Audio.bgm_play("Audio/BGM/Fyresale - Playing for Pinks", 100, 100, 1100000)
The start point is measured in... actually I don't know what it's measured in, but the higher the number you enter the later it starts, and you usually need to work with very high numbers. If you look at the advanced Properties of your track, it may tell you the length of the song as a seven to nine digit number; this is what you can use to easily figure out what kind of numbers to use for start point.
Since you've already saved the time of day (let's say as a number 0 through 23), let's simplify the example and pretend you only have one track (that you want to play at 90% volume) and that the track is 4,000,000 units long. If the player loads and the game finds that the hour is 05:00, you would want to start it at (4,000,000 * 5 / 24) = ~833,000 units into the loop. So you'd script Audio.bgm_play("Audio/BGM/worldmap", 90, 100, 833,000) or something like that. To create a script line that would play the correct music at any hour, assuming that your time of day variable is Variable #16, you'd make the line: Audio.bgm_play("Audio/BGM/worldmap", 90, 100, 4000000 * $game_variables[16] / 24) and that should do it!
If that's the case, you'll be interested in the following script command:
Audio.bgm_play("path/name", volume, pitch, start point)
For example, in one of my menus I want to start "Playing for Pinks" about 30 seconds into the track, so I use the script line:
Audio.bgm_play("Audio/BGM/Fyresale - Playing for Pinks", 100, 100, 1100000)
The start point is measured in... actually I don't know what it's measured in, but the higher the number you enter the later it starts, and you usually need to work with very high numbers. If you look at the advanced Properties of your track, it may tell you the length of the song as a seven to nine digit number; this is what you can use to easily figure out what kind of numbers to use for start point.
Since you've already saved the time of day (let's say as a number 0 through 23), let's simplify the example and pretend you only have one track (that you want to play at 90% volume) and that the track is 4,000,000 units long. If the player loads and the game finds that the hour is 05:00, you would want to start it at (4,000,000 * 5 / 24) = ~833,000 units into the loop. So you'd script Audio.bgm_play("Audio/BGM/worldmap", 90, 100, 833,000) or something like that. To create a script line that would play the correct music at any hour, assuming that your time of day variable is Variable #16, you'd make the line: Audio.bgm_play("Audio/BGM/worldmap", 90, 100, 4000000 * $game_variables[16] / 24) and that should do it!
Original thread: https://forums.rpgmakerweb.com/threads/reset-parallel-process-common-event-when-loading-file.67680/


