question

Israel Amor Hernandez Mediavilla avatar image
Israel Amor Hernandez Mediavilla asked

How to track time passed after I started a timer

I am creating a videogame where the player starts a timer to receive a reward after the timer time has passed. I am thinking about how to make the timer and to be honest it is doing my head in. Any ideas on how to implement a script that reads the current timer time and gives the reward when the timer time has passed even if the game is turned off?


I have thought that maybe I can get server time in UTC and then compare when I should receive the prize and check every time if the server time is the desired time I need.... If you have any advice or idea I would highly appreaciate it!

Player Dataunity3d
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Seth Du avatar image
Seth Du answered

You can create 2 Azure Functions to handle this task and prevent cheating.

  • Start function. This one will get the time from server and store timestamp in Player Read-Only Data.
  • Claim function. When called, this one will get the current server time and compare with the timestamp in Player Read-Only Data, to determine whether the reward can be granted to this player.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.