Ending based on Points
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.
Ending based on Points
Hello!
Quick question, I'm making a short game with a good ending and a bad ending, based on how many points you have collected (through choices).
The only thing I haven't been able to code is the last part.
This is what I've got down:
$ lovepoints = 0
menu:
"I'm sort of famous for my battle skills at home (Lie)":
jump lie
"I do have some experience... (Exaggerate)":
$ lovepoints += 1
jump almost
"No...":
$ lovepoints += 2
jump truth
So, let's say the player needs 20 points to get the good ending, otherwise he gets the bad ending, how do I code that?
Thank you ^-^
Quick question, I'm making a short game with a good ending and a bad ending, based on how many points you have collected (through choices).
The only thing I haven't been able to code is the last part.
This is what I've got down:
$ lovepoints = 0
menu:
"I'm sort of famous for my battle skills at home (Lie)":
jump lie
"I do have some experience... (Exaggerate)":
$ lovepoints += 1
jump almost
"No...":
$ lovepoints += 2
jump truth
So, let's say the player needs 20 points to get the good ending, otherwise he gets the bad ending, how do I code that?
Thank you ^-^
Last edited by Saicachii on Tue Dec 09, 2014 12:22 pm, edited 1 time in total.
- Marionette
- Regular
- Posts: 128
- Joined: Thu Apr 21, 2011 12:04 pm
- Completed: https://marionette.itch.io/
- Projects: Get Meowt of Here
- Deviantart: rexx9224
- itch: marionette
- Location: Ireland
- Discord: Marionette#2995
- Contact:
Re: Ending based on Points
If thats all you need then something simple like this should do the trick:
Code: Select all
if duckieepoints >=20:
jump goodEnd
jump badEnd
Re: Ending based on Points
Thank you! I thought it was something like that I just made a small mistake!Marionette wrote:If thats all you need then something simple like this should do the trick:
Code: Select all
if duckieepoints >=20: jump goodEnd jump badEnd
Re: Ending based on Points
I made it work except one thing.
when I do it like this:
if marckpoints >=20:
jump goodEnd
jump badEnd
It jumps to both ends
And when I do it like this:
if marckpoints >=20:
jump goodEnd
if marckpoints <=20:
jump badEnd
It only jumps to the badEnd
Here's how I coded how to get points if that is incorrect and that's why it won't work
label start:
$ duckieepoints = 0
menu:
"I'm sort of famous for my battle skills at home (Lie)":
jump lie
"I do have some experience... (Exaggerate)":
jump almost
$ marckpoints += 1
"No...":
jump truth
$ marckpoints += 3
when I do it like this:
if marckpoints >=20:
jump goodEnd
jump badEnd
It jumps to both ends
And when I do it like this:
if marckpoints >=20:
jump goodEnd
if marckpoints <=20:
jump badEnd
It only jumps to the badEnd
Here's how I coded how to get points if that is incorrect and that's why it won't work
label start:
$ duckieepoints = 0
menu:
"I'm sort of famous for my battle skills at home (Lie)":
jump lie
"I do have some experience... (Exaggerate)":
jump almost
$ marckpoints += 1
"No...":
jump truth
$ marckpoints += 3
- Marionette
- Regular
- Posts: 128
- Joined: Thu Apr 21, 2011 12:04 pm
- Completed: https://marionette.itch.io/
- Projects: Get Meowt of Here
- Deviantart: rexx9224
- itch: marionette
- Location: Ireland
- Discord: Marionette#2995
- Contact:
Re: Ending based on Points
Hmmm, It should only be able to go through one ending if you use jump to go to a new label.
Just make sure theres a tab difference between the two jumps, so they aren't being included in the same if statment. And then make sure your ending label has a return statment to bring the player back to the menu when the ending is finished, that way it wont go through the other ending.
If you want to have both ifs you should change the second one to just <20
otherwise a value of 20 is true for both statments and will hit both.
Just make sure theres a tab difference between the two jumps, so they aren't being included in the same if statment. And then make sure your ending label has a return statment to bring the player back to the menu when the ending is finished, that way it wont go through the other ending.
Code: Select all
label story:
if marckpoints >=20:
jump goodEnd
jump badEnd
label goodEnd:
"You got the good end"
return
label badEnd:
"You got the good end"
return
If you want to have both ifs you should change the second one to just <20
otherwise a value of 20 is true for both statments and will hit both.
Re: Ending based on Points
Still can't get it to work :/
Here's what I have:
label start:
$ marckpoints = 0
menu:
"I'm sort of famous for my battle skills at home (Lie)":
jump lie
"I do have some experience... (Exaggerate)":
jump almost
$ marckpoints += 18
"No...":
jump truth
$ marckpoints += 21
label lie:
s "Hmm really...? Without a weapon? I see..."
d "I- I do I just don't have it with me!"
s "Hmm... Alright."
jump back
label almost:
s "Oh, I see. Guess you won't be totally useless in battle then!"
d "..."
jump back
label truth:
s "Well, I figured as much. I guess I'll just have to show you the ropes then."
d "Yeah, yeah..."
label back:
"--- The Cursed Forest ---"
if marckpoints >=20:
jump goodEnd
if marckpoints <20:
jump badEnd
label goodEnd:
"yay!"
return
(I only have one choice menu right now that's why the choices have so many points)
I tried the other way too, with only one if statement but that didn't work either. Same problems as before.
Here's what I have:
label start:
$ marckpoints = 0
menu:
"I'm sort of famous for my battle skills at home (Lie)":
jump lie
"I do have some experience... (Exaggerate)":
jump almost
$ marckpoints += 18
"No...":
jump truth
$ marckpoints += 21
label lie:
s "Hmm really...? Without a weapon? I see..."
d "I- I do I just don't have it with me!"
s "Hmm... Alright."
jump back
label almost:
s "Oh, I see. Guess you won't be totally useless in battle then!"
d "..."
jump back
label truth:
s "Well, I figured as much. I guess I'll just have to show you the ropes then."
d "Yeah, yeah..."
label back:
"--- The Cursed Forest ---"
if marckpoints >=20:
jump goodEnd
if marckpoints <20:
jump badEnd
label goodEnd:
"yay!"
return
(I only have one choice menu right now that's why the choices have so many points)
I tried the other way too, with only one if statement but that didn't work either. Same problems as before.
- Marionette
- Regular
- Posts: 128
- Joined: Thu Apr 21, 2011 12:04 pm
- Completed: https://marionette.itch.io/
- Projects: Get Meowt of Here
- Deviantart: rexx9224
- itch: marionette
- Location: Ireland
- Discord: Marionette#2995
- Contact:
Re: Ending based on Points
You need to set the points before you jump otherwise they wont be counted.
eg:
eg:
Code: Select all
"No...":
$ marckpoints += 21
jump truth
Re: Ending based on Points
I tried that too but it didn't work :/ I'll try again and see if I missed something! Thank you!
Edit: I don't know why it didn't work before but it did now, thank you so much for the help!!
Edit: I don't know why it didn't work before but it did now, thank you so much for the help!!
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot]