Save Data carrying over across games (Persistent data?)

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
Destiny-Smasher
Regular
Posts: 29
Joined: Wed Aug 09, 2017 7:10 pm
Projects: DownRight Fierce, Life is Strange: All Wounds
Tumblr: destiny-smasher.tumblr.com
itch: destiny-smasher
Contact:

Save Data carrying over across games (Persistent data?)

#1 Post by Destiny-Smasher » Mon Feb 03, 2020 9:56 am

So the project I'm moving on is long, and I'm trying to release it in smaller chunks, episodically, but I'm unsure about how to carry choices over across the episodes.

posting.php?mode=post&f=8

It LOOKS like this is probably what I'm looking for, right?

So would I create a NEW game in RenPy, copy/paste over the code that is persistent across episodes (ex. sprite/image data, menu stuff), then edit the code for choices in the previous episode that should carry over, create a 'key', paste that same 'persistent data' code into Episode 2, and use that?

I'm having trouble finding out how to do this outside of a simple 'did you finish part 1?' context.

As an example of the sort of thing I'm trying to do, in Episode 1, the reader might receive a text message from someone asking if they want to hang out. If they said yes, then in episode 2, they would have a separate scene where they hang out with that character.

So, for example, would it look something like this?
init python:
mp = MultiPersistent("MyGame")

label start:

# Reply to text

$ ep1text = True
$ mp.save()

p "( Cool, I'll catch you then. )"
And the second part:
init python:
mp = MultiPersistent("MyGame")

label start:

if ep1text:
"You your friend you'd meet them today, better get ready."
jump HangOut
else:
"You're in the mood to be by yourself for a while."
jump NoHangOut

rames44
Veteran
Posts: 232
Joined: Sun May 29, 2016 4:38 pm
Contact:

Re: Save Data carrying over across games (Persistent data?)

#2 Post by rames44 » Mon Feb 03, 2020 1:35 pm

Close, but not quite. Your variable has to be on the “mp” object in order to end up in the multipersistent store

Code: Select all

$mp.ep1text = True
$mp.save()

Code: Select all

if mp.ep1text:
    ....
See https://www.renpy.org/doc/html/persiste ... ersistence

User avatar
Destiny-Smasher
Regular
Posts: 29
Joined: Wed Aug 09, 2017 7:10 pm
Projects: DownRight Fierce, Life is Strange: All Wounds
Tumblr: destiny-smasher.tumblr.com
itch: destiny-smasher
Contact:

Re: Save Data carrying over across games (Persistent data?)

#3 Post by Destiny-Smasher » Thu Feb 06, 2020 7:16 am

Ah, thanks! I will give that a look!

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], span4ev