Frictional Games Forum (read-only)

Full Version: How to stop music when going next level on door?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How to stop long track on background when reaching door and that is taking you next level. Then other track song coming to play?

My problem this same track plays and not stopping when you move player to the next level on previously level?

How i can solve this?

Cheers. Smile
StopMusic(float afFadeTime, int alPrio);

To stop the music. Put that in the .hps of the map that has the music you want to stop when you leave.

Then just add a PlayMusic on the next map. Or set the new map's music to a higher priority.
(07-10-2011, 10:11 AM)TFEF Wrote: [ -> ]StopMusic(float afFadeTime, int alPrio);

To stop the music. Put that in the .hps of the map that has the music you want to stop when you leave.

Then just add a PlayMusic on the next map. Or set the new map's music to a higher priority.

Not working this is my script:

Forbidden cellar hps. map file:

void MusicControl2(string &in asParent, string &in asChild, int alState)
{
PlayMusic("You Only Live Once.ogg", false, 3, 3, 10, true);
StopMusic(2, 0);
}

Undead house map hps. map file:

void MusicControl(string &in asParent, string &in asChild, int alState)
{
if(alState == 1) PlayMusic("Requim For A Dream.ogg", true, 1.0f, 0, 0, true);
if(alState == -1) StopMusic(2, 0);
}

Still playing when i exit the next map Sad

void OnLeave()
{
StopMusic(0f, 1);
}

If doesn't work:

void OnLeave()
{
StopMusic(0.5f, 1);
}
Smile
(07-10-2011, 10:27 AM)Unearthlybrutal Wrote: [ -> ]void OnLeave()
{
StopMusic(0f, 1);
}

If doesn't work:

void OnLeave()
{
StopMusic(0.5f, 1);
}
Smile

Nope. Not working darn.

(07-10-2011, 10:18 AM)HumiliatioN Wrote: [ -> ]Not working this is my script:

Forbidden cellar hps. map file:

void MusicControl2(string &in asParent, string &in asChild, int alState)
{
PlayMusic("You Only Live Once.ogg", false, 3, 3, 10, true);
StopMusic(2, 0);
}

Undead house map hps. map file:

void MusicControl(string &in asParent, string &in asChild, int alState)
{
if(alState == 1) PlayMusic("Requim For A Dream.ogg", true, 1.0f, 0, 0, true);
if(alState == -1) StopMusic(2, 0);
}

Still playing when i exit the next map Sad
if you want to do it that way, then it should be...

void MusicControl2(string &in asParent, string &in asChild, int alState)
{
StopMusic(4, 1);
PlayMusic("You Only Live Once.ogg", false, 3, 3, 10, true);
}

void MusicControl(string &in asParent, string &in asChild, int alState)
{
if(alState == 1) PlayMusic("Requim For A Dream.ogg", true, 1.0f, 0, 0, true);
else StopMusic(4, 1);
}




(07-10-2011, 01:27 PM)Juby Wrote: [ -> ]
(07-10-2011, 10:18 AM)HumiliatioN Wrote: [ -> ]Not working this is my script:

Forbidden cellar hps. map file:

void MusicControl2(string &in asParent, string &in asChild, int alState)
{
PlayMusic("You Only Live Once.ogg", false, 3, 3, 10, true);
StopMusic(2, 0);
}

Undead house map hps. map file:

void MusicControl(string &in asParent, string &in asChild, int alState)
{
if(alState == 1) PlayMusic("Requim For A Dream.ogg", true, 1.0f, 0, 0, true);
if(alState == -1) StopMusic(2, 0);
}

Still playing when i exit the next map Sad
if you want to do it that way, then it should be...

void MusicControl2(string &in asParent, string &in asChild, int alState)
{
StopMusic(4, 1);
PlayMusic("You Only Live Once.ogg", false, 3, 3, 10, true);
}

void MusicControl(string &in asParent, string &in asChild, int alState)
{
if(alState == 1) PlayMusic("Requim For A Dream.ogg", true, 1.0f, 0, 0, true);
else StopMusic(4, 1);
}

Not working :/ I cant understand why that music never stops?

The priority of the stopmusic will only stop music played at that "level" of priority. Make sure you set the same priority on the previous playmusic as the stopmusic.
(07-10-2011, 08:26 PM)Acies Wrote: [ -> ]The priority of the stopmusic will only stop music played at that "level" of priority. Make sure you set the same priority on the previous playmusic as the stopmusic.

void MusicControl(string &in asParent, string &in asChild, int alState)
{
if(alState == 1) PlayMusic("01_amb_darkness.ogg", true, 1.0f, 0, 0, true);
if(alState == -1) StopMusic(2, 0);
}

void MusicControl2(string &in asParent, string &in asChild, int alState)
{
PlayMusic("You Only Live Once.ogg", false, 1.0f, 0, 0, true);
StopMusic(2, 0);
}

Like this?

EDIT: Nevermind I just make 20s track then It disappears Smile

Thanks anyways to everyone. Now I can finish this release to the end.