Page 1 of 1

Save Data carrying over across games (Persistent data?)

Posted: Mon Feb 03, 2020 9:56 am
by Destiny-Smasher
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

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

Posted: Mon Feb 03, 2020 1:35 pm
by rames44
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

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

Posted: Thu Feb 06, 2020 7:16 am
by Destiny-Smasher
Ah, thanks! I will give that a look!