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.
So basically I want to be able to display an animation, and then have it stop once the animation is complete.
It's not immediately obvious how to do this, without using renpy.movie_cutscene, which I don't think is really what I'm looking to do here.
#The animation is defined like so:
image swordAttack movie = Movie(channel="swordAttack", play="img/animations/swordAttack_real.webm", mask="img/animations/swordAttack_mask.webm")
#and then used like so:
show swordAttack movie
This will show the animation, but then it keeps looping rather than stopping once it is complete.
I am hoping there is a way to tell the animation to not loop that I've overlooked, rather than needing to add a bunch of pauses and hides each time I use them.
renpy.movie_cutscene(filename, delay=None, loops=0, stop_music=True)
This displays an MPEG-1 cutscene for the specified number of seconds. The user can click to interrupt the cutscene. Overlays and Underlays are disabled for the duration of the cutscene.
filename
The name of a file containing an MPEG-1 movie.
delay
The number of seconds to wait before ending the cutscene. Normally the length of the movie, in seconds. If None, then the delay is computed from the number of loops (that is, loops + 1) * the length of the movie. If -1, we wait until the user clicks.
loops
The number of extra loops to show, -1 to loop forever
Perhaps use this method instead and set looping to 0
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
renpy.movie_cutscene(filename, delay=None, loops=0, stop_music=True)
This displays an MPEG-1 cutscene for the specified number of seconds. The user can click to interrupt the cutscene. Overlays and Underlays are disabled for the duration of the cutscene.
filename
The name of a file containing an MPEG-1 movie.
delay
The number of seconds to wait before ending the cutscene. Normally the length of the movie, in seconds. If None, then the delay is computed from the number of loops (that is, loops + 1) * the length of the movie. If -1, we wait until the user clicks.
loops
The number of extra loops to show, -1 to loop forever
Perhaps use this method instead and set looping to 0
Thanks for your response, unfortunately, it seems that this function sets the movie to play fullscreen, which means it won't work as an in-game animation. Also, i don't think it allows you to apply a mask to it, and without the mask the animations in this format look terrible. lol
init:
image movie = Movie(size=(1280, 720), xalign=0.5, yalign=0.5, loop=False)
label start:
play movie "movies/mymovie.mkv"
Now, no guarantees because;
1: Its not mentioned in the documentation
2: I tested the code, but my movie from that time was encoded in AVC (mpeg-4 part10) and later versions of Ren'Py no longer work with this (not supported to begin with) codec.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
init:
image movie = Movie(size=(1280, 720), xalign=0.5, yalign=0.5, loop=False)
label start:
play movie "movies/mymovie.mkv"
Now, no guarantees because;
1: Its not mentioned in the documentation
2: I tested the code, but my movie from that time was encoded in AVC (mpeg-4 part10) and later versions of Ren'Py no longer work with this (not supported to begin with) codec.
Thanks for your help, I tried your code and although it didn't work directly, with a bit of tweaking I was able to get it to not loop if I used it like this instead.
init:
image movie = Movie(size=(1280, 720), xalign=0.5, yalign=0.5)
label start:
play movie "movies/mymovie.mkv" noloop
However as my animations rely on masks, it's still not quite there. I tried adding the masks to the movie define, but when I do that the animation doesn't show up at all.
I can't seem to figure out how to add the mask inline when I'm calling the play movie bit either.
Did you figure this out? I have the same problem. I have an Animation that needs to have a Mask and play over a background. In some cases I will have other Animations playing at the same time.