[SOLVED] Add a variable to determine if "save and load" feature has been used

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
AsHLeX
Miko-Class Veteran
Posts: 556
Joined: Wed Dec 25, 2013 1:09 pm
Completed: Starlight Dreamers, Mysterious Melody, Town of Memories, Marked, To Fly, The Change, Him From The Past, A Forgotten Memory
Projects: Cafe Mysteria
Location: Malaysia
Contact:

[SOLVED] Add a variable to determine if "save and load" feature has been used

#1 Post by AsHLeX »

Hi everyone, thanks for taking the time to read this question.
I was wondering if it was possible, using Ren'py, to add a variable to determine if the player has used the "save and load" feature.
What I want to do is similar to Witch House, in which there is a secret ending if the player makes it to the end of the game without using the save and load feature (mostly to reward players who don't save scum aka saving and loading to achieve a desirable result).
For this to occur, my question is, is it possible to define a certain variable e.g. save_and_load, so that I can do something like...

Code: Select all

if save_and_load == false: ## never used the save/load feature
	jump true_end
Thanks again!!
Last edited by AsHLeX on Thu Dec 31, 2020 9:33 am, edited 1 time in total.

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: Add a variable to determine if "save and load" feature has been used

#2 Post by _ticlock_ »

Hi, AsHLeX,
You can do something like the following code to count how many times the player loaded in current playthrough:

Code: Select all

default load_count = 0

label after_load:
    $ load_count += 1
Then check if load counter is zero at the end:

Code: Select all

If load_count == 0:
	jump true_end
Although, do you really expect the player to play one run non-stop (without breaks). You probably want to have 'single' autosave so player can leave the game and continue later. In this case you need additionally check if the autosave was used and avoid increasing the counter for such loads.

User avatar
AsHLeX
Miko-Class Veteran
Posts: 556
Joined: Wed Dec 25, 2013 1:09 pm
Completed: Starlight Dreamers, Mysterious Melody, Town of Memories, Marked, To Fly, The Change, Him From The Past, A Forgotten Memory
Projects: Cafe Mysteria
Location: Malaysia
Contact:

Re: Add a variable to determine if "save and load" feature has been used

#3 Post by AsHLeX »

Thanks for the quick reply, _ticlock_! That's exactly what I was looking for :)

Post Reply

Who is online

Users browsing this forum: Google [Bot]