Music continuing from the middle on restore?

Started by mmm_bot, Wed 19/06/2013 18:12:36

Previous topic - Next topic

mmm_bot

Hey, I guess this might be a stupid question, but it's really bugging me - Everytime I save my game and then load it, the music continues from where it was the moment I saved the game. Is this a bug or some strange feature? Is there a way to make the music track start from the beginning when a player loads a game?

Thanks in advance!

Ghost

That is exactly as intended. A game is saved "as it is at the moment of saving", so the music position is kept, too.

You can write your own function to restart the music though; one way would be to use a global audiochannel for the music and then manually reset it AFTER calling the restore command.

Crimson Wizard

#2
There's a way to respond to "game restored" event in game.

In GlobalScript.asc add "on_event" function:
Code: ags

function on_event(EventType event, int data)
{
    if (event == eEventRestoreGame)
    {
        // reset your music here
    }
}



E: I must correct myself:
You don't have to put "on_event" function only in GlobalScript, you may as well put it in every room you have and do a specific action for each of them (if you need to).

mmm_bot

Thanks a lot! Seemed weird to me that this is a feature - It's really weird to hear the middle of a track when you restore a game.
But at least there's an easy fix, so thanks :)

SMF spam blocked by CleanTalk