Passing time in a 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
nautilus_nc
Newbie
Posts: 17
Joined: Wed Jan 16, 2019 11:59 pm
Contact:

Passing time in a game ...

#1 Post by nautilus_nc »

Hi people! (sorry the bad English and I really did not want to have to get to the point of asking here!) I have read several topics about 'import time' and etc... I was wanting to make a game that used pc time ( at least) and that it recognizes the passage of the hours...

* The player spends an amount of energy X in action (type move) (This I do quietly (In case I only put a save with automatic save and a reset done by me))

* When this energy is spent I give a check and if it is 0 pause the renpy ".pause" for seconds and I have to rechecar ... if he has enough he will return to the game

* What I need help with and to get this amount of energy to be loaded hourly even with the game closed or not (I wanted to be able to do in pc and android) and that it stops when it reaches a limit (type ' if energy <100: 'or something like this)

   * PS: I also wanted to be able to block access to a minigame every time it was played. (Playable only every 24 hours (based on the time the player played last time the access button is available))

Sorry for the bad english ^^

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Passing time in a game ...

#2 Post by Remix »

You likely do not want to go the full hog and write your own system based on python time module.
Instead, you are likely to get an easier framework built by basing it on:

renpy.get_game_runtime() which returns (iirc) the seconds float counting how long has been spent in non-main-menu areas of the game.

The rest of the code you'll have to write yourself though and you should be aware of RENPY_TIMEWARP in your released game: https://www.renpy.org/doc/html/environm ... ables.html
Frameworks & Scriptlets:

nautilus_nc
Newbie
Posts: 17
Joined: Wed Jan 16, 2019 11:59 pm
Contact:

Re: Passing time in a game ...

#3 Post by nautilus_nc »

you know if i can use import time for make my 'PS' ?

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Passing time in a game ...

#4 Post by Remix »

Python's time module is incorporated within Ren'Py, so if you wanted (inside an init python: block) you can easily do import time
Frameworks & Scriptlets:

Post Reply

Who is online

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