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.
if has_visited_kitchen == False:
#Events for the first time visit
$ has_visited_kitchen = True
jump next_label
elif has_visited_kitche == True:
#Events for the second visit
jump next_label
So basically, upon the first visit to the kitchen the variable has_visited_kitchen is set to True, which means on subsequent visits the game will know the player has been there and can run a separate block of code.
if has_visited_kitchen == False:
#Events for the first time visit
$ has_visited_kitchen = True
jump next_label
elif has_visited_kitche == True:
#Events for the second visit
jump next_label
So basically, upon the first visit to the kitchen the variable has_visited_kitchen is set to True, which means on subsequent visits the game will know the player has been there and can run a separate block of code.
D:!! I think It worked! I will report this in a while after I try the other codes too XD
Sorry Im a complete noob to this ;_;---It doesnt work what I did was the following:
the label "cho2" is the menu that appears after you make your first visit in any of the 3 locations
label cho2:
c"Well, Shall we go now?"
o"*nods*"
play music "two_warriors.mp3"
menu:
"Go to the Basement":
jump ba
"Go to the Kitchen":
jump ki
"Go to the Watchtower":
jump wt
label ki:
if has_visited_kitchen == False:
#Events for the first time visit
$ has_visited_kitchen = True
jump ki2
elif has_visited_kitchen == True:
#Events for the second visit
jump ki2
SpoilerDuck wrote:Did you declare the variable has_visited_kitchen as 'false' at the beginning of your game? You'd want to place it in your Start label, so:
Replace cho2 with whatever label you actually want the player to go to first etc.
I think..I might be doing something wrong...But Im not sure what it is...
I did declare it at the start of the game(I realized I had to because of this), but when I used the other code before the scene it took me directly to the second scene the first time
when I messed a bit with the code..The game freezed orz
The game code goes like this_
label start:
$ has_visited_kitchen = False
$ has_visited_basement = False
$ has_visited_watchtower = False
$ corvus = 0
$ vorges = 0
$ gervase = 0
$ lilja = 0
#blablabla goes here
c"Why dont we explore the tower a little...I think there were some slav- I mean servants inside"
o"*nods*"
play music "scale-two_warriors.mp3"
menu:
"Go to the Basement":
jump ba
"Go to the Kitchen":
jump ki
"Go to the Watchtower":
jump wt
#If you jump to any of those labels, they in the end will lead you to cho2
label cho2:
c"Well, Shall we go now?"
o"*nods*"
play music "scale-two_warriors.mp3"
menu:
"Go to the Basement":
jump ba
"Go to the Kitchen":
jump ki
"Go to the Watchtower":
jump wt
label ki:
if has_visited_kitchen == False:
$ has_visited_kitchen = True
jump ki2
elif has_visited_kitchen == True:
jump ki2
stop music fadeout 1.5
scene black with aaa
c"Whats the matter with this tower. Each place stinks worst than the other!"
o"..."
has_visited_kitchen == True:
jump ki2
stop music fadeout 1.5
scene black with aaa
c"Whats the matter with this tower. Each place stinks worst than the other!"
o"..."
Everything after "jump ki2" is going to be ignored, as you've already jumped to a different label.
If you want to do it via separate labels, you want "has_visited_kitchen == False" to send the player to a 'ki1' and "has_visited_kitchen == True" to send the player to ki2. You don't need to send them elsewhere though.