Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Bob423

Scripted Day/Night system

Recommended Posts

[RMXP]

 

i know this can be done with common events, but i think it will be easier with a script.

 

i need a script that makes the tint go through a 5 tone cycle:

 

dawn

midday

evening

dusk

midnight

(easily customized intervals)

 

could be more or less though.

 

in addition to that, i need the script to turn a switch on when it reaches dusk, and off when it reaches dawn. (so i can make lights and stuff)

 

i would also like there to be a place in the script where i can list the IDs of inside maps, where the color tone is reset, but it stores the current time as a variable so the time isnt reset when you leave. in fact, i would like the time to continue even after you enter an inside map, but the color tone doesnt change.

 

and i know kellessdee has a lighting system that i want to try. if i can get a link to that, that would be great.

 

thanks :biggrin_002:

Edited by Bob423

Share this post


Link to post
Share on other sites

Here's some scripts I found, probaby not completely what you want maybe. But here you go.

 

 

http://forum.chaos-project.com/index.php?topic=2546.0

 

#|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|
# Day Night Climate System (DNC) by Winkio
# Version: 1.00
#|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|
# 
# 
#|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|
# This script keeps track of the time of day and tints the screen accordingly.
# The user can define the length of the day and night.
# Also, the user can create climates which determine the chances of different
# types of weather, which are automatically applied to any map through this 
# script.
#
# Have three sound files, "Wind.ogg", "Rain.ogg", and "Storm.ogg" in your BGS
# folder to be used as sound effects for those weathers.
# 
# Commands:
# $game_dnc.disable - disables the DNC
# $game_dnc.enable  - enables the DNC
# $game_dnc.setup_climate(id, phase) - sets up a climate.  If phase is true,
#    it sets up the climate for the map of the id.  If phase it false, it sets
#    up the climate with that id
# $game_dnc.pass_time(amount) - time passes for the amount of seconds
# $game_dnc.goto_day - sets the time to daybreak
# $game_dnc.goto_night - sets the time to nightfall
# $game_dnc.set_weather_rates(rate1, rate2, rate3, rate4, rate5) - sets the
#    chances of getting different weather.  rates are from 0-100
# $game_dnc.set_weather_states(state1, state2, state3, state4, state5) - sets
#    what weather is currently happening or not (true/false)
# $game_dnc.set_time(newtime) - sets the time to newtime
# 
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|

#===============================================================================
# Climates
#
# Configure your climates here.
#===============================================================================

module Climates

 #=============================================================================
 # get(id)
 #
 # returns the climate number for map with ID id.
 # when (MAP_ID) then return (CLIMATE_ID)
 #=============================================================================
 def self.get(id)
   case id
   when 12 then return 1
   end
   return 0
 end
 #=============================================================================
 # cycle(id)
 #
 # returns the length of a day/night cycle for the climate with ID id.
 # (in seconds)
 # when (CLIMATE_ID) then return (CYCLE_LENGTH)
 #=============================================================================
 def self.cycle(id)
   case id
   when 1 then return 60
   when 2 then return 300
   end
   return 0
 end
 #=============================================================================
 # day_night(id)
 #
 # returns the day start, night start, day transition, and night transition
 # times for the climate with ID id.
 # (in seconds)
 # when (CLIMATE_ID) then return
 # [day_start, night_start, day_transition, night_transition]
 #=============================================================================
 def self.day_night(id)
   case id
   when 1 then return [0, 30, 5, 5]
   when 2 then return [0, 150, 10, 10]
   end
   return [0, 0, 0, 0]
 end
 #=============================================================================
 # weather(id)
 #
 # returns the percent chance of wind, clouds, rain, snow, and storm weather
 # for the climate with ID id.
 # (0-100)
 # when (CLIMATE_ID) then return
 # [wind_chance, clouds_chance, rain_chance, snow_chance, storm_chance]
 #=============================================================================
 def self.weather(id)
   case id
   when 1 then return [20, 20, 20, 20, 20]
   when 2 then return [10, 10, 10, 10, 0]
   end
   return [0, 0, 0, 0, 0]
 end
 #=============================================================================
 # volatility(id)
 #
 # returns how often the weather changes for the climate with ID id.
 # (in seconds) greater than 0 or weather never updates.
 # when (CLIMATE_ID) then return (VOLATILITY)
 #=============================================================================
 def self.volatility(id)
   case id
   when 1 then return 15
   when 2 then return 30
   end
   return 0
 end
