UGX-Mods

Call of Duty 5: World at War => Help Desk => Scripting => Topic started by: fusorf on September 02, 2016, 06:39:16 pm

Title: Mute Round sounds & Ambient music for some time
Post by: fusorf on September 02, 2016, 06:39:16 pm
Hi everyone,

Basically I wrote a script to play an easter egg song. But I would like to mute the ambient music and the round sounds while it's playing.

Thanks for the help ^^
Title: Re: Mute Round sounds & Ambient music for some time
Post by: HitmanVere on September 03, 2016, 11:41:41 am
Code Snippet
Plaintext
level.eggs = 1;

Set that to 1, when song is playing and when song ends, set it to 0
Title: Re: Mute Round sounds & Ambient music for some time
Post by: fusorf on September 03, 2016, 01:55:29 pm
Tried that, doesn't work :/ do I need to return it from my script's function to zombiemode ?
Title: Re: Mute Round sounds & Ambient music for some time
Post by: HitmanVere on September 03, 2016, 02:22:26 pm
Tried that, doesn't work :/ do I need to return it from my script's function to zombiemode ?

No? Its set on level. Show script and how are you setting ambient sounds?
Title: Re: Mute Round sounds & Ambient music for some time
Post by: fusorf on September 03, 2016, 10:40:30 pm
Code Snippet
Plaintext
init()
{
level.song_playing_now = false;
level.eggs = 0;
level.trig_mus_count = 0;

trigs = getEntArray("radio_music_trigs","targetname");

for(i=0; i<trigs.size; i++)
{
trigs[i] thread watch_radio();
}
}

watch_radio()
{
self SetCursorHint("HINT_NOICON");
self playLoopSound("ee_song_loop");
self waittill("trigger", player);

playsoundatposition( "ee_song_affirm", player.origin );
self StopLoopSound();

level.trig_mus_count++;

if(level.song_playing_now == false && level.trig_mus_count == 3)
{
level.song_playing_now = true;
level.eggs = 1;
thread play_plr_song();
player waittill("song_done");

wait 0.1;
level.song_playing_now = false;
level.eggs = 0;
self delete();
}
}

play_plr_song()
{
players = get_players();
for(i=0; i<players.size; i++)
{
players[i] playsound("ee_song", "song_done");
}
}

there you go, sorry if it's messy ^^'
Title: Re: Mute Round sounds & Ambient music for some time
Post by: HitmanVere on September 03, 2016, 10:48:33 pm
Could you do instead of player waittill("song_done");, have wait for actual sound length? That should work at least, never used notify bit in playSound
Edit: Also, move self delete(); under if-statement, so the triggers get deleted correctly, lol. Just something I noticed while looking at script
Title: Re: Mute Round sounds & Ambient music for some time
Post by: fusorf on September 03, 2016, 11:58:47 pm
Thank you for your help HitmanVere :)

I did your changes. What I got working was that the round sounds are sucessfully disabled while the song is played.

However, the background music (mx_wave_1 overwritten with custom csv) keeps playing, even between rounds as they are no more round sounds to stop it. don't know if it makes sense xD

Fact is, when I trigger the song between rounds, the ambient music stops playing correctly. It seems that I can't stop it while it's playing.

But prehaps I could turn down the volume or something ? I don't know...

Btw you had 666 respects, I saved you by adding one ^^
Title: Re: Mute Round sounds & Ambient music for some time
Post by: HitmanVere on September 04, 2016, 12:08:06 am
Thank you for your help HitmanVere :)

I did your changes. What I got working was that the round sounds are sucessfully disabled while the song is played.

However, the background music (mx_wave_1 overwritten with custom csv) keeps playing, even between rounds as they are no more round sounds to stop it. don't know if it makes sense xD

Fact is, when I trigger the song between rounds, the ambient music stops playing correctly. It seems that I can't stop it while it's playing.

But prehaps I could turn down the volume or something ? I don't know...

I think you can set something up in soundalias. Cant remember atm how, but there is a way to link them somehow

Btw you had 666 respects, I saved you by adding one ^^

Damn it, why did I answer to this topic :-\
Title: Re: Mute Round sounds & Ambient music for some time
Post by: fusorf on September 04, 2016, 12:20:08 am
I think you can set something up in soundalias. Cant remember atm how, but there is a way to link them somehow

Alright let me know, i'll try to see if I find anything :)

Damn it, why did I answer to this topic :-\

Oh so that's how you thank me ? :o then I would remove it if I could!