Point-based change to the story- 3 endings? [SOLVED]

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
User avatar
Cinto
Regular
Posts: 42
Joined: Sat Apr 27, 2013 11:36 pm
Tumblr: geckcellent.tumblr.com
Contact:

Point-based change to the story- 3 endings? [SOLVED]

#1 Post by Cinto » Sun Apr 28, 2013 12:17 am

I get point-based story changes, but would it work with three or more endings? I mean, that was probably a dumb question, but I just wanted to check.

Would that be something like this?

At the beginning of the script
$ good_ending = 0

$ bad_ending = 0

$ true_ending = 0


Then after every choice,
$ good/bad/true_ending += 1

And then lastly
if good_ending > bad_ending
jump good_ending

if bad_ending > good_ending
jump bad_ending

if true_ending > bad_ending and good_ending
jump true_ending


from here, how would I make it so that it would read as "If true_ending is greater than both bad_ending and good_ending, jump to the true ending? Is it just a simple "and" or something else? I'm not very experienced obviously lol.

Any answers would be much appreciated, thanks!
Last edited by Cinto on Sun Apr 28, 2013 6:47 pm, edited 1 time in total.

apricotorange
Veteran
Posts: 479
Joined: Tue Jun 05, 2012 2:01 am
Contact:

Re: Point-based change to the story- 3 endings?

#2 Post by apricotorange » Sun Apr 28, 2013 2:51 am

Code: Select all

  if true_ending > bad_ending and true_ending > good_ending:
Otherwise, it looks like you have the right idea.

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Point-based change to the story- 3 endings?

#3 Post by xela » Sun Apr 28, 2013 6:59 am

Some holes in your approach that can lead to bugs like two or all three variables having equal values or the only way true_ending activates is that if bad_ending == good_ending and does not equal true ending.

Try something like:

Code: Select all

if good_ending <= true_ending >= bad_ending:
    jump true_ending
elif good_ending >= bad_ending:
    jump good_ending
else:
    jump bad_ending
Like what we're doing? Support us at:
Image

User avatar
Cinto
Regular
Posts: 42
Joined: Sat Apr 27, 2013 11:36 pm
Tumblr: geckcellent.tumblr.com
Contact:

Re: Point-based change to the story- 3 endings?

#4 Post by Cinto » Sun Apr 28, 2013 6:46 pm

Thanks for answering my question, that really helps.

Post Reply

Who is online

Users browsing this forum: Google [Bot], Ocelot, zyric