SOLVED Points endings not working

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
Night130
Newbie
Posts: 13
Joined: Sun Apr 22, 2018 9:57 am
Contact:

SOLVED Points endings not working

#1 Post by Night130 » Sun Jun 03, 2018 2:26 am

In my game, there are 4 possible endings, and depending on how many points you get for a certain character, is the ending you end up with. I have 2 of the ending working, but the other 2 are not.
Here is my code:

Code: Select all

label start:
    $ rapunzel_Point = 0
    $ anya_Point = 0
    $ dimitri_Point = 0
    $ john_Point = 0
    
    ###Stuff happens
    
    menu:
    "Go shopping with Anya":
        $ anya_Point += 1
        $ anyatruth = True 
	jump yesshopping
	
if anya_Point == 1:
    show anya earring with dissolve
    $ anya_Point += 2
    
    ###Stuff happens
        
if anya_Point == 2:
    jump anyaending

elif anya_Point <= 2:
    jump castleday2
    
   ###Stuff happens
  ### The castleday2 is where the other ending are supposed to be triggered   
   

Code: Select all

  
label guestrooms:
    $ john_Point += 1 
 y "Why not the guest rooms?"
 
if john_Point == 1:
    show john medal with dissolve 
    $ john_Point += 2
    
     ###Stuff happens
        
if john_Point == 2:
     jump johnending
     

Code: Select all

label dinningroom:
    $ rapunzel_Point += 1 
   y "I think I'll check the dining room first."
       
if rapunzel_Point == 1:
    show rapunzel mask with dissolve
    $ rapunzel_Point += 2
    
    ###Stuff happens
        
if rapunzel_Point == 2:
    jump rapunzelending
    

Code: Select all

label kitchen:
    $ dimitri_Point += 1  
    y "Let's try the kitchen first. "
    
if dimitri_Point == 1:
    show dimitri petal with dissolve
    $ dimitri_Point += 2
    
    ###Stuff happens
        
if dimitri_Point == 2:
    jump dimitriending
    
    
I have Anya's and John's ending working, however if I try for Rapunzel or Dimitri's it goes straight to john's ending. I hope this all makes sense :)
Last edited by Night130 on Sun Jun 03, 2018 10:15 am, edited 1 time in total.

User avatar
Ocelot
Miko-Class Veteran
Posts: 849
Joined: Tue Aug 23, 2016 10:35 am
Skype: miinipaa
Contact:

Re: Points endings not working

#2 Post by Ocelot » Sun Jun 03, 2018 3:09 am

I would like to see code I can paste into RenPy and see problem myself.

One thing: Anya's and John's ending as posted should not work either. Look closely:

Code: Select all

 $ anya_Point = 0 # Value is 0
# . . .
    "Go shopping with Anya":
        $ anya_Point += 1 # Now it is 1
        $ anyatruth = True 
	jump yesshopping
# . . . 
if anya_Point == 1: # check is passed because we set it to 1 before
    show anya earring with dissolve
    $ anya_Point += 2  # Now it is 3 !
# . . .
if anya_Point == 2:  #  Would not trigger. Value is 3! It can be either 1 or 3, there is no way for that value to be 2!
    jump anyaending
elif anya_Point <= 2: # Does not trigger either
    jump castleday2

# Execution continues here. If label anyaending is placed here then incidentally it would be executed. Not because code is correct, but because you placed it here.
< < insert Rick Cook quote here > >

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Points endings not working

#3 Post by kivik » Sun Jun 03, 2018 3:49 am

In terms of your endings, have you tracked the values of all your character's variables? There're lots of possibilities, and without seeing enough code to be able to test it ourselves, my suggestion is to first make your game show the points constantly using a screen:

Code: Select all

screen show_points:
    vbox:
        xalign 1.0
        yalign 0.0
        text rapunzel_Point
        text anya_Point
        text dimitri_Point
        text john_Point

label start:
    show screen show_points # add this to the start
Then you can at least eliminate whether the variables are correct.


