How to make an AM PM clock.

Discussion in 'RPG Maker MV' started by cybarxz, Feb 7, 2018.

  1. cybarxz

    cybarxz Veteran Veteran

    Messages:
    66
    Likes Received:
    11
    First Language:
    English
    Primarily Uses:
    RMMV
    So, I saw this super helpful video teaching how to make a time system. But I would like the clock to show the hours as a 12h clock not an 24h



    Could you help me ?
     
    #1
  2. Canini

    Canini Veteran Veteran

    Messages:
    974
    Likes Received:
    647
    First Language:
    Swedish
    I must admit I did not watch the entire video, but isnĀ“t it just a matter of changing the display text (from 24H:60M to 12AM/PM:60M) and then change the variable to that it rolls around when it hits twelve instead of twenty-four?
     
    #2
  3. sabao

    sabao Veteran Veteran

    Messages:
    832
    Likes Received:
    298
    Location:
    Tokyo
    First Language:
    Filipino
    Primarily Uses:
    RMVXA
    I can think of two ways to do this. I only have time to explain one.

    Method 1: Change the Existing Common Event
    • Create a Switch called 'AM or PM'. Let's say that if the switch is Off, then it's AM and if it's On, it's PM.
    • Copy the events below. I did this on VX Ace because my ancient laptop doesn't play nice with MV, but the logic is the same.
    [​IMG]

    What this does is it makes the clock run on 12-hour cycles only. If it's PM (meaning AM/PM is 'On') and the clock hits 12, then it's midnight (AM/PM is switched 'Off'), so the day advances (Days =+1).

    If it's not PM (meaning AM/PM is 'Off') when the clock hits 12, then it's noontime (AM/PM is switched 'On'). It's still the middle of the day, so the day doesn't change yet.

    This method makes lighting checks a little more annoying. Not only do you have to check for what Hour it is, you'll need to check for whether it's AM or PM as well.​

    Method 2 in summary is just creating a new variable called 'PublicTime' or whatever you want to name it. It will be the variable you use when you want to tell players the time. Then you make Conditional Branches that go like:
    • if Hours = 13 then PublicTime = 1
    • if Hours = 14 then PublicTime = 2
    • if Hours = 15 then PublicTime = 3
    • etc.
    You'll also want to check if it's AM (0:00~11:59) or PM (12:00~23:59) using Conditional Branches and store the value in the form of a Switch.
     
    #3
    cybarxz likes this.
  4. cybarxz

    cybarxz Veteran Veteran

    Messages:
    66
    Likes Received:
    11
    First Language:
    English
    Primarily Uses:
    RMMV
    Thanks for the help @sabao . I used the method 2. I would be easier for my brain.

    I only wish we the clock says 01, 02, 03 ... instead of 1, 2, 3. It's weird to see 4:5 PM. I think I can solve this with conditional branches too. But I'm too lazy for that now.

    Thanks again.
     
    #4
  5. sabao

    sabao Veteran Veteran

    Messages:
    832
    Likes Received:
    298
    Location:
    Tokyo
    First Language:
    Filipino
    Primarily Uses:
    RMVXA
    It may be easier to just use a plugin and create a list of strings to present time in that format, but I don't know if there's a readily available plugin that has that function. I may try my hand with it, but I'm not exactly a great programmer. Good luck with your game!
     
    #5

Share This Page