• To improve security, we will soon start forcing password resets for any account that uses a weak password on the next login. If you have a weak password or a defunct email, please update it now to prevent future disruption.

Ren'Py Force players to restart at certain scene

kytee

Member
Dec 17, 2018
291
680
Hey guys, so here's the scenario. Let's assume that I have a previously released a chapter of my VN, then on my next chapter, I decided to change some stuff in the ending of the first chapter. How do I make it so that people who load into their previous save in the new release get pushed back to the scene before the changes occur? This is to make it so that they are forced to replay the new ending. I also want to make sure that we don't skip to this point if the player hasn't gotten to where I've changed the story.

I'm thinking the solution has something to do with using label after_load: to intercept the load and jump to the scene before the changes. I'm just not sure how to check to make sure a player has passed that scene before jumping them back there. Also, one problem I'm running into is that the solution should only check the save once. Let's say that a player has already been sent back to the scene before the changes, and then played to the newest chapter and makes a save there. If he reloads, the code shouldn't pull him all the way back to the first chapter before the changes again.

Any thoughts?
 
Last edited:

rayminator

Engaged Member
Respected User
Sep 26, 2018
3,040
3,118
it's best to create a save for your players instead guessing where they really are in the game
it can be done but lot of dev don't do it. it's because of any changes in the code that it can break the save
game bright past dev tried that but it was a waste of time and give up on it
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,213
14,963
Hey guys, so here's the scenario. Let's assume that I have a previously released a chapter of my VN, then on my next chapter, I decided to change some stuff in the ending of the first chapter.
What kind of stuff ? Because forcing the players to replay a scene also mean doing twice everything that is in this scene.


How do I make it so that people who load into their previous save in the new release get pushed back to the scene before the changes occur? This is to make it so that they are forced to replay the new ending. I also want to make sure that we don't skip to this point if the player hasn't gotten to where I've changed the story.
Well, there's many way to do this.

The most obvious one would looks more or less like this:
Python:
label whatever:
    $ whateverControlChan = True

    [your content]

    if hasattr( store, "whateverControlChan" ) and whateverControlChan:
        jump nextLabel

    jump whatever
If the player come from another label, the flag is raised, and therefore at the end of the label, the player will be sent to the continuation of the game.
But, if he saved while being inside this label, the flag will be unknown, and at the end of the label, the player will be sent back at it start. Then the flag will be raised and you already know what will happen.
And, no, this wouldn't works from the "after_load" label. Whatever the place where the save would have been made, the flag would be unknown. This even if you initialize it with default. What mean that you would have no way to know where the player was when he saved.

There a set keeping track of all the already seen labels, but it's a global value. This mean that the list isn't related to this particular play, and a label can be marked as "seen" just because it have been seen during another playthrough. Do not use it to try to guess what content the player have seen or not, except if it's as part of a gallery or achievement mechanism.


This being said, it's the most obvious solution, not the most efficient. If the player saved, let's say two lines after the start of the label, he will have to pass through the rest of the label once, then will pass through it a second time. But you can benefit form Ren'Py behavior to solve this.

If the changes in a label are significant enough for Ren'Py to not be able to find the save point, then when the save file will be loaded, Ren'Py will restart at the top of the label.
Therefore, something like this should works:
Python:
label whatever:
    jump whateverUpdated

label whateverUpdated:
    [your new content]
It will be totally transparent for a player who haven't reach the updated label yet, while a player who saved inside the label, whatever at what moment inside it, will be taken back to the only line still in it, and from there forced to replay the label you updated.



All this being said, it's way better to plan all this beforehand. As I implied above, depending of the changes the consequences can be really not pleasant. Variable increased/decreased twice, opposite flags being both raised because the player decided to make a different choice the second time, are part of the possible consequences.
Changes in previously released content should limit to bug fixes and narratives. Everything regarding the game mechanism and player decision shouldn't be changed, except eventually one time, when you release the final version.
 

kytee

Member
Dec 17, 2018
291
680
What kind of stuff ? Because forcing the players to replay a scene also mean doing twice everything that is in this scene.
I added an additional choice before the ending and variables to track which choice the player made. Other than that, it mostly plays the same.

If the changes in a label are significant enough for Ren'Py to not be able to find the save point, then when the save file will be loaded, Ren'Py will restart at the top of the label.
Therefore, something like this should works:
Python:
label whatever:
    jump whateverUpdated

label whateverUpdated:
    [your new content]
It will be totally transparent for a player who haven't reach the updated label yet, while a player who saved inside the label, whatever at what moment inside it, will be taken back to the only line still in it, and from there forced to replay the label you updated.
I'll probably give this a try. Worst comes to worst, I'll just have to force everyone to play through the whole game again or implement a catch-up system that allows a player to skip the content but make all the choices in the first chapter until the part where the changes occur.