Page 1 of 1
How do I program this?
Posted: Sun Aug 04, 2019 5:33 pm
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:
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.
Re: How do I program this?
Posted: Sun Aug 04, 2019 5:41 pm
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"
Re: How do I program this?
Posted: Sun Aug 04, 2019 6:12 pm
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?
Re: How do I program this?
Posted: Sun Aug 04, 2019 6:21 pm
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.
Re: How do I program this?
Posted: Sun Aug 04, 2019 7:24 pm
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.
Re: How do I program this?
Posted: Sun Aug 04, 2019 7:31 pm
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