[SOLVED] Invisible love meter?
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.
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.
- Rinzamakani
- Regular
- Posts: 74
- Joined: Wed Aug 16, 2017 3:23 pm
- Completed: Love's Apathy (Ciro route), A Frigid Space, Telechronic Static
- Projects: Love's Apathy (Full)
- itch: rinzamakani.itch.io
- Contact:
[SOLVED] Invisible love meter?
Hello. I was wondering if there was a way to make an invisible love meter? Like the player would collect points for each character (there are 5). But instead of showing a bar or anything, the game would keep track of how many points the player has to get an ending. So if character1 has less than or is at 30 love points, they'd get the bad end. If between 40 and and 60 points, they'd get the normal end and above 70 is the good end. But if the player gets 100, they'd get a perfect ending. I was thinking of using this meter and go by 10s.
Last edited by Rinzamakani on Sun Oct 01, 2017 11:04 am, edited 1 time in total.
- PyTom
- Ren'Py Creator
- Posts: 15893
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Invisible love meter?
Usually, these are just called "points."
The way to do this is to use the default statement to initialize a points variable, and then to test it.
It rapidly become more complex when you have characters with multiple endings.
The way to do this is to use the default statement to initialize a points variable, and then to test it.
Code: Select all
default eileen_points = 0
Code: Select all
$ eileen_points += 10
Code: Select all
if eileen_points > 70:
jump good_end
else:
jump bad_end
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom
- Rinzamakani
- Regular
- Posts: 74
- Joined: Wed Aug 16, 2017 3:23 pm
- Completed: Love's Apathy (Ciro route), A Frigid Space, Telechronic Static
- Projects: Love's Apathy (Full)
- itch: rinzamakani.itch.io
- Contact:
Re: Invisible love meter?
Thank you. But can I ask where to put these codes? Is it specific or can they be placed anywhere?PyTom wrote: ↑Thu Sep 28, 2017 10:44 amUsually, these are just called "points."
The way to do this is to use the default statement to initialize a points variable, and then to test it.
Code: Select all
default eileen_points = 0Code: Select all
$ eileen_points += 10It rapidly become more complex when you have characters with multiple endings.Code: Select all
if eileen_points > 70: jump good_end else: jump bad_end
- RicharDann
- Veteran
- Posts: 284
- Joined: Thu Aug 31, 2017 11:47 am
- Contact:
Re: Invisible love meter?
Normally it's a good idea to put all of the variable declarations with default before the start label, the ones using the $ sign are to be placed inside the script, in the exact point where you want the variable to change, and the if statement when you want to check the variable's value. So, if you're planning to put all this in your script.rpy file, it would be like this:
Code: Select all
define e = Character("Eileen")
default eileen_points = 0
label start:
"This is where the game begins."
# Later in the game, when you want to increase the variable
"Eileen is looking at you. What will you say?"
menu:
"I like you":
$ eileen_points += 10 #Increase Eileen's love points
"Don't say anything":
pass #Nothing happens
# Later in the game, we check what ending will the player get.
if eileen_points >= 100:
jump eileen_perfect_end
elif eileen_points in range(70,90):
jump eileen_good_end
elif eileen_points in range(40,60):
jump eileen_normal_end
elif eileen_points < 30:
jump eileen_bad_end
#These are the different endings
label eileen_perfect_end:
e "I love you too! Let's get married right now!"
"Perfect Ending."
return #This ends the game
label eileen_good_end:
e "I love you! Let's go on a date tomorrow."
"Good Ending."
return
label eileen_normal_end:
e "I like you too, but we should take things slowly."
"Normal Ending."
return
label eileen_bad_end:
e "I'm sorry, but this won't work."
"Bad end."
return
The most important step is always the next one.
- Rinzamakani
- Regular
- Posts: 74
- Joined: Wed Aug 16, 2017 3:23 pm
- Completed: Love's Apathy (Ciro route), A Frigid Space, Telechronic Static
- Projects: Love's Apathy (Full)
- itch: rinzamakani.itch.io
- Contact:
Re: Invisible love meter?
This helps! Thank you! I'm actually breaking up my project into multiple .rpy files by the different scenes. But wait. Is there a way to remove points? Like if the player makes a bad choice? I'm guessing it would be:RicharDann wrote: ↑Thu Sep 28, 2017 1:38 pmNormally it's a good idea to put all of the variable declarations with default before the start label, the ones using the $ sign are to be placed inside the script, in the exact point where you want the variable to change, and the if statement when you want to check the variable's value. So, if you're planning to put all this in your script.rpy file, it would be like this:
Code: Select all
define e = Character("Eileen") default eileen_points = 0 label start: "This is where the game begins." # Later in the game, when you want to increase the variable "Eileen is looking at you. What will you say?" menu: "I like you": $ eileen_points += 10 #Increase Eileen's love points "Don't say anything": pass #Nothing happens # Later in the game, we check what ending will the player get. if eileen_points >= 100: jump eileen_perfect_end elif eileen_points in range(70,90): jump eileen_good_end elif eileen_points in range(40,60): jump eileen_normal_end elif eileen_points < 30: jump eileen_bad_end #These are the different endings label eileen_perfect_end: e "I love you too! Let's get married right now!" "Perfect Ending." return #This ends the game label eileen_good_end: e "I love you! Let's go on a date tomorrow." "Good Ending." return label eileen_normal_end: e "I like you too, but we should take things slowly." "Normal Ending." return label eileen_bad_end: e "I'm sorry, but this won't work." "Bad end." return
$ eileen_points -= 10
- RicharDann
- Veteran
- Posts: 284
- Joined: Thu Aug 31, 2017 11:47 am
- Contact:
Re: Invisible love meter?
Yes you're correct, it's pretty straightfoward as you can see, += is used for adition, -= for substraction, *= for multiplication and /= for division, in case you ever need to use those. Also keep in mind that a single = sign sets the variable to the value you want as you see in
default eileen_points = 10
Double equals signs == are used if you need to do a comparison.
Also good call separating the project into multiple files, it's more organized and easier to mantain that way
default eileen_points = 10
Double equals signs == are used if you need to do a comparison.
Also good call separating the project into multiple files, it's more organized and easier to mantain that way
The most important step is always the next one.
- Rinzamakani
- Regular
- Posts: 74
- Joined: Wed Aug 16, 2017 3:23 pm
- Completed: Love's Apathy (Ciro route), A Frigid Space, Telechronic Static
- Projects: Love's Apathy (Full)
- itch: rinzamakani.itch.io
- Contact:
Re: Invisible love meter?
Yes. It is. Thanks for the help! Appreciated! I think that's all I need for now.RicharDann wrote: ↑Thu Sep 28, 2017 3:59 pmYes you're correct, it's pretty straightfoward as you can see, += is used for adition, -= for substraction, *= for multiplication and /= for division, in case you ever need to use those. Also keep in mind that a single = sign sets the variable to the value you want as you see in
default eileen_points = 10
Double equals signs == are used if you need to do a comparison.
Also good call separating the project into multiple files, it's more organized and easier to mantain that way![]()
Who is online
Users browsing this forum: Bing [Bot]