[Custom Action] Get System Time

Hey, someone asked for a way to get the system time, so I worked with Baz to create a plug-in for a Custom Action that gathers system time and allows you to store it as a variable or in a database.

It’s pretty straight forward plug-in, and the tooltips are hopefully enough!

Let me know if you have any questions!

CA_GetSystemTime.gd (29.4 KB)

6 Likes

Hello, this is really neat. I do have a question. I’m trying to make a virtual pet game and I wanted to know if this can help me with my game. For example, I make an action in which every hour that passes, hunger variable is reduced by 5 or environment changes depending on the date. Like in animal crossing.

I think it can help with both. For the date stuff, set Run Mode to Snapshot and grab Month, Day of Month, or Weekday into a Project Variable when the scene starts. Then your normal variable conditions can decide which background, tiles, or events show up for that day.

Hunger dropping every hour is a little more work, mostly because of the time that passes while the game is closed. What I’d probably do is save a timestamp and compare against it the next time they play:

  1. When the player saves, use Get System Time with Unix Timestamp into a Project Variable like last_seen.
  2. When the game loads, grab Unix Timestamp again into another variable like time_now.
  3. Use ChangeObjectProperty to subtract last_seen from time_now and then divide by 3600. That gives you how many hours they were away.
  4. Multiply that by 5, subtract it from hunger, then set last_seen to time_now.

You could also run steps 2 to 4 every minute or so while they’re playing, and hunger would just go down a little at a time.

3 Likes

This will help me a lot for the game jam proyect I’m working on! Thanks a lot mate!

2 Likes