Movie code not working (Resolved)

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.
Post Reply
Message
Author
TheRedHare
Regular
Posts: 29
Joined: Mon Jun 27, 2016 7:58 pm
Projects: Parricide
Organization: Poena Cullei
Tumblr: theredharestuff
Contact:

Movie code not working (Resolved)

#1 Post by TheRedHare »

I'm currently in the process of creating a VN.

Whilst doing so, I would like my game to end with a movie, which shows the credits inside as well. However, no movie loads properly.

The key part to my games multiple endings, is based on a scoring system. Highest score wins.

label day4:

$max_score = max(maid_points,father_points,mother_points)
if max_score == maid_points:
jump event3
elif max_score == mother_points:
jump event2
elif max_score == father_points:
jump event1

scene bg scene2
with dissolve

"text"
scene bg scene5
with dissolve
scene bg scene11
with dissolve

$winner = "father"
label event1:

"Text"
show movie
play movie "EndCredits.ogv"
play music "New.ogg"

$winner = "mother"
label event2:

"Text"
show movie
play movie "EndCredits.ogv"
play music "New.ogg"

$winner = "maid"
label event3:

"text"
show movie
play movie "EndCredits.ogv"
play music "New.ogg"

return


However, most of the time if the father wins, the movie plays fine. Other times, the text between endings follows on from one another, and doesn't show the movie.

Clearly there is something basic I must be missing, but after staring at this for hours now, I cannot seem the grasp it.

I also have

image movie = Movie(size=(config.screen_height,config.screen_width), xpos=0, ypos=0, xanchor=0, yanchor=0)

In my script.rpy

Any help would be awesome, thanks!
Last edited by TheRedHare on Sun Jul 24, 2016 6:15 am, edited 1 time in total.

User avatar
Kinjo
Veteran
Posts: 219
Joined: Mon Sep 19, 2011 6:48 pm
Completed: When the Seacats Cry
Projects: Detective Butler
Organization: Goldbar Games
Tumblr: kinjo-goldbar
Deviantart: Kinjo-Goldbar
Github: GoldbarGames
Skype: Kinjo Goldbar
itch: goldbargames
Location: /seacats/
Contact:

Re: Movie code not working

#2 Post by Kinjo »

Firstly, lines 10-20 won't ever be executed, since max() will always return a number that jumps ahead to the other labels. So I'm not sure why those lines exist.

Then, I'm not sure if this could be relevant but when you say "highest score wins" what do you do in the event of a tie? The way it is set up right now, if two points are the same, the player will jump to only the first label. So if father_points and mother_points are equal, the player will jump to the mother label instead of the father due to the order of the if-statements. Not sure if that was intentional, but that's something to think about.

So, what values are you using to test these? Where is it supposed to jump and where does it actually end up? It sounds like you're trying to test the father's label and it indeed goes there but continues to go to the other labels afterward. The text will continue to follow from one another unless you return or jump to another label. There's no getting around that. I'd also recommend changing the text to different string ("text father", "text mother", etc.) so that you know exactly where you ended up.

Also, although I'm not too familiar with how Ren'Py handles videos, it appears that the video must contain audio to play and I would double-check to make sure you are using a valid codec. However you said that you got it to play at least once, so maybe that's not the problem.

TheRedHare
Regular
Posts: 29
Joined: Mon Jun 27, 2016 7:58 pm
Projects: Parricide
Organization: Poena Cullei
Tumblr: theredharestuff
Contact:

Re: Movie code not working

#3 Post by TheRedHare »

I've edited the code slightly, and found that all 3 now work correctly in terms of showing scenes and text, however no movie plays at all for any of them.

label day4:

scene bg scene2
with dissolve

"text"
scene bg scene5
with dissolve
scene bg scene11
with dissolve

$max_score = max(maid_points,father_points,mother_points)
if max_score == maid_points:
jump event3
elif max_score == mother_points:
jump event2
elif max_score == father_points:
jump event1

$winner = "father"
label event1:

"text"
show movie
play movie "EndCredits.ogv"
play music "New.ogg"
return

$winner = "mother"
label event2:

"Text"
"I knew it wasn’t directed at me in particular, though I stopped to tell him that whatever it was, it wasn’t his fault."
"Then I headed off toward the tree in order to ensure that it was indeed what I thought it was..."
"And that's when I saw her."
show movie
play movie "EndCredits.ogv"
play music "New.ogg"
return

$winner = "maid"
label event3:

"text"
show movie
play movie "EndCredits.ogv"
play music "New.ogg"
return

return



I should also note that in my script.rpy I use;


init python:
#points for all characters
father_points = 0
mother_points = 0
maid_points = 0

and I use;

image movie = Movie(size=(800,700), xpos=0, ypos=0, xanchor=0, yanchor=0)

In terms of what happens in a tie, the code above $max_score = max(maid_points,father_points,mother_points) would prioritise maid points over father, and father over mother.

TheRedHare
Regular
Posts: 29
Joined: Mon Jun 27, 2016 7:58 pm
Projects: Parricide
Organization: Poena Cullei
Tumblr: theredharestuff
Contact:

Re: Movie code not working

#4 Post by TheRedHare »

As I've asked a very quick, yet detailed question which I imagine takes a decent coder to understand, far beyond my own skills, I have therefore offered a small fee for the code to be corrected here in light of the time it would take for someone to look at it properly.

I hope this is not against the rules, if it is please delete this post and accept my apologises.
Image

DragoonHP
Miko-Class Veteran
Posts: 758
Joined: Tue Jun 22, 2010 12:54 am
Completed: Christmas
IRC Nick: DragoonHP
Location: Zion Island, Solario
Contact:

Re: Movie code not working

#5 Post by DragoonHP »

The problem with your code is that you "return" back as soon as the movie plays which causes it to hide. Ether put a text block or put in a pause after the play statment.

Code: Select all

    "text"

    show movie
    play movie "EndCredits.ogv"
    play music "New.ogg"

    pause
    
    return

TheRedHare
Regular
Posts: 29
Joined: Mon Jun 27, 2016 7:58 pm
Projects: Parricide
Organization: Poena Cullei
Tumblr: theredharestuff
Contact:

Re: Movie code not working

#6 Post by TheRedHare »

DragoonHP wrote:The problem with your code is that you "return" back as soon as the movie plays which causes it to hide. Ether put a text block or put in a pause after the play statment.

Code: Select all

    "text"

    show movie
    play movie "EndCredits.ogv"
    play music "New.ogg"

    pause
    
    return
I can't believe how simple that was. Makes perfect sense and the movies are playing fine, I just need to adjust the size/placement.

As you have helped me by fixing the code, I would therefore like to offer you a small token of thanks as I stated in my other tread. Please send me a pm with your paypal and I'll send you a token of gratitude.

Cheers again,


The Red Hare
Image

DragoonHP
Miko-Class Veteran
Posts: 758
Joined: Tue Jun 22, 2010 12:54 am
Completed: Christmas
IRC Nick: DragoonHP
Location: Zion Island, Solario
Contact:

Re: Movie code not working (Resolved)

#7 Post by DragoonHP »

There's no need. It really wasn't anything. Treat yourself if you must spend the money.

Post Reply

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot]