[solved] repeated events in a sim game

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
User avatar
REDREDSWAP
Newbie
Posts: 15
Joined: Sat Jun 23, 2018 9:49 am
Projects: Road to Hinata
Location: Canada
Contact:

[solved] repeated events in a sim game

#1 Post by REDREDSWAP »

i'm currently working on a sim game where the active part of the story is over a period of five days. the day is divided in three parts: morning, afternoon and evening. morning is a passive part of the day for the narrator, the afternoon and the evening are the only moment in the day where the player is active (deciding what the narrator does during the day).

my game gives the same options for the five days. for example, in the afternoon, the player can decide to:
  • go on a date with her love interest
  • walk around the city
  • go shopping
if the player decides to walk around the city, she'll run into a character named kayla and talk to her.

the thing is, i want to code every each of the five days separately and write five different dialogues (the first one is when the narrator and kayla run into each other in the city for the first time, the second one is when they run into each other for the second time and so on until five times.) so someone playing my game could choose the option of walking around the city in the afternoon five times during the active part of the game.

however i don't know how to queue my dialogues (if that makes sense?). how should i set up my if statements and variables so that the dialogues still follow order (1st meeting, 2nd meeting, 3rd meeting, etc) when the player chooses (for example) to walk around in the city in the afternoon on day 2 and does it again on day 4?
Last edited by REDREDSWAP on Mon Jul 23, 2018 11:47 am, edited 1 time in total.
ImageImage
no thread yet but will create one soon! looking for a proofreader

philat
Eileen-Class Veteran
Posts: 1900
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: repeated events in a sim game

#2 Post by philat »

Disregarding more complex solutions and focusing on simplicity:

Code: Select all

default city_convo = 0 # use variable to track how  many city conversations have been seen

label start:
    menu schedule:
        "What should I do?"
        "Go on a date":
            pass
        "Walk around the city":
            jump city_convos
        "Go shopping":
            pass

label city_convos:
    $ city_convo += 1 # add to the variable
    jump expression "city_convo" + str(city_convo) # jump to city_convo1, city_convo2, etc.

label city_convo1:
    "First"
    jump schedule # return to loop

label city_convo2:
    "Second"
    jump schedule
    
# and so on and so forth

User avatar
REDREDSWAP
Newbie
Posts: 15
Joined: Sat Jun 23, 2018 9:49 am
Projects: Road to Hinata
Location: Canada
Contact:

Re: repeated events in a sim game

#3 Post by REDREDSWAP »

i tested it and it works!! thank you sooo much <3
ImageImage
no thread yet but will create one soon! looking for a proofreader

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot]