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.
My idea here is to have a character that's talking up until the text of their say statement finishes scrolling. I then want the character to switch back to their non-talking image.
I have a minimal example that reproduces the issue I'm having. The assumptions here are two images in the 'image' folder: "man.png" and "man talking.png", as well as
init python:
def show_guy(event, interact=True, **kwargs):
if event == "slow_done":
renpy.show("man")
elif event == "begin":
renpy.show("man talking")
label start:
define guy = Character('Guy', image = "man", callback = show_guy)
guy "I should be talking right up until the end of this sentence."
guy "Now, I should be talking again, but when this text finishes my mouth will close."
return
The result is we only ever see the "man talking", and never "man". When the "slow" text finishes, the character image remains the same.
You could use the config.speaking_attribute to do this more easily.
Check out this post of mine: viewtopic.php?p=483546#p483546
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Your code does do the same thing as my callback (more concisely, I might add), but it still doesn't solve the problem. I want the talking animation to end when the slow text is finished being revealed, not when it moves onto the say statement. (like in the ace attorney series.)
The pulse example you linked runs through the transformation once as the text reveals, then finishes independent of how much text has been displayed. But maybe I implemented it wrong?
After further experimentation I've found that the issue is not "slow_done" not firing, but something related to the displayables.
For example in the following code, the sound starts and stops fine but the images still aren't working as they should.
init python:
def show_guy(event, interact=True, **kwargs):
if event == "slow_done":
renpy.hide("man talking")
renpy.sound.stop()
elif event == "begin":
renpy.show("man talking")
renpy.sound.play("beeps.wav")
label start:
define guy = Character('Guy', image = "man", callback = show_guy)
guy "I should be talking right up until the end of this sentence."
guy "Now, I should be talking again, but when this text finishes my mouth should close."
guy "Unfortunately, what is actually happening is that the 'talking' image is being shown the entire time."
return
In this case the 'renpy.hide' does not seem to be hiding the talking image.
I'm not familiar with this code as I don't plan to in my own project but asking cause curious in case I might want to.
The idea is that the "talking" image shows until the text finishes for said line. Similar to how some games have a mouth flap until the voice file is finished playing. But would the player being able to change the text speed effect this? Cause if someone wants the text to appear faster or slower, the idea is to have the flap follow. But how would it in the code go about doing that?