Play sound for in-game choice buttons?
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.
Play sound for in-game choice buttons?
Hello, I'm new here (and new to Ren'Py), I'm having so much fun with this software, but I got stuck and I'm not sure how to do something. I'd like to be able to play a sound when you select an in-game menu choice, I did find some older discussions about it but I'm still having trouble trying to make it work, is anyone able to walk me through it for the new version of Ren'Py?
- DannyGMaster
- Regular
- Posts: 113
- Joined: Fri Sep 02, 2016 11:07 am
- Contact:
Re: Play sound for in-game choice buttons?
A way is to modify the choice screen, probably located in your Project's screens.rpy file.
Around line 202, there should be something like this:
In the same line as the textbutton, you can add activate_sound "sound.ogg", it's a button style property, (search Style Properties in the documentation for more on them). It would end up like this:
You can also add hover_sound "hover.ogg" if you want that too.
Hope this helps.
Around line 202, there should be something like this:
Code: Select all
screen choice(items):
style_prefix "choice"
vbox:
for i in items:
textbutton i.caption action i.action
Code: Select all
screen choice(items):
style_prefix "choice"
vbox:
for i in items:
textbutton i.caption action i.action activate_sound "select.ogg"
Hope this helps.
The silent voice within one's heart whispers the most profound wisdom.
Re: Play sound for in-game choice buttons?
Thanks so much DannyGMaster! That's perfect, I'll try it out now, thank you! 
- DannyGMaster
- Regular
- Posts: 113
- Joined: Fri Sep 02, 2016 11:07 am
- Contact:
Re: Play sound for in-game choice buttons?
Glad I helped 
The silent voice within one's heart whispers the most profound wisdom.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot]