Issues setting up a time of day system

Discussion in 'RPG Maker MV' started by Hahasea, Jul 4, 2019.

  1. Hahasea

    Hahasea Veteran Veteran

    Messages:
    115
    Likes Received:
    13
    First Language:
    English
    Primarily Uses:
    RMMV
    Hi, so I'm setting up a system which enables different tints to be applied to outdoor areas at different times of day to emulate dusk, night etc based on XIIIthHarbinger's guide on Steam https://steamcommunity.com/sharedfiles/filedetails/?id=1341167707

    While it's working to an extent, there are a few issues that I've been banging my head against all day. My event is practically identical to the one the lay out here, and I've checked it at least 5 times, so I think it's an issue with the original system, and not my implementation.

    1) The day tints work well, but I'm having an issue with player transfers. When I move a player from an outdoor zone to an indoor zone, the tint appears in the indoor zone for a moment, then fades away. Likewise, when I move from indoor to outdoor, the map appears un-tinted for a moment, regardless of what time of day it is, before fading in.

    Want to find a way to make the tint changes instant on transfers, without changing the general fade lengths settings (so the fade can still happen gradually while a player is on a map)?

    2) Despite the fact that I haven't set a starting time for the timing system, so logically it should be starting at 0/1, when running the game it consistently starts at 6am, and nothing I do seems to change that.

    3) Also, not an issue, just a wish, anyone have some leads on how I might visually display the current game time, which is running in the background of this system?

    Any help appreciated, whether that be tweaking this system, or pointing me to another system which has this stuff ironed out. TIA!
     
    #1
  2. standardplayer

    standardplayer Keeper of Kitties Veteran

    Messages:
    252
    Likes Received:
    940
    First Language:
    English
    Primarily Uses:
    N/A
    There are time systems out there, but in my experience you'd probably want a custom one, which I wouldn't mind helping you build. They really aren't too complicated.
    I know for a while Hudell had a nice Date/Time plugin, along with a bunch of other custom HUD related stuff that you'd find in a lot of games that keep time/time of day info readily available.

    As far as why you start at 6 am, we won't know what your system looks like, that's very specific and it has to be coming from somewhere. We need more details on that.

    Now about the tint, i'd do it all with Tint Screen. Don't use Fade In/Fade Out, just use Tint Screen for everything. Wherever you have the player transferring, Tint the screen completely black using the Tint Screen event command.
    For the Transfer Player command, set the Fade option to None.

    Just handle it all with the Tint Screen option, because when you fool around with it a bunch and always want it active in some way (different tints for different times of day) Transfer Effects can make it difficult. Sort of a natural timing issue, if you will.

    Current game time can be returned with $gameSystem.playtimeText(). I can help you display that as well, but it wouldn't be a cut and dry answer. If you'd like to display custom data in custom windows, that's a very easy thing to search for, many plugins do this.

    So there's the answer to question 3. If you do want help with an actual custom window to display the text, DM me as the scope itself is outside of this specific thread.

    EDIT: If you're okay just returning the total play time in a text box, you can use that call with the script option in the Control Variables Menu to store it in a game variable, and use the shorthand to return that variable in a Text Box.
     
    Last edited: Jul 4, 2019
    #2
    caethyril likes this.
  3. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,118
    Likes Received:
    695
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    Re the tint updating...in case it helps, I happen to have a demo project on the Steam Workshop (link) that includes a time/tint system. May be a bit different to Harbinger's approach, though. To ensure the tint updates correctly on transitions I've used a self-erasing parallel event on each map to invoke a tint update, and a switch to adjust whether the tint should happen instantly (1 frame) or gradually (120 frames in my case). Relevant event excerpts:
    • Parallel map event:
      Code:
      ◆Comment:Updates weather/visual fx when arriving on this map from outside.
      ◆If:Is Outside is ON
        ◆Control Switches:#0010 Is Outside = OFF
        ◆Common Event:[s] Show Weather
        ◆
      :End
      ◆Erase Event
    • Common event that applies time-of-day screen tint:
      Code:
      ◆Comment:Now do screen tint~
      ◆If:Is Outside is ON
        ◆Comment:Only if outside!
        ◆If:Weather Fade is ON
          ◆Comment:Fade if switch is on, instant (for map transitions) otherwise
          ◆If:Time: Hour ≥ 5
            ◆If:Time: Hour ≥ 6
              ◆If:Time: Hour ≥ 7
                ...
                ◆
              :Else
                ◆Comment:Dawn!
                ◆Tint Screen:(0,-20,-30,35), 120 frames
                ◆
              :End
              ◆
            :Else
              ◆Comment:Pre-dawn~
              ◆Tint Screen:(-50,-70,-90,50), 120 frames
              ◆
            :End
            ◆
          :Else
            ◆Comment:Night
            ◆Tint Screen:(-140,-140,-70,90), 120 frames
            ◆
          :End
          ◆
        :Else
          ◆Comment:Instant (1 frame) transition
          ◆If:Time: Hour ≥ 5
            ◆If:Time: Hour ≥ 6
              ◆If:Time: Hour ≥ 7
                ...
                ◆
              :Else
                ◆Comment:Dawn!
                ◆Tint Screen:(0,-20,-30,35), 1 frame
                ◆
              :End
              ◆
            :Else
              ◆Comment:Pre-dawn~
              ◆Tint Screen:(-50,-70,-90,50), 1 frame
              ◆
            :End
            ◆
          :Else
            ◆Comment:Night
            ◆Tint Screen:(-140,-140,-70,90), 1 frame
            ◆
          :End
          ◆
        :End
        ◆
      :Else
        ◆Comment:Indoors it is always bright, because I say so~
        ◆Tint Screen:(-12,-12,-20,10), 1 frame
        ◆
      :End
    [Edit: tint event excerpt now refers to screen tint, not weather. :kaoslp:]
     
    Last edited: Jul 4, 2019
    #3
    Hahasea and standardplayer like this.
  4. TWings

    TWings The Dragon Whisperer Veteran

    Messages:
    325
    Likes Received:
    584
    Location:
    Kyoto
    First Language:
    French
    Primarily Uses:
    RMMV
    To deal with different tints on map transfers, I usually set the transfers on "fade none" and set manually the Fadeout and Fadein (making sure the Fadein is the last command of the tranfer event
     
    #4
  5. gstv87

    gstv87 Veteran Veteran

    Messages:
    1,745
    Likes Received:
    766
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    I began with the same structure: an evented system, and a lot of conditionals.
    it didn't work.... because, the battle scene would interrupt that.
    so, I hardwired it into the engine, by code.

    same instructions, same logic, same flow.... except, ran at interpreter level rather than map level.
    WHICH, allowed me to control the time sprite, which is part of the screen, which is run by the interpreter.
     
    #5
  6. Hahasea

    Hahasea Veteran Veteran

    Messages:
    115
    Likes Received:
    13
    First Language:
    English
    Primarily Uses:
    RMMV
    Thanks @caethyril, that's very helpful and generous of you :)
     
    #6
  7. Hahasea

    Hahasea Veteran Veteran

    Messages:
    115
    Likes Received:
    13
    First Language:
    English
    Primarily Uses:
    RMMV
    Oh, I'm not using a separate fad in/out command, just the inbuilt fade in the Tint Screen command (which has a minimum of 1 frame, hence the flash). I guess fade to black could be a way of overwriting that 1 frame?

    Thanks for your offer of help, very kind. Once I have the basics set up I'll send through a DM to figure out the custom window. :)
     
    #7
  8. Hahasea

    Hahasea Veteran Veteran

    Messages:
    115
    Likes Received:
    13
    First Language:
    English
    Primarily Uses:
    RMMV
    Ok thanks, I think I see what you mean. Might be a bit of labour, but I'll give it a go. Cheers!
     
    #8
  9. Hahasea

    Hahasea Veteran Veteran

    Messages:
    115
    Likes Received:
    13
    First Language:
    English
    Primarily Uses:
    RMMV
    Ah yep. Interesting approach. Will give that a try if all else fails (mainly because I'm not expert at code). Cheers :)
     
    #9
  10. Hahasea

    Hahasea Veteran Veteran

    Messages:
    115
    Likes Received:
    13
    First Language:
    English
    Primarily Uses:
    RMMV
    @caethyril I had a look at your system, it's great :)

    I'm duplicating it in my project to get my head around the commands, before I apply a version of it to the rest of my system, but I'm running into a hitch - for some reason I can't seem to get the seed options to load:



    I think I've narrowed it down to the 'Select Item : Seed: Crop ID, Key Item' command in the '[v] Plant Crop' common event. I realised I have no idea how you assign items to be recognised as crops, with regard to the Crop ID variable. Can't seem to find where that is! Could you explain how you've set that up?

    Thanks!
     
    #10
  11. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,118
    Likes Received:
    695
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    Oh, you're interested in the farming stuff as well? Just so you know, that's probably the more complicated bit of that project, got a few script calls hidden in there (they should be commented, though). :kaoslp:

    The Select Item command picks an item category to display. The default item categories are Item, Weapon, Armor, and Key. I've simply renamed the Key category (via the Terms tab) and set all the seed items' types to Key Item. Then I've set Select Item to pick from the "Key Items". Select Item stores the selected item's database ID in the specified game variable, which then gets used in the follow-up event to decide which crop to spawn etc. :kaophew:

    If you're already using the Key Items category for something else, you could instead make use of one of the Hidden Item categories for seeds; in that case if you want the seeds to show up in the menu you'll need a plugin, e.g. Yanfly's Item Menu Categories~
     
    #11
  12. Hahasea

    Hahasea Veteran Veteran

    Messages:
    115
    Likes Received:
    13
    First Language:
    English
    Primarily Uses:
    RMMV
    Thanks, yeah, farming was a bonus! It was going to be my next step after implementing the time system. So on the plus side, time is working great!

    So a little update, I did actually manage to get the seed planting options to show up, and while that seems to work (makes a sound, subtracts 1 from seed count), the seed animations don't occur, and the plot remains empty (you can plant more seeds in it). Can't for the life of me figure it out, I've compared my version with yours a gazillion times, have the plugins installed, and the template map all set up and referred to by the plugin, but dayum it if it just doesn't work! I honestly don't know if it's possible for you to give me any advice of how I might fix it, I'm beginning to wonder if there's a plugin conflict or something weird going on. Unless there's some weird snippet of code it an unexpected event or something that comes into play? Idk.

    In any case, I'll figure it out one way or another, thank so much for sharing your project, it was exactly what I needed!
     
    #12
  13. Hahasea

    Hahasea Veteran Veteran

    Messages:
    115
    Likes Received:
    13
    First Language:
    English
    Primarily Uses:
    RMMV
    Actually it might be something to do with 'Self Var CropTime'. I'm not clear on where it calls it's value from, and when I debug it's always at 0, as is 'Self Var CropSpeed'. Any idea?
     
    #13
  14. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,118
    Likes Received:
    695
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    They're handled via script call, since they're both "self-variables". :kaoswt:

    The farming system makes use of a couple of Yanfly plugins:
    • Event Morpher: change empty plots into the relevant crop when planting a seed, very useful!
    • Self Switches/Variables: simplifies allocating "timer" variables to crops, each farm plot has its own self variable value~
    Relevant concepts:
    • Variables:
      • Self Var CropTime: tracks the game time elapsed since this crop was planted, when it hits zero the crop is fully-grown.
      • Self Var CropSpeed: affects how much CropTime gets reduced by each update.
    • Crop events: found on the Templates map of the demo, the different pages let you customise the crop's growth.
    • Common events (scripts will require editing if you make changes to variable, event, or map IDs):
      • 0004 Update Crops: reduces each crop's CropTime self-var by the value of its CropSpeed self-var.
        First script line determines the map ID; second line lists the farm plot event IDs; third line indicates the CropTime/CropSpeed var IDs.
      • 0013 Plant Crop: initialises the activated event's self-variables and morphs the event into a copy of the appropriate crop template.
      • 0014 Harvest Crop: gets the morphed ID (i.e. "crop ID") of the input farm plot event and returns the appropriate item.
    :kaoback: As you can see, time + weather are considerably simpler by contrast! (Or maybe I'm just doing things the hard way...)

    You may find it easier to use a dedicated farming plugin, e.g. Galv's Simple Crops. :kaoslp:
     
    #14
    Hahasea likes this.
  15. Hahasea

    Hahasea Veteran Veteran

    Messages:
    115
    Likes Received:
    13
    First Language:
    English
    Primarily Uses:
    RMMV
    Hey @caethyril , just wanted to say thanks for all your help! I ended up mixing your time system with Galv's plugin, and it's doing what I need it to do. Thanks so much :)
     
    #15
    caethyril likes this.
  16. Hahasea

    Hahasea Veteran Veteran

    Messages:
    115
    Likes Received:
    13
    First Language:
    English
    Primarily Uses:
    RMMV
    @caethyril, quick question with your setup. I seem to still have a 'seed' item in the game menu from something in your system. I can't figure out how to remove it, could you let me know how you added it? Have checked plugins, common events and map events, but can't find anything obvious. Thanks :)
     
    #16
  17. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,118
    Likes Received:
    695
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    :kaoswt: Not sure what you mean? Seeds are key items, added (or removed) via the Change Items event command. They'll display in the Keys category in the item menu, which can be renamed via the Terms tab in the database (Commands > column 3, row 4).
     
    #17
  18. Hahasea

    Hahasea Veteran Veteran

    Messages:
    115
    Likes Received:
    13
    First Language:
    English
    Primarily Uses:
    RMMV
    That would be it! Thanks!
     
    #18
    caethyril likes this.
  19. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,118
    Likes Received:
    695
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    Great! Happy farming! :kaojoy:
     
    #19

Share This Page