Frictional Games Forum (read-only)
How to stop music when going next level on door? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: How to stop music when going next level on door? (/thread-9058.html)



How to stop music when going next level on door? - HumiliatioN - 07-10-2011

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


RE: How to stop music when going next level on door? - TFEF - 07-10-2011

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.


RE: How to stop music when going next level on door? - HumiliatioN - 07-10-2011

(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




RE: How to stop music when going next level on door? - Unearthlybrutal - 07-10-2011

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

If doesn't work:

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


RE: How to stop music when going next level on door? - HumiliatioN - 07-10-2011

(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.




RE: How to stop music when going next level on door? - Juby - 07-10-2011

(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);
}







RE: How to stop music when going next level on door? - HumiliatioN - 07-10-2011

(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?




RE: How to stop music when going next level on door? - Acies - 07-10-2011

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.


RE: How to stop music when going next level on door? - HumiliatioN - 07-10-2011

(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.