Variable Calendar/Weather System

Discussion in 'RGSS3 Scripts (RMVX Ace)' started by Selchar, Feb 17, 2013.

  1. Selchar

    Selchar Veteran Veteran

    Messages:
    299
    Likes Received:
    78
    First Language:
    English
    Variable Calendar/Weather System Ver. 2.0
    Selchar
    Introduction
    This script adds an easy to use calendar and weather system, that should also be easy to customize if needed.

    Features
    - Controls time through variables(you can change which ones), allowing for easy use for/through eventing without scriptcalls.
    - Changes the weather once a day(midnight), currently has Sun, Rain, and Snow(also output to a variable for easy access for events)
    - Choose what maps stop time automatically, or maps that don't show the weather and use normal tint.
    - Easily adjustable settings

    How to Use
    Place below Materials and above Main, adjust the settings as needed, should be Plug'n Play(Read the notes for extra info for customizing. Remember to name your variables you choose to use properly so that you know what's what.

    Script
    Main Script
    Basic Clock Add-On
    Calendar Clock Add-On
    Calendar Clock Menu Add-On

    Seasonal Tones Add-On

    Demo
    The demo features some extra scripts, and addons working together for an extra feature ;) . I should also mention, in case some people don't know, that you can have multiple rpg maker projects open at the same time, which makes it easy to copy events/scripts/etc... from one game into another. Note: Demo is a little out of date.

    >Here<

    Credits for the demo:
    Selchar
    Tsukihime
    Galv
    PK8
    Fomar
    Ceilianna
    Shaz(For answering an important question of mine to make this work)
    Lemony


    FAQ

    Q: Non-Commercial or Commercial?
    A: Anything goes.

    Q: Are there any script calls/notetags I should know about?
    A: Covered in the script.

    Q: Are there any required scripts or compatibility issues?
    A: It's unlikely to have problems with other scripts.

    Credit
    - Selchar
    - Vlue & deilin(For inspiration with their own time/weather scripts, and the tone/weather settings came from there as well, tho added in my own way once I figured out how.)

    10/8/14 Update: Clock Add-Ons have been updated, removed the toggle and fixed a bug with them as well as cleaned up the code. They automatically vanish when time stops and come back when it starts again.
     
    Last edited: Jul 26, 2017
    #1
    gregbaby, Idril, appletre and 6 others like this.
  2. ShinGamix

    ShinGamix DS Style 4Ever! Veteran

    Messages:
    3,906
    Likes Received:
    447
    Location:
    Alien Ship
    First Language:
    April Fools
    Primarily Uses:
    N/A
    I am going to test this out.

    Does it have on screen displays for the time/ calendar or weather?

    Edit- Needs a way to disable tone or change tone for inside houses or dungeons?
     
    Last edited by a moderator: Feb 18, 2013
    #2
  3. Selchar

    Selchar Veteran Veteran

    Messages:
    299
    Likes Received:
    78
    First Language:
    English
    There isn't an on-screen display for the time or weather at this time, it's beyond what I can do for now but I will be trying to learn to add one.

    As for your suggestions, if you mean...

    1: A way to disable time based tone altogether

    2: Splitting weather and tone to work separately .

    That was an easy enough change, I also fixed a small bug I noticed regarding days marked for festivals, the weather, and the HM_SEL::next_day scriptcall, it should work just fine now.

    Edit: As per request I made a slight adjustment to the script call HM_SEL::next_day.  There is no changed if used like this, but it does now allow for an optional parameter, for example HM_SEL::next_day(8) will have you wake up at 8 AM, HM_SEL::next_day(14) will have you wake up at 2 PM.

    Note:  I am contemplating combining the 2 minute variables once a proper HUD has been made, as well as removing the 2nd hour variable and PM_SWITCH since their original purpose would be gone(giving a way to tell time without a HUD.

    I also just realized time moves forward while you are talking to an npc(unless the stop time switch is activated of course), is there a need for me to figure out how to handle that automatically, or should I leave it as is, allowing the user to just flip a switch before and after conversations.

    Ninja Update:

    1: I have successfully done away with the 2nd minute variable, 2nd hour variable, and pm switch.

    2: Fixed a slight oversight in the next_day scriptcall

    3: Improved instructions in the script's header.

    Final Edit:  Next time I'll actually post.  I finally learned how to make the clock hud properly, I updated my opening post with an update.  It's a basic time clock similar to the one in Vlue's Basic one, only a little smaller and can optionally be placed in the middle/top or midle/bottom of the screen, as well as the normal corners.

    I'll get to work on a full calendar based one next.
     
    Last edited by a moderator: Feb 21, 2013
    #3
  4. SuicideToro

    SuicideToro Veteran Veteran

    Messages:
    39
    Likes Received:
    1
    First Language:
    English
    Yay! A clock HUD! Fantastics :D I think the easiest way is to put it all together like the Four Seasons one, since players want to look at both time and date at a glance :)
     
    #4
  5. Selchar

    Selchar Veteran Veteran

    Messages:
    299
    Likes Received:
    78
    First Language:
    English
    Consider it done, also will update the clock hud,.  Actually I'll do that after some testing, after I'm done with the calendar one.   I saw a screenshot of yours in the vxace.net forums and noticed your windowskin border partly covers the M in AM, which got me thinking I should have a setting for either the smaller/slimmer one I have, and one that's bigger that would hopefully wouldn't get in the way of bigger windowskins borders.

    Til then, enjoy the clock!  I'm sure it will help with testing time based events/setups you may have, to insure they are working the way you want them to.

    Edit: Basic Clock has been updated with the following.

    1: 2 clock sizes, the original size that was up til now is now "small", and there is a new default size.

    2: Made the AM/PM thinner, it just looks better to me this way.

    3: Added Opacity Control, now you can either make the windowskin disappear completely, semi-transparent, or keep it fully visible.

    4: Added an option to disable the hud in maps in the "TIMESTOPMAPS" array.  If a separate array is preferred I can do that instead.

    I also have the calendar clock finished as well now, however running into slight problems with google atm, the link will be up when it's up.

    Edit: Calendar Clock HUD is up, same setup as the Basic one except with the addition of being able to change day/month names.

    Edit:  Is there anything you, or anyone else would like me to consider adding?  As far as I can see it is now 99% complete.  I am a bit at a loss when it comes to where to go next with it :p .  In the now updated version I added...

    1: A new scriptcall that returns true if "tomorrow" is marked as a festival day, which was also used to fix tomorrow's weather for when used as a forecast if it was a festival(all festival days are by default sunny, but if you had a forecast event it could still say rain/snow instead, that's no longer possible).

    2: A way to setup up to 2 common events to run at a specific time every day, using both the hour and minute variables to determine when it happens without complicating things with autorun/parallel process switch condition + conditional branches to narrow down the trigger time.

    I'm trying to think of whether or not there's something else I should add.
     
    Last edited by a moderator: Feb 23, 2013
    #5
  6. SuicideToro

    SuicideToro Veteran Veteran

    Messages:
    39
    Likes Received:
    1
    First Language:
    English
    I can't currently think of any other features at the moment. This is great work :)  If I hit any bugs or glitches, I'll report it asap ^^
     
    #6
  7. Selchar

    Selchar Veteran Veteran

    Messages:
    299
    Likes Received:
    78
    First Language:
    English
    Alrighty, well I guess for now I'll just hand out a performance upgrade to the clock huds, they shouldn't be eating up frames like no tomorrow now, and I think I tested them thoroughly enough to get rid of any bugs in them.
     
    #7
  8. SuicideToro

    SuicideToro Veteran Veteran

    Messages:
    39
    Likes Received:
    1
    First Language:
    English
    I got a problem. Your calendar clock, which you seemed to have updated, now reads an error at line 94, undefined method '+' for nil:NilClass. When I use the save file from the older version, the script worked fine.
     
    #8
  9. Selchar

    Selchar Veteran Veteran

    Messages:
    299
    Likes Received:
    78
    First Language:
    English
    That's odd, it has worked perfectly for me *thinks*... nil class...

    Well I tested and figured out why I never got that error.  I've been using PK8's Initial Variables/Switches which forced the variables into certain values, and luckily it can also be used in this situation to figure out the exact cause of the problem.  I have a feeling something that normally starts off as 0 is causing it.

    And... fixed.  This error should have occurred before the performance update as well from the looks of it.  All I had to do in the calendar add-on was force whatever variables you have assigned to DAYA, and MONTH to = 1 at the start of the game.  I could have also just had them return "" as nil, but I figure if you're using the calendar,  then you don't want the day of the week or the month to appear as a blank.  As a bonus DAYB is also initialized as 1 now, tho that itself wasn't completely necessary.

    These changes/fixes are only present in the calendar add=on, they should also prevent those 3 variables from ever becoming 0.

    Edit: I've had a whole day to think about it, that and I've been working on something to compliment this script(see that harvest moon thread you made at the rpgmakervxace.net forums).  I can either shift the numbers in the main script back by 1, or I can force the numbers in the main script to start as 1 like how I handled the calenar add-on.  I'm leaning towards the 2nd once as it wouldn't break any events if one decided to update their script, but at the same time with such an update there wouldn't be any "perks" to updating if you already manually set the starting date, so it would only really benefit future users who'd try out the script.  *thinks on that*
     
    Last edited by a moderator: Feb 28, 2013
    #9
  10. SuicideToro

    SuicideToro Veteran Veteran

    Messages:
    39
    Likes Received:
    1
    First Language:
    English
    I see! Yeap, checking back, it seemed to have worked until I added values for the time and date variables at the beginning of my game. Before that, the date was indeed blank. Good job with spotting the problem!

    I would say the second is better, too. It would be dandy to have everything start from Day 1 by default. I can see a lot of people using this script for its features, so it's probably better to do that :)
     
    #10
  11. poundcakery

    poundcakery Veteran Veteran

    Messages:
    38
    Likes Received:
    3
    First Language:
    English
    Ooh, this is an awesome script!

    I only have one comment; I tried playing through an entire day (starting at midnight), but around 6am the sceen tint got CRAZY bright. like neon yellow color. I haven't screwed with the tint any, so just a heads up that the plug-and-play tints might be off.
     
    #11
  12. Selchar

    Selchar Veteran Veteran

    Messages:
    299
    Likes Received:
    78
    First Language:
    English
    Update to the main script

    1: Guaranteeing certain values will start off as 1 instead of 0)

    2: Redid how I was handling tints(and adding a 4 AM change before 6 am)

    Small update to the Calendar clock(requires the update to the main script)

    Added a demo with some extra features, and "some" examples of how to use the script, there are better ways of doing dome things of course.

    The demo also includes... Farming?  Check it out if you're interested, I think I covered everything I needed to.
     
    #12
  13. ragnawind

    ragnawind Veteran Veteran

    Messages:
    180
    Likes Received:
    5
    Location:
    USA
    First Language:
    English
    Is it easy to adjust the Stamina HUD and clock HUD to work ith an already implemented time system, like the initial Day/Night system and clock HUD by Vlue, since I don't really want to replace my currently working time system, but the HUDs are much better than what I am currently using for my project? Also, the farming system, do you think that would be easy to work with, since I'm not really that good with scripting currently, but I have been able to make a few changes to scripts that work they way I want them to?
     
    #13
  14. Selchar

    Selchar Veteran Veteran

    Messages:
    299
    Likes Received:
    78
    First Language:
    English
    I actually learned how to make my Clock HUD by studying a couple other simple scripts, Vlue's basic time in particular I examined, took apart, found the bare minimum required to make an HUD, re-examined to figure out what's what, then got it to work with my script... took a couple tries because it kept showing the window but no numbers, then expanded from there. Then I redid it a couple times to be sure of what I could and couldn't change. Actually now that I think about it I noticed something the other day that I haven't tested, which looked like I could easily add the ability to use different windowskins/font colors, seemed really really easy to do...

    Anyways where was I? Is there anything in particular about my clock hud that you like over Vlues? I think the only real differences that I can think of are...
    1: Switched from his time to my time
    2: Top Middle and bottom Middle locations
    3: Made it so that it didn't update every single frame, and instead refreshed every time the time actually changes.
    4: Added a "smaller" version.
    5: Added the ability to change the Window's Opacity.

    Also, I assume you're refering to my Basic Clock, and not the Calendar Clock since you mentioned Vlue's day/night system, right? Tho at the same time you're asking about my farming system, which atm requires a variable to be used for the "month"... so it's the calendar clock then which is showed in the demo?  What can be done depends on what time system you're using, and the some things involving the setup of your project.

    All of these changes could probably be made to Vlues no problem if I remember right. The Stamina HUD was basically made by using my Basic Clock as a base, and just changing what was necessary. In fact the Basic Stamina within the demo is completely standalone, no dependencies at all and can be freely copied from the demo into any project, just change the variables to whatever you want it to use. It just doesn't have a smaller version... yet anyways.

    The farming system... *re-checks a couple things* It's set up and tied to my calendar system, but it shouldn't be too hard to rig it to use something else. I put as much information as I think I needed to into the readme to allow moving it into another project, but I'd still recommend just using the demo as a base. Anyways you'd have to modify the provided event, common events, and the scripts I think.

    In the event:
    On Page 2: There are conditional branches that include a scriptcall to the current month's variable my system is using. That would need to be changed. You also have conditional branches within that pointing towards specific seeds. After those is a conditional branch, again using my system but to check the current weather.

    On Pages 3, 5, 7, 10, 12, 14, a lot of pages, events that are not wet.
    I just noticed I forgot to change a conditional branch from a normal variable control to a scriptcall version... and it's on multiple pages too >.> I'll fix that later when it's not pass midnight and dark outside. Luckily I set it up so that the event pages are "mostly" copy/paste, and the complicated stuff is crammed into a single scriptcall.

    On Pages 9, 16...basically the "full grown" crop pages, you gotta change the Item to fit whatever you have/will have for the item the crop gives you.

    From page 31 and onward: There is a month variable used for the page condition, that would need changing.

    In the common events:
    Auto-Return is only used by my calendar script, so you can get rid of it if you use another time script.
    Out of Stamina has a scriptcall from my calendar script again that "move time forward", which I suppose can be done away with for something that'd work for another time system.
    crop_progress(2) is the scriptcall used to progress the crop events, the 2 means it'll do it to crop events on the map with the ID of 2.
    Below those is a conditional branch that checks the current time to determine whether or not it should call the shipping bin common event... wait I think that should have been placed before the next_day scriptcall.
    Any changes made here should also be done to the event you use for your bed.

    In the scripts:
    HM Tools: This script defines some variables that the events should use when you interract with thim. It also holds some simple scriptcalls used to reduce the number conditional branches you need... plus all edits here will effect all conditional branches that use them so that you don't have to go looking for every single one, like that 71 page event I made. Just change the numbers to fit your item(shipping)/weapon(tools) database.

    No need to touch the one at the very bottom, have_seed?.

    HM Farm:
    On line 16, that if statement is there to determine whether or not it's the first day of the month(uses my system's variable, so change as needed).
    Line 18 is the start of where you'd modify the growth rates for spring crops.
    Line 69 is the start for summer crops.
    Line 120 is the start of fall crops.
    Line 174 runs a check for the current weather, change this as needed.
    Line 205 is run instead of everything above this, which should only be on the 1st day of the month. It turns any active crops into a dead plant that can only be removed by using a weapon marked as a sickle.

    I think I covered most of this in the readme file that can be found in the demo's folder, of course it's a little more focused on if you wanted to move the whole thing into a currently existing project, not use it but with a different time system. Overall it should be possible to do as long as you make the proper adjustments.
     
    Last edited by a moderator: Mar 5, 2013
    #14
    ragnawind and SuicideToro like this.
  15. ragnawind

    ragnawind Veteran Veteran

    Messages:
    180
    Likes Received:
    5
    Location:
    USA
    First Language:
    English
    thanks for the info. I should be able to work with it, then, with this info.
     
    #15
  16. Selchar

    Selchar Veteran Veteran

    Messages:
    299
    Likes Received:
    78
    First Language:
    English
    While I'm slowly working on other possible updates/changes to the script(s), at the very least I'll add an add-on that was requested.  Simply put it allows for different tone settings for different seasons.  Brighter summers?  Darker Winters?  Shorter Days(Less hours of sunlight)?  It's all rather simple to do with the Seasonal Tones add-on. Just make sure it's below the Variable Calendar/Weather script, and it'll work just fine.

    Link: https://docs.google.com/file/d/0BywhvOtY4_H9dHUzZEltaU1aV0k/edit?usp=sharing

    Or just return to the first post to find it.

    Edit Update: 3/27/13

    Changelog:
    1: Command 201 and Perform Transfer are no longer overwritten, post_transfer
    is aliased instead.
    2: Added $hm_frame to init_var, removed from bottom of script.
    3: Slight change in time/tone/inside checks
    4: Changes to show_tint, making use of .. ranges instead of a when for each
    individual hour. Also fixed tone changes when transfering between maps, it's
    now instant instead of over 60 frames.
    5: Seasonal Tones Add-On included in the demo.
    6: Small update/change to both clocks, requires
    7: Removed Tsukihime's Event Trigger Labels from the demo, added my own
    2nd action button script instead.

    Edit: Noticed a weird bug in the 2nd action button script.  Will try to figure that out.
     
    Last edited by a moderator: Mar 28, 2013
    #16
  17. Selchar

    Selchar Veteran Veteran

    Messages:
    299
    Likes Received:
    78
    First Language:
    English
    And I've rebuilt the script mostly from scratch, shouldn't have too many problems if switching from the old version to this one.

    Changes made for version 2.0
    1: Remade half the script from scratch, making it more modmular and allowing for
    some extra customizations.(Stop time after a certain point in time or other conditions is possible)
    2: Switched to Note Tags for controlling which maps have what effects instead of arrays.
    3: You can have up to 24 common events instead of 2(1 for each hour, no 2 can be called in the same hour tho without some changes, but shouldn't be a problem.)
    4: The festival switch is now a festival variable using a hash, should be easier to use for eventing.
    6: The switches in customization are no longer required, but are for giving extra control.
    7: Put the initial variable method into an easier to see location.
    8: Fixed some small bugs here and there

    Updated Seasonal Tones to work with the new version.

    The huds still seem to work for the most part, but I will be remaking them/removing unnecessary stuff
     
    #17
  18. estriole

    estriole Veteran Veteran

    Messages:
    1,030
    Likes Received:
    334
    First Language:
    indonesian
    any screenshot?
     
    #18
  19. DreamcasterDC

    DreamcasterDC Villager Member

    Messages:
    9
    Likes Received:
    1
    First Language:
    English
    [​IMG]

    I get a strange error while using this script. I'm currently using the XAS Hero Edition script for Ace as a battle system, if that has any effect. Anyway, this isn't just on the first day the game starts out, this is every day. But when the clock strikes 5 pm exactly, I get this error and the game crashes! Do you know anything that would fix this?
     
    #19
  20. Selchar

    Selchar Veteran Veteran

    Messages:
    299
    Likes Received:
    78
    First Language:
    English
    Game Interpreter line 89/90 refers to common events, so I would assume you have my script attempting to run one, but it can not.  The most likely problem is in your Common Event hash.

    COMMON_EVENTS = {
    #Hour => [Minute, ID],
    5 => [30, 1],
    11 => [55, 2],
    17 => [0, 11],

    }#Please do not remove

    Find this in your script, I added the line that starts with 17 and it gives the same error in new projects, the reason why would be common event 11 doesn't initially exist.  Do remember to follow the given format and make sure you don't use a common event ID number that doesn't exist(by default there are only 10 common events, you can increase/decrease this in the database).  You are free to remove the lines as well.(those that start with numbers followed by an array of course, not the 1st/last line.
     
    Last edited by a moderator: Jul 24, 2013
    #20

Share This Page