Multiple Ending scripting
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.
- EriksBlue
- Regular
- Posts: 36
- Joined: Tue Jul 19, 2011 3:56 pm
- Projects: Torn Apart
- Location: California
- Contact:
Re: Multiple Ending scripting
I think I understand but does the 'if' work with long stings of dialogue? Also do I need to use 'jump to label' for when dialogue ends and needs to continue in a place farther down than the other dialogue?
-
- Eileen-Class Veteran
- Posts: 1006
- Joined: Thu Dec 22, 2011 4:26 am
- Projects: Eternal Memories, plot bunnies that won't die.
- Organization: HellPanda Studios
- Location: United States
- Contact:
Re: Multiple Ending scripting
Yes, just remember to keep your indentation.
Code: Select all
label start:
$ variable = True
if variable:
"Text"
"Text"
"MOAR TEXT"
"Even more text"
jump next_label
"Random text (not read)"
label not_next_label:
"More random text (also not read)"
"You end up skipping this block of text. (not read)"
label next_label:
"And you end up here instead. (Woah! This text is getting read!)"
(All projects currently on a hiatus of sorts. I blame life.)
Tsundere VN
Not really checking the forums any more due to time constraints, so if you want to contact me, PM. I'll get a notification and log in.
Also, I've been hit and run posting, which means I don't see many replies. If you want to respond to something I've said, also feel free to PM me.
NOTE: if you've got questions about vnovel or things like that, it's Leon that you should be contacting. Leon's been pretty much handling everything, but due to various reasons, I've had to withdraw entirely.
Tsundere VN
Not really checking the forums any more due to time constraints, so if you want to contact me, PM. I'll get a notification and log in.
Also, I've been hit and run posting, which means I don't see many replies. If you want to respond to something I've said, also feel free to PM me.
NOTE: if you've got questions about vnovel or things like that, it's Leon that you should be contacting. Leon's been pretty much handling everything, but due to various reasons, I've had to withdraw entirely.
- EriksBlue
- Regular
- Posts: 36
- Joined: Tue Jul 19, 2011 3:56 pm
- Projects: Torn Apart
- Location: California
- Contact:
Re: Multiple Ending scripting
redeyesblackpanda wrote:Yes, just remember to keep your indentation.Code: Select all
label start: $ variable = True if variable: "Text" "Text" "MOAR TEXT" "Even more text" jump next_label "Random text (not read)" label not_next_label: "More random text (also not read)" "You end up skipping this block of text. (not read)" label next_label: "And you end up here instead. (Woah! This text is getting read!)"
Okay is there also a way to have diffrent variables/multiple choices (like in a otome game/date sim) determine wether you get certain text. Thank you.
-
- Eileen-Class Veteran
- Posts: 1006
- Joined: Thu Dec 22, 2011 4:26 am
- Projects: Eternal Memories, plot bunnies that won't die.
- Organization: HellPanda Studios
- Location: United States
- Contact:
Re: Multiple Ending scripting
This was already answered above, but here's a restatement, since it doesn't seem to be clear.
Code: Select all
label start:
#define your variables here. Every single one of them.
$ made_choice_one = False
$ made_choice_two = False
"Random text before menu."
menu:
"What should I do tomorrow?"
"I'll do this thing that I call choice one":
"Making choice one here"
$ made_choice_one = True
"I'll make this thing that I call choice two":
"Making choice two here"
$ made_choice_two = True
"More random text."
"Well, it's the next day... Yesterday I decided to do something... what was it?"
if made_choice_one:
"Oh, that's right! I decided to do choice one!"
"Okay, I'll do choice one."
if made_choice_two:
"Oh, that's right! I decided to make choice two!"
"Okay, I'll do choice two."
return
(All projects currently on a hiatus of sorts. I blame life.)
Tsundere VN
Not really checking the forums any more due to time constraints, so if you want to contact me, PM. I'll get a notification and log in.
Also, I've been hit and run posting, which means I don't see many replies. If you want to respond to something I've said, also feel free to PM me.
NOTE: if you've got questions about vnovel or things like that, it's Leon that you should be contacting. Leon's been pretty much handling everything, but due to various reasons, I've had to withdraw entirely.
Tsundere VN
Not really checking the forums any more due to time constraints, so if you want to contact me, PM. I'll get a notification and log in.
Also, I've been hit and run posting, which means I don't see many replies. If you want to respond to something I've said, also feel free to PM me.
NOTE: if you've got questions about vnovel or things like that, it's Leon that you should be contacting. Leon's been pretty much handling everything, but due to various reasons, I've had to withdraw entirely.
-
- Eileen-Class Veteran
- Posts: 1006
- Joined: Thu Dec 22, 2011 4:26 am
- Projects: Eternal Memories, plot bunnies that won't die.
- Organization: HellPanda Studios
- Location: United States
- Contact:
Re: Multiple Ending scripting
No problem. ^^
(All projects currently on a hiatus of sorts. I blame life.)
Tsundere VN
Not really checking the forums any more due to time constraints, so if you want to contact me, PM. I'll get a notification and log in.
Also, I've been hit and run posting, which means I don't see many replies. If you want to respond to something I've said, also feel free to PM me.
NOTE: if you've got questions about vnovel or things like that, it's Leon that you should be contacting. Leon's been pretty much handling everything, but due to various reasons, I've had to withdraw entirely.
Tsundere VN
Not really checking the forums any more due to time constraints, so if you want to contact me, PM. I'll get a notification and log in.
Also, I've been hit and run posting, which means I don't see many replies. If you want to respond to something I've said, also feel free to PM me.
NOTE: if you've got questions about vnovel or things like that, it's Leon that you should be contacting. Leon's been pretty much handling everything, but due to various reasons, I've had to withdraw entirely.
Re: Multiple Ending scripting
SusanTheCat wrote:So lets say that early on the Main Character has the choice to buy some gum or buy a chocolate bar.
We have two kind of variables/stats there. "money" is a number that we can use to see how much money the player has. "item_bought" is a box that we put the name of what they bought in.Code: Select all
# Player starts with twenty money $ money = 20 menu: "Buy Gum": $ item_bought = "gum" $ money -= 5 //subtract 5 from money "Buy Chocolate": $ item_bought = "chocolate" $ money -= 10 //subtract 10 from money
So you go on with your game.
It is now several scene later when you meet up with a little kid that is crying. The player decides to give them something.
You use an if statement to make a decision.
Or lets say the player character has a chance to go to an amusement park. But does he have enough money?Code: Select all
if item_bought == "gum": crying_kid "I hate gum!" if item_bought == "chocolate": crying_kid "I love chocolate!"
That is just a shortened version of the excellent link @redeyesblackpanda provided. But sometime another explanation is useful for understanding.Code: Select all
if money >= 15: //does he have at least 15 money? jump amusementpark_scene else: jump forever_alone_scene
Susan
How do we shown the current money on the screen so that the player can keep track on how much they have money in hand? I know you said
# Player starts with twenty money
but how to let the player know without have to inform them first
#"You have %(coins)d coins remaining. What would you like to buy?"
Is there a way to make a box on the screen letting people know how much money they have?
-
- Regular
- Posts: 93
- Joined: Sat Jun 12, 2010 11:27 am
- Projects: Rogue of Heart, Valkyrie
- Contact:
Re: Multiple Ending scripting
ah, that's where screens come in handy! first you write a quick screen that'll just display your money:
and then in your script, you write "show screen DisplayMoney" somewhere, and then it'll pop up and hang around being useful, like so:
and then to make it go away, just write "hide screen DisplayMoney", and it'll go away.
Code: Select all
screen DisplayMoney:
frame:
xalign 1.0
yalign 0.0
vbox:
text "Money: [playermoney]"
and then in your script, you write "show screen DisplayMoney" somewhere, and then it'll pop up and hang around being useful, like so:
Code: Select all
label start:
scene whatever
$ playermoney = 1
show screen DisplayMoney
mc "huh, I don't have much money! maybe I should change that..."
$ playermoney = 500 #the displaymoney screen will automatically update itself. so handy!
mc "much better!"
- OokamiKasumi
- Eileen-Class Veteran
- Posts: 1779
- Joined: Thu Oct 14, 2010 3:53 am
- Completed: 14 games released -- and Counting.
- Organization: DarkErotica Games
- Deviantart: OokamiKasumi
- Location: NC, USA
- Contact:
Re: A Basic and Easy tutorial.
Go here:EriksBlue wrote:What script do I use to have certain endings play based of choices you made.
1) Through menus choices.
2) Through stats.
Please be specific I've been rather lost when working with renpy.
http://www.otome-games.com/index.php/ma ... otome-game
Read that.
This is the best - and easiest to understand - tutorial for how to make a game that uses stats and menu choices. It's a tutorial for making an otome or dating simulation game, but what you want to know is there, plus how it works!
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed:
"No amount of great animation will save a bad story." -- John Lasseter of Pixar
Most recent Games Completed:
- The Walk[Psychological][NanoWinter] ~ PG New!
- Trap! [ModernFantasy][VN] ~ PG16
- The Adventures of Prince Ivan [Fant/Adv/VN] ~ PG
"No amount of great animation will save a bad story." -- John Lasseter of Pixar
- Starshine
- Veteran
- Posts: 247
- Joined: Mon Jan 30, 2012 7:50 am
- Completed: http://berry-melon.blogspot.co.uk/2016/ ... -2016.html
- Projects: Pancake Surprise (2016)
- Tumblr: http://bettybooplover.tumblr.com
- Deviantart: berry-melon
- Soundcloud: sweepea-1
- Contact:
Re: Multiple Ending scripting
Oh alright, thanks for the link.redeyesblackpanda wrote:Ah, to show numbers takes more programming. The cookbook has a recipe for that: http://www.renpy.org/wiki/renpy/doc/coo ... ion_Screen
http://berry-melon.blogspot.com
I'm not resting until I find
What would make your eyes
Glisten like mine
With loves divine!
Boo-Boo I couldn't aspire....to anything...
Higher...than to fill that one desire to make it
My own....Bop-Bop-a-Dop-Boop-Oop-a-Doop honey?
I'm not resting until I find
What would make your eyes
Glisten like mine
With loves divine!
Boo-Boo I couldn't aspire....to anything...
Higher...than to fill that one desire to make it
My own....Bop-Bop-a-Dop-Boop-Oop-a-Doop honey?
- EriksBlue
- Regular
- Posts: 36
- Joined: Tue Jul 19, 2011 3:56 pm
- Projects: Torn Apart
- Location: California
- Contact:
Re: Multiple Ending scripting
This is a new question how does stacking choices work because I'm making a date sim kind of game and I want to have an accumulated set of choices to result in a certain scene to play. An I’m not sure how I’m supposed to get that to work.
-
- Veteran
- Posts: 356
- Joined: Tue Aug 12, 2008 12:02 pm
- Projects: Valentine Square (writer) Spiral Destiny (programmer)
- Location: The treacherous Brazilian Rainforest
- Contact:
Re: Multiple Ending scripting
Use a variable to track "affection":
Code: Select all
label start:
$ affection = 0
menu:
"do something nice"
affection += 1 # affection is increased by one
if affection > 2:
jump loveydovey
else:
jump friendzoned
Keep your script in your Dropbox folder.
It allows you to share files with your team, keeps backups of previous versions, and is ridiculously easy to use.
It allows you to share files with your team, keeps backups of previous versions, and is ridiculously easy to use.
Re: Multiple Ending scripting
You can also use the and and or keywords if you have different variables that track different kind of events
Code: Select all
label start:
$ i_have_been_nice = False
$ i_have_been_helpful = False
menu:
"Do something nice":
$ i_have_been_nice = True
"Do nothing"
menu:
"Do something helpful":
$ i_have_been_helpful = True
"Do nothing"
if i_have_been_nice and i_have_been_helpful: #if the player has done both
jump i_love_you
elif not (i_have_been_nice or i_have_been_helpful): #if the player has done neither
jump i_hate_you
else:
jump friendzoned
Who is online
Users browsing this forum: Wildmask