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.
I have a couple of questions that I want to remain hidden unless the character has accrued enough of a stat. When I want that to happen, I'd write out the code like this:
susy "Do you even like pizza?"
menu:
"Yes, of course I do!":
jump pizza_yes
"No, of course I don't!":
jump pizza_no
"How can you even talk about pizza at a time like this? Jim is dead!" if boldness >= 5:
jump pizza_diversion
For some reason, regardless of how much "boldness" the character has, the option will pop up no matter what. I've also tried writing it like this:
susy "Do you even like pizza?"
menu:
"Yes, of course I do!" if boldness <= 5:
jump pizza_yes
"No, of course I don't!" if boldness <=5:
jump pizza_no
"How can you even talk about pizza at a time like this? Jim is dead!" if boldness >= 5:
jump pizza_diversion
That hasn't worked either. Is there something I'm doing wrong?
The code itself seems fine, so the problem might be on how boldness is being defined and updated. Did you use default to initialize the variable? And how are you changing its value?
Quick example:
default boldness = 0
label start:
"Here's a menu to quickly test changes in the boldness variable."
menu:
"Make me bold!":
$ boldness += 3 # increase boldness by 3
"Your current boldness level is [boldness]."
"Make me bolder!":
$ boldness += 5
"Your current boldness level is [boldness]."
susy "Do you even like pizza?"
menu:
"Yes, of course I do!":
jump pizza_yes
"No, of course I don't!":
jump pizza_no
"How can you even talk about pizza at a time like this? Jim is dead!" if boldness >= 5:
jump pizza_diversion
return
I'm defining my stats under the class resource. At the start of the game I set them all to zero, but for the purposes of the example I set boldness to 1 at the start. The way I've defined the class and increase/decrease stats looks like this.