Frictional Games Forum (read-only)
Music problem! - 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: Music problem! (/thread-24315.html)



Music problem! - Radical Batz - 01-07-2014

When I'm in a level it plays it's music but when I go in a different level which I want it not have music in it! it still plays the music that as played in the other level how can I stop this? i tried doing stopmusic but it just stops the music even in the other level!

my hps file

void OnStart()
{
PlayMusic("02_amb_safe.ogg", true, 1, 4, 1, true);
StopMusic(4, 1);
AddUseItemCallback("", "StorageKey", "StorageDoor", "UseStorageKeyOnDoor", true);
}

void UseStorageKeyOnDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("StorageDoor", false);
PlaySoundAtEntity("", "unlock_door.ogg", asEntity, 0, false);
RemoveItem(asItem);
}


RE: Music problem! - Lizard - 01-07-2014

(01-07-2014, 05:42 PM)Badcat5550 Wrote: When I'm in a level it plays it's music but when I go in a different level which I want it not have music in it! it still plays the music that as played in the other level how can I stop this? i tried doing stopmusic but it just stops the music even in the other level!

my hps file

void OnStart()
{
PlayMusic("02_amb_safe.ogg", true, 1, 4, 1, true);
StopMusic(4, 1);
AddUseItemCallback("", "StorageKey", "StorageDoor", "UseStorageKeyOnDoor", true);
}

void UseStorageKeyOnDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("StorageDoor", false);
PlaySoundAtEntity("", "unlock_door.ogg", asEntity, 0, false);
RemoveItem(asItem);
}

try to put StopMusic() in OnLeave, so that it stops the music, when you leave the map


RE: Music problem! - Radical Batz - 01-07-2014

(01-07-2014, 07:46 PM)Lizard Wrote:
(01-07-2014, 05:42 PM)Badcat5550 Wrote: When I'm in a level it plays it's music but when I go in a different level which I want it not have music in it! it still plays the music that as played in the other level how can I stop this? i tried doing stopmusic but it just stops the music even in the other level!

my hps file

void OnStart()
{
PlayMusic("02_amb_safe.ogg", true, 1, 4, 1, true);
StopMusic(4, 1);
AddUseItemCallback("", "StorageKey", "StorageDoor", "UseStorageKeyOnDoor", true);
}

void UseStorageKeyOnDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("StorageDoor", false);
PlaySoundAtEntity("", "unlock_door.ogg", asEntity, 0, false);
RemoveItem(asItem);
}

try to put StopMusic() in OnLeave, so that it stops the music, when you leave the map

I did like this

void OnStart()
{
PlayMusic("02_amb_safe.ogg", true, 1, 4, 1, true);
AddUseItemCallback("", "StorageKey", "StorageDoor", "UseStorageKeyOnDoor", true);
}

void UseStorageKeyOnDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("StorageDoor", false);
PlaySoundAtEntity("", "unlock_door.ogg", asEntity, 0, false);
RemoveItem(asItem);
}

void OnLeave()
{
StopMusic(4, 0);
}

but it still plays the music in an other level SadHuhUndecided


RE: Music problem! - Lizard - 01-07-2014

in StopMusic try make the 0 a 1 so that it has the same priority, if that dosen't work try to set the last true in PlayMusic to false


RE: Music problem! - Radical Batz - 01-07-2014

(01-07-2014, 07:57 PM)Lizard Wrote: in StopMusic try make the 0 a 1 so that it has the same priority, if that dosen't work try to set the last true in PlayMusic to false

yes it worked, you are amazing thank you so much Big Grin but after I exit the level then the music won't come back


RE: Music problem! - Neelke - 01-07-2014

Put it on void OnEnter instead then.


RE: Music problem! - Radical Batz - 01-07-2014

(01-07-2014, 09:23 PM)Neelke Wrote: Put it on void OnEnter instead then.

but then it will play in other levels too


RE: Music problem! - i3670 - 01-07-2014

(01-07-2014, 09:33 PM)Badcat5550 Wrote:
(01-07-2014, 09:23 PM)Neelke Wrote: Put it on void OnEnter instead then.

but then it will play in other levels too

Edit: Ha! Didn't read thread before posting. Ignore.


RE: Music problem! - Lizard - 01-08-2014

(01-07-2014, 09:33 PM)Badcat5550 Wrote:
(01-07-2014, 09:23 PM)Neelke Wrote: Put it on void OnEnter instead then.

but then it will play in other levels too

If you use PlayMusic in OnEnter() and Stop Music in OnLeave()

The music will start playing everytime you enter that certain map/level and stop everytime you leave that certain map/level