Wintermute Engine Forum
Wintermute Engine => Technical forum => Topic started by: Mikael on September 02, 2007, 01:28:23 PM
-
When a game is saved while a music channel is playing, upon loading the game, the music file starts up at the exact same place as it was when the game was saved. It might be a nice touch to let the music file start from the beginning instead, and give the load a "smoother" feel. Is this possible somehow?
And while we're on the topic: Is there any way to pause the music during the save/load screens ONLY?
Thanks in advance for any suggestions!
Mikael
-
Is this possible somehow?
Unfortunately not, the game continues where is stopped when the player saved the game.
And while we're on the topic: Is there any way to pause the music during the save/load screens ONLY?
You'd have to pause music before calling Game.SaveGame() / Game.LoadGame() and resume after the SaveGame() call.
-
I think you can hijack the Game.AfterLoad event to start over the music.
Or is there a trap Mnemonic?
To be more specific I thought about something like this in the game.script:
on "AfterLoad"
{
if (Game.IsMusicPlaying()) Game.SetMusicPosition(0);
}
-
The trap is you need to know what music file to start over.
-
oops, you're always too fast. ::beer
-
The trap is you need to know what music file to start over.
Exactly. But I'll keep it in mind if I'll make a game with only one music file in it. ;)
Thanks the both of you!
Mikael
-
Actually meta's solution should work universally. Obviously he's more creative with WME scripting than I am :)
-
Yippee! It really DOES work
My initial conclusion was, like Mnemonic's, that you needed to know which particular music file to start over. I tested it nonetheless, making the classic mistake of trying it out from old savegames. But, off course, Meta's simple yet perfect solution does the trick (which is kind of obvious at second glance).
It's so much nicer to load a game without being thrown into the middle of a music piece (or the last two notes, for that matter).
Thanks again, the both of you!
Mikael