Remebring old saves and progress resets with boolean
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.
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.
Remebring old saves and progress resets with boolean
I'm new here and im still learning the python engine and renpy. my questions are these
1. when I add a new boolean to effect a user choice later in the story how can i make an old save that was created before the boolean was coded to work?
So when I'm playtesting to make sure everything works I find i may have to add a new boolean to fix an option in the game that would later affect the story, but however when I create that new Boolean the old save I was using creates an error and the game crashes. This forces me to start the game from the beginning of the game so the new boolean can work without the game crashing. this is obviously a hassle.
Is there any way i can make an old save work with new booleans without it crashing without having to start the game from the begining?
2. Is there any way I can have the player start from the beginning of the game once a route is completed but have it remember the route being completed?
I want to have an endgame secret ending if the player completes all the routes. heres my issue though: I want to be able to tell the program the player did X route as a flag for the secret ending but have the choices in the route reset.
My routes have multiple endings based on what the user choose and has a small little morality meter based on what the user says in the game. i want to reset the progress of the route once its completed so that if the user wants they could replay the route to see the other endings but still have the route being registed as completed for the secret ending.
So in short its this, how do I reset the progress, choices, and morality values of a route but still have a flag to tell the system that the player has completed the route for the secret ending?
1. when I add a new boolean to effect a user choice later in the story how can i make an old save that was created before the boolean was coded to work?
So when I'm playtesting to make sure everything works I find i may have to add a new boolean to fix an option in the game that would later affect the story, but however when I create that new Boolean the old save I was using creates an error and the game crashes. This forces me to start the game from the beginning of the game so the new boolean can work without the game crashing. this is obviously a hassle.
Is there any way i can make an old save work with new booleans without it crashing without having to start the game from the begining?
2. Is there any way I can have the player start from the beginning of the game once a route is completed but have it remember the route being completed?
I want to have an endgame secret ending if the player completes all the routes. heres my issue though: I want to be able to tell the program the player did X route as a flag for the secret ending but have the choices in the route reset.
My routes have multiple endings based on what the user choose and has a small little morality meter based on what the user says in the game. i want to reset the progress of the route once its completed so that if the user wants they could replay the route to see the other endings but still have the route being registed as completed for the secret ending.
So in short its this, how do I reset the progress, choices, and morality values of a route but still have a flag to tell the system that the player has completed the route for the secret ending?
- Ocelot
- Eileen-Class Veteran
- Posts: 1883
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: Remebring old saves and progress resets with boolean
You can check if variable was set and set it to some default value:
To remember variable between different playthroughs, you should use persistent storage.
Code: Select all
label i_have_saved_here:
#....
#Just before our check
python:
if not ("boolean_variable" in globals()):
boolean_variable = True # We agreed to choice by default
if boolean_variable: # if we have agreed to some question before that
pass #do something
else:
pass #do something else
< < insert Rick Cook quote here > >
Re: Remebring old saves and progress resets with boolean
Thanks for the tips, but sorry if this sounds noob-ish as Im still learning the engine, is there anyway I can reset the choices the player selects also? not just the morality choice? reset flags basically?
also sounds noob-ish but how does this help with my new boolean crashing with old saves issue?
also sounds noob-ish but how does this help with my new boolean crashing with old saves issue?
- Ocelot
- Eileen-Class Veteran
- Posts: 1883
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: Remebring old saves and progress resets with boolean
Your old saves are probably crashing because your code tries to refer to nonexistent variable: it didn't exist at the time save was made, so there is no mention of it in save file.how does this help with my new boolean crashing with old saves issue?
This code checks if variable exist and sets it to some sensible value if it isn't.
You just set them to some starting value. You want to do this anyway each time you start a route if only to avoid possible problems with undefined variables.is there anyway I can reset the choices the player selects also?
Like:
Code: Select all
label route_start:
python:
some_flag = False
some_other_flag = False
god_ending_points = 0< < insert Rick Cook quote here > >
Re: Remebring old saves and progress resets with boolean
Thanks for the tips. But how exactly would setting them to a base value work. lemme post an example.
In my route the player asks if the character likes chocolate. this activates a flag like asks_chocolate= true.
This allows a player to bring up they asked this question later in the route. But if they were to replay the route without asking it would act as if they asked later in the story. would I need to set all flag's to false at the start or would there be an easier way of doing this?
Thanks for the help and sorry if I'm being difficult, first time programmer Im trying to learn the engine.
EDIT: i'm basically asking if I would need to set all the flags to false at the start. or is there a way I can create an Array or function to set the needed ones to false?
In my route the player asks if the character likes chocolate. this activates a flag like asks_chocolate= true.
This allows a player to bring up they asked this question later in the route. But if they were to replay the route without asking it would act as if they asked later in the story. would I need to set all flag's to false at the start or would there be an easier way of doing this?
Thanks for the help and sorry if I'm being difficult, first time programmer Im trying to learn the engine.
EDIT: i'm basically asking if I would need to set all the flags to false at the start. or is there a way I can create an Array or function to set the needed ones to false?
- Ocelot
- Eileen-Class Veteran
- Posts: 1883
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: Remebring old saves and progress resets with boolean
First of all I would initialize all flags at start anyway.
In your case it seems that if you do not ask about chocolate, it would not do anything about that variable, therefore it will retain whichever value it had before. If you would set it to False instead, you would not have this problem.
In your case it seems that if you do not ask about chocolate, it would not do anything about that variable, therefore it will retain whichever value it had before. If you would set it to False instead, you would not have this problem.
< < insert Rick Cook quote here > >
Re: Remebring old saves and progress resets with boolean
Hmm seems I need to clean up the code a bit then to make things clearer.
Thank you for your help!
Thank you for your help!
Who is online
Users browsing this forum: Bing [Bot]