This script provides a simple “daily bonus” mechanic, allowing players to receive bonus rewards once a day. It assumes that you can get a bonus on a new day, but you can write your conditions to use different periods if you want.
It is intended for offline games and uses the player’s system time to reward bonuses and to determine whether rewards can be rewarded.
In order to provide developers with more control over the rewards, script calls are provided. It is up to the developer to determine how to set it up for their game.
Script: download here
Place this script below Materials and above Main
The following script calls are provided.
This checks whether you are eligible for daily bonuses, based on the current
day. The assumption is that you can only get rewards once a day, and so this
method returns true only if the day is different from the last recorded day.
This will update the time that the bonus was taken. You should call this
whenever a bonus is rewarded.
If “daily bonus” is not suitable, you can get the last reward time directly
Which returns a Time object. You can then use this to check against the current
Suppose you decided to create an event that serves as the reward NPC. Use a variable to determine how many times you have received rewards.
You would have a conditional branch that checks whether login bonuses are available. If so, you would then go through a series of variable checks to determine which reward to give them.
Finally, you would call
update_bonus_time to log the actual reward.