Time Solved!

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
Hotaru Shizuka
Regular
Posts: 25
Joined: Tue Mar 15, 2011 1:11 pm
Contact:

Time Solved!

#1 Post by Hotaru Shizuka »

Okay, I'm making a date sim and I was wondering if anyone knew how to put a time limit on the overall game, like, you have to get a guy by thirty days or you will lose the game, how do you do that? also I was wondering if anyone knew how to put in day names instead of "Day 1".
Last edited by Hotaru Shizuka on Mon Jun 06, 2011 8:37 pm, edited 1 time in total.

EternalDream
Veteran
Posts: 208
Joined: Sat Nov 27, 2010 6:04 pm
Completed: Secret Santa
Projects: Memory Lane
Contact:

Re: Time

#2 Post by EternalDream »

How about just end the game on Day 30 and if the player doesn't get a guy, you write a message saying that they lost? Then after lead them back to the main menu so that they can replay it if they want.

Hotaru Shizuka
Regular
Posts: 25
Joined: Tue Mar 15, 2011 1:11 pm
Contact:

Re: Time

#3 Post by Hotaru Shizuka »

okay, but I wanted to add the days of the week, and I know I can end the game on day 30, but I don't know how to do it.

EternalDream
Veteran
Posts: 208
Joined: Sat Nov 27, 2010 6:04 pm
Completed: Secret Santa
Projects: Memory Lane
Contact:

Re: Time

#4 Post by EternalDream »

Oh... sorry, I didn't read your question properly >.< Adding dates is in the RenPy FAQ, right here :)

Hotaru Shizuka
Regular
Posts: 25
Joined: Tue Mar 15, 2011 1:11 pm
Contact:

Re: Time

#5 Post by Hotaru Shizuka »

okay, thank you, now how do I do the event when they lose?

KimiYoriBaka
Miko-Class Veteran
Posts: 636
Joined: Thu May 14, 2009 8:15 pm
Projects: Castle of Arhannia
Contact:

Re: Time

#6 Post by KimiYoriBaka »

variables. you need them.

for anything you'd like to keep track of during a game just make a new variable for it. if you want to know how many days have gone by without hard coding each day, make a variable called "days" or something and add one to it at the beginning of each day. If you want to keep track of the day of the week, make a variable called "day_of_week" starting with whatever number you associate with the starting day, and reset it at the end of the week.

if you need both you can use the same variable for both with just a little math. for example, if your game starts on monday:

Code: Select all

show_date = True
day = 1
def day_of_week(day):
    n = day % 7
    if n == 0:
        return "Sunday"
    if n == 1:
        return "Monday"
    if n == 2:
        return "Tuesday"
    if n == 3:
        return "Wednesday"
    if n == 4:
        return "Thursday"
    if n == 5:
        return "Friday"
    if n == 6:
        return "Saturday"

def date_overlay():
    if show_date:
        ui.text("Day " + day + " " + day_of_week(day), size=20, color="#ffffff")

config.overlay_functions.append(date_overlay)

Hotaru Shizuka
Regular
Posts: 25
Joined: Tue Mar 15, 2011 1:11 pm
Contact:

Re: Time

#7 Post by Hotaru Shizuka »

cool, thank you.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], mirceea