As Ocelot said, if your anya code is as they appear (then Anya would never ever have 2 points, the problem doesn't seem to be in the code you're showing us (alone at least), but in either the overall logic or stuff that we're not able to see.

Night130
Newbie
Posts: 13
Joined: Sun Apr 22, 2018 9:57 am
Contact:

Re: Points endings not working

#4 Post by Night130 » Sun Jun 03, 2018 9:19 am

How much more code do you need? There's almost 2,000 lines of code. I'm not sure how much I should paste.
I added the vbox code, and changed the +=2 to += 1, and it still does the same thing.

Code: Select all

menu:
    "Go shopping with Anya":
        $ anya_Point += 1
        $ anyatruth = True
        jump yesshopping
    "Decline and go to the castle":
        jump gotocastle
        
label yesshopping:
y "Okay, fine. Maybe you're right."
a "You know I am!"
hide anya happy with dissolve 
hide your room with dissolve 
scene town with dissolve
play music "cafe.wav"
show anya happy with dissolve 
a "So, what do you want to do first?"
y "I don't know. You dragged me out here."
a "What about Duke's cafe?"
y "Sure, I haven't been there in a while."
hide anya happy with dissolve 
hide town with dissolve 
scene cafe with dissolve
show anya happy with dissolve 
a "Look, there's a free table over there." 
a "I think they changed their menu recently."
y "Cool."
show anya hand with dissolve 
a "Why are you being such a downer?"
y "I'm not."
a "Well, something's bothering you."

menu:
    "Truth (I want to investigate)":
        jump truth
    "Lie (I miss the old menu)":
        jump lie
        
label truth:
y "I don't want to be here Anya. I want to investigate."
a "Don't worry about Gaston, you said he was a creep anyway. With the way he talked about your outfit and all."
jump normal9

######

if anya_Point == 1:
    show anya earring with dissolve
    $ anya_Point += 1
    y "That looks like..."
    y "Anya's other earring?"
    y "What is it doing here?"
    hide anya earring with dissolve
    jump nextday

######
if anya_Point == 2:
    jump anyaday

elif anya_Point <= 2:
    jump castleday2

label anyaday:
    y "Yeah, sure. I want to talk to you anyway."
    show anya happy with dissolve
    a "Okay, great! Let's go."
    hide anya happy with dissolve
    hide your room with dissolve 
    scene town with dissolve
    show anya happy with dissolve
    ### lines 1381-1461 are all conversation
    play sound "knock1.wav" 
    y "Seriuosly?" 
    play sound "knock2.wav"
    y "Can I not get one good night of sleep?!"
    show your room with dissolve 
    y "Who the hell is it?"
    k "Detective Kent Mansley. I talked to you a few days ago?"
    y "Oh, shit..."
    play sound "dooropen1.wav"
    show kent paper with dissolve 
    y "What can I do for you?"
    k "Just a routine check in. Wanted to know if you remembered anything else?"
    y "Oh, umm..."

menu:
    "Turn Anya in":
        jump turnanyain
    "Protect Anya":
        jump protectanya

label turnanyain:
    y "Yeah, actually. I..."
    y "A friend of mine, Anya, confessed to me that she killed Gaston."
    k "You sure? She told you it was actually her that killed him?"
    y "Yes. She told me she pushed him back, and he hit his head on the table corner."
    k "What was this person's name again?"
    y "... Anya Romanov."
    y "She lives a few block from here."
    k "Thank you for telling me this."
    k "I'll head over there now."
    hide kent paper with dissolve 
    y "Okay..."
    hide your room with dissolve 
    show black with dissolve 
    pause 0.5 
    show your room with dissolve 
    play sound "phonering.wav"
    play sound "phoneanswer.wav"
    y "Hello?"
    a "Hey, want to tell my why that Detective is at my door?"
    y "I... told him."
    a "About?"
    y "You killing Gaston..."
    a "..."
    a "Fantastic."
    play sound "hangup.wav"
    y "Great..."
    show anya arrested with dissolve 
    pause 2.0
    show anyaendscreen with dissolve 
    pause 1.0
    show anyaendscreen1 with dissovle 
    pause 2.0
return 

label protectanya:
    y "No, I haven't remembered anything new."
    k "Are you sure about that?"
    y "Yep, positive."
    k "Alright, thank you."
    hide kent papaer with dissovle
    play sound "doorclose.wav"
    hide your room with dissolve 
    scene town with dissolve 
    show anya hand with dissolve 
    a "Have you seen the news?"
    y "About Gaston's case?"
    a "Yeah. The police called off the search."
    a "They can't find enough evidence to convict anyone."
    y "That's good."
    a "Thank you for not turning me in."
    y "Yeah, well..."
    y "I would be bored without you here, so might as well keep you around."
    show anya happy with dissolve 
    a "Aw, don't I feel loved."
    hide anya happy with dissovle 
    hide town with dissovle 
    show anyaendscreenhappy with dissolve 
    pause 2.0
return 


Code: Select all

label guestrooms:
    $ john_Point += 1 
y "Why not the guest rooms?"
y "Maybe Gaston was staying in one of the rooms."
hide inside gate with dissolve 
scene hallway with dissolve
y "I think this is the place."
y "Which room do I check first though?"
play sound "walking.wav"
y "Oh! The guards!"
y "I need to hide!"
label menu3:
    $ time = 5
    $ timer_range = 5
    $ timer_jump = 'menu3_slow'
    show screen countdown
    menu:
        "Hide in closet":
            hide screen countdown
            jump closet_end
        "Hide in a room":
            hide screen countdown
            jump room_end
   
label menu3_slow:
ga "Hey! What are you doing in here?!"
"You got caught"
jump guestrooms

####

if john_Point == 1:
    show john medal with dissolve 
    $ john_Point += 1
    y "Is that a medal?"
    y "Why does it look familiar?"
    y "Wait, I remember where I've seen this."
    y "John Rolfe wore it the night of the party."
    y "But why is it here?"
    hide john medal with dissolve
    jump nextday
    
######
    
if john_Point == 2:
     jump johnending

label johnending: 
    y "Time to find John."
    scene hallway with dissolve 
    play sound "knock1.wav"
    play music "mystery.wav"
    y "John, are you in there?"
    show john happy with dissolve 
### lines 1559-1609 are all conversation
    scene black 
    play sound "knock1.wav" 
    y "Seriuosly?" 
    play sound "knock2.wav"
    y "Can I not get one good night of sleep?!"
    show your room with dissolve 
    y "Who the hell is it?"
    k "Detective Kent Mansley. I talked to you a few days ago?"
    y "Oh, ..."
    play sound "dooropen1.wav"
    show kent paper with dissolve 
    y "What can I do for you?"
    k "Just a routine check in. Wanted to know if you remembered anything else?"
    y "Oh, umm..."

menu:
    "Turn John in":
        jump turnjohnin
    "Protect John":
        jump protectjohn

label turnjohnin:
    y "I went to see Prince John yesterday."
    y "He confesed to me that he killing Gaston."
    k "Are you certain? Accusing a royal is a serious accusation."
    y "I'm aware. He confesed."
    k "Alright. Thank you for your time."
    hide kent paper with dissolve
    hide your room with dissolve 
    show black 
    pause 1.0
    show john arrested with dissolve 
    n "This just end..."
    n "Prince John Rolfe of England has been arrested for the muder of Gaston La Bête."
    n "Prince John's trial will be held in the next upcoming days."
    pause 1.0
    show john arrested card with dissolve 
    pause 2.0
return 
    

label protectjohn:
    y "No, I haven't remembered anything new."
    k "Are you sure about that?"
    y "Yep, positive."
    k "Alright, thank you."
    hide kent papaer with dissolve
    play sound "doorclose.wav"
    hide your room with dissolve 
    scene front gate day with dissolve 
    pause 0.5
    show john happy with dissolve 
    j "Hey. I assume you saw the news?"
    y "About Gaston's murder case? Yeah."
    j "They couldn't find enough evidence to accuse anyone."
    y "How lucky, huh."
    j "Did you come to say bye?"
    y "Bye?"
    j "I'm leaving for England now."
    y "Oh..."
    j "Thank you for not telling anyone, [name]."
    j "I will be trying to make up for my mistakes for the rest of my life."
    y "I know."
    y "See you around?"
    j "Sure. See you around."
    show john returned with dissolve 
    pause 2.0
    show john never with dissolve 
    pause 2.0
return     
    

Code: Select all

label dinningroom:
    $ rapunzel_Point += 1 
    y "I think I'll check the dining room first."
    y "That's where the most foot work is."
    hide inside gate with dissolve 
    scene dining room with dissolve
    y "I'm here, now what?"
    play sound "walking.wav"
    y "Oh! The guards!"
    y "I need to hide!"

if rapunzel_Point == 1:
    show rapunzel mask with dissolve
    $ rapunzel_Point += 1
    y "That mask looks familiar."
    y "Oh yeah! Rapunzel was wearing this mask at the party."
    y "But why did that person have it?"
    y "Unless..."
    hide rapunzel mask with dissolve
    jump nextday
    
if rapunzel_Point == 2:
    jump rapunzelending

label rapunzelending: 
    y "Time to find Rapunzel."
    play music "mystery.wav"
    scene dining room with dissolve 
    y "If I were a princess, where would I be?"
    show rapunzel cute with dissolve 
    r "[name]! How are you?"
### lines 1692-1747 are all dialog
    scene black 
    pause 1.0
    play sound "knock1.wav" 
    y "Seriuosly?" 
    play sound "knock2.wav"
    y "Can I not get one good night of sleep?!"
    show your room with dissolve 
    y "Who the hell is it?"
    k "Detective Kent Mansley. I talked to you a few days ago?"
    y "Oh,..."
    play sound "dooropen1.wav"
    show kent paper with dissolve 
    y "What can I do for you?"
    k "Just a routine check in. Wanted to know if you remembered anything else?"
    y "Oh, umm..."

menu:
    "Turn Rapunzel in":
        jump turnrapunzelin
    "Protect Rapunzel":
        jump protectrapunzel

label turnrapunzelin:
    y "I spoke to Princess Rapunzel yesterday."
    y "She told me what happened."
    k "What did she say?"
    y "She pushed Gaston and he hit his head against a table."
    k "I see. Thank you for telling me."
    hide kent paper with dissolve 
    y "No problem..."
    scene black 
    pause 1.0
    show rapunzel arrested with dissolve 
    n "This just end..."
    n "Princess Rapuznel of Carona has been arrested for the muder of Gaston La Bête."
    n "Princess Rapunzel's trial will be held in the next upcoming days."
    n "There is also a rumor saying that the Princess's family with be dethroned before the Princess's trial..."
    n "As to not persuade the jury in her favor."
    pause 1.0
    show rapunzel arrested card with dissolve 
    pause 2.0
return 

label protectrapunzel:
    y "No, I haven't remembered anything new."
    k "Are you sure about that?"
    y "Yep, positive."
    k "Alright, thank you."
    hide kent papaer with dissolve
    play sound "doorclose.wav"
    hide your room with dissolve 
    scene hallway with dissolve 
    show rapunzel cute with dissolve 
    r "Hey! [name]!"
    y "Hi Rapunzel."
    r "Did you see the news?"
    y "About Gaston? Yeah."
    r "The police couldn't find enough evidence to pin point any suspects."
    y "Yeah, that's good news."
    show rapunzel nervous with dissolve 
    r "For me anyway."
    show rapunzel cute with dissolve 
    r "So, what brings you here?"
    y "I came to actually ask for a job."
    show rapunzel sad with dissolve 
    r "Really? Doing what?"
    y "The royal mouse catcher, of course."
    y "Plus, you owe me one."
    show rapunzel nervous with dissolve 
    r "Yeah, I sure do."
    r "Okay, follow me!"
    r "I'll get you all signed up."
    hide rapunzel nervous with dissolve 
    hide hallway with dissolve 
    pause 0.5
    show rapunzel end 1 with dissolve 
    pause 0.5
    show rapunzel end 2 with dissolve 
    pause 0.5
return
Dimitri's is relatively the same, just different dialog.
Last edited by Night130 on Sun Jun 03, 2018 9:34 am, edited 1 time in total.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Points endings not working

#5 Post by kivik » Sun Jun 03, 2018 9:24 am

With the screen showing - can you see if the variables are behaving as they should when it gets to the ending? Basically are the variables showing the right values, but the wrong endings are shown, or the variables are showing the wrong values?

If the variables are right then we need to see all the codes around the endings; if the variables are wrong, we need to understand what you're doing with with the variables and the parts that the variables go wrong (play your game, watch the variables in the corner of your screen and see if when they don't add correctly.

Just to make life easier, change the screen code to this:

Code: Select all

screen show_points:
    vbox:
        xalign 1.0
        yalign 0.0
        text "rapunzel:[rapunzel_Point]"
        text "anya:[anya_Point]"
        text "dimitri:[dimitri_Point]"
        text "john:[john_Point]"

Night130
Newbie
Posts: 13
Joined: Sun Apr 22, 2018 9:57 am
Contact:

Re: Points endings not working

#6 Post by Night130 » Sun Jun 03, 2018 10:02 am

I played through the game, and all of the points add up correctly. Anya's ending still works, while the other 3's ending all jump to Johns.

Edit: I got it to work! I move all of the if _Points together. Before I just had if _Points with their ending right underneath. Turns out I needed them together like this:

Code: Select all

if john_Point == 2:
     jump johnending

if rapunzel_Point == 2:
    jump rapunzelending

if dimitri_Point == 2:
    jump dimitriending
Thank you all for helping!

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: SOLVED Points endings not working

#7 Post by kivik » Sun Jun 03, 2018 10:31 am

Cool! I had a feeling you had them in strange places but would be hard to figure out without seeing the code!

Good job figuring it out and fixing :)

Post Reply

Who is online

Users browsing this forum: Newnewbie, Rydetox