I couldn't find that code anywhere in it. When I pasted the scripts over from the demo, I didn't copy over the farming ones. Would that have any effect on this?
Variable Calendar/Weather System
RGSS3 Scripts (RMVX Ace)Oh, you got the script from the demo? I really should update that later, it's outdated, I rewrote the script since then. Try the copy from the main script link: https://docs.google.com/file/d/0BywhvOtY4_H9dGNFSTlWQlVEZ3M/edit?pli=1
I inserted the updated script and now everything works fine! Sorry for the trouble, but thanks!
If I use this for a commercial game, in addition to crediting you guys, do I need to send you free copies as well?
While it would be appreciated, I do not see it as necessary to send me a free copy. This calendar script of mine is free to use with no strings attached!
hey , help me, how to initially disable all the function, include showing the hud and so on, and initialize after the talking and so on.?
I try to look into all the scripts yet found no luck, maybe I didnt check correctly or anything. please help
my project starting as a story tell (many2 words) and after tutorial then I want the script to turn on.. not from the beginning.. any help?
I try to look into all the scripts yet found no luck, maybe I didnt check correctly or anything. please help
my project starting as a story tell (many2 words) and after tutorial then I want the script to turn on.. not from the beginning.. any help?
Before customization ends in the main script, you should see the following methods.
def self.time_stop?
def self.no_tone?
def self.no_weather?
These are meant to be modified for extending their purposes. You can simply add a line at the top of the method that says 'return true unless $game_switches[some_switch]' where some_switch is any switch you choose to use(as long as it doesn't conflict with any other switches). As long as said switch is off(default behaviour), then time will be stopped, no tone changes will take place, and the weather whatever it is will not take effect. After your tutorial or whatever just turn that switch on.
Of course another option is to have the talking/intro stuff take place on an event/cutscene only map, and give said map the notetags:
<stop_time>
<no_tone>
<no_weather>
And have the player start in said map, and transfer to the "real gameplay" maps afterwards. Also remember you can use the built in event commands control variable to set/change time in game if necessary.
As for the HUD scripts, I've been meaning to remake them to fix a bug or two, and make the code cleaner, but I barely remember how I made them in the first place. They were originally made for the old version of the main script, and I have since remade it. I'll try to fix the huds and make them easier to read/control, but I can't make any promises.
def self.time_stop?
def self.no_tone?
def self.no_weather?
These are meant to be modified for extending their purposes. You can simply add a line at the top of the method that says 'return true unless $game_switches[some_switch]' where some_switch is any switch you choose to use(as long as it doesn't conflict with any other switches). As long as said switch is off(default behaviour), then time will be stopped, no tone changes will take place, and the weather whatever it is will not take effect. After your tutorial or whatever just turn that switch on.
Of course another option is to have the talking/intro stuff take place on an event/cutscene only map, and give said map the notetags:
<stop_time>
<no_tone>
<no_weather>
And have the player start in said map, and transfer to the "real gameplay" maps afterwards. Also remember you can use the built in event commands control variable to set/change time in game if necessary.
As for the HUD scripts, I've been meaning to remake them to fix a bug or two, and make the code cleaner, but I barely remember how I made them in the first place. They were originally made for the old version of the main script, and I have since remade it. I'll try to fix the huds and make them easier to read/control, but I can't make any promises.
I'm having this error:
Script 'HM_Calendar' line 290: TypeError ocurred.
Can't convert NilClass into tone
Can you help me? Your script is awesome man!
Script 'HM_Calendar' line 290: TypeError ocurred.
Can't convert NilClass into tone
Can you help me? Your script is awesome man!
The 1st and most important question is, are you using the script from the demo, or the stand alone? The demo has been temporarily taken down, I'll do a rough update later on to the most recent version of the actual calendar system.
Can you give me what line 290 for you is, as well as surrounding lines and let me know of any other changes you may have made in the editable region of the script?
Can you give me what line 290 for you is, as well as surrounding lines and let me know of any other changes you may have made in the editable region of the script?
I'm using the stand alone version.
The line 290 is:
284 #-----------------------------------------------------------------------------
285 #=#Tone Related-----------------------------------------------------------------
286 #-----------------------------------------------------------------------------
287 def self.show_tint(dura = 60)
288 hour = $game_variables[HOUR];hour = 0 if hour == 24
289 t = TONES[hour] unless no_tone?
290 t = TONE_DEFAULT if t == nil
291 $game_map.screen.start_tone_change(t, dura)
292 end
#---------------------------------------------------------------------------------------
And in the editable region, I've only added eight more months, and made the adjusts for those months.
Thanks for the quick reply!
The line 290 is:
284 #-----------------------------------------------------------------------------
285 #=#Tone Related-----------------------------------------------------------------
286 #-----------------------------------------------------------------------------
287 def self.show_tint(dura = 60)
288 hour = $game_variables[HOUR];hour = 0 if hour == 24
289 t = TONES[hour] unless no_tone?
290 t = TONE_DEFAULT if t == nil
291 $game_map.screen.start_tone_change(t, dura)
292 end
#---------------------------------------------------------------------------------------
And in the editable region, I've only added eight more months, and made the adjusts for those months.
Thanks for the quick reply!
Sorry, I've been trying but I can't seem to replicate the error no matter what I try while editing the editable region... or editing the script itself, I'll have to ask for a copy of your version of the script, as well as any extra details you can provide.
1: When does the error happen exactly?(immediately at game start, or at a certain time of day)
2: What were you doing at the time of the error(transfering maps, battle, using an event)
3: While doubtful that they'd effect this script in such a fashion, do you any other scripts that might effect tones?
When posting the script, be sure to use the spoiler tags.
It's hard to provide a fix or let you know if you did something wrong if I can't find a way to replicate the problem no matter what I do, I'm sure you understand.
1: When does the error happen exactly?(immediately at game start, or at a certain time of day)
2: What were you doing at the time of the error(transfering maps, battle, using an event)
3: While doubtful that they'd effect this script in such a fashion, do you any other scripts that might effect tones?
When posting the script, be sure to use the spoiler tags.
It's hard to provide a fix or let you know if you did something wrong if I can't find a way to replicate the problem no matter what I do, I'm sure you understand.
The answers for your questions:
1. The error happens when the game start, precisely in the moment when the map is gonna be shown.
2. Nothing, I only need to start the game and press new game to happen.
3. I'm using Khas Awesome Light Effects for sometimes changes the tone. But I've already deleted the script and tried again but no success...
Here it is the script.
Thanks in advance 🙂
1. The error happens when the game start, precisely in the moment when the map is gonna be shown.
2. Nothing, I only need to start the game and press new game to happen.
3. I'm using Khas Awesome Light Effects for sometimes changes the tone. But I've already deleted the script and tried again but no success...
Here it is the script.
#-------------------------------------------------------------------------------
#Harvest Moon style Variable Based Calendar and Weather System
#Author: Selchar
#Version 2.1
#-------------------------------------------------------------------------------
=begin
This is an attempt to make an easy to use yet customizable calendar system
similar to what can be found in Harvest Moon games. It's come a long say since
the initial release, as I've remade the whole thing to make it easier to
understand and customizable. Instructions are down below in the customization
area.
#-------------------------------------------------------------------------------
#Map/Tileset Note Tags
#-------------------------------------------------------------------------------
The following can be used in either map note boxes, or tileset note boxes.
<stop_time> - Maps with this tag will disable time.
<no_tone> - Maps with this tag will use the default done setting.
<inside_map> - Maps with this tag will not show weather effects, but
will have background sound volume will be divided by 3
<no_weather> - Maps with this tag will not show weather or use said weather's
background sound.
#-------------------------------------------------------------------------------
#Scriptcalls
#-------------------------------------------------------------------------------
All scriptcalls begin with HM_SEL::
next_day - This scriptcall will transition the day forward to the
nearest 6 AM.
next_day(x) - It also allows for an optional argument to select what
time of the day you will arrive at.
show_tint - This scriptcall should be used after manually changing
the time variable, to re-adjust the tone settings needed.
show_weather - This scriptcall should be used after manually adjusting
the Weather variable.
festivalcheck(x) - This scriptcall will return true if day x of the year is
flagged for a festival.
tomorrow_festival? - This scriptcall will return true if tomorrow is flagged
as a festival.
exact_time(h, m) - Returns true if it is the specified time.
Example: HM_SEL::exact_time(22, 10) is true at 10:10 PM
hour_range(a, 😎 - Returns true if the current hour is within the range.
Example: HM_SEL::hour_range(9, 21) is false before 9 AM
and after 9 PM, otherwise is true.
week_range(a, 😎 - Same as hour_range except for days.
=end
#-------------------------------------------------------------------------------
#Customization Begin
#-------------------------------------------------------------------------------
module HM_SEL
#What variables will be used
MIN = 81 #Minute Variable
HOUR = 82 #Hour variable, actual/military time. 0 = 12 AM, 13 = 1 PM
DAYA = 83 #Day of the Week variable, 1 for Monday, 7 for Sunday
DAYB = 84 #Day of the Month variable, you can find a use for it I'm sure.
DAYC = 85 #Day of the Year variable, used for festival day checks.
MONTH = 86 #Month Variable
YEAR = 87 #Year Variable
WEATHA = 88 #Current Weather
WEATHB = 89 #Tomorrow's Weather
#Used to determine if the currend day is flagged as a festival. 0 means it's
#a normal day, and you can set different values for different days in the
#FESTIVALDAYS hash below.
FESTIVAL_VAR = 10
#Switches that can be used for extra control. Set to 0 if you don not wish
#to use them.
STOP_TIME = 0
NO_TONE = 2
INSIDE_SWITCH = 3
DISABLE_WEATHER = 0
FRAMES_TIL_UPDATE = 60 #How quickly time updates, 60 roughly = 1 second
MINUTE_CYCLE = 1 #How many minutes pass per update
DAYS_IN_MONTH = {
#Month => Days,
1 => 31,
2 => 28,
3 => 31,
4 => 30,
5 => 31,
6 => 30,
7 => 31,
8 => 31,
9 => 30,
10 => 31,
11 => 30,
12 => 31,
#Add more for more months.
}#Please do not remove
#Want a common event to run at a specific time? Add it below in the shown format!
#Note, you can only have 1 common event per hour.
COMMON_EVENTS = {
#Hour => [Minute, ID],
0 => [0, 1], #Midnight
}#Please do not remove
#Hash used for flagging special days of the year. All days will be 0 by
#default. Day refers to the day of the year, Variable is what number you
#want to associate with said day for eventing purposes.
FESTIVALDAYS = {
#Day => Variable,
1 => 0,
2 => 1,
}#Please do not remove
TONE_DEFAULT = Tone.new(0,0,0,0)
TONES = {
#Hour => Tone Settings(Red, Green, Blue, Grey)
0 => Tone.new(-125,-125,0,125),
1 => Tone.new(-125,-125,0,125),
2 => Tone.new(-125,-125,0,125),
3 => Tone.new(-125,-125,0,125),
4 => Tone.new(-75,-75,0,50),
5 => Tone.new(-75,-75,0,50),
11 => Tone.new(45,45,0,-25),
12 => Tone.new(45,45,0,-25),
13 => Tone.new(45,45,0,-25),
14 => Tone.new(45,45,0,-25),
18 => Tone.new(-50,-50,0,25),
19 => Tone.new(-50,-50,0,25),
20 => Tone.new(-50,-50,0,25),
21 => Tone.new(-75,-100,0,75),
22 => Tone.new(-75,-100,0,75),
23 => Tone.new(-75,-100,0,75),
}
WEATHER = {
#Month => [Odds, Weather, BGS, Volume, Pitch]
1 => [30, :rain, "Rain", 95, 100],
2 => [45, :rain, "Rain", 95, 100],
3 => [60, :rain, "Rain", 95, 100],
4 => [60, :storm, "Wind", 75, 100],
5 => [70, :storm, "Wind", 75, 100],
6 => [45, :rain, "Rain", 95, 100],
7 => [15, :snow, "Rain", 95, 100],
8 => [50, :rain, "Rain", 95, 100],
9 => [30, :snow, "Rain", 95, 100],
10 => [70, :snow, "Wind", 75, 100],
11 => [80, :snow, "Wind", 75, 100],
12 => [60, :snow, "Wind", 75, 100],
}
#The following methods are used as condions for determining whether or not to
#use this script's effect. Feel free to add/remove conditions as you see fit.
def self.time_stop?
#EXAMPLES
#Stops time at 11 PM
#return true if $game_variables[HOUR] == 23
#Stops time if not moving
#return true if $game_player.movable?
return true if $game_switches[sTOP_TIME]
#Stop time during messages.
#Stop time running events.
return true if $game_map.map.stop_time
return true if $game_map.tileset.stop_time
return false
end
def self.no_tone?
return true if $game_switches[NO_TONE]
return true if $game_map.map.no_tone
return true if $game_map.tileset.no_tone
return false
end
def self.inside?
return true if $game_switches[iNSIDE_SWITCH]
return true if $game_map.map.inside_map
return true if $game_map.tileset.inside_map
return false
end
def self.no_weather?
return true if $game_switches[DISABLE_WEATHER]
return true if $game_map.map.no_weather
return true if $game_map.tileset.no_weather
return false
end
#This determines what the variables will be at the start of the game.
def self.init_var
if $game_variables[DAYA] == 0 #Ignore this
$game_variables[DAYA] = 1 #1 = Monday, 7 = Sunday
$game_variables[DAYB] = 1 #Day of the month
$game_variables[DAYC] = 1 #Day of the year
$game_variables[MONTH] = 1 #Starting month
$game_variables[YEAR] = 1 #Starting year
$game_variables[WEATHA] = 1 #Initial weather.
$game_variables[WEATHB] = 1 #1 = Sun, 2 = Rain, 3 = Snow
show_tint
show_weather
end
end
end
#-------------------------------------------------------------------------------
#Customization End
#-------------------------------------------------------------------------------
#Beow is the core of the script. It should be easy to understand, tho there
#is little reason to change anything, feel free to look around.
#===============================================================================
$sel_time_frame = 0
module HM_SEL
def self.prog_minute #Minute's End
$sel_time_frame = 0
$game_variables[MIN] += MINUTE_CYCLE
#Checks Common Event Hash
call_common_event
end
def self.prog_hour #Hour's End
$game_variables[MIN] = 0
$game_variables[HOUR] += 1
show_tint
end
def self.prog_day #Day's End
$game_variables[HOUR] = 0
$game_variables[DAYA] += 1
$game_variables[DAYB] += 1
$game_variables[DAYC] += 1
#Week's end
$game_variables[DAYA] = 1 if $game_variables[DAYA] == 8
#Month's end
if $game_variables[DAYB] > DAYS_IN_MONTH[$game_variables[MONTH]]
$game_variables[DAYB] = 1
$game_variables[MONTH] += 1
end
#Year's end
if $game_variables[MONTH] > DAYS_IN_MONTH.size
$game_variables[DAYC] = 1
$game_variables[MONTH] = 1
$game_variables[YEAR] += 1
end
#Shift Weather
weather_manager
if festivalcheck($game_variables[DAYC])
$game_variables[FESTIVAL_VAR] = FESTIVALDAYS[$game_variables[DAYC]]
else
$game_variables[FESTIVAL_VAR] = 0
end
end
#-----------------------------------------------------------------------------
#Start of Time Manager--------------------------------------------------------
#-----------------------------------------------------------------------------
def self.time_manager
unless time_stop?
init_var
if $sel_time_frame == FRAMES_TIL_UPDATE
prog_minute
prog_hour if $game_variables[MIN] >= 60
prog_day if $game_variables[HOUR] >= 24 && $game_variables[MIN] == 0
end
$sel_time_frame += 1
end
end
#-----------------------------------------------------------------------------
def self.call_common_event
hour = $game_variables[HOUR]
minute = $game_variables[MIN]
#Corrects time if minute is 60
if minute == 60
hour += 1
minute = 0
end
hour = 0 if hour == 24
if COMMON_EVENTS[hour] != nil
if COMMON_EVENTS[hour].at(0) == minute
$game_temp.reserve_common_event(COMMON_EVENTS[hour].at(1))
end
end
end
#-----------------------------------------------------------------------------
#=#Tone Related-----------------------------------------------------------------
#-----------------------------------------------------------------------------
def self.show_tint(dura = 60)
hour = $game_variables[HOUR];hour = 0 if hour == 24
t = TONES[hour] unless no_tone?
t = TONE_DEFAULT if t == nil
$game_map.screen.start_tone_change(t, dura)
end
#-----------------------------------------------------------------------------
#=#Weather Related--------------------------------------------------------------
#-----------------------------------------------------------------------------
def self.weather_manager
$game_variables[WEATHA] = $game_variables[WEATHB]
t_weather = 1
unless tomorrow_festival?
random_number = 1 + rand(100)
odds = WEATHER[$game_variables[MONTH]]
if random_number <= odds[0]
case odds[1]
when :rain
t_weather = 2
when :snow
t_weather = 3
when :storm
t_weather = 4
end
end
end
$game_variables[WEATHB] = t_weather
show_weather
end
def self.show_weather(dura = 300)
unless no_weather?
temp = WEATHER[$game_variables[MONTH]]
unless inside?
case $game_variables[WEATHA]
when 1 #Sun
$game_map.screen.change_weather🙂none, 0, dura)
Audio.bgs_stop
else
$game_map.screen.change_weather(temp[1], 5, dura)
RPG::BGS.new(temp[2], temp[3], temp[4]).play
end
else #Inside
$game_map.screen.change_weather🙂none, 0, 0)
case $game_variables[WEATHA]
when 1 #Sun
Audio.bgs_stop
else
RPG::BGS.new(temp[2], temp[3]/3, temp[4]).play
end
end
else
$game_map.screen.change_weather🙂none, 0, 120)
Audio.bgs_stop
end
end
#-----------------------------------------------------------------------------
#=#Scriptcalls------------------------------------------------------------------
#-----------------------------------------------------------------------------
def self.next_day(temp_hour = 6)
$sel_time_frame = 0
case $game_variables[HOUR]
when 0...temp_hour
$game_variables[MIN] = 0
$game_variables[HOUR] = temp_hour
else
prog_day
$game_variables[MIN] = 0
$game_variables[HOUR] = temp_hour
show_tint
end
end
def self.festivalcheck(day)
return false if FESTIVALDAYS[day] == nil
return false if FESTIVALDAYS[day] == 0
return true
end
def self.tomorrow_festival?
return festivalcheck($game_variables[DAYC] + 1)
end
def self.exact_time(hour, min)
if $game_variables[HOUR] == hour && $game_variables[MIN] == min
return true
else
return false
end
end
def self.hour_range(hour_a, hour_ 😎
if $game_variables[HOUR] >= hour_a && $game_variables[HOUR < hour_b]
return true
else
return false
end
end
def self.week_range(day_a, day_ 😎
if $game_variables[DAYA] >= day_a && $game_variables[DAYA] < day_b
return true
else
return false
end
end
end
#-------------------------------------------------------------------------------
#Auto Weather/Tone change during transfers just before Fade-In
#-------------------------------------------------------------------------------
class Scene_Map < Scene_Base
alias :sel_time_post_transfer 😛ost_transfer
def post_transfer
HM_SEL::show_tint(0)
HM_SEL::show_weather(0)
sel_time_post_transfer
end
alias :hm_sel_update :update
def update
hm_sel_update
HM_SEL::time_manager
end
end
#-------------------------------------------------------------------------------
#Map Note Tags Begin============================================================
#-------------------------------------------------------------------------------
class Game_Map
attr_accessor :map
end
class RPG::Map
def stop_time
if @stop_time.nil?
if @note =~ /<stop_time>/i
@stop_time = true
else
@stop_time = false
end
end
@stop_time
end
def no_tone
if @no_tone.nil?
if @note =~ /<no_tone>/i
@no_tone = true
else
@no_tone = false
end
end
@no_tone
end
def inside_map
if @inside_map.nil?
if @note =~ /<inside_map>/i
@inside_map = true
else
@inside_map = false
end
end
@inside_map
end
def no_weather
if @no_weather.nil?
if @note =~ /<no_weather>/i
@no_weather = true
else
@no_weather = false
end
end
@no_weather
end
end
class RPG::Tileset
def stop_time
if @stop_time.nil?
if @note =~ /<stop_time>/i
@stop_time = true
else
@stop_time = false
end
end
@stop_time
end
def no_tone
if @no_tone.nil?
if @note =~ /<no_tone>/i
@no_tone = true
else
@no_tone = false
end
end
@no_tone
end
def inside_map
if @inside_map.nil?
if @note =~ /<inside_map>/i
@inside_map = true
else
@inside_map = false
end
end
@inside_map
end
def no_weather
if @no_weather.nil?
if @note =~ /<no_weather>/i
@no_weather = true
else
@no_weather = false
end
end
@no_weather
end
end
#-------------------------------------------------------------------------------
#End of File
#-------------------------------------------------------------------------------
#Harvest Moon style Variable Based Calendar and Weather System
#Author: Selchar
#Version 2.1
#-------------------------------------------------------------------------------
=begin
This is an attempt to make an easy to use yet customizable calendar system
similar to what can be found in Harvest Moon games. It's come a long say since
the initial release, as I've remade the whole thing to make it easier to
understand and customizable. Instructions are down below in the customization
area.
#-------------------------------------------------------------------------------
#Map/Tileset Note Tags
#-------------------------------------------------------------------------------
The following can be used in either map note boxes, or tileset note boxes.
<stop_time> - Maps with this tag will disable time.
<no_tone> - Maps with this tag will use the default done setting.
<inside_map> - Maps with this tag will not show weather effects, but
will have background sound volume will be divided by 3
<no_weather> - Maps with this tag will not show weather or use said weather's
background sound.
#-------------------------------------------------------------------------------
#Scriptcalls
#-------------------------------------------------------------------------------
All scriptcalls begin with HM_SEL::
next_day - This scriptcall will transition the day forward to the
nearest 6 AM.
next_day(x) - It also allows for an optional argument to select what
time of the day you will arrive at.
show_tint - This scriptcall should be used after manually changing
the time variable, to re-adjust the tone settings needed.
show_weather - This scriptcall should be used after manually adjusting
the Weather variable.
festivalcheck(x) - This scriptcall will return true if day x of the year is
flagged for a festival.
tomorrow_festival? - This scriptcall will return true if tomorrow is flagged
as a festival.
exact_time(h, m) - Returns true if it is the specified time.
Example: HM_SEL::exact_time(22, 10) is true at 10:10 PM
hour_range(a, 😎 - Returns true if the current hour is within the range.
Example: HM_SEL::hour_range(9, 21) is false before 9 AM
and after 9 PM, otherwise is true.
week_range(a, 😎 - Same as hour_range except for days.
=end
#-------------------------------------------------------------------------------
#Customization Begin
#-------------------------------------------------------------------------------
module HM_SEL
#What variables will be used
MIN = 81 #Minute Variable
HOUR = 82 #Hour variable, actual/military time. 0 = 12 AM, 13 = 1 PM
DAYA = 83 #Day of the Week variable, 1 for Monday, 7 for Sunday
DAYB = 84 #Day of the Month variable, you can find a use for it I'm sure.
DAYC = 85 #Day of the Year variable, used for festival day checks.
MONTH = 86 #Month Variable
YEAR = 87 #Year Variable
WEATHA = 88 #Current Weather
WEATHB = 89 #Tomorrow's Weather
#Used to determine if the currend day is flagged as a festival. 0 means it's
#a normal day, and you can set different values for different days in the
#FESTIVALDAYS hash below.
FESTIVAL_VAR = 10
#Switches that can be used for extra control. Set to 0 if you don not wish
#to use them.
STOP_TIME = 0
NO_TONE = 2
INSIDE_SWITCH = 3
DISABLE_WEATHER = 0
FRAMES_TIL_UPDATE = 60 #How quickly time updates, 60 roughly = 1 second
MINUTE_CYCLE = 1 #How many minutes pass per update
DAYS_IN_MONTH = {
#Month => Days,
1 => 31,
2 => 28,
3 => 31,
4 => 30,
5 => 31,
6 => 30,
7 => 31,
8 => 31,
9 => 30,
10 => 31,
11 => 30,
12 => 31,
#Add more for more months.
}#Please do not remove
#Want a common event to run at a specific time? Add it below in the shown format!
#Note, you can only have 1 common event per hour.
COMMON_EVENTS = {
#Hour => [Minute, ID],
0 => [0, 1], #Midnight
}#Please do not remove
#Hash used for flagging special days of the year. All days will be 0 by
#default. Day refers to the day of the year, Variable is what number you
#want to associate with said day for eventing purposes.
FESTIVALDAYS = {
#Day => Variable,
1 => 0,
2 => 1,
}#Please do not remove
TONE_DEFAULT = Tone.new(0,0,0,0)
TONES = {
#Hour => Tone Settings(Red, Green, Blue, Grey)
0 => Tone.new(-125,-125,0,125),
1 => Tone.new(-125,-125,0,125),
2 => Tone.new(-125,-125,0,125),
3 => Tone.new(-125,-125,0,125),
4 => Tone.new(-75,-75,0,50),
5 => Tone.new(-75,-75,0,50),
11 => Tone.new(45,45,0,-25),
12 => Tone.new(45,45,0,-25),
13 => Tone.new(45,45,0,-25),
14 => Tone.new(45,45,0,-25),
18 => Tone.new(-50,-50,0,25),
19 => Tone.new(-50,-50,0,25),
20 => Tone.new(-50,-50,0,25),
21 => Tone.new(-75,-100,0,75),
22 => Tone.new(-75,-100,0,75),
23 => Tone.new(-75,-100,0,75),
}
WEATHER = {
#Month => [Odds, Weather, BGS, Volume, Pitch]
1 => [30, :rain, "Rain", 95, 100],
2 => [45, :rain, "Rain", 95, 100],
3 => [60, :rain, "Rain", 95, 100],
4 => [60, :storm, "Wind", 75, 100],
5 => [70, :storm, "Wind", 75, 100],
6 => [45, :rain, "Rain", 95, 100],
7 => [15, :snow, "Rain", 95, 100],
8 => [50, :rain, "Rain", 95, 100],
9 => [30, :snow, "Rain", 95, 100],
10 => [70, :snow, "Wind", 75, 100],
11 => [80, :snow, "Wind", 75, 100],
12 => [60, :snow, "Wind", 75, 100],
}
#The following methods are used as condions for determining whether or not to
#use this script's effect. Feel free to add/remove conditions as you see fit.
def self.time_stop?
#EXAMPLES
#Stops time at 11 PM
#return true if $game_variables[HOUR] == 23
#Stops time if not moving
#return true if $game_player.movable?
return true if $game_switches[sTOP_TIME]
#Stop time during messages.
#Stop time running events.
return true if $game_map.map.stop_time
return true if $game_map.tileset.stop_time
return false
end
def self.no_tone?
return true if $game_switches[NO_TONE]
return true if $game_map.map.no_tone
return true if $game_map.tileset.no_tone
return false
end
def self.inside?
return true if $game_switches[iNSIDE_SWITCH]
return true if $game_map.map.inside_map
return true if $game_map.tileset.inside_map
return false
end
def self.no_weather?
return true if $game_switches[DISABLE_WEATHER]
return true if $game_map.map.no_weather
return true if $game_map.tileset.no_weather
return false
end
#This determines what the variables will be at the start of the game.
def self.init_var
if $game_variables[DAYA] == 0 #Ignore this
$game_variables[DAYA] = 1 #1 = Monday, 7 = Sunday
$game_variables[DAYB] = 1 #Day of the month
$game_variables[DAYC] = 1 #Day of the year
$game_variables[MONTH] = 1 #Starting month
$game_variables[YEAR] = 1 #Starting year
$game_variables[WEATHA] = 1 #Initial weather.
$game_variables[WEATHB] = 1 #1 = Sun, 2 = Rain, 3 = Snow
show_tint
show_weather
end
end
end
#-------------------------------------------------------------------------------
#Customization End
#-------------------------------------------------------------------------------
#Beow is the core of the script. It should be easy to understand, tho there
#is little reason to change anything, feel free to look around.
#===============================================================================
$sel_time_frame = 0
module HM_SEL
def self.prog_minute #Minute's End
$sel_time_frame = 0
$game_variables[MIN] += MINUTE_CYCLE
#Checks Common Event Hash
call_common_event
end
def self.prog_hour #Hour's End
$game_variables[MIN] = 0
$game_variables[HOUR] += 1
show_tint
end
def self.prog_day #Day's End
$game_variables[HOUR] = 0
$game_variables[DAYA] += 1
$game_variables[DAYB] += 1
$game_variables[DAYC] += 1
#Week's end
$game_variables[DAYA] = 1 if $game_variables[DAYA] == 8
#Month's end
if $game_variables[DAYB] > DAYS_IN_MONTH[$game_variables[MONTH]]
$game_variables[DAYB] = 1
$game_variables[MONTH] += 1
end
#Year's end
if $game_variables[MONTH] > DAYS_IN_MONTH.size
$game_variables[DAYC] = 1
$game_variables[MONTH] = 1
$game_variables[YEAR] += 1
end
#Shift Weather
weather_manager
if festivalcheck($game_variables[DAYC])
$game_variables[FESTIVAL_VAR] = FESTIVALDAYS[$game_variables[DAYC]]
else
$game_variables[FESTIVAL_VAR] = 0
end
end
#-----------------------------------------------------------------------------
#Start of Time Manager--------------------------------------------------------
#-----------------------------------------------------------------------------
def self.time_manager
unless time_stop?
init_var
if $sel_time_frame == FRAMES_TIL_UPDATE
prog_minute
prog_hour if $game_variables[MIN] >= 60
prog_day if $game_variables[HOUR] >= 24 && $game_variables[MIN] == 0
end
$sel_time_frame += 1
end
end
#-----------------------------------------------------------------------------
def self.call_common_event
hour = $game_variables[HOUR]
minute = $game_variables[MIN]
#Corrects time if minute is 60
if minute == 60
hour += 1
minute = 0
end
hour = 0 if hour == 24
if COMMON_EVENTS[hour] != nil
if COMMON_EVENTS[hour].at(0) == minute
$game_temp.reserve_common_event(COMMON_EVENTS[hour].at(1))
end
end
end
#-----------------------------------------------------------------------------
#=#Tone Related-----------------------------------------------------------------
#-----------------------------------------------------------------------------
def self.show_tint(dura = 60)
hour = $game_variables[HOUR];hour = 0 if hour == 24
t = TONES[hour] unless no_tone?
t = TONE_DEFAULT if t == nil
$game_map.screen.start_tone_change(t, dura)
end
#-----------------------------------------------------------------------------
#=#Weather Related--------------------------------------------------------------
#-----------------------------------------------------------------------------
def self.weather_manager
$game_variables[WEATHA] = $game_variables[WEATHB]
t_weather = 1
unless tomorrow_festival?
random_number = 1 + rand(100)
odds = WEATHER[$game_variables[MONTH]]
if random_number <= odds[0]
case odds[1]
when :rain
t_weather = 2
when :snow
t_weather = 3
when :storm
t_weather = 4
end
end
end
$game_variables[WEATHB] = t_weather
show_weather
end
def self.show_weather(dura = 300)
unless no_weather?
temp = WEATHER[$game_variables[MONTH]]
unless inside?
case $game_variables[WEATHA]
when 1 #Sun
$game_map.screen.change_weather🙂none, 0, dura)
Audio.bgs_stop
else
$game_map.screen.change_weather(temp[1], 5, dura)
RPG::BGS.new(temp[2], temp[3], temp[4]).play
end
else #Inside
$game_map.screen.change_weather🙂none, 0, 0)
case $game_variables[WEATHA]
when 1 #Sun
Audio.bgs_stop
else
RPG::BGS.new(temp[2], temp[3]/3, temp[4]).play
end
end
else
$game_map.screen.change_weather🙂none, 0, 120)
Audio.bgs_stop
end
end
#-----------------------------------------------------------------------------
#=#Scriptcalls------------------------------------------------------------------
#-----------------------------------------------------------------------------
def self.next_day(temp_hour = 6)
$sel_time_frame = 0
case $game_variables[HOUR]
when 0...temp_hour
$game_variables[MIN] = 0
$game_variables[HOUR] = temp_hour
else
prog_day
$game_variables[MIN] = 0
$game_variables[HOUR] = temp_hour
show_tint
end
end
def self.festivalcheck(day)
return false if FESTIVALDAYS[day] == nil
return false if FESTIVALDAYS[day] == 0
return true
end
def self.tomorrow_festival?
return festivalcheck($game_variables[DAYC] + 1)
end
def self.exact_time(hour, min)
if $game_variables[HOUR] == hour && $game_variables[MIN] == min
return true
else
return false
end
end
def self.hour_range(hour_a, hour_ 😎
if $game_variables[HOUR] >= hour_a && $game_variables[HOUR < hour_b]
return true
else
return false
end
end
def self.week_range(day_a, day_ 😎
if $game_variables[DAYA] >= day_a && $game_variables[DAYA] < day_b
return true
else
return false
end
end
end
#-------------------------------------------------------------------------------
#Auto Weather/Tone change during transfers just before Fade-In
#-------------------------------------------------------------------------------
class Scene_Map < Scene_Base
alias :sel_time_post_transfer 😛ost_transfer
def post_transfer
HM_SEL::show_tint(0)
HM_SEL::show_weather(0)
sel_time_post_transfer
end
alias :hm_sel_update :update
def update
hm_sel_update
HM_SEL::time_manager
end
end
#-------------------------------------------------------------------------------
#Map Note Tags Begin============================================================
#-------------------------------------------------------------------------------
class Game_Map
attr_accessor :map
end
class RPG::Map
def stop_time
if @stop_time.nil?
if @note =~ /<stop_time>/i
@stop_time = true
else
@stop_time = false
end
end
@stop_time
end
def no_tone
if @no_tone.nil?
if @note =~ /<no_tone>/i
@no_tone = true
else
@no_tone = false
end
end
@no_tone
end
def inside_map
if @inside_map.nil?
if @note =~ /<inside_map>/i
@inside_map = true
else
@inside_map = false
end
end
@inside_map
end
def no_weather
if @no_weather.nil?
if @note =~ /<no_weather>/i
@no_weather = true
else
@no_weather = false
end
end
@no_weather
end
end
class RPG::Tileset
def stop_time
if @stop_time.nil?
if @note =~ /<stop_time>/i
@stop_time = true
else
@stop_time = false
end
end
@stop_time
end
def no_tone
if @no_tone.nil?
if @note =~ /<no_tone>/i
@no_tone = true
else
@no_tone = false
end
end
@no_tone
end
def inside_map
if @inside_map.nil?
if @note =~ /<inside_map>/i
@inside_map = true
else
@inside_map = false
end
end
@inside_map
end
def no_weather
if @no_weather.nil?
if @note =~ /<no_weather>/i
@no_weather = true
else
@no_weather = false
end
end
@no_weather
end
end
#-------------------------------------------------------------------------------
#End of File
#-------------------------------------------------------------------------------
I don't know what to say, it doesn't crash in a new project, I don't see anything wrong with the settings, I let it go through a couple weeks worth of highspeed time changes, I even set an event to parallel to change tones constantly... There must be something I'm missing. On the map you start on, are there any events on autorun/parallel process doing anything? I can't think of anything that would crash the game with my script off the bat but it wouldn't hurt to check those if you have them.
If there is no event causing the problem, then perhaps you can try disabling the other scripts 1 by one to see if any of them react, or transfer your scripts to another project and do that.
Sorry, I'm really curious as to what's causing your error, nothing I've thought of worked.
If there is no event causing the problem, then perhaps you can try disabling the other scripts 1 by one to see if any of them react, or transfer your scripts to another project and do that.
Sorry, I'm really curious as to what's causing your error, nothing I've thought of worked.
It's okay. I'm gonna check and then I tell you what I've found.
I've added a function to allow for passing time in hourly increments to your script, for instance if the player wants to take a nap. I've implemented it in a way to still call the events from the COMMON_EVENTS hash because even though the character is napping,I would like these events to happen. The problem I'm having is, if the hour of the event is between the time I call the function and goes into the following day, the events aren't called. I've just started learning how to script, so if you have a better idea of how to implement this, I'd be grateful. Thanks!
# The functions are within 'module HM_SEL', I haven't changed any of the other functions within the script you have made available
#------------------------------------------------------------------
#Option to advance time by hours
#-------------------------------------------------------
def self.advance_time(hour_amt)
for hr in (0...hour_amt)
advance_per_hour()
end
end
#-------------------------------------
#Calls events during time advance
#-------------------------------------
def self.advance_per_hour()
for min in (0...60)
call_common_event
$game_variables[MIN] += 1
if $game_variables[MIN] == 60
prog_hour
end
if $game_variables[HOUR] == 24
prog_day
end
end
end
#------------------------------------------------------------------
#Option to advance time by hours
#-------------------------------------------------------
def self.advance_time(hour_amt)
for hr in (0...hour_amt)
advance_per_hour()
end
end
#-------------------------------------
#Calls events during time advance
#-------------------------------------
def self.advance_per_hour()
for min in (0...60)
call_common_event
$game_variables[MIN] += 1
if $game_variables[MIN] == 60
prog_hour
end
if $game_variables[HOUR] == 24
prog_day
end
end
end
The common events aren't called? Or do you mean just 1 common out of however many common events you have aren't called? There is actually a difference, and if I remember right if you set things up in a script to call multiple common events in quick succession, just the first? of them will be called and the rest ignored.
Assuming I'm remembering that right, try the following script by Tsukihime which adds a common event queue which might fix your problem. If it doesn't let me know.
https://www.dropbox.com/sh/sz6mpw5n2d6zxi2/qCfRyagzi9/RMVXA%20Scripts/Common_Event_Queue.txt
Assuming I'm remembering that right, try the following script by Tsukihime which adds a common event queue which might fix your problem. If it doesn't let me know.
https://www.dropbox.com/sh/sz6mpw5n2d6zxi2/qCfRyagzi9/RMVXA%20Scripts/Common_Event_Queue.txt
Ah, so, I tested it using just one common event and the event happened every time. When I added additional events, it only called one event out of the three events. It seemed random which event it called. Should I add a sleep in between events?
I'm looking into the script you suggested, trying to figure out how to implement it. Still learning the basic stuff. Thanks!
Tried adding a sleep timer, still only called the last event.
I'm looking into the script you suggested, trying to figure out how to implement it. Still learning the basic stuff. Thanks!
Tried adding a sleep timer, still only called the last event.
def self.advance_time(hour_amt)
start_hour = $game_variables[HOUR]
end_hour = $game_variables[HOUR] + hour_amt
events = []
for hour in (start_hour...end_hour)
p(hour)
prog_hour
if COMMON_EVENTS[hour] != nil
events.push(hour)
end
end
if end_hour >= 24
end_hour -= 24
prog_day
for hour in (0...end_hour)
if COMMON_EVENTS[hour] != nil
events.push(hour)
end
end
end
p(events)
for event in events
$game_temp.reserve_common_event(COMMON_EVENTS[event].at(1))
sleep(5)
end
end
start_hour = $game_variables[HOUR]
end_hour = $game_variables[HOUR] + hour_amt
events = []
for hour in (start_hour...end_hour)
p(hour)
prog_hour
if COMMON_EVENTS[hour] != nil
events.push(hour)
end
end
if end_hour >= 24
end_hour -= 24
prog_day
for hour in (0...end_hour)
if COMMON_EVENTS[hour] != nil
events.push(hour)
end
end
end
p(events)
for event in events
$game_temp.reserve_common_event(COMMON_EVENTS[event].at(1))
sleep(5)
end
end
If I'm reading Tsukihime's script correctly, you can just drop it into your project(where other scripts go of course) and use the piece you provided as is. All it does is turn the normal 1 only system into a Queue, and they "should" be processed right after each other in the order of activation.
Awesome! That worked perfect, I really appreciate it. I wasn't understanding that I didn't need to modify my function to work with Tsukihime's script. Thanks again!
I'm a script noob basically, and when I go outside from the house I start out in the game, the script doesn't work properly and it's just perpetual day no matter what and going back into the house where it was working doesn't fix the issue. Also, the clock can freeze from time to time, I use a lot of scripts from Yanify, could that be causing the issue? Please reply soon, thanks. I'm using the core script along with the seasonal tones and the calendar clock from you.
Original thread: https://forums.rpgmakerweb.com/threads/variable-calendar-weather-system.9370/