I'm currently working on a scene where the player enters a room that spawns a monster. At the moment he enters, suspenseful music starts playing. When he is killed by the monster, the music changes to a sad piece, and is meant to play throughout the death hint, and keep playing as he changes maps and respawns in a previous map. However, for some reason, the sad music abruptly reverts to a previous ambient as soon as the map starts changing.
Before the scene, the music playing is this one:
PlayMusic("ACD_03_amb", true, 0.5f, 5, 0, true);
When the player enters the room where the monster is activated, I set a check point, and play some event music:
void EnterMaster(string &in asParent, string &in asChild, int alState)
{
CheckPoint ("third", "PlayerStartArea_1", "reset3", "", "");
PlayMusic("music_reactor_pre_kyrie.ogg", false, 0.7f, 0, 10, false);
}
void reset3(string &in asName, int alCount)
{
ChangeMap("chateau1.map", "PlayerStartArea_1", "", "");
}
I have a timer checking the player's HP, and when it drops below 1, I use the following script:
void BellMusic(string &in asTimer)
{
PlayMusic("music_reactor_children_temp.ogg", false, 0.7f, 1, 0, false);
}
Now, when the player dies and the death hint plays, the "music_reactor_children_temp.ogg" music is still playing. But when the death hint fades away and the map starts changing, the music abruptly changes back to "ACD_03_amb." There is nothing under OnLeave for this map or OnStart/OnEnter for the map it's changing to, so I don't know what's causing the music to suddenly end. Can anyone help me with this?