Frictional Games Forum (read-only)
[SCRIPT] music - 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: [SCRIPT] music (/thread-25486.html)

Pages: 1 2


music - G510s - 06-16-2014

the music from the first level is still playing in the 2nd level...this is my script.


--------------
01_UnTold.hps
--------------

void OnStart()
{
PlayMusic("10_amb", true, 4.3, 7, 0, true);


AddUseItemCallback("", "Key_01", "Door_01", "DoorUnlock", true);


AddEntityCollideCallback("Player", "Script", "Music", true, 1);
}

void DoorUnlock(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "Unlock_Door.snt", asEntity, 0, false);
RemoveItem(asItem);
}

void Music(string &in asParent, string &in asChild, int alState)
{
PlayMusic("dan_Brute", true, 3.2, 8, 10, true);
}








void OnEnter()
{

}







void OnLeave()
{

}


--------------
02_UnTold.hps
--------------

void OnStart()
{
PlayMusic("01_amb_darkness", true, 4.3, 7, 1, true);
}


void DoorLockedPlayer(string &in entity)
{

GetSwingDoorLocked("DoorMessage");
SetMessage("Sign", "msgname", 0);

}





void OnEnter()
{

}




void OnLeave()
{

}


RE: music - Neelke - 06-16-2014

Which music? There are two of them. I'm assuming the brute music, but its the same problem there which I told you before. Too high priority. On void OnLeave in the first hps file, put this there:

StopMusic(8.0f, 10);


RE: music - Lizard - 06-16-2014

If you have used PlayMusic in a map, then you always has to use StopMusic with the same values at void OnLeave if you dont want them to continue in the other maps aswell


RE: music - Mudbill - 06-16-2014

Actually, as long as the priority is higher, one music track will overlap and mute the other. The lower one will continue if the highest is stopped though.


RE: music - Lizard - 06-16-2014

yeah but as soon the sound/music with the highest priority stops the lower continues, but he wanted it to stop on leaving the map, then you have to use the StopMusic to prevent to continue at any point


RE: music - G510s - 07-07-2014

(06-16-2014, 10:23 PM)Neelke Wrote: Which music? There are two of them. I'm assuming the brute music, but its the same problem there which I told you before. Too high priority. On void OnLeave in the first hps file, put this there:

StopMusic(8.0f, 10);

can you please show me more...by that i mean will you show the script and how i will need to put it into the code?


RE: music - PutraenusAlivius - 07-07-2014

PHP Code:
void OnLeave()
{
StopMusic(8.0f10);

This is what Neelke meant.


RE: music - G510s - 07-08-2014

and how do i get a key for lvl 1 to work in level 2? or3 ect...


RE: music - Lizard - 07-08-2014

You just put the script into the level it is supposed to be used in


RE: music - G510s - 07-08-2014

can you please put it into a script example so i can understand more? thx Smile