Changing storyline on second playthrough?

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
resiate
Newbie
Posts: 5
Joined: Sat Jul 09, 2016 2:03 am
Contact:

Changing storyline on second playthrough?

#1 Post by resiate »

What I'm trying to do is add options that only appear after the player has completed the game once already, that lead into a deeper "secret" storyline on the second runthrough. A lofty goal, to be certain - is there some way I can make this work (without just copy-pasting the entire first section of the game into a different place)?

User avatar
Obscura
Eileen-Class Veteran
Posts: 1431
Joined: Fri Mar 09, 2012 6:58 pm
Projects: Coming Out On Top
Location: United States
Contact:

Re: Changing storyline on second playthrough?

#2 Post by Obscura »

-deleted and corrected below-
Last edited by Obscura on Wed Jan 30, 2019 11:12 am, edited 1 time in total.
Coming Out On Top - An Adult Gay Dating Sim
website

resiate
Newbie
Posts: 5
Joined: Sat Jul 09, 2016 2:03 am
Contact:

Re: Changing storyline on second playthrough?

#3 Post by resiate »

Obscura wrote: Wed Jan 30, 2019 12:28 am
[SNIPPED]
First of all, thank you, this was much easier than expected and I appreciate it greatly.

Second holy shit I am a giant fan of CooT. Thank you for your time and also your games.

User avatar
Obscura
Eileen-Class Veteran
Posts: 1431
Joined: Fri Mar 09, 2012 6:58 pm
Projects: Coming Out On Top
Location: United States
Contact:

Re: Changing storyline on second playthrough?

#4 Post by Obscura »

Ugh, sorry, DON'T use default! Instead use persistent:

Before your game starts:

Code: Select all

init python:
    if persistent.first_playthrough_completed is None:
        persistent.first_playthrough_completed = False
.....

At the end of your game, and before the "return", put this:

Code: Select all


$ persistent.first_playthrough_completed=True

.....

Now go through your game and whenever parts of the secret storyline appears you can put things like:

Code: Select all

 

"I walked along the road."

if persistent.first_playthrough_completed: #this part and whatever is indented underneath it will only show up if the variable is true

  "I saw a secret path appear."

  menu:

    "Walk along the secret path.":
      jump take_secret_path # if you wish, you can add a label with this name and put the rest of this branch of the story underneath it somewhere else in your code

     "Stay on the road.":
       pass


# continue rest of the main storyline
Sorry about the goof, I was getting flummoxed over trying to figure out some other code last night so my mind was on default.
Coming Out On Top - An Adult Gay Dating Sim
website

Post Reply

Who is online

Users browsing this forum: No registered users