Frictional Games Forum (read-only)
[ART] Music "Lower" if player enters area - 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: [ART] Music "Lower" if player enters area (/thread-31160.html)

Pages: 1 2


RE: Music "Lower" if player enters area - Amnesiaplayer - 10-07-2015

Thanks!! It finally worked.
Really thought the problem was in the snt file haha


RE: Music "Lower" if player enters area - Mudbill - 10-07-2015

Hopefully you don't run into any issues, because I'm sure this code is prone to it. I don't know the data limit of the music priority, although seeing as it is an int, it's probably somewhere in either 30k or 60k calls. That shouldn't be an issue unless you repeatedly walk in and out of the area 30 000 times.

Also, if you want to play any other music later, that one will need a higher priority as well. Perhaps using a for-loop to stop all the music running at lower priorities can be used to clear out that list, should it be necessary.

Though, if you don't experience any issues, no action is needed.


RE: Music "Lower" if player enters area - Amnesiaplayer - 10-08-2015

(10-07-2015, 08:30 PM)Mudbill Wrote: Hopefully you don't run into any issues, because I'm sure this code is prone to it. I don't know the data limit of the music priority, although seeing as it is an int, it's probably somewhere in either 30k or 60k calls. That shouldn't be an issue unless you repeatedly walk in and out of the area 30 000 times.

Also, if you want to play any other music later, that one will need a higher priority as well. Perhaps using a for-loop to stop all the music running at lower priorities can be used to clear out that list, should it be necessary.

Though, if you don't experience any issues, no action is needed.

Okey, thanks for the info, but if I use Stopmusic, then all the music that is playing has to stop right, doesn't it stop the priority count back to 0 again?!
But luckily, you don't need to acces the are for more then 10 times, I just made 3 these kinds, in one of it, you kinda "drown" if you stay 6.7 seconds or longer, but something didn't work here, I don't know if it is on topic or not, but if you are in an area ( which covers the whole liquid area) You will unforntunatly drown, but if you acces the are, a sound appears, "playguisound" but I need it to stop if you leave the area, but it doesn't work, if you leave the area, hearing the "drown" sound and/or getting the damage does stop, but it doesn't stop the other sound, better explanation:
PHP Code:
void Drowning(string &in asParentstring &in asChildint alState)
{
if(
alState == 1)

PlaySoundAtEntity("DrownSound""UnderWater.snt""Player"1false);
AddTimer("DrownFast"4,"DEAD");
}

if(
alState == -1)
{
StopSound("UnderWater"0);
RemoveTimer("DrownFast");
}


void DEAD(string &in asTimer)
{
PlayGuiSound("W_1"1); 
GivePlayerDamage(40"damage_bloodsplat2"falsetrue);
AddTimer("DrownFast"4.1,"DEAD2");
}

void DEAD2(string &in asTimer)
{
PlayGuiSound("W_2"1); 
GivePlayerDamage(50"damage_bloodsplat2"falsetrue);
AddTimer("DrownFast"3.2,"DEAD3");
}

void DEAD3(string &in asTimer)
{
PlayGuiSound("W_3"1); 
GivePlayerDamage(100"damage_bloodsplat2"falsetrue);


UnderWater.snt does't sotp after leaving the area, even if I use StopSound("UnderWater", 0); with SNT behind UnderWater, I tried playgui sound, it doesn't work, sounds very weird haha


RE: Music "Lower" if player enters area - Mudbill - 10-08-2015

The name you must use in the StopSound is the internal name you created for the sound when you added it. In this case, that internal name is the first parameter: "DrownSound".

So you must use StopSound("DrownSound", 0);