I have a gunshot sound and I want it to play 5 times. How can I tell Ren'Py to let it play 5 times?
I do not want to make an extra music file where it's played 5 times to safe space.
Have a sound play a set number of times?
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.
-
- Newbie
- Posts: 16
- Joined: Wed Jul 17, 2019 8:51 am
- Contact:
- Per K Grok
- Miko-Class Veteran
- Posts: 882
- Joined: Fri May 18, 2018 1:02 am
- Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
- itch: per-k-grok
- Location: Sverige
- Contact:
Re: Have a sound play a set number of times?
A very simple way to do it would beSquittenKitten wrote: ↑Sat Jul 20, 2019 3:21 pm I have a gunshot sound and I want it to play 5 times. How can I tell Ren'Py to let it play 5 times?
I do not want to make an extra music file where it's played 5 times to safe space.
Code: Select all
play sound "sound/bang.ogg"
pause 0.5
play sound "sound/bang.ogg"
pause 0.5
play sound "sound/bang.ogg"
pause 0.5
play sound "sound/bang.ogg"
pause 0.5
play sound "sound/bang.ogg"
pause 0.5
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3794
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Have a sound play a set number of times?
Isn't there a loops=5 kwarg or something?
I didn't see it in the documentation, but I'm sure there was
I didn't see it in the documentation, but I'm sure there was
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Re: Have a sound play a set number of times?
Pfff.....
play sound.....
queue sound.....
queue sound....
play sound.....
queue sound.....
queue sound....
Renpy textbook (in Russian). https://disk.yandex.ru/i/httNEajU7iFWHA (all information is out of date) Update 22.06.18
Sawa - a game of the Drow Nation
Honest Critique
Poses in visual novels, or how to hold a character properly in the frame
Help save articles to the webarchive. [/color]
Sawa - a game of the Drow Nation
Honest Critique
Poses in visual novels, or how to hold a character properly in the frame
Help save articles to the webarchive. [/color]
- IrinaLazareva
- Veteran
- Posts: 399
- Joined: Wed Jun 08, 2016 1:49 pm
- Projects: Legacy
- Organization: SunShI
- Location: St.Petersburg, Russia
- Contact:
Re: Have a sound play a set number of times?
No, loops only takes on yes/no values.
So, loops=5 is the equivalent of loops=True
For example, the number of cycles can be set, for transformation ( ATL). Maybe it's settled in your memory.
- IrinaLazareva
- Veteran
- Posts: 399
- Joined: Wed Jun 08, 2016 1:49 pm
- Projects: Legacy
- Organization: SunShI
- Location: St.Petersburg, Russia
- Contact:
Re: Have a sound play a set number of times?
Anyway:
or
Code: Select all
label start:
'...'
play sound ['bang.mp3', 'bang.mp3', 'bang.mp3', 'bang.mp3', 'bang.mp3']
'queue of five shots'
return
Code: Select all
define audio.bang = ['bang.mp3', 'bang.mp3', 'bang.mp3', 'bang.mp3', 'bang.mp3']
label start:
'...'
play sound bang
'queue of five shots'
play sound bang[:3] #! the number following the colon should not exceed the number of files in the audio.bang[] list
'Three shots'
play sound bang[:2]
'Two shots'
play sound bang[:1] #or# play sound bang[0]
'single shot'
return
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot]