Reset parallel process common event when loading file

MusicTF

Soundtrack Composer
Veteran
Joined
Mar 30, 2015
Messages
102
Reaction score
8
First Language
English
Primarily Uses
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?
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,635
Reaction score
5,116
First Language
English
Primarily Uses
RMVXA
I'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!
 

xdan

Veteran
Veteran
Joined
Aug 21, 2016
Messages
158
Reaction score
59
First Language
Spanish
Primarily Uses
Maybe have an empty page in the event that is activated by a switch, then have another event that turns on the switch, turns it off and erases itself? Something like (sorry that it's in Spanish):

rtret.png


rtgerytr.png


gregergrety.png
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,047
Messages
1,018,539
Members
137,834
Latest member
EverNoir
Top