end

#==============================================================================
# DNC
#==============================================================================

class DNC

 attr_accessor :cid
 attr_accessor :time
 attr_accessor :day
 attr_accessor :weather
 attr_accessor :cycle
 attr_accessor :day_start
 attr_accessor :night_start
 attr_accessor :day_tran
 attr_accessor :night_tran
 attr_accessor :wind
 attr_accessor :clouds
 attr_accessor :rain
 attr_accessor :snow
 attr_accessor :storm
 attr_accessor :current_weather
 attr_accessor :volatility

 def initialize
   @time = 0
   @day = true
   @weather = [false, false, false, false, false]
   setup_climate(0)
 end

 def setup_climate(id, phase=true)
   if phase
     @cid = Climates.get(id)
   else
     @cid = id
   end
   @cycle = Climates.cycle(cid)
   @day_start = Climates.day_night(cid)[0]
   @night_start = Climates.day_night(cid)[1]
   @day_tran = Climates.day_night(cid)[2]
   @night_tran = Climates.day_night(cid)[3]
   @wind = Climates.weather(cid)[0]
   @clouds = Climates.weather(cid)[1]
   @rain = Climates.weather(cid)[2]
   @snow = Climates.weather(cid)[3]
   @storm = Climates.weather(cid)[4]
   @volatility = Climates.volatility(cid)
   if @cycle != 0
     @time %= @cycle
   end
 end

 def self.disable
   setup_climate(0)
 end

 def self.enable
   setup_climate($game_map.map_id)
 end

 def pass_time(amount=1)
   if @cycle != 0
     @time = (@time + amount)%@cycle
   end
 end

 def goto_day
   @time = @day_start
   apply_day_night
 end

 def goto_night
   @time = @night_start
   apply_day_night
 end

 def set_weather_rates(rate1, rate2, rate3, rate4, rate5)
   @wind = rate1
   @clouds = rate2
   @rain = rate3
   @snow = rate4
   @storm = rate5
 end

 def set_weather_states(state1, state2, state3, state4, state5)
   @weather = [state1, state2, state3, state4, state5]
 end

 def set_time(newtime)
   @time = newtime % @cycle
   apply_day_night
 end

 def apply_day_night
   # determine if it is day or night
   if @time < @night_start and @time > @day_start
     newday = true
   else
     newday = false
   end
   # transition if not the same as current state of day
   if @cid != 0 and newday != @day
     if newday
       $game_screen.start_tone_change(Tone.new(0, 0, 0, 0), 40*@day_tran)
     else
       $game_screen.start_tone_change(Tone.new(-40, -40, 0, 0), 40*@night_tran)
     end
     @day = newday
   end
 end

 def apply_climate
   # determine weather
   if @cid != 0
     chance = rand(100)
     if chance < @wind
       @weather[0] = true
     else
       @weather[0] = false
     end
     chance = rand(100)
     if chance < @clouds
       @weather[1] = true
     else
       @weather[1] = false
     end
     chance = rand(100)
     if chance < @rain
       @weather[2] = true
     else
       @weather[2] = false
     end
     chance = rand(100)
     if chance < @snow
       @weather[3] = true
     else
       @weather[3] = false
     end
     chance = rand(100)
     if chance < @storm
       @weather[4] = true
     else
       @weather[4] = false
     end
   end
   # apply weather
   if @weather[3]
     # apply snow
     $game_system.bgs_fade(2)
     $game_screen.weather(3, 5, 200)
     if @day
       $game_screen.start_tone_change(Tone.new(0, 0, 0, 64), 160)
     else
       $game_screen.start_tone_change(Tone.new(-40, -40, 0, 128), 160)
     end
   elsif @weather[4]
     #apply storm
     Audio.bgs_play("Audio/BGS/Storm.ogg", 80, 100)
     $game_screen.weather(2, 5, 200)
     if @day
     $game_screen.start_tone_change(Tone.new(-28, -28, -28, 28), 160)
     else
       $game_screen.start_tone_change(Tone.new(-58, -58, -58, 54), 160)
     end
   elsif @weather[2]
     #apply rain
     Audio.bgs_play("Audio/BGS/Rain.ogg", 80, 100)
     $game_screen.weather(1, 5, 200)
     if @day
       $game_screen.start_tone_change(Tone.new(-15, -15, -15, 64), 160)
     else
       $game_screen.start_tone_change(Tone.new(-50, -50, -50, 128), 160)
     end
   elsif @weather[1]
     #apply clouds
     $game_screen.weather(0, 5, 200)
     $game_system.bgs_fade(2)
     if @day
       $game_screen.start_tone_change(Tone.new(-10, -10, -10, 32), 160)
     else
       $game_screen.start_tone_change(Tone.new(-45, -45, -45, 64), 160)
     end
   else
     if @day
       $game_screen.start_tone_change(Tone.new(0, 0, 0, 0), 160)
     else
       $game_screen.start_tone_change(Tone.new(-40, -40, 0, 0), 160)
     end
   end
   if @weather[0]
     #apply wind
     $game_screen.weather(0, 5, 200)
     Audio.bgs_play("Audio/BGS/Wind.ogg", 80, 100)
   end
   #if no weather
   if @weather == [false, false, false, false, false, false]
     $game_screen.weather(0, 5, 200)
     $game_system.bgs_fade(2)
   end
 end

end

$game_dnc = DNC.new

#==============================================================================
# Scene_Map
#==============================================================================

class Scene_Map

 attr_accessor :updatetimer
 attr_accessor :weathertimer

 alias main_dnc_later main
 def main
   @weathertimer = 0
   @updatetimer = Graphics.frame_count / Graphics.frame_rate * 2
   $game_dnc.setup_climate($game_map.map_id)
   main_dnc_later
 end

 alias update_dnc_later update
 def update
   if @updatetimer != Graphics.frame_count / Graphics.frame_rate * 2
     update_dnc
     @updatetimer = Graphics.frame_count / Graphics.frame_rate * 2
   end
   update_dnc_later
 end

 def update_dnc
   if $game_dnc.volatility != 0
     $game_dnc.pass_time
     $game_dnc.apply_day_night
     if @weathertimer >= $game_dnc.volatility
       $game_dnc.apply_climate
       @weathertimer %= $game_dnc.volatility
     end
     @weathertimer += 1
   end
 end

 alias transfer_player_dnc_later transfer_player
 def transfer_player
   if $game_map.map_id != $game_temp.player_new_map_id
     $game_dnc.setup_climate($game_temp.player_new_map_id)
   end
   transfer_player_dnc_later
 end

end

 

http://www.rpgrevolution.com/forums/index.php?showtopic=35105

 

#===============================================================================
#  Check_Time, By Leon_Westbrooke
#  Edited by: Night_Runner (23/Nov/09)
#-------------------------------------------------------------------------------
#  Details:
#       Will automatically change the tint of maps that it is called on based on
#       the computer's internal clock.
#
#  Instructions:
#       Place script above main, but below other default scripts.
#       Below is a customizarion area (lines 27 ~ 36), in it you can set the
#       switch that has to be turned on for your map to update tint, and you
#       can define a variable to store what part of the day it is.
#
#  Notes:
#       Between 9pm and 6am the variable returns 1
#       Between 6am and 8am the variable returns 2
#       Between 8pm and 5pm the variable returns 3
#       Between 5pm and 9pm the variable returns 4
#
#===============================================================================



class Game_Map

 #----------------------------------------------------------------------------
 # Customization
 #----------------------------------------------------------------------------
 # Store the type of day in variable 14
 GAME_VARIABLE = 14
 # Switch to turn this script on
 SWITCH_ON = 3
 #----------------------------------------------------------------------------
 # End of customization.
 #----------------------------------------------------------------------------

 #----------------------------------------------------------------------------
 # Alias Methods
 #----------------------------------------------------------------------------
 alias check_time_initialize initialize
 alias check_time_update update
 #----------------------------------------------------------------------------
 # Update
 #----------------------------------------------------------------------------
 def update
   check_time_update
   @time_stamp = Time.new
   if $game_switches[sWITCH_ON]
     if @time_stamp.strftime("%H").to_i < 6 or @time_stamp.strftime("%H").to_i > 20
       red = -100
       green = -100
       blue = -90
       $game_screen.start_tone_change(Tone.new(red, green, blue, 20), 120)
       $game_variables[GAME_VARIABLE] = 1
     elsif @time_stamp.strftime("%H").to_i > 5 and @time_stamp.strftime("%H").to_i < 9
       red = -60
       green = -42
       blue = -60 
       $game_screen.start_tone_change(Tone.new(red, green, blue, 15), 120)
       $game_variables[GAME_VARIABLE] = 2
     elsif @time_stamp.strftime("%H").to_i > 8 and @time_stamp.strftime("%H").to_i < 18
       red = 0
       green = 0
       blue = 0
       $game_screen.start_tone_change(Tone.new(red, green, blue, 0), 120)
       $game_variables[GAME_VARIABLE] = 3
     elsif @time_stamp.strftime("%H").to_i >17 and @time_stamp.strftime("%H").to_i  < 21
       red = -40 
       green = -60 
       blue = -60 
       $game_screen.start_tone_change(Tone.new(red, green, blue, 15), 120)
       $game_variables[GAME_VARIABLE] = 4
     end
   end
 end
 def initialize
   check_time_initialize
   @time_stamp = Time.new
   if $game_switches[sWITCH_ON]
     if @time_stamp.strftime("%H").to_i < 6 or @time_stamp.strftime("%H").to_i > 20
       red = -100 
       green = -100 
       blue = -90 
       $game_screen.start_tone_change(Tone.new(red, green, blue, 20), 0)
       $game_variables[GAME_VARIABLE] = 1
     elsif @time_stamp.strftime("%H").to_i > 5 and @time_stamp.strftime("%H").to_i < 9
       red = -60 
       green = -42 
       blue = -60 
       $game_screen.start_tone_change(Tone.new(red, green, blue, 15), 0)
       $game_variables[GAME_VARIABLE] = 2
     elsif @time_stamp.strftime("%H").to_i > 8 and @time_stamp.strftime("%H").to_i < 18
       red = 0
       green = 0
       blue = 0
       $game_screen.start_tone_change(Tone.new(red, green, blue, 0), 0)
       $game_variables[GAME_VARIABLE] = 3
     elsif @time_stamp.strftime("%H").to_i >17 and @time_stamp.strftime("%H").to_i  < 21
       red = -42 
       green = -60 
       blue = -60 
       $game_screen.start_tone_change(Tone.new(red, green, blue, 15), 0)
       $game_variables[GAME_VARIABLE] = 4
     end
   end
 end
end

GAME_VARIABLE = 14

 

 

Edited by bigace

Share this post


Link to post
Share on other sites

sweet thanks. dont know why i can never find this kind of stuff

 

 

edit: i have a few problems:

 

1. there doesnt seem to be anyway of telling weather or not a map is indoors.

 

2. the first one is hard to customize.

 

3. i think the second one will work for what i want, but its strictly set for the computer's internal clock. i dont want that

Edited by Bob423

Share this post


Link to post
Share on other sites

You should check the links to as they help. The second has the original script without the internal clock.

Share this post


Link to post
Share on other sites

How come I never saw that thing on Choas? Or was it there and I was just blind. Any ways I that thing looks awesome, I'll be taking a look at it myself. :alright:

Share this post


Link to post
Share on other sites

dont worry about it guys, liz is helping me with it. thanks though :biggrin_002:

 

 

edit: actually i think ill try out that system of your zero

Edited by Bob423

Share this post


Link to post
Share on other sites

[shameless self-advertising]

 

Complete Climate & Time System

 

[/shameless self-advertising]

 

 

ok, so i have a problem with that script. its amazing and all, but i need some better instructions.

 

it wont let me change the climates tab at all in the .exe

 

i really want to use this, but cant get it to work :(

 

 

edit:

i also get this error when i run the game

 

"minimum WEATHER_WAIT must be less than maximum WEATHER_WAIT!"

 

on line 275 of the main script

Edited by Bob423

Share this post


Link to post
Share on other sites

In the "Climates" tab, you need to have a climate selected to edit, which are listed in the listbox in the top-left corner on that panel. As for the error, it is kinda self-explanatory, the minimum needs to be less than the maximum.

Share this post


Link to post
Share on other sites

yea i know you need to select something first, i did that, but when i edit something, it just goes right back to default when i click on something else.

 

as for the error, i dont think its that simple.

here's the method its in

 

 

 def error_check
   # Checks that required settings are within permissable range. All of these
   # would mess up the system later, or throw an error themselves. This will
   # just give a better explanation, and catch it earlier.
   raise('Time speed must be greater than 0!') unless @speed > 0
   raise('No Days defined!') if CCTS::DAYS.empty?
   raise('No Months defined!') if CCTS::MONTHS.empty?
   if CCTS::WEATHER_WAIT[0] >= CCTS::WEATHER_WAIT[1]
     raise('Minimum WEATHER_WAIT must be less than Maximum WEATHER_WAIT!')
   end
   if CCTS::MONTH_LENGTH.size != CCTS::MONTHS.size
     raise('\'MONTH_LENGTH\' and \'MONTHS\' arrays must be equal size.')
   end
   if @minute > 60 || @hour > 24 || 
       @day > CCTS::MONTH_LENGTH[@month - 1] || @month > CCTS::MONTHS.size ||
       [@minute, @hour, @day, @month, @year].any? {|time| time < 0}
     raise('Time System Error! Time value(s) not within permitted range.')
   end
 end

 

 

 

unless its something that i did in the .exe

in which case, i need to know know how to fix it.

Edited by Bob423

Share this post


Link to post
Share on other sites

Are you adding the settings? The check boxes are just for selecting which setting to MODIFY. if you would like to actually SEE all the set values, click the review button. Click add to modify the settings.

 

climate.png

 

As for the wait, open the configuration script and look for this part:

 

# 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 = [5, 15]

 

Make sure the first value (in this case 5) is LESS (not equal and not greater) than the second value (in this case 15)

Share this post


Link to post
Share on other sites

alright, thanks :alright:

 

edit: ok, so i got rid of the error, by making it [0, 1]

 

but now there is a new error

 

 

 

script: main time

line: 604

 

error:

no method error occured

undefined method '[]' for nil:NilClass

 

 

 

also, that add button doesnt seem to do anything.

 

what im trying to edit is the behavior and maps sections. in the tab, and nothing else seems to want to change either.

 

do i need the two scripts in a certain order?

Edited by Bob423

Share this post


Link to post
Share on other sites

Somethings messed up with the config, and that line doesn't really explain a lot.

I imagine something is messed up with the weather probabilities. Hard to say without seeing the configuration.

Share this post


Link to post
Share on other sites

ok, here it is

 

 

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Complete Climate and Time System (CCTS)
# Author: ForeverZer0
# Version: 1.2.3
# Date: 2.10.2011
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#                             VERSION HISTORY
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# v.1.0   5.12.2010
#   - Original Release
# v.1.1   5.26.2010
#   - Added an attr_reader I mistakenly placed in the debugger that would make
#     the debugger a requirement for the script to work.
#   - Added some commands for message text to display the time, day, month, etc.
# v.1.2   10.10.10
#   - Added the "Good Weather Switch" by popular demand.
#   - Added ability to have game variables set to the current time values.
#   - Fixed bug so that the map refreshes properly when switches change.
#   - Fixed it so that window returns when scene changes and returns.
#   - Cleaned up overall code and added comments to help follow the main flow
#     of the script and understand it better.
#   - Changed the debug. No longer just prints to the standard output, but now
#     displays all the same info on-screen in real-time as it occurs.
#   - Built the Missing Climate Logger into the script. Will create a text file
#     in the directory listing any errors every time the game is play-tested.
#   - Added configurable format for how time is displayed.
#   - Added configuration for the look of the clock's windowskin
#   - Added Analog Clock spriteset.
#   - Consolidated the scripts into one.
# v.1.2.1  10.12.10
#   - Fixed a syntax error (Thanks rim1000 for pointing out)
# v.1.2.2  10.16.10
#   - Actually fixed the bug I should have fixed in 1.2.1
#   - Altered 'calculate_time' method, which would not allow the switches to 
#     refresh correctly until the next game hour passed. Switches will not
#     update each game minute as they were intended to.
# v.1.2.3  2.25.11
#   - Added configuration for setting bold and italic in the clock.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Introduction:
#
#   This script will give you TOTAL control of weather and time in your game. It
#   will allow you to set up different climates that use different weather
#   patterns, tints, sounds, and effects. It is also a complete Time System that
#   gives you full control of, and keeps track of, time, with every possible
#   configuration at your disposal. Note this script comes with a preset config
#   that will be suitable for most's needs, but it can be configured to the most
#   extreme level if so desired, which will require more work. It is not
#   neccessary to do this, but the ability is there.
#
# Features:
#
#   - Automatic weather control with defined types, frequency, probabilities,
#     tints, and sounds for any and every map in your game.
#   - Weather tint and BGS will fade in/out smoothly with the weather for a very
#     realistic feel
#   - Configurable screen tints for every climate, month, and hour that will
#     smoothly transition over the course of each hour, not transition to day
#     or night in matter of seconds.
#   - Completely configurable calendar system that can use custom names for days
#     and months, custom month lengths, etc.
#   - Can easily use configurable switches and variables for event conditions
#     based off the hour of the day, the season of the year, or the current
#     weather.
#   - Comes with a clock that can be toggled on/off by the player, with custom
#     location, opacity, and font name/size options.
#   - Also have option to use an analog clock.
#   - Complete control to freeze the time, screen tone, weather, or time speed,
#     seperately or together, with simple script calls.
#   - Comes with error checking and a debugger for easily testing your own
#     customization, and to help understand the system.
#   - Short, simple script calls for easy manipulation
#   - Compatible with Zero Advanced Weather and MAWS (v.1.2 or higher)
#
# Instructions:
# 
#   All instructions for configuration are explained below in each section.
#
#   ------------------------------------------------------------------------
#
#   Script Calls:
#
# * time.freeze(true/false)
#     - Will freeze/unfreeze time, tone, and weather.
#
# * time.tone_freeze(true/false)
#     - Will freeze/unfreeze the screen tone from updating automatically. Use
#       before you would like to set a custom screen tone, otherwise the system
#       will override it.
#
# * time.weather_freeze(true/false)
#     - Will freeze/unfreeze the weather from updating. Freeze if you would like
#       to manually set the weather and do not want the system to override it.
#
# * time.speed_freeze(true/false)
#     - Will keep the time speed set at a specific rate, and not change per each
#       map as the system usually does.
#
# * time.change_speed(SPEED)
#     - Will set the time speed to SPEED. Use time.speed_freeze if you would
#       would like to keep it there indefinitely
#
# * time.set(m, h, d, m, y)
#     - Sets the time to time defined in (minute, hour, day, month, year)
#       This will also allow you to 'go back' in time.
#
# * time.advance_minute(NUMBER)
#     - Advances minute by NUMBER
#
# * time.advance_hour(NUMBER)
#     - Advances hour by NUMBER
#
# * time.advance_day(NUMBER)
#     - Advances day by NUMBER
#
# * time.advance_month(NUMBER)
#     - Advances month by NUMBER
#
# * time.advance_year(NUMBER)
#     - Advances year by NUMBER
#
# * time.memorize(INDEX)
#     - Memorizes the current time to an array at INDEX. The INDEX can be any
#       integer you like, it is used to reference later if the time is restored.
#       This will allow for you to memorize as many 'times' as you need. Using
#       an existing INDEX will over-write the old one.
#
# * time.restore(INDEX)
#     - Sets the time to memorized time at INDEX. Does nothing if INDEX does not
#       exist. Obviously, you must have a memorized time before using.
#
# * time.clock(true/false)
#     - Enables/Disables player from toggling clock. Will dispose the clock
#       if disabled when clock is showing.
#
# * time.simple_clock(true/false)
#     - By default, the clock displays the time, day, and date. If this is true,
#       the clock will only display the time, nothing else.
#
# * time.analog_clock(true/false)
#     - Sets Analog Clock flag ON/OFF. If true, analog clock will be used,
#
# * time.clock_face(x, y, opacity, fontname, fontsize, bold, italic)
#     - Changes the clock settings to defined values. Can be called with any 
#       number of arguments that you would like to change.
#
# * time.analog_face(filename, handoffset, x, y, opacity)
#     - Changes the settings for the analog clock. Can be called with any number
#       of arguments that you would like to change. (see note below for analog)
#
# * time.show_clock
#     - Forcibly toggles the clock ON. Used for showing the clock when it is
#       unknown if the player will have it ON or OFF at that time. The clock must
#       be enabled for this method to work. (Only during Scene_Map)
#
# * time.change_climate(MAP_ID, CLIMATE_ID)
#     - Will permanently change map with MAP_ID from its current climate to the
#       the one defined by CLIMATE_ID. Will not have an immediate effect on the
#       current map, but will be applied next time the player returns.
#
# * CCTS.debug
#     - Toggles the debug sprite ON/OFF. Shows almost every relevant variable
#       associated with the system and how it changes in real-time. See bottom
#       of script (around line 1500) for more information.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#                         BEGIN CONFIGURATION
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

 #    ** Script Generated at 11/1/2011 5:19:41 PM.

module CCTS

 # The names for your days. Use as many as you want. 
 DAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 
         'Saturday']

 # The name for your months. Use as many as you want. 
 MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 
           'August', 'September', 'October', 'November', 'December']

 # 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, 7, 2, 9, 2000]

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

 # 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 = [600, 400, 160, 'Arial', 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 = 'HCoA_WS.png'

 # 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 = '%2d:%02d'

 # 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 = [1, 2]

 # 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 = 13

 # 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 = 16
 # This switch will always be the opposite of the BAD_WEATHER_SWITCH.
 GOOD_WEATHER_SWITCH = 15

 # 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 = 14
 # 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 = 13
 NIGHT_SWITCH = 14

 # 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 = 20

 # 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 = 8
 HOUR_VARIABLE = 9
 DAY_VARIABLE = 10
 MONTH_VARIABLE = 11
 YEAR_VARIABLE = 12

 # 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 0  # 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 0  # 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 0  # 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
   @climate = []
 #-----------------------------------------------------------------------------
 # 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 = 48
   @climate[1].speed = 48
   @climate[2].speed = 48
   @climate[3].speed = 48
   @climate[4].speed = 48
 #-----------------------------------------------------------------------------
 # Maps for each climate
 # Include IDs of maps that use each respective climate. 
 #-----------------------------------------------------------------------------
   @climate[0].maps = [1, 3, 11, 12, 14, 15, 16, 17, 20, 21, 22, 27]
   @climate[1].maps = [2, 4, 5, 6, 7, 8, 9, 10, 13, 18, 23, 24, 25, 26]
   @climate[2].maps = []
   @climate[3].maps = []
   @climate[4].maps = [19]

 #-----------------------------------------------------------------------------
 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 
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

 

Share this post


Link to post
Share on other sites

In the "Hourly Tints" section, it looks like all the values for "climate_id" are 0.

 

ex.

when 0 # Outdoor

when 0 # Snow

when 0 # Desert

when 0 # Underground

 

They should be different. I wouldn't be surprised if that was a bug in the config program. It was my very first C# project I ever made, so I'm sure there is a lot of room for improvement. Either way, try manually changing the values there to what they should be.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...