Ending Scores - How to Code?

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
Siri
Newbie
Posts: 18
Joined: Mon May 23, 2016 4:45 pm
Contact:

Ending Scores - How to Code?

#1 Post by Siri »

Hi,

I was wondering how to correctly code the endings (if you have 3 endings)? (For example, as shown below, how would you write points greater or equal to 25, but less than 50)

Code: Select all

                    label Endings:
                        
                        if Points >= 50:
                            
                            "Vampire Ending"
                            
                            return

                        if Points #How would you write points greater or equal to 25, but less than 50?
                            
                            "Manservant Ending"
                            
                            return
                            
                        if Points < 25:
                            
                            "Brute Ending"
                            
                            return
Me and my partner are rather new to renpy, so if I did something wrong in the code, please show an example with code. Thanks :)

User avatar
mobychan
Veteran
Posts: 275
Joined: Fri Apr 24, 2015 6:31 am
Projects: The Chosen - Sakura Pink & Gentian Blue
Organization: Foresoft
Location: Germany
Contact:

Re: Ending Scores - How to Code?

#2 Post by mobychan »

just connect the conditions with and:

Code: Select all

Points >= 50 and Point <= 25
In your case you could simply change your code to this as well:

Code: Select all

                    label Endings:
                        if Points >= 50:
                            "Vampire Ending"
                            return
                        elif Points >= 25:
                            "Manservant Ending"
                            return
                        else:
                            "Brute Ending"
                            return

Siri
Newbie
Posts: 18
Joined: Mon May 23, 2016 4:45 pm
Contact:

Re: Ending Scores - How to Code?

#3 Post by Siri »

Thank you so much, both of your methods seem work :D

Post Reply

Who is online

Users browsing this forum: No registered users