How do I program this?

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
NadOtavlas
Regular
Posts: 38
Joined: Sat Apr 21, 2018 3:46 am
Contact:

How do I program this?

#1 Post by NadOtavlas »

In the test game I'm making I wanna have choices that are don't exist unless they are unlocked by prior choices.
Example image:
detroit-stormy-night-upper-branch1.jpg
In this image certain paths/choices are impossible unless the player choice to do an prior action that unlocked the ability to choose that option as indicated by the yellow lock icons.

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: How do I program this?

#2 Post by namastaii »

you only need to have a list of variables that are all False by default
default my_variable1 = False
default my_variable2 = False

menu:
"Choice that always shows up":
e "blah blah blah"
"Unlocked choice" if my_variable1:
e "you finally unlocked this choice"

NadOtavlas
Regular
Posts: 38
Joined: Sat Apr 21, 2018 3:46 am
Contact:

Re: How do I program this?

#3 Post by NadOtavlas »

namastaii wrote: Sun Aug 04, 2019 5:41 pm you only need to have a list of variables that are all False by default
default my_variable1 = False
default my_variable2 = False
Where do I put the variable list? And how do I program a choice so that it makes the variable become true?

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: How do I program this?

#4 Post by namastaii »

If you're keeping it simple, you can put those variables in the script before the game starts (where characters are defined in the beginning template and such) and after you picked a choice, you could put any dialogue you want there or jump to another scene but just before in the script you can just change the variable with $. You should look at the documentation and other examples on the forums since there is a lot of information in both.

NadOtavlas
Regular
Posts: 38
Joined: Sat Apr 21, 2018 3:46 am
Contact:

Re: How do I program this?

#5 Post by NadOtavlas »

My bad code, for reference:

Code: Select all

menu:
     "Try to calm down.":
     jump calmdown1
     "Ask question.":
     jump askquestion1
     "Use gun." if bringgun = True:
     jump usegun
The third option is meant to be the unlocked choice.

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: How do I program this?

#6 Post by namastaii »

it needs to be indented correctly but also you don't need to put if it equals true, if you just put "if bringgun:" then it'll assume if it's true otherwise if you want to do the opposite and check that it's false, you'd do "if bringgun == False". Use double == because we use that to check a variable and we use a single = to assign.

Code: Select all

menu:
    "Try to calm down.":
        jump calmdown1
    "Ask question.":
        jump askquestion1
    "Use gun." if bringgun = True:
        jump usegun

Post Reply

Who is online

Users browsing this forum: No registered users