So I just answered to a member of the forum, on a nice question.
"Hey I want the game to know the real date, cause I can do cool things with that, like a Christmas event if it's Christmas in real life".
How could I resist to such a clever idea.
Searched for a plugin, found nothing.
Go 0figure, it is super simple. OR NOT?
Here comes the code:
// The actual calculation part:
var dt = new Date();
// The grabbing part
m = dt.getMonth();
d = dt.getDay();
y = dt.getYear();
// The correction part:
m = m+1;
d = d+4;
y = y+1900;
// The show part:
$gameVariables.setValue(1, m);
$gameVariables.setValue(2, d);
$gameVariables.setValue(3, y);
Fact 1: Okay I get it. Year 1900 is equivalent to 0.
Question 1: Why should I have to add 1 to month?
Question 2: Why should I add +4 to the day?
Question3: Is it supposed to work like that?
"Hey I want the game to know the real date, cause I can do cool things with that, like a Christmas event if it's Christmas in real life".
How could I resist to such a clever idea.
Searched for a plugin, found nothing.
Go 0figure, it is super simple. OR NOT?
Here comes the code:
// The actual calculation part:
var dt = new Date();
// The grabbing part
m = dt.getMonth();
d = dt.getDay();
y = dt.getYear();
// The correction part:
m = m+1;
d = d+4;
y = y+1900;
// The show part:
$gameVariables.setValue(1, m);
$gameVariables.setValue(2, d);
$gameVariables.setValue(3, y);
Fact 1: Okay I get it. Year 1900 is equivalent to 0.
Question 1: Why should I have to add 1 to month?
Question 2: Why should I add +4 to the day?
Question3: Is it supposed to work like that?