[XP] Complete Climate and Time System (CCTS)

Started by ForeverZer0, May 12, 2010, 06:08:20 pm

Previous topic - Next topic

Moshan

 Hello! How can I set the default show clock to false and how can I see what key is assigned as L?(CLOCK_BUTTON = Input::L)

ThallionDarkshine

If you are using custom controls from tons of addons or babs, then set it to Input::Key['L']

Moshan

 Thank you very much! Btw for disabling clock as default I tried to change this  def clock(value = false)

KK20

A potential bug has been found--requiring others to confirm if this is the appropriate solution.

Bug: If a climate was configured to not have sound played (like being Underground), the sound is still heard.

Solution:
Spoiler: ShowHide
 Find
    # Reset BGS if climate has changed.
    if $game_map.climate.id != $game_map.old_climate.id &&
      $game_map.climate.sound

and replace with
    # Reset BGS if climate has changed.
    if $game_map.climate.id != $game_map.old_climate.id


Then find

      if weather_bgs_playing?
        $game_system.bgs_fade(0)
        $game_system.bgs_play($game_map.map.bgs) if $game_map.map.autoplay_bgs
        return
      end

and replace with

        $game_system.bgs_fade(0)
        $game_system.bgs_play($game_map.map.bgs) if $game_map.map.autoplay_bgs
        return


Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

ArcaneAlchemy

"Wait? Do I look like a waiter?" -Kefka

X-Law

Quote from: KK20 on May 29, 2013, 07:34:05 pm
A potential bug has been found--requiring others to confirm if this is the appropriate solution.

Bug: If a climate was configured to not have sound played (like being Underground), the sound is still heard.

Solution:
Spoiler: ShowHide
 Find
    # Reset BGS if climate has changed.
    if $game_map.climate.id != $game_map.old_climate.id &&
      $game_map.climate.sound

and replace with
    # Reset BGS if climate has changed.
    if $game_map.climate.id != $game_map.old_climate.id


Then find

      if weather_bgs_playing?
        $game_system.bgs_fade(0)
        $game_system.bgs_play($game_map.map.bgs) if $game_map.map.autoplay_bgs
        return
      end

and replace with

        $game_system.bgs_fade(0)
        $game_system.bgs_play($game_map.map.bgs) if $game_map.map.autoplay_bgs
        return




After testing this (sorry didn't found it until now xD) i got this error:
NoMethodError occurred
undefined method 'autoplay_bgs' for nil:NilClass

AlbatrosStorm is on sale now!

KK20

Could you tell me how it happened and what your configuration is? It's been a while since I've looked at this and retesting it from no base is time consuming.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

X-Law

Ouch sorry! i completely forgot about this.
I managed to "fix" it just deleting the ISO script by MGC. Looks like there was some missing part in his spriteset_map overwrite and others. I tried pointing every class call in CCTS to the new ones in MGSISO and it worked fine until i applied your fix.

AlbatrosStorm is on sale now!

KK20

Because I have no idea how that script works (nor am I going to learn it O_o) try doing this:

        $game_system.bgs_fade(0)
        $game_system.bgs_play($game_map.map.bgs) if ($game_map.map != nil && $game_map.map.autoplay_bgs)
        return

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Sasquatch927

August 22, 2013, 03:16:10 pm #269 Last Edit: August 22, 2013, 03:24:14 pm by Sasquatch927
I've got a couple errors with this script, not sure if anyone else has had this issue but here they are

--every time the new month starts, it starts on the 2nd and not the 1st.

--when the game starts the new year from 1991-1992, I get this error

Script 'time' line 812: type error occurred

nil can't be coerced into fixnum

If anyone has any ideas, It'd be much appreciated

EDIT: I just now discovered that the above errors only occur whenever you make the script call 'time.advance_day(1)'
these don't occur when you let time pass on its own.

Terv

August 23, 2013, 03:08:45 am #270 Last Edit: August 23, 2013, 03:21:24 am by Terv
Quote from: Sasquatch927 on August 22, 2013, 03:16:10 pmEDIT: I just now discovered that the above errors only occur whenever you make the script call 'time.advance_day(1)'

I can confirm that -- when manually advancing the day from January 1st on, the starting days of the next month are as follows (default setup):

February: 5, 30, 3, 1, 3, 1, 2, 3, 1, 3, 1, next year: nil can't be coerced into Fixnum

Sasquatch927

I'm guessing what the script is doing... I believe it handles the advance day and time tracking separately. When the script call advances the month to the next, the script processes the advance via script call and also advances by time tracking. I'm thinking whatever process the calculations are undergoing, they're calculating twice. I think this relates somehow to how the new year keeps bringing up that nil-fixnum error. My belief is that since the calculations are made twice, that somehow, the days subtract themselves into becoming a nil value which bring up the error. I am in no way a scripter lol... These are just my theories.

I'm gonna roll with a temporary fix. If I want to advance in time a little bit, I bring up a script call:

time.speed_frozen(false)
time.change_speed(6000)
time.speed_frozen(true)

This speeds up time extremely fast. Then when the clock strikes a certain time of the day, a switch triggers a parallel process that does this script call:

time.speed_frozen(false)
time.change_speed(60)
time.speed_frozen(true)

Since the error doesn't come from the time ticking away on its own, the above method works perfectly fine. It is a temporary fix, so I can make due for now until the bug is fixed.

ArcaneAlchemy

Hey ForeverZero,

I found a bug with the advance time script calls. Particularly the month advancement. I set up a little testing game so that I could sample all of the really awesome elements of your script, but when I advance from "December"(or the last month in the array) to "January" of the next year it gets a nil definition error. It sends me to line 810 where your time advancement calculations are.

  I noticed that it does in fact trigger right at line 810 for some reason because it will let me print() a debug message right before it, but if it's inside the if statement then it doesn't get reached. I also noticed that the month reads 13 or "month_array.size +1" right then. I'm gonna take a crack at it, but it looks right to me, especially considering that the normal advancement of time without the in-game script calls works perfectly well. I'll post a solution if it bugs me enough to fix it, but I thought I'd throw that out there.
"Wait? Do I look like a waiter?" -Kefka

KK20

June 23, 2014, 11:58:11 am #273 Last Edit: June 23, 2014, 12:57:26 pm by KK20
Yeah, the logic of time_fix is completely broken. If you were to, say, call time.advance_day(1) on August 31, it would spit out September 3. The absolute best way to handle this would be a loop, checking the number of days in each month and subtracting @day until it is within a reasonable range.

And it really should be
@month > CCTS::MONTHS.size

I can fix this up pretty quick.

EDIT: And first post-ed.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Blizzard

It won't work with leap years. You can't do it like this.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

KK20

June 23, 2014, 01:10:29 pm #275 Last Edit: June 23, 2014, 01:12:43 pm by KK20
Are there even leap years in this script? :P
The idea really is to come up with your own months and days to them. The default template just so happens to be the Gregorian calendar.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

ArcaneAlchemy

Yeah, thanks for the insight. I'm not using that feature anyway, but I've been picking it apart the best I could and ended up finding that error.

A leap year would be cool and likely easy to add. I am also trying to use a lighting system with this script and it's proving to be somewhat of a pain. I'm probably going to use an overlayed image for the light and change the opacity over time rather than the tinting(r,g,b,grey) system. It still won't give me the ability to turn on/off a switch for the light, but whatever. If I use this in conjunction with the Frech lighting script on here http://forum.chaos-project.com/index.php?topic=14062.0 then it seems possible. If I get it working and the addition is short enough I may add a switch option for it and post it here.
"Wait? Do I look like a waiter?" -Kefka

ArcaneAlchemy

July 01, 2014, 04:40:25 am #277 Last Edit: July 01, 2014, 08:06:46 am by ArcaneAlchemy
I'm not sure if I'll get crap for double-posting or not, but this issue is completely different from what I was talking about on the last post. Anyway, so there's a major bug in this script. I know that ForeverZero isn't really looking at these anymore but I figure that I'll point out the bug anyway.

Here's the bug:

Let's say that you have map 1 with a climate of raining with a 100% probability. You have map 2, which is a house located on map 1 and has no weather "case/when" set. There is a transfer event between the two. Then, you have map 3, which is a snow 100% probability climate. If you go into the snow map(map 3) and it starts snowing, then you go back to map 1(rain), and into the transfer event to get to map2(no weather) and then go back outside to map 1. Map 1 will show snow even though snow is not a part of it.

From what I've seen from the debugger, it will do this if the weather count has not finished with the current weather type. Once the count is done, it will choose a weather type within the climate. Mind you, this has nothing to do with the months or anything else.

The only way to fix this from what I see is to have each new map instance check if the weather type that is being used is part of the weather types of the new map climate. So, for instance if map 1 is getting snow(let's say weather type 16 for example), and 16 is not listed in that climate's weather array, then it stops the weather for 0 frames, therefore resetting the count and weather type to no weather until it is randomized again within that climate's proper list.

I'll try and add this to the code as a switch to prove my point and I can provide an example if anyone is interested in troubleshooting this. Anyway, I have a solution, but if ForeverZero isn't here maybe someone else can verify the cleanliness of my patch and update it?

Edit: Figured it out. Script add-on below.

Just add on below the CCTS to try it out whomever the script updater may be...

Spoiler: ShowHide
CCTS_MAP_CHANGE_FIX = true
if CCTS_MAP_CHANGE_FIX == true
 
class Game_Map
alias ccts_fix_ini setup
  def setup(map_id)
  ccts_fix_ini(map_id)
   # Gets the current climate and month to determine weather for the season.
   climate, month = $game_map.climate.id, $game_system.time.month
   climate_weather = CCTS.weather_prob(climate, month)

     weather_list = []
     if climate_weather != nil
       climate_weather.each do |x|
       ###print x[0]
       weather_list.push(x[0])
     end
     
     end
     current_weather = $game_screen.weather_type_target
     if current_weather != 0
       if weather_list.include?(current_weather)
         #print("this weather is inside the list")
       else
         #print("fixing it")
         $game_screen.weather(0,0,0)
       end
     end
 end#end def setup
end#end Game_Map class

end#end if CCTS_MAP_CHANGE_FIX statement
"Wait? Do I look like a waiter?" -Kefka