Jump to content
God of Monkeys

How to reduce Vehicle Sound when music play?

Recommended Posts

How to reduce Vehicle Sound when music play?

 

I make a intro to my MP mission, when intro start, music will play.

 

But my vehicle (helicopter)'s sound too loud, so, when everybody is in the heli, they will hardly to hear music.

 

I try to use fadeSound, but it not work.

 

Can you guys help me?

 

Thanks^^

Share this post


Link to post
Share on other sites


defaultVolume = soundVolume;

0 fadeSound 0.3;

playmusic "some_track";

_ehID = addMusicEventHandler ["MusicStop", {0 fadeSound defaultVolume; defaultVolume = nil}];

  • Like 3

Share this post


Link to post
Share on other sites
defaultVolume = soundVolume;

0 fadeSound 0.3;
playmusic "some_track";

_ehID = addMusicEventHandler ["MusicStop", {0 fadeSound defaultVolume; defaultVolume = nil}];

Very thx^^

So when I want to reduce Sound,use this.

defaultVolume = soundVolume;

0 fadeSound 0.3;
playmusic "some_track";

_ehID = addMusicEventHandler ["SoundStop", {0 fadeSound defaultVolume; defaultVolume = nil}];
When I want to let Sound back,use this.

0 fadeSound 1;

_ehID = addMusicEventHandler ["SoundStart", {0 fadeSound defaultVolume; defaultVolume = nil}];
Is that correct?

Share this post


Link to post
Share on other sites

Is that correct?

 

Nope. There is no sound eventhandler, but you can use the musicStop EH to change the sound volume back to normal as soon as the music stops e.g your intro ends.

Share this post


Link to post
Share on other sites

Not exactly.  The code suggested is specifically for reducing game sound levels while a song is playing and to restore them when the sound is finished.

 

The first line captures the current value of the soundVolume of the player and saves it as a variable called defaultVolume.  Then it fades the game sounds down via the fadeSound command and plays the song via the playMusic command.  

 

The last line sets an eventhandler, a piece of code that waits for some trigger than executes specific actions.  The trigger it's waiting for is MusicStop which is caused by the playMusic command which sends a MusicStart event when the song starts and a MusicStop event when it finishes.

 

Once the MusicEventHandler detects the song is over it restores the previously saved volume level by using the defaultVolume variable with the fadeSound command.  Then it deletes that variable since it's not needed anymore.

 

There is no "SoundStart" or "SoundStop" options for the MusicEventHandler and there's no SoundEventHandler.  You can simply use fadeSound to adjust the game volume at other times if desired.

 

Does that make sense?

  • Like 1

Share this post


Link to post
Share on other sites

Not exactly.  The code suggested is specifically for reducing game sound levels while a song is playing and to restore them when the sound is finished.

 

The first line captures the current value of the soundVolume of the player and saves it as a variable called defaultVolume.  Then it fades the game sounds down via the fadeSound command and plays the song via the playMusic command.  

 

The last line sets an eventhandler, a piece of code that waits for some trigger than executes specific actions.  The trigger it's waiting for is MusicStop which is caused by the playMusic command which sends a MusicStart event when the song starts and a MusicStop event when it finishes.

 

Once the MusicEventHandler detects the song is over it restores the previously saved volume level by using the defaultVolume variable with the fadeSound command.  Then it deletes that variable since it's not needed anymore.

 

There is no "SoundStart" or "SoundStop" options for the MusicEventHandler and there's no SoundEventHandler.  You can simply use fadeSound to adjust the game volume at other times if desired.

 

Does that make sense?

Ok , I got it. Thanks^^

Share this post


Link to post
Share on other sites
defaultVolume = soundVolume;

0 fadeSound 0.3;
playmusic "some_track";

_ehID = addMusicEventHandler ["MusicStop", {0 fadeSound defaultVolume; defaultVolume = nil}];

I meet a problem, I write the script in trigger to test.

0 fadeSound 0.1;
playMusic "track_name";
But sound still as loud as same. No sign to reduce.

Are you have same problem?

Share this post


Link to post
Share on other sites
defaultVolume......

 

 

Not exactly.  .....

 

I find problem. It's ACE3 cause problem. When ACE3 not load, the script will be fine. I already  feedback this problem to ACE dev team.

Share this post


Link to post
Share on other sites
On 2017/1/14 at 7:12 AM, Devastator_cm said:

Did you get any reply on that as I am also not able to turn off the sound and I am using ACE 3

 

I got reply with ACE Team:https://github.com/acemod/ACE3/issues/3830

 

you can try this.

ace_hearing_disableVolumeUpdate = true;

This can disable ACE's volume control and let your fadeSound script work.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×