[XP] Complete Climate and Time System (CCTS)

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

Previous topic - Next topic

TheCableGuy

February 15, 2012, 07:50:49 pm #220 Last Edit: February 15, 2012, 07:57:16 pm by TheCableGuy
The font, yeah. Font problems seam to hit me regularly.

Got that working but would you know why, when using the Script linked on the OP or copied straight from the Demo has no problems running but When i use the configuration tool Provided, I get this Error Message?



Also, is there any suppose for this script using regular am/pm time instead Military time?

tatasz

Just wonder if its possible to implement some overlay pictures (for example, to show a picture imitating sunlight during the day - with good weather of course).

ForeverZer0

Its very possible, just not part of the script. You can use the variables to make a common event or something easy enough, though.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

tatasz

Was trying to do it, but its a bit annoying to make it smooth =)
<-- lazy one

Poe

is this still getting a rewrite? i could try to get this black/white screen bug out myself but...O_O

TheCableGuy

Is there a way to disable the Clock display in the Script? I can only find the script call to turn it off in the game but would it be possible to turn it off from within the script?

Vexus

There's an error I keep on getting randomly while testing battles and was wondering if there's anything you could do to fix it.



Line is:

unless $game_map.climate.weather


I don't know if this error comes during the game too but it's annoying when I can't test the enemies vs players because of the error.
Current Project/s:

LiTTleDRAgo


Vexus

February 28, 2012, 11:34:12 am #228 Last Edit: February 28, 2012, 11:40:06 am by Vexus
Thanks I'll see if it works now.

[Edit]

Seems like it works, thanks :)
Current Project/s:

Poe

one of the problems i was having was that, if the weather changes, while the screen tone change from previous weather is not complete, the calculated change will bring it too far. i believe this was because the time between weather changes (weather_wait) was smaller than the transition lasted. i kicked it up a notch for debugging purposes, and caused a problem doing so, silly. but maybe you should put a warning for that or a minimal setting?

another problem that's now become clear is, if old weather is directly followed by new weather (without returning to 0 first), and then weather that does not change screen tone starts, it changes screen tone anyway (perhaps from previous values that didn't get cleared?) wrecking the system. i would appreciate any help on this, i feel like Krillin fighting Frieza here.:p

Vexus

Current Project/s:

ForeverZer0

Haven't really been working on it. I stopped for some reason at about 85% completion. The only real thing left to make it functional is to implement weather tinting. I'll get around to it at some point...
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Vexus

Current Project/s:

Danger Force

why is it not working climates was I clicked on the script but instead an empty climates

Sbus

Hi,
I'm not good at scripting so I ask to you: is there a way to make the lenght of a minute in the game equals the lenght of a real second?

ForeverZer0

If I remember correctly, setting the speed to 40 will be one minute. A minute's length is equal to the (Graphics.frame_rate / SPEED) * 60. One second in a game is 40 frames, so setting speed to 40 should have the effect you are looking for.

time.change_speed(40)
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Sbus


Sbus

July 12, 2012, 07:05:01 pm #237 Last Edit: July 12, 2012, 07:09:55 pm by KK20
oh, another thing: I can't use the hourly tints, I used this config:
Spoiler: ShowHide
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#                         BEGIN CONFIGURATION
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

 #    ** Script Generated at 12/07/2012 20.01.49.

