how to low the music volume via script without changing it?

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,042
First Language
French
Primarily Uses
RMMV
Hi I work on a script who permit to pause the game but I don't want to change the music

just to low the current music volume  without changing it or restart it 

I know this a pretty basic question I was just not sure of how you can do this ....

did I have to do this ?

RPG::BGM.new("",50,100).play ? because the song name is empty did it will take the current song and modify it?

thanks for your further answer
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
no. Did you try passing it the BGM that's already playing?


I tried to do this with pitch, but there was a very short pause between the changes - you might find the same thing.
 

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,042
First Language
French
Primarily Uses
RMMV
Hum I am not sure of what you mean can you show me exemple of what you mean shaz ?
 

Bastrophian

The Pixel Heartist!
Veteran
Joined
Oct 26, 2013
Messages
3,830
Reaction score
2,070
First Language
English
Primarily Uses
Other
I just lower the volume using events. Is there a reason you have to use a script for it?
 

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,042
First Language
French
Primarily Uses
RMMV
actually yes this for a script ( a Scene script)  like I said in the first post and no I don't want to use any even method for this sorry 
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Well, how would you do it with events?


Get it working with events (without switching scenes), then look at what Game_Interpreter does when you run those commands. That will give you the equivalent script calls.
 

Bastrophian

The Pixel Heartist!
Veteran
Joined
Oct 26, 2013
Messages
3,830
Reaction score
2,070
First Language
English
Primarily Uses
Other
Well, how would you do it with events?
Im really sorry, i was on my phone at a restaurant just as the server was coming to bring us our order when posted last, and i jumped the gun a little. I read the title but not the rest of his question :( .

Im really sorry Nio. Because i didint read the rest of your topic, i thought you were talking about lowering the volume during something like a cut scene. I'll make sure i read the whole topic next time. :(
 

Galenmereth

Retired
Veteran
Joined
May 15, 2013
Messages
2,248
Reaction score
2,158
First Language
English
Primarily Uses
N/A
The way to lower volumes of a BGM (or any other audio file, like ME and SFX) is that you run the following:

Audio.bgm_play("Audio/BGM/SongName", new_volume)So if you want to lower the volume down by, say, 1 point each frame, you'd have to subtract 1 from the new_volume variable before calling this. To show how I tested this really quickly with a script call in the event editor:



I know you said you wanted this as part of a script, but it's hard to say exactly how you'd implement it, because it depends on how you want the script to work. But just in terms of pseudocode, you could put it in a class's update method like this:

def update # other things that get updated control_volumeenddef control_volume if @current_volume > @new_volume @current_volume -= 1 update_volume elsif @current_volume < @new_volume @current_volume += 1 update_volume endenddef update_volume Audio.bgm_play("Audio/BGM/#{current_song_name}", @current_volumeendIf at any point you were to change @new_volume to a new value, it'd increase or decrease the volume of the current_song_name song until it reaches that desired volume. I hope this helps :)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,860
Messages
1,017,038
Members
137,568
Latest member
invidious
Top