I want to have the ability for players to toggle optional voice acting for the player character in the preferences menu. One for male voice, and one for female.
I'm brand new to Ren'Py, and have no idea how to go about coding this in. Any help is appreciated, and I'll make sure to check in here frequently to answer any questions.
Toggle Optional Player Voice Acting in preferences GUI?
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.
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.
- qirien
- Miko-Class Veteran
- Posts: 538
- Joined: Thu Jul 31, 2003 10:06 pm
- Organization: Metasepia Games
- Deviantart: qirien
- Github: qirien
- itch: qirien
- Location: New Mexico, USA
- Discord: qirien
- Contact:
Re: Toggle Optional Player Voice Acting in preferences GUI?
You can edit the Preferences menu in screens.rpy. Then you could add in some code like this:
Then, in your code, where you normally call:
You should instead call a function that can check the voice gender and play the right sound. For example:
If you're going to use auto-voicing, then you could probably do it a different way with player tags, but to me this seems the easiest
See https://www.renpy.org/doc/html/voice.html
Code: Select all
vbox:
style_prefix "radio"
label _("PC Voice")
textbutton _("Male") action SetVariable("voice_gender", "male")
textbutton _("Female") action SetVariable("voice_gender", "female")
Code: Select all
voice "male_line01.ogg"
Code: Select all
python:
def v(filename):
renpy.voice("voice_gender_" + filename + ".ogg")
label start:
$ v("line01")
mc "This should play using the right gender from the Preferences menu."
See https://www.renpy.org/doc/html/voice.html
Re: Toggle Optional Player Voice Acting in preferences GUI?
Thank you! I'll test this out once I get my voice lines in. ^^
Who is online
Users browsing this forum: Google [Bot]


