Option to reset music to default in game? [SOLVED]

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
AsHLeX
Miko-Class Veteran
Posts: 556
Joined: Wed Dec 25, 2013 1:09 pm
Completed: Starlight Dreamers, Mysterious Melody, Town of Memories, Marked, To Fly, The Change, Him From The Past, A Forgotten Memory
Projects: Cafe Mysteria
Location: Malaysia
Contact:

Option to reset music to default in game? [SOLVED]

#1 Post by AsHLeX »

Hi! Thanks for reading this.
So my problem is that when I use

Code: Select all

_preferences.volumes['music'] *= 
to set the fraction of the volume that I want (mostly at times when the character is speaking to reduce the volume of the music), say at

Code: Select all

_preferences.volumes['music'] *= 0.7
Then the sound automatically goes to 0.7 fraction of 1.0 (which is the default max)
But the problem is that if the player quits at this point and chooses to restart the game, he'll have a music volume of "0.7" as his default.
So when he reaches the part of the game that says

Code: Select all

_preferences.volumes['music'] *= 0.7
he'll end up with a "0.49" music volume. Do this enough times and the volume keeps decreasing until you can barely hear it.

The question is, how do I avoid this? Is there a way to restore default at the very beginning of the game? As in putting music into the "actual" 1.0.
I tried putting

Code: Select all

_preferences.volumes['music'] *= 1.0 
At the beginning of the game, but I think the game recognizes the fraction of the volume at which the player quit the game as as "100%". Meaning if he quit the game at 0.7, then the game recognizes it as the "new" 1.0, because putting

Code: Select all

_preferences.volumes['music'] *= 1.0 
at the beginning of the game to try and avoid this problem doesn't do anything. It still remains 0.7.

Thanks for reading this, and I hope you understand what I'm trying to say?
Last edited by AsHLeX on Sat Feb 10, 2018 1:27 pm, edited 1 time in total.
Image
New demo out 24/12/23!!

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Option to reset music to default in game?

#2 Post by PyTom »

Take a look at the Emphasize Audio preference.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
AsHLeX
Miko-Class Veteran
Posts: 556
Joined: Wed Dec 25, 2013 1:09 pm
Completed: Starlight Dreamers, Mysterious Melody, Town of Memories, Marked, To Fly, The Change, Him From The Past, A Forgotten Memory
Projects: Cafe Mysteria
Location: Malaysia
Contact:

Re: Option to reset music to default in game?

#3 Post by AsHLeX »

Oh, I never knew that existed. Just had a look at it and it's really handy, thanks PyTom!!
Image
New demo out 24/12/23!!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], voluorem