module CCTS

 # The names for your days. Use as many as you want.
 DAYS = ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì',
         'Sabato']

 # The name for your months. Use as many as you want.
 MONTHS = ['Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio',
           'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre']

 # How many days in a month? (Per each index above)
 MONTH_LENGTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

 # Set up as follows: [Minute, Hour, Day, Month, Year]
 START_DATE = [30, 6, 1, 1, 628]

 # Button used to toggle clock ON/OFF (if enabled). This is the game button,
 # not just the key on your keyboard.
 CLOCK_BUTTON = Input::Z

 # Default settings for the clock.
 # Set up using this pattern. [X, Y, OPACITY, FONTNAME, FONTSIZE, BOLD, ITALIC]
 # All can be changed in-game with a script call at any time.
 CLOCK_FACE = [0, 0, 160, 'MS PGothic', 14, false, false]

 # Default settings for the analog clock.
 # Set up using this pattern: ['FILENAME', HAND_OFFSET, X, Y, OPACITY]
 # Can be changed at any time during the game with a script call.
 ANALOG_FACE = ['', 0, 0, 0, 0]

 # Set the skin for the clock (normal). Configure like one of the following:
 #   Set to nil to not use a skin
 #   Set to 'DEFAULT SKIN' to use whatever the player is using.
 #   Set to 'FILENAME' of the skin. Must be in Windowskins folder of game.
 CLOCK_SKIN = 'DEFAULT SKIN'

 # If true, the analog clock will be used by default. Can be changed later.
 ANALOG_CLOCK = false

 # Configure how the time will be displayed. Ignore this if you are unsure of
 # how to set this up. Look up "sprintf Format" in the Help File of the game to
 # learn more of how it works.
 TIME_FORMAT = '%02d:%2d'

 # The minimun/maximum number of seconds before the system re-calculates what
 # weather pattern will be used. The number will be randomly selected from
 # within the defined range.
 WEATHER_WAIT = [0, 1]

 # This variable will be always be equal to the weather type. Lets you create
 # event conditions based off the weather. (must be raining to do this, etc...)
 # If using Zer0 Advanced Weather, just set to same as "Weather_Type_Variable"
 WEATHER_VARIABLE = 6

 # This switch will only be ON during "bad" weather effects (below). Used for
 # event conditions. (Villagers go inside if it is raining, storming, etc...)
 # If using Zer0 Advanced Weather, just set to same as "Adverse_Weather_Switch"
 BAD_WEATHER_SWITCH = 4
 # This switch will always be the opposite of the BAD_WEATHER_SWITCH.
 GOOD_WEATHER_SWITCH = 3

 # Include all "bad" weather types in this array. The above switch will only
 # be on when one of them is occurring
 # Same as from Zer0 Advanced Weather, if using.
 BAD_WEATHER_TYPES = []

 # This variable will be set by the "season" of the year. This can also be used
 # as a condition in events.
 SEASON_VARIABLE = 7
 # 0 = Summer
 # 1 = Autumn
 # 2 = Winter
 # 3 = Spring
 # Define the months for each season.
 SEASON_MONTHS = [ [5, 6, 7],   # Summer
                   [8, 9, 10],   # Autumn
                   [0, 1, 11],   # Winter
                   [2, 3, 4]]   # Spring

 # These switches will be used as conditions for events, etc. They will only
 # be ON during the hours defined below.
 DAY_SWITCH = 1
 NIGHT_SWITCH = 2

 # Define the hours that are considered "Day" and "Night". The respective
 # switch above will be ON/OFF depending on the hour of the day.
 DAY_START_HOUR = 6
 NIGHT_START_HOUR = 21

 # IDs of variables that will be equal to their named value. They can be used
 # for eventing, etc. Set any to nil that you do not want to use.
 MINUTE_VARIABLE = 1
 HOUR_VARIABLE = 2
 DAY_VARIABLE = 3
 MONTH_VARIABLE = 4
 YEAR_VARIABLE = 5

 # If true, and $DEBUG, a text file will be created each load in the games
 # directory that lists maps that do not have a climate defined, or those that
 # are defined more than once.
 WRITE_MISSING_DATA =

 #-----------------------------------------------------------------------------
 # Weather Tints
 #   Set the tint influence for each weather type. These are NOT the values
 #   the screen tint will be, rather they are the amount applied to whatever
 #   the current screen tint already is. They will transition in/out at the
 #   same rate of the weather transition.
 #-----------------------------------------------------------------------------
 def self.weather_tint(type)
   case type
 # when WEATHER_TYPE then return [RED, GREEN, BLUE, GRAY]
   when 1, 4  # Rain
     return [-20, -20, -15, 10]
   when 2, 5, 9  # Storm
     return [-30, -30, -20, 15]
   when 3, 16  # Snow
     return [-15, -15, -15, 20]
   end
   return [0, 0, 0, 0]
 end
 #-----------------------------------------------------------------------------
 # Weather BGS
 #   Define the BGS used for each weather type. They BGS will fade in/out at
 #   the same rate of the weather's transition. Volume will be 50% for maps
 #   that do not have weather, but still have weather sound.
 #-----------------------------------------------------------------------------
 def self.weather_BGS(type)
   case type
 # when WEATHER_TYPE then return ['FILENAME', VOLUME, PITCH]
   when 1  # Rain
     return ['005-Rain01', 80, 100]
   when 2  # Heavy Rain
     return ['006-Rain02', 80, 100]
   when 3  # Snow
     return ['001-Wind01', 80, 100]
   when 4  # Hail
     return ['005-Rain01', 60, 75]
   when 5, 9  # Thunder Storm
     return ['007-Rain03', 80, 100]
   when 7  # Blowing Leaves
     return ['003-Wind03', 80, 100]
   when 8, 16  # Swirling Leaves
     return ['004-Wind04', 80, 100]
   when 22  # Falling Rocks
     return ['015-Quake01', 100, 125]
   end
 end
 #-----------------------------------------------------------------------------
 # Weather Probability
 #   Define the weather probabilities for each climate. The climate ID and the
 #   month are passed as arguments for branching. This will allow you to make
 #   it snow in the winter, storm in the summer, etc.
 #
 #   Set up like this:
 #
 #   case climate_id
 #   when CLIMATE_ID
 #     case month
 #     when MONTH then return [[TYPE, PROB], [TYPE, PROB], [TYPE, PROB], etc]
 #
 #   If you are using Zer0 Advanced Weather or MAWS (v.1.2 or >) where the
 #   "variation" is used, just add the variation value into the respective
 #   array, like this:
 #                     [TYPE, PROBABILITY, VARIATION]
 #
 #   You need not define a probability for 0, or no weather. It is the default
 #   value used for undefined weather and when the weather probability is not
 #   high enough when the system calculates it.
 #
 #   The actual weather will be chosen randomly from all types that have a
 #   probability above the randomly chosen 'chance' at each weather update.
 #-----------------------------------------------------------------------------
 def self.weather_prob(climate_id, month)
   case climate_id
   when 0  # Outdoor
     case month
     when 1, 2, 12
       return [[3, 17], [16, 12]]
     when 3, 4, 5
       return [[1, 30], [2, 25], [9, 25]]
     when 6, 7, 8
       return [[1, 20], [9, 20], [2, 10]]
     when 9, 10, 11
       return [[1, 15], [9, 10], [6, 25] [7, 25], [8, 25]]
     end
   when 1  # Indoor
     case month
     when 1, 2, 12
       return [[3, 17], [16, 12]]
     when 3, 4, 5
       return [[1, 30], [2, 25], [9, 25]]
     when 6, 7, 8
       return [[1, 20], [9, 20], [2, 10]]
     when 9, 10, 11
       return [[1, 15], [9, 10], [6, 25] [7, 25], [8, 25]]
     end
   when 2  # Snow
     return [[3, 80], [16, 50]]
   when 3  # Desert
     return [[1, 5]]
   end
 end
 #-----------------------------------------------------------------------------
 # Hourly Tints
 #   Define the target tints for each hour of the day, for each climate.
 #   The month, hour, and climate_id are all passed as arguments so you can
 #   create as in-depth of a configuration as you like. Just create branches
 #   within branches using the climate, month, and hour as conditions to define
 #   the desired screen tone. There will be no tint (0, 0, 0, 0) for anything
 #   left undefined. (see presets below for examples)
 #
 #   Setup: [RED, GREEN, BLUE, GRAY]
 #-----------------------------------------------------------------------------
 def self.time_tint(climate_id, hour, month)
   case climate_id
   when 0  # Outdoor
     case month
     when 1, 2, 12
       case hour
       when 0, 1, 2, 3, 4, 5, 6, 19, 20, 21, 22, 23
         return [-100, -100, -20, 15]
       when 7
         return [-15, -15, -25, 10]
       when 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18
         return [-10, -10, -10, 10]
       end
     when 3, 4, 5
       case hour
       when 0, 1, 2, 3, 4, 5, 20, 21, 22, 23
         return [-100, -100, -20, 10]
       when 6
         return [-5, -5, -20, 0]
       when 18
         return [0, 0, -15, 5]
       when 19
         return [-15, -15, -30, 10]
       end
     when 6, 7, 8
       case hour
       when 0, 1, 2, 3, 4, 5, 20, 21, 22, 23
         return [-100, -100, -20, 15]
       when 6
         return [10, 10, -10, 0]
       when 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17
         return [5, 5, -5, 0]
       when 18
         return [-25, -25, -10, 5]
       when 19
         return [-50, -50, -15, 10]
       end
     when 9, 10, 11
       case hour
       when 0, 1, 2, 3, 4, 5, 20, 21, 22, 23
         return [-100, -100, -20, 10]
       when 6
         return [10, 5, -10, 10]
       when 18
         return [5, 5, -20, 0]
       when 19
         return [-5, -5, -25, 10]
       end
     end
   #-------------------------------------------------------------------
   when 1  # Snow
     case month
     when 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
       case hour
       when 0, 1, 2, 3, 4, 5, 6, 19, 20, 21, 22, 23
         return [-100, -100, -20, 15]
       when 7
         return [-15, -15, -25, 10]
       when 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18
         return [-10, -10, -10, 10]
       end
     end
   #-------------------------------------------------------------------
   when 2  # Desert
     case month
     when 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
       case hour
       when 0, 1, 2, 3, 4, 5, 20, 21, 22, 23
         return [-100, -100, -20, 15]
       when 6
         return [10, 10, -10, 0]
       when 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17
         return [5, 5, -5, 0]
       when 18
         return [-25, -25, -10, 5]
       when 19
         return [-50, -50, -15, 10]
       end
     end
   #-------------------------------------------------------------------
   when 3  # Underground
     case month
     when 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
       case hour
       when 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23
         return [-20, -20, -20, 0]
       end
     end
   #-------------------------------------------------------------------
   end
   # Default return value for undefined time/climate (Don't edit)
   return [0, 0, 0, 0]
 end
end

 #-----------------------------------------------------------------------------

class Climate

 attr_accessor :maps

 def initialize
 #-----------------------------------------------------------------------------
 # Initialize New Climates
 #   Simply follow the same pattern for each new climate you create.
 #-----------------------------------------------------------------------------
   @climate[0] = Game_Climate.new(0)
   @climate[1] = Game_Climate.new(1)
   @climate[2] = Game_Climate.new(2)
   @climate[3] = Game_Climate.new(3)
   @climate[4] = Game_Climate.new(4)
 #-----------------------------------------------------------------------------
 # Climate Names
 #   Create names for the different climates.
 #-----------------------------------------------------------------------------
   @climate[0].name = 'Outdoor'
   @climate[1].name = 'Indoor'
   @climate[2].name = 'Snow'
   @climate[3].name = 'Desert'
   @climate[4].name = 'Underground'
 #-----------------------------------------------------------------------------
 # Weather for this Climate?
 #   If false, no weather will be shown for climate, although weather sound and
 #   tinting can still be used if desired.
 #-----------------------------------------------------------------------------
   @climate[0].weather = true
   @climate[1].weather = false
   @climate[2].weather = true
   @climate[3].weather = true
   @climate[4].weather = false
 #-----------------------------------------------------------------------------
 # Weather Tinting?
 #   If true, different weather patterns will influence the screen tint
 #-----------------------------------------------------------------------------
   @climate[0].tinting = true
   @climate[1].tinting = false
   @climate[2].tinting = true
   @climate[3].tinting = true
   @climate[4].tinting = true
 #-----------------------------------------------------------------------------
 # Weather Sound?
 #   If true, weather BGS will be played automatically for that climate
 #-----------------------------------------------------------------------------
   @climate[0].sound = true
   @climate[1].sound = true
   @climate[2].sound = true
   @climate[3].sound = true
   @climate[4].sound = false
 #-----------------------------------------------------------------------------
 # Time Speed
 #   This will be the default time speed used for the climate. It can be
 #   overridden with script calls in-game if needed. "1" is real-time, and
 #   any other number is multiples of real-time, so "5" is 5 times as fast as
 #   the real world. (unless you live in a videogame)
 #-----------------------------------------------------------------------------
   @climate[0].speed = 40
   @climate[1].speed = 40
   @climate[2].speed = 40
   @climate[3].speed = 40
   @climate[4].speed = 40
 #-----------------------------------------------------------------------------
 # Maps for each climate
 # Include IDs of maps that use each respective climate.
 #-----------------------------------------------------------------------------
   @climate[0].maps = [001]
   @climate[1].maps = []
   @climate[2].maps = []
   @climate[3].maps = []
   @climate[4].maps = []
 #-----------------------------------------------------------------------------
 end
#-------------------------------------------------------------------------------
 def map_climate(map_id)
   @climate.each {|climate| return climate if climate.maps.include?(map_id)}
   # Returns a dummy climate with empty settings if not defined.
   return Game_Climate.new(-1, 'DUMMY', false, false, false, 5, [])
 end
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#                           END CONFIGURATION
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:


Please use the 'code' tags. ~KK20

ForeverZer0

I see that the climate configuration only defines one map, the map with ID:1. Are you using this configuration in a brand new project with only one map?
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Sbus

July 13, 2012, 07:10:30 am #239 Last Edit: July 13, 2012, 07:27:05 am by Sbus
yes
EDIT: I tried the script ina new blank project with just one map, and i got this error:
????? 'CCTS_Configuration' ? 493 ??? NoMethodError ???????
undefined method '[]= for nil:NilClass

line 493 is the line in which the first climate is created...
so i think the problem with the first project is that the climates aren't created, so weather and hourly tint don't work.