Day/Night system help!

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
Tritonials
Newbie
Posts: 16
Joined: Fri Sep 21, 2018 6:32 pm
Completed: None. Still learning how to code.
Contact:

Day/Night system help!

#1 Post by Tritonials »

Hello, This is a newbie post and i need help on stuff and backgrounds for a day and night system. Basically, the game has 4 parts of the day. Morning, Noon, Afternoon and night.
So it goes like this..

Code: Select all

label start:
    $ day = 4
    menu day1:
        "Park":
            c "you went out on a walk."
            $ day -= 1
            c "you now have [day] points."
        "Pool":
            c "You went swimming."
            $ day -= 1
            c "You now have [day] points."
        "Rest":
            c "You slept good."
            $ day += 4
            c "You now have [day] points."
But i don't want it to go beyond 4 points and if there's no point left i need to make the player rest and make it unable to do more stuff. And also the background would change from day to night as the day points go from 4 to 1. Kinda like the Summertime Saga day/night engine! How do i do this? Any help will be lovely! :D

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Day/Night system help!

#2 Post by Per K Grok »

Tritonials wrote: Sat Dec 29, 2018 12:42 pm Hello, This is a newbie post and i need help on stuff and backgrounds for a day and night system. Basically, the game has 4 parts of the day. Morning, Noon, Afternoon and night.
So it goes like this..

Code: Select all

label start:
    $ day = 4
    menu day1:
        "Park":
            c "you went out on a walk."
            $ day -= 1
            c "you now have [day] points."
        "Pool":
            c "You went swimming."
            $ day -= 1
            c "You now have [day] points."
        "Rest":
            c "You slept good."
            $ day += 4
            c "You now have [day] points."
But i don't want it to go beyond 4 points and if there's no point left i need to make the player rest and make it unable to do more stuff. And also the background would change from day to night as the day points go from 4 to 1. Kinda like the Summertime Saga day/night engine! How do i do this? Any help will be lovely! :D
To make sure the number of points never gets larger than 4 you can add this after each time something is added to day.

Code: Select all

if day >4:
	$ day=4
To stop the player from doing stuff when they have no points left you could do something like this.

Code: Select all

if day ==0:
	c "You don't have any points left. You need to rest before you can do something more."
else:
	c "you went out on a walk."
	$ day -= 1
	c "you now have [day] points."	
	

User avatar
Tritonials
Newbie
Posts: 16
Joined: Fri Sep 21, 2018 6:32 pm
Completed: None. Still learning how to code.
Contact:

Re: Day/Night system help!

#3 Post by Tritonials »

Ah, Thank you for replying to my post! But i'm still waiting for the answer for my last question which is the backgrounds. But, these will be very helpful Thank you again! :)

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Day/Night system help!

#4 Post by Per K Grok »

Tritonials wrote: Sat Dec 29, 2018 9:29 pm Ah, Thank you for replying to my post! But i'm still waiting for the answer for my last question which is the backgrounds. But, these will be very helpful Thank you again! :)
You could do something like this

Code: Select all

if day==4:
	scene bg morning
elif day==3
	scene bg noon
elif day==2
	scene bg afternoon
else:
	scene bg night

User avatar
Tritonials
Newbie
Posts: 16
Joined: Fri Sep 21, 2018 6:32 pm
Completed: None. Still learning how to code.
Contact:

Re: Day/Night system help!

#5 Post by Tritonials »

Thank you so much for your help and i already figured it out thanks to you! :D

Post Reply

Who is online

Users browsing this forum: Google [Bot]