Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

CPU CLOCK

Ducati

Member

I have been using RM since 95 and since i was 13...im now 21
and i quit for almost 3 years but i remember when rmxp came out
i was working on a game that used real time triggers/switches

for example when your CPU clock (real time) was 12:00am
it would turn on a switch "12:00am"
then 12:30am another switch...and turn off the 12:00am (FOR EVERY 30 MINUETS OR HOUR)
so....when you open up rmxp whatever time of day it is in real life it is the same in game.

I requested this script a long time ago and got it so i know its possible..
anyone think they could do that?

p.s. I was the creator of Dementia Preacox if anyone remembers that game.
Sad that i quit for so long i can barely remember half of what i was capable of befor.
 

khmp

Sponsor

I believe you might find use of Mr. Trickster's Time System V2.0 http://www.rmxp.org/forums/showthread.php?t=17788

But I haven't used it to see :) Just going off the quote under the forum script listings
http://www.rmxp.org/forums/showpost.php?p=38756 <- Time Scripts
This allows your game to have time. Also includes a simple Day Night System. And Also you can setup events that happen at a certain time (ex. at 0 to 6 minutes past each hour, or on Tuesday March 20, 2007 at 3:00 PM to 4:00 the same day and year), This script wasn't meant to be an exact copy of our calendar (you can only set up a month to be 30 days and not vary by month), but well enjoy.
 
You could set up a common event with something like this in a Call Script:

Code:
for i in 1..48
  $game_switches[i] = false
end
t = Time.now
intervals = ((t.min + (t.hour * 60)) / 30).to_i
$game_switches[intervals + 1] = true

This will turn off switches 1-48, then set the correct one to true based on the time of day. If it is 12:00AM Midnight, it should set Switch 1 to true, if it is 12:30, it should set Switch 2 to true, and so on until 11:30 PM, which should be Switch 48.

So throw that into a Common Event set to Parallel Process.. My suggestion would be to put that in a Conditional Branch that has the condition "Script: Graphics.frame_count % (Graphics.frame_rate * 3) == 0" which is on the last page of the Conditional Branch setup.

So the parallel process would look something like this:

Code:
> Conditional Branch [Script: Graphics.frame_count % (Graphics.frame_rate * 3) == 0]
: > Call Script: for i in 1..48
        $game_switches[i] = false
      end
      t = Time.now
      intervals = ((t.min + (t.hour * 60)) / 30).to_i
      $game_switches[intervals + 1] = true
> End Conditional Branch
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top