I’d like there to be an event where, if you click on it, it gives you something, and then won’t give you another unless you come back the next real-world day. How would I go about doing this?
Split the problem into parts.
First problem: How to get the real-world day.
Second problem: How to remember the last real-world day we last interacted with the event.
One thing is that you might want to use a bit of scripting for this. Like for example, for the first problem, you can use the class Date to store the current day and month in variables.
var date = new Date();
// Change 1 and 2 for variable IDs you know are free
$gameVariables.setValue(1, date.getMonth())
$gameVariables.setValue(2, date.getDate())
With this you got the current month and the current day stored in variables.
You can then keep these somewhere, then get the current day again and check against the other using conditional branches and such, and if they’re equal, it’s the same day. You can also add the year if you want, date.getYear() does the trick.
Something here isn’t working, but I can’t figure out what. It says “Date isn’t defined.” Do you have any advice?
Your conditional script is trying to use a variable from the script call. That won’t work – Javascript variables declared in a script call can only be seen in the same script call.
You shouldn’t be using a script call at all. Use Control Variables (with a different variable than 3) and put this in the Script box:
new Date().getDate()
Then your Conditional Branch is just a regular variable compare (compare variable 3 to the other variable). The second Script call can be replaced by a Control Variables that sets variable 3 equal to the other variable.
Is it possible to have multiple of these on the same map without them canceling each other out?
I don’t see why not? You might need a separate pair of variables for each one though. It could get messy if you have a lot of them.
I’ll look into that Self Variable plugin.
It’s in Japanese.
I’m using the following event for the login bonus:
I hope this helps.
◆Variable Operation: #0017 Day = new Date().getDate()
◆Conditional Branch: #0017 Day ≠ #0018 Previous Day
◆Text: None, None, Dim, Medium
: : Thank you for playing!
: : Here’s a login bonus!
◆Variable Operation: #0018 Previous Day = #0017 Day
◆
: End Branch
