Is there a way to make a sound effect play upon a screen being shown? For instance, an alert sound for an OK/YesNo dialogue box? I'm aware I could separately play the sound whenever that screen is called, but I was hoping there's some way of hardcoding it into the screen itself as otherwise that would require me to go back through my entire game script and menus and add in that play sound command at every single instance...
I tried adding a basic $renpy.sound.play statement in the screen for the hell of it but of course, as expected, resulted in horrendous audio glitches due to the repeating nature of screen code.
Playing sound upon screen show
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.
- computistxyz
- Regular
- Posts: 58
- Joined: Thu Jul 10, 2014 8:35 am
- Github: sjgriffiths
- Location: Coventry/Norwich, UK
- Contact:
- 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: Playing sound upon screen show
Here's the code I used to play a random song from a playlist when a screen is shown if the music is not already playing. It goes at the very end of the screen code. Could you use something like this?
Code: Select all
on "show" action If(renpy.music.is_playing(), true=None, false=pop_songs.RandomPlay())
Who is online
Users browsing this forum: Bing [Bot], Google [Bot]


