Persistence and how to work with it

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
Thundy
Regular
Posts: 88
Joined: Tue Dec 05, 2017 9:08 am
Contact:

Persistence and how to work with it

#1 Post by Thundy »

Hey All. so my game is coming on really nicely, but I have had some issues with persistent data.
A lot of my events are triggered based on criteria and flags in the manner outlined below:

Event.criteriaA is true if it is the correct time of day
Event.criteriaB is true if the relevant NPC is in the right location
Event.criteriaC is true if the player is in the right location
Event.isActive is true based on other things and switched to false once the event has ended to prevent it triggering again.

If all 4 are true the event triggers

The issue I am having is that somehow these variables seem to be persisting so when I am testing, i have to manually delete the files in the save folder otherwise the events dont trigger. Its a bit odd since i thought you had to tell renpy if you wanted specific things to persist.

Is there anyone who might have experience or insight into this problem?

User avatar
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Re: Persistence and how to work with it

#2 Post by wyverngem »

Your using persistent variables for one game play through? That’s not their purpose. A persistent variable is used for variables set when the person unlocks something. For example unlocking an achievement you only ever see it once no matter who is playing.

You just need regular variables to set up if a, b, c, and d do this. When the player starts a new game it resets to the default state. It loads whatever state they’re in from the save.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Persistence and how to work with it

#3 Post by xavimat »

These variables should not persist, and probably your problem has another origin. Try using the console or "watch" the variables to test them.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Post Reply

Who is online

Users browsing this forum: Alex, Google [Bot], Majestic-12 [Bot], piinkpuddiin