Disable/Enable choices based on previous choices
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.
- Destiny-Smasher
- Regular
- Posts: 29
- Joined: Wed Aug 09, 2017 7:10 pm
- Projects: DownRight Fierce, Life is Strange: All Wounds
- Tumblr: destiny-smasher.tumblr.com
- itch: destiny-smasher
- Contact:
Disable/Enable choices based on previous choices
I've been trying to find info on how to do this but am getting a bit confused.
I'm writing a VN where the protag has various stats that change based on choices the reader makes, and I want to be able to disable or enable choices based on those kinds of factors. Even if it's not possible to do with variables tied to numerical values, at least being able to do so using flags would be really useful.
As an example, I have the main character arrive at a new place, and I want to give the reader multiple chances to choose to spent their free time unpacking their things, so that a later scene in the story can play out two different ways based on whether the reader took one of those chances to unpack their belongings.
So I have
$ Unpack = False
as the default, and when the reader chooses the option, I set the flag to 'True.'
But when I get to a second opportunity, I don't know how to disable that choice for those who already picked it previously.
menu:
"Free time. What do?"
"~unpack~":
If I wanted to ENABLE a choice, ex. if I want something to happen ONLY if they have activated a flag, it looks like I could maybe do this?
menu:
"Free time. What do?"
"~invite someone over~" if Unpack:
But I don't know how to do it if the flag is not active. Would I need to make a separate flag that triggers when anything else is picked?
Basically, I want to have options not even show up as a choice if a specific flag has already been activated, although being able to do so with numerical values (ie having a choice not even show up if a certain stat isn't high enough) would also open up a lot of possibilities.
Any advice on this is appreciated! And I hope ya'll are staying safe during these crazy times.
I'm writing a VN where the protag has various stats that change based on choices the reader makes, and I want to be able to disable or enable choices based on those kinds of factors. Even if it's not possible to do with variables tied to numerical values, at least being able to do so using flags would be really useful.
As an example, I have the main character arrive at a new place, and I want to give the reader multiple chances to choose to spent their free time unpacking their things, so that a later scene in the story can play out two different ways based on whether the reader took one of those chances to unpack their belongings.
So I have
$ Unpack = False
as the default, and when the reader chooses the option, I set the flag to 'True.'
But when I get to a second opportunity, I don't know how to disable that choice for those who already picked it previously.
menu:
"Free time. What do?"
"~unpack~":
If I wanted to ENABLE a choice, ex. if I want something to happen ONLY if they have activated a flag, it looks like I could maybe do this?
menu:
"Free time. What do?"
"~invite someone over~" if Unpack:
But I don't know how to do it if the flag is not active. Would I need to make a separate flag that triggers when anything else is picked?
Basically, I want to have options not even show up as a choice if a specific flag has already been activated, although being able to do so with numerical values (ie having a choice not even show up if a certain stat isn't high enough) would also open up a lot of possibilities.
Any advice on this is appreciated! And I hope ya'll are staying safe during these crazy times.
Re: Disable/Enable choices based on previous choices
You can check whether something is false the same way you check if it's true.
Code: Select all
menu:
"Unpack" if not unpack:
$ unpack = True
"Invite someone over" if unpack:
"blah blah"
"fallback":
pass
-
Dimorphodon
- Newbie
- Posts: 12
- Joined: Sat Mar 21, 2020 9:36 pm
- Contact:
Re: Disable/Enable choices based on previous choices
The way I do it is:
Outside of a menu:
And for a menu:
in the menu's case, option "blah" will always show; "blah2" will only show if unpack is true.
Outside of a menu:
Code: Select all
if unpack == True:
n "blah blah"
Code: Select all
menu:
"blah":
jump scene1
"blah2." if unpack == True: #Tests if unpack is true
jump scene2
- Destiny-Smasher
- Regular
- Posts: 29
- Joined: Wed Aug 09, 2017 7:10 pm
- Projects: DownRight Fierce, Life is Strange: All Wounds
- Tumblr: destiny-smasher.tumblr.com
- itch: destiny-smasher
- Contact:
Re: Disable/Enable choices based on previous choices
Thanks for the help!
Who is online
Users browsing this forum: Ocelot