0 votes
by (1.1k points)
edited by
Hi guys, I'm about doubts in an efficient way to put a function in the whole game. For example, the character is on the street at night, when it is 11 at night he should automatically go home and sleep, and so start a new day. Anywhere he is. But I want to do this in an efficient way to keep my code organized, do you have any ideas?

Edit, information.

If you move from each to the center of the city for example, watch TV, listen to music, all this makes spending a few minutes.
The time system is formed of widgets to advance the time, composed of minutes, hours, days, months and years, with some javascript.
I thought it was just a message in the same scenario that it is, saying that it is too late for example, and instead of the normal stock links, a link to go home.

This is also true for other times of the day, such as 9am in the morning to go to college, or to work. I thought of a javascript solution but I'm still a beginner at it...

1 Answer

0 votes
by (159k points)

Without more information about how the existing parts of your project are implemented it is hard to give a complete answer. For example:
a. What player actions can cause time to advance?
(all/any passage transitions, moving between location related passages, selecting some/all links. etc...)

b. How is your time system implemented?
(Do you use a set of custom widget/macros to advance the current time, do you just use Setter Links to increase story variables, etc..)

c. How do you plan to handle the player's surprise?
(eg. they selected the "Enter Shop" link and arrived Home instead...)

Without knowing more I can only suggest that you read about the Navigation Events & Tasks (maybe PassageReader) which allow you to implement code that is processed everytime a Passage Transition occurs.

by (1.1k points)
Added information, sorry for my lack of precision.
...