Remembering variables even if the player reloads the game

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
OldNoEyes
Newbie
Posts: 14
Joined: Wed Nov 20, 2019 7:20 pm
Projects: Black Heaven
itch: oldnoeyes.itch.io
Location: Brooklyn, NYC
Contact:

Remembering variables even if the player reloads the game

#1 Post by OldNoEyes »

I thought it would be terrifying if the player makes a decision, decides to choose something else, reloads the game, and an NPC still remembers the choice they made previously and says something about it.

To be clear, I'm not trying to block rollback--I'm just trying to find a way to increment and store variables in a place that won't be affected by loading saves.

Is there a way to do this?
You opened the box, he came.

User avatar
zankizuna
Veteran
Posts: 416
Joined: Fri May 04, 2012 2:20 am
Completed: Monochrome Valentine
Projects: Softwar
Deviantart: raseru09
itch: ZanKizuna
Location: Manilaaaaaaaa
Contact:

Re: Remembering variables even if the player reloads the game

#2 Post by zankizuna »


User avatar
OldNoEyes
Newbie
Posts: 14
Joined: Wed Nov 20, 2019 7:20 pm
Projects: Black Heaven
itch: oldnoeyes.itch.io
Location: Brooklyn, NYC
Contact:

Re: Remembering variables even if the player reloads the game

#3 Post by OldNoEyes »

Zankizuna, you're a goddamn champion. I've been fiddling around for 2 hours trying to figure this out.

Thanks so much!
You opened the box, he came.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Remembering variables even if the player reloads the game

#4 Post by Imperf3kt »

Note that persistent works across saves as well.
If the player begins a new game, it'll also have the sane variable.

You may need to think of a way to reset the variable on a new game (without resetting it in the existing game) depending on how your game works.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

Post Reply

Who is online

Users browsing this forum: babayi0827, Semrush [Bot]