Amnesiaplayer
Senior Member
Posts: 539
Threads: 105
Joined: Jun 2014
Reputation:
0
|
RE: Music "Lower" if player enters area
Thanks!! It finally worked.
Really thought the problem was in the snt file haha
|
|
10-07-2015, 07:29 PM |
|
Mudbill
Muderator
Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation:
179
|
RE: Music "Lower" if player enters area
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.
|
|
10-07-2015, 08:30 PM |
|
Amnesiaplayer
Senior Member
Posts: 539
Threads: 105
Joined: Jun 2014
Reputation:
0
|
RE: Music "Lower" if player enters area
(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:
void Drowning(string &in asParent, string &in asChild, int alState) { if(alState == 1) { PlaySoundAtEntity("DrownSound", "UnderWater.snt", "Player", 1, false); 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", false, true); AddTimer("DrownFast", 4.1,"DEAD2"); }
void DEAD2(string &in asTimer) { PlayGuiSound("W_2", 1); GivePlayerDamage(50, "damage_bloodsplat2", false, true); AddTimer("DrownFast", 3.2,"DEAD3"); }
void DEAD3(string &in asTimer) { PlayGuiSound("W_3", 1); GivePlayerDamage(100, "damage_bloodsplat2", false, true); }
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
|
|
10-08-2015, 11:30 AM |
|
Mudbill
Muderator
Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation:
179
|
RE: Music "Lower" if player enters area
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);
(This post was last modified: 10-08-2015, 12:19 PM by Mudbill.)
|
|
10-08-2015, 12:18 PM |
|
|