Room Changes by not Playing Game

Howdy!


I'd like to know if it is possible to make it so that if you stay off the game for a certain amount of time, your save is altered and makes it so that you start in a different room.


If it is possible, how would I go about doing it?
You could probably use two variables ingame. One for just prior to saving your game that will store the current time in a variable (example being 15) like so--


$gameVariables.setValue(15, Date.now() );


and then another upon save load that will get the current time and compare the two numbers. If the difference is greater than whatever you defined, then you can execute a common event that will transfer the player to a random map of your choosing as defined in some kind of if conditional. 🙂

Amusingly enough, I just suggested almost the same piece of code to someone else only a few minutes ago to solve an entirely different problem. 


Edit: SORRY Just realized this is for VX Ace. Sigh. I'm not 100% sure but there should probably be some kind of comparable function in Ruby. Lemme look!


Edit ONCE AGAIN:  Ok so there's a Ruby function that's quite similar.

 


t = Time.now
t.to_f * 1000
$game_variables[variable id] = t


and then you can commit the final result into a game variable! At least, I think that's what it would look like hahaha. Ruby was really not anything I was very good at. ;----;

Original thread: https://forums.rpgmakerweb.com/threads/room-changes-by-not-playing-game.61983/