|
  |
~[Kylock's Time System VX 1.5]~ |
|
|
|
|
May 5 2009, 11:09 AM
|

Level 1

Group: Member
Posts: 7
Type: Developer
RM Skill: Skilled

|
Hey again, Kylock. Major problem
Ok, I have done the test event/sample (whatever) and the Night person isnt showing up. I have the excact same common event and event sample. Mabye I have to call the common event? I'm not sure, hopefully its a minor bug I done wrong in the script.
Thanks, Wortana
__________________________
 >:[ Buy or die... Remember: No human has ever survived life...
|
|
|
|
|
|
|
|
|
May 12 2009, 02:27 PM
|

Gotta catch 'em all!

Group: Revolutionary
Posts: 633
Type: Event Designer
RM Skill: Skilled

|
QUOTE (Kylock @ May 9 2008, 02:36 AM)  For my example, I'll make a set of events that only exist at night after 9pm and 5am. First, make a common event that looks like this:  You'll notice that Switch 9 has to be on for this event to work, so you need to make sure that you turn it on before any important maps show up. So maybe turn on Switch 9 in your game opening sequence. Now, for any event you want to show up only at night, all you have to do is this:  Piece of cake for any self-proclaimed eventers out there! I am open to requests not covered above. Enjoy, Kylock If I turn on the common event that makes the night people appear at night at the start sequence of my game, will it affect all maps, or just that one? EDIT: Problem fixed.
This post has been edited by Paper PokéMaster: May 13 2009, 04:42 AM
__________________________
CONGRATULATIONS!You have been selected out of OVER 9000 for a -FREE- spamwich!! Just click this link to claim your prize!
|
|
|
|
|
|
|
|
|
May 21 2009, 03:41 PM
|
Level 1

Group: Member
Posts: 10
Type: Event Designer
RM Skill: Skilled

|
In first place sorry if this is a necropost but, I just figured out how to disable auto-tint on indoor maps (no [KTS] in the map name) In maps like caves or ruins you need to add a darker tint to the map. With Kylock's time system by default, a map with no [KTS] in his name would be always like a day map. Because I don't wanted this I changed a bit the Kylock's Time system VX 1.5 script to have maps with disabled day auto-tint functionality Here is: First: Replace the line 295 CODE if !$kts_map_data[$game_map.map_id].outside_tint? with this: CODE if !$kts_map_data[$game_map.map_id].outside_tint? && !$kts_map_data[$game_map.map_id].indoor_no_tint? and add this definition below the line 382 CODE def indoor_no_tint? #to maps with no auto-tint effect at all return @name.scan(/\[NOTINT\]/).size>0 end Then, to add no auto-tint to a specific map just rename it like this: CODE mapname[NOTINT] That's all ^^ Or, for the lazy ones, just replace the Kylocks time system script with this one ^^ #========================================================================= ===== # – Kylock's Time System VX 1.5 # 6.3.2008 #------------------------------------------------------------------------------ # Script by: Kylock #============================================================================== # Mostly rewritten since XP version. Cleaner code and less intrusive (more # compatible). This is my comprehensive time and day/night system. This # script adds a new window to the game menu, so if you use a CMS, then place # this script ABOVE it so that it won't mess up your CMS. If you use a custom # script that makes changes to the battle background, place KTS below it so # that you don't get the delayed-tone effect in you battles. Other than that, # there shouldn't be any other script compatibility issues. # I've tried to make this script as customizable as possible, the settings # are found immediately following this header. Although time output to game # variables is optional, I strongly suggest using it so that its easier to # build your events based on the time in the game. #============================================================================== # — Change Log #------------------------------------------------------------------------------ # 1.0 - Original Release. # 1.1 - Corrected tinting issue at the start of a battle. Place this script # below any battle background scripts if you experience "jumpy tinting" # 1.2 - Corrected the accuracy of $kts.stop and $kts.go # 1.3 - $kts.stop really stops everything now. Also added game switches for # even easier eventing. # 1.4 - Fixed Battle Test compatibility (simulates normal daylight for battle # test instead of darkness). # Now switches and variables will only update when the map loads so that # events don't suddenly dissappear when their time is up. # Added $kts_anti_tone - returns an inverse tone color to allow sprites # to appear normally on a tinted screen. # 1.5 - Rewrote the regexp that finds the [KTS] in the map name. Hopefully # this resolves the wrong maps being tinted problem. # 1.5a- Rewroted some instructions to be able to skip the auto-toning effect # in indoor maps, just add [NOTINT] to the mapname: ex(mapname[NOTINT]) #============================================================================== # — Auto-tone Instructions #------------------------------------------------------------------------------ # Maps designated as outdoors are the only maps to be affected by this # scripts use of auto-toning. To signify a map to be "outdoors", you must # include [KTS] In the name of the map. For example, you world map could be # named "World Map [KTS]" or "[KTS] World Map". Provisions are made later in # the script to remove [KTS] from the map name when it's read by another # script. This means that "[KTS]" won't show up in your Map Name Popup # windows. #============================================================================== # — Script Function Calls #------------------------------------------------------------------------------ # The following are script commands that can be executed by using the # "Script..." command in your events. # — $kts.stop - Stops time (can be used for cutscenes) # — $kts.go - Resumes time (don't forget to use this!) # — $kts.sec(n) - progresses time forward (n) seconds # — $kts.min(n) - progresses time forward (n) minutes # — $kts.hours(n) - progresses time forward (n) hours # — $kts.days(n) - progresses time forward (n) days # — $kts.jump_to_hour(n) - progresses time forward TO the specified hour. # Particularly useful in a situation where you # want a certain event to happen at a certain time, # or an Innkeeper who should wake the party up at # a certain hour. This command MAY cause your game # to appear to freeze for a few seconds on slower # computers. #============================================================================== # — Game Database Setup #------------------------------------------------------------------------------ # This script, by defult, uses the following game variables and switches: # Database Variables: # [1] The Current Time [4] The Current Hour # [2] The Current Second [5] The Current Day # [3] The Current Minute [6] Name of the Current Day # Database Switches # [1] ON during night hours (2200-0400)(10pm-4am) # [2] ON during dawn hours (0500-0800)( 5am-8am) # [3] ON during daytime hours (0900-1800)( 9am-6pm) # [4] ON during sunset hours (1900-2100)( 7pm-9pm) #============================================================================== #============================================================================== # Stores variables and user defined settings for the time system. #============================================================================== module KTS #----------------------------------------------------------------------- # User Definable Clock Settings #----------------------------------------------------------------------- # Sets the speed multiplier of the clock. 1 is real time. A higher # value will give you a faster clock. Default is 100. SPEED = 100 #AMPM (True: 12-hour clock, False: 24-hour clock) AMPM = false # Sets the time at the start of your game. START_HOUR = 1 START_DAY = 1 #----------------------------------------------------------------------- # If you want custom day names, edit away! #----------------------------------------------------------------------- DAY_NAMES = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"] #----------------------------------------------------------------------- # Settings for Time Periods #----------------------------------------------------------------------- T1 = [ 0,5 ] # Night # Sets time periods for tinting effects T2 = [ 6,8 ] # Dawn # [Start Hour, End Hour] for time period T3 = [ 9,18] # Day # Use 24-hour values for time periods T4 = [19,21] # Sunset T5 = [22,24] # Night # <- Ex: Night is between 23:00 and 24:00 #----------------------------------------------------------------------- # Settings for Output to Game Variables option. #----------------------------------------------------------------------- # Set this to true to output the current time to game variables. DATABASE_OUTPUT = true # Game Variable to be used for time output. TIME = 1 #(Time in string format. Ex: "2:48 AM" or "02:48") SECONDS = 2 MINUTES = 3 HOURS = 4 DAYS = 5 DAYNAME = 6 # Game Switches to be used for time output. NIGHT = 1 # This switch is on during night hours (2200-0400)(10pm-4am) DAWN = 2 # This switch is on during dawn hours (0500-0800)( 5am-8am) DAY = 3 # This switch is on during daytime hours (0900-1800)( 9am-6pm) SUNSET = 4 # This switch is on during sunset hours (1900-2100)( 7pm-9pm) #----------------------------------------------------------------------- # Settings for time controlled screen toning #----------------------------------------------------------------------- # True will enable screen toning to be used by the script. USE_TONE = true # Sets the duration of tone changes (in frames) FADE_LENGTH = 120 # Defines tones to be used in the corresponding time periods defined above. # RED, GREEN, BLUE, GREY C1 = Tone.new(-187, -119, -17, 68) C2 = Tone.new( 17, -51, -102, 0) C3 = Tone.new( 0, 0, 0, 0) C4 = Tone.new( -68, -136, -34, 0) C5 = Tone.new(-187, -119, -17, 68) # Defines anti-tones A1 = Tone.new( 187, 119, 17, -68) A2 = Tone.new( -17, 51, 102, 0) A3 = Tone.new( 0, 0, 0, 0) A4 = Tone.new( 68, 136, 34, 0) A5 = Tone.new( 187, 119, 17, -68) end #============================================================================== # Core Time System Engine #============================================================================== class Kylock_Time_System # sets instance variables def initialize $kts_map_data = load_data("Data/MapInfos.rvdata") @event_offset = (KTS::START_HOUR * 3600) + (KTS::START_DAY * 86400) @kts_stop = false $kts_event_tone = false $kts_battle_tone = true $kts_anti_tone = Tone.new(0,0,0,0) end # Computes current time and updates variables if used def update if !@kts_stop @total_seconds = (Graphics.frame_count * KTS::SPEED / 60) + @event_offset @seconds = (@total_seconds) % 60 @minutes = (@total_seconds / 60) % 60 @hours = (@total_seconds / 3600) % 24 @days = (@total_seconds / 86400) update_tint if KTS::DATABASE_OUTPUT $game_variables[KTS::TIME] = getTime end end end def update_variables $game_variables[KTS::SECONDS] = @seconds $game_variables[KTS::MINUTES] = @minutes $game_variables[KTS::HOURS] = @hours $game_variables[KTS::DAYS] = @days $game_variables[KTS::DAYNAME] = getDayName end def update_switches if @period == 1 || @period == 5 $game_switches[KTS::NIGHT] = true else $game_switches[KTS::NIGHT] = false end if @period == 2 $game_switches[KTS::DAWN] = true else $game_switches[KTS::DAWN] = false end if @period == 3 $game_switches[KTS::DAY] = true else $game_switches[KTS::DAY] = false end if @period == 4 $game_switches[KTS::SUNSET] = true else $game_switches[KTS::SUNSET] = false end end def getTime if KTS::AMPM # Formats a 12-Hour Clock if @hours > 12 hours1 = @hours - 12 if hours1 > 9 time = sprintf("%02d:%02d" + " PM", hours1, @minutes) else time = sprintf("%01d:%02d" + " PM", hours1, @minutes) end else if @hours > 9 time = sprintf("%02d:%02d" + " AM", @hours, @minutes) else time = sprintf("%01d:%02d" + " AM", @hours, @minutes) end end return time else # Formats a 24-Hour Clock time = sprintf("%02d:%02d", @hours, @minutes) return time end end #----------------------------------------------------------------------- # Script Command Functions #----------------------------------------------------------------------- def stop @time_stopped = @total_seconds @kts_stop = true end def go total_seconds = (Graphics.frame_count * KTS::SPEED / 60) + @event_offset @event_offset -= (total_seconds - @time_stopped) @kts_stop = false end def sec(sec = 0) @event_offset += sec end def min(min = 0) @event_offset += min * 60 end def hours(hours = 0) @event_offset += hours * 3600 end def days(days = 0) @event_offset += days * 86400 end def jump_to_hour(jhour = 0) while @hours != jhour @event_offset += 1 $kts.update end end #----------------------------------------------------------------------- # Script Support/Misc Functions #----------------------------------------------------------------------- def getDayName weekday = (@days % KTS::DAY_NAMES.length) return KTS::DAY_NAMES[weekday] end #----------------------------------------------------------------------- # Screen Tone Functions #----------------------------------------------------------------------- def update_tint(duration = KTS::FADE_LENGTH) return if $BTEST if KTS::USE_TONE && !$kts_event_tone && $kts_map_data[$game_map.map_id].outside_tint? if @hours >= KTS::T1[0] and @hours <= KTS::T1[1] @period = 1 screen.start_tone_change(KTS::C1,duration) $kts_anti_tone = KTS::A1 elsif @hours >= KTS::T2[0] and @hours <= KTS::T2[1] @period = 2 screen.start_tone_change(KTS::C2,duration) $kts_anti_tone = KTS::A2 elsif @hours >= KTS::T3[0] and @hours <= KTS::T3[1] @period = 3 screen.start_tone_change(KTS::C3,duration) $kts_anti_tone = KTS::A3 elsif @hours >= KTS::T4[0] and @hours <= KTS::T4[1] @period = 4 screen.start_tone_change(KTS::C4,duration) $kts_anti_tone = KTS::A4 elsif @hours >= KTS::T5[0] and @hours <= KTS::T5[1] @period = 5 screen.start_tone_change(KTS::C5,duration) $kts_anti_tone = KTS::A5 end else # no tone if indoors # if you add to mapname [NOTINT] it will not auto update his tone to (0,0,0,0) if !$kts_map_data[$game_map.map_id].outside_tint? && !$kts_map_data[$game_map.map_id].indoor_no_tint? screen.start_tone_change(Tone.new(0,0,0,0),duration) end end end def screen if $game_temp.in_battle return $game_troop.screen else return $game_map.screen end end end class Spriteset_Map #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- alias kts_initialize initialize def initialize $kts.update_switches if !@kts_stop && KTS::DATABASE_OUTPUT $kts.update_variables if !@kts_stop && KTS::DATABASE_OUTPUT kts_initialize end end #============================================================================== # Instantly updates screen tone when a new map is loaded. #============================================================================== class Game_Map alias kts_setup setup def setup(map_id) kts_setup(map_id) $kts_event_tone = false $kts.update $kts.update_tint(0) end end #============================================================================== # Instantly updates screen tone when a battle starts. #============================================================================== class Spriteset_Battle alias kts_create_battleback create_battleback def create_battleback $kts.update_tint(0) kts_create_battleback end end #============================================================================== # Temporarily disables auto-toning if an event tints the screen. #============================================================================== class Game_Interpreter alias kts_Interpreter_command_223 command_223 def command_223 $kts_event_tone = true kts_Interpreter_command_223 end end #============================================================================== # Integrates the Time System into the Game System. #============================================================================== class Game_System # inits a KTS object alias kts_initialize initialize def initialize $kts=Kylock_Time_System.new kts_initialize end # Updates kts every game frame alias kts_update update def update $kts.update kts_update end end #============================================================================== # Scans Map Names for Toning #============================================================================== class RPG::MapInfo def name # Definition prevents location scripts from reading anything within return @name.gsub(/\[.*\]/) {""} # brackets, including the brackets end def original_name return @name end def outside_tint? return @name.scan(/\[KTS\]/).size > 0 # old regexp: return @name.scan(/[\KTS]/).size > 0 end # fix - definition for use for no auto-tone indoor maps def indoor_no_tint? # to maps with no KTS auto-tone (tint(0,0,0,0) ) return @name.scan(/\[NOTINT\]/).size>0 end # end fix end #============================================================================== # Sets up the time window for the menu. #============================================================================== class Window_KTS < Window_Base def initialize(x, y) super(x, y, 160, WLH + 32) refresh end def refresh self.contents.clear self.contents.draw_text(4, -6, 120, 32, $kts.getTime, 2) end def update super $kts.update self.contents.clear self.contents.draw_text(4, -6, 120, 32, $kts.getTime, 2) end end #============================================================================== # Adds the time window to the menu. #============================================================================== class Scene_Menu < Scene_Base alias kts_start start def start kts_start @kts_window = Window_KTS.new(0,305) end alias kts_terminate terminate def terminate kts_terminate @kts_window.dispose end alias kts_update update def update kts_update @kts_window.update end end #============================================================================== # Saves and Loads game time to/from save game file. #============================================================================== class Scene_File alias kts_write_save_data write_save_data def write_save_data(file) kts_write_save_data(file) Marshal.dump($kts, file) end alias kts_read_save_data read_save_data def read_save_data(file) kts_read_save_data(file) $kts = Marshal.load(file) end end Just remember to ALWAYS add a CHANGE TINT EVENT inside the map because If in the previous map was night because of Kylock's time system, in this map will be night as well. Cheers to Kylock for his time system and for me to find out this solution ^^
This post has been edited by nmad: May 21 2009, 04:13 PM
|
|
|
|
|
|
|
|
|
May 29 2009, 08:28 AM
|
Level 2

Group: Member
Posts: 25
Type: Event Designer
RM Skill: Skilled

|
Awesome! I stopped using RPG maker for a while and now i forgot how to do switches and variables! I still remember Self Switches, oh well, this makes me feel like a NOOB all over again  Anyway awesomesauce script!
__________________________
 Lol look at the OMG one and i do not think the one at the top right corner likes you and the one under it is laughing at you cause you whacked your head on a Microphone and it made a massive noise. Please respect these cats except for the winking one(Scary lol)
|
|
|
|
|
|
|
|
|
Jun 3 2009, 10:17 PM
|

Level 15

Group: Revolutionary
Posts: 294
Type: Developer
RM Skill: Intermediate

|
took many event
__________________________
  Topic'ZVLAD REQUIEM IS UPDATE! to ~8~ The TopicszZ @~Action Battle System~@
Bored Battle System Like This So Do you liem MMORPG style?or Zelda? if yes you'll need this... style~> Join Here ABS @### @@@### @# @#### @## @## @## @@# @@@## @@[Show/Hide] DONT WASTE MY TIME AGAIN!!!!!!!!!!!!!!!!!!!! clever you are the 99999999 visitors who open this get outta here!!!!!
|
|
|
|
|
|
|
|
|
Jul 18 2009, 12:48 PM
|


Group: Member
Posts: 3
Type: None
RM Skill: Undisclosed

|
QUOTE (Kylock @ May 16 2008, 11:46 PM)  QUOTE (wii19 @ May 16 2008, 04:49 PM)  where i place your script because everywhere i put it the script doesn't work Below battle backgrounds if you have them, and above your CMS if you have one. If you don't see the time, then you'll need to modify your CMS to have a time window. You can print the time using $kts.getTime Even if you don't see anything, it IS still working. Hit F9 in your game to look at the variables and switches to test. Where do you put it if you don't have either!? EDIT: Nevermind, figured it out.
This post has been edited by andragon40: Jul 18 2009, 12:57 PM
__________________________
|
|
|
|
|
|
|
|
|
Aug 6 2009, 06:27 AM
|

Group: Member
Posts: 2
Type: None
RM Skill: Undisclosed

|
Im having some trouble with this. The events only appear if i have KST in my map name.
|
|
|
|
|
|
|
|
|
Aug 22 2009, 01:42 AM
|

It's been awhile lol

Group: Revolutionary
Posts: 168
Type: Artist
RM Skill: Advanced

|
I don't know where is Kylock now, but by some requests, I update this script by adding some features from my KTS MOD to this normal KTS. . . (if one day Kylock is back, it's up to him want to delete this or not) . . . here's the script, Version 1.6CODE #============================================================================== # ¦ Kylock's Time System VX 1.6 # 21.8.2009 #------------------------------------------------------------------------------ # Script by: Kylock # Modified by Reijubv #============================================================================== # NOTE from reijubv : # I modified this KTS so it will have (almost) same feature with KTS MOD, # I've added week, month, year, and season system, but not with auto weather. # I also modified some script's functions, like now days in game will have a # maximum number of 365, I also added some more variables to use. #============================================================================== # ? Change Log #------------------------------------------------------------------------------ # 1.0 - Original Release. # 1.1 - Corrected tinting issue at the start of a battle. Place this script # below any battle background scripts if you experience "jumpy tinting" # 1.2 - Corrected the accuracy of $kts.stop and $kts.go # 1.3 - $kts.stop really stops everything now. Also added game switches for # even easier eventing. # 1.4 - Fixed Battle Test compatibility (simulates normal daylight for battle # test instead of darkness). # Now switches and variables will only update when the map loads so that # events don't suddenly dissappear when their time is up. # Added $kts_anti_tone - returns an inverse tone color to allow sprites # to appear normally on a tinted screen. # 1.5 - Rewrote the regexp that finds the [KTS] in the map name. Hopefully # this resolves the wrong maps being tinted problem. # 1.6 - Improved by reijubv by adding week, month, year, auto weather and # season system, as in KTS MOD by reijubv. Also fixed some bugs. #============================================================================== # ? Auto-tone Instructions #------------------------------------------------------------------------------ # Maps designated as outdoors are the only maps to be affected by this # scripts use of auto-toning. To signify a map to be "outdoors", you must # include [KTS] In the name of the map. For example, you world map could be # named "World Map [KTS]" or "[KTS] World Map". Provisions are made later in # the script to remove [KTS] from the map name when it's read by another # script. This means that "[KTS]" won't show up in your Map Name Popup # windows. #============================================================================== # ? Script Function Calls #------------------------------------------------------------------------------ # The following are script commands that can be executed by using the # "Script..." command in your events. # ? $kts.stop - Stops time (can be used for cutscenes) # ? $kts.go - Resumes time (don't forget to use this!) # ? $kts.sec(n) - progresses time forward (n) seconds # ? $kts.min(n) - progresses time forward (n) minutes # ? $kts.hours(n) - progresses time forward (n) hours # ? $kts.days(n) - progresses time forward (n) days # ? $kts.weeks(n) - progresses time forward (n) weeks # ? $kts.months(n) - progresses time forward (n) months # ? $kts.years(n) - progresses time forward (n) years # ? $kts.jump_to_hour(n) - progresses time forward TO the specified hour. # Particularly useful in a situation where you # want a certain event to happen at a certain time, # or an Innkeeper who should wake the party up at # a certain hour. This command MAY cause your game # to appear to freeze for a few seconds on slower # computers. #============================================================================== # Credits : # Kylock # reijubv #==============================================================================
#============================================================================== # Stores variables and user defined settings for the time system. #============================================================================== module KTS #----------------------------------------------------------------------- # User Definable Clock Settings #----------------------------------------------------------------------- # Sets the speed multiplier of the clock. 1 is real time. A higher # value will give you a faster clock. Default is 100. SPEED = 100 #AMPM (True: 12-hour clock, False: 24-hour clock) AMPM = false # Sets the time at the start of your game. START_HOUR = 12 # 1 - 24 START_DAY = 1 # 1 - 30 START_MONTH= 1 # 1 - 12 START_YEAR = 2009 # 1 - ?? #----------------------------------------------------------------------- # If you want custom day names, edit away! #----------------------------------------------------------------------- DAY_NAMES = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday", "Saturday"] #----------------------------------------------------------------------- # If you want custom month names, edit too! #----------------------------------------------------------------------- MONTH_NAMES = ["January","February","March","April","May","June","July", "August","September","October","November","December"] #----------------------------------------------------------------------- # If you want custom season names, edit again! #----------------------------------------------------------------------- SEASON_NAMES = ["Spring","Summer","Fall","Winter"] #----------------------------------------------------------------------- # Settings for Time Periods, fortmat : [Start Hour, End Hour] #----------------------------------------------------------------------- T1 = [ 0,5 ] # Night T2 = [ 6,8 ] # Dawn T3 = [ 9,18] # Day T4 = [19,21] # Sunset T5 = [22,24] # Night #----------------------------------------------------------------------- # Settings for Season Periods, fortmat : [start_month,end_month] #----------------------------------------------------------------------- S1 = [ 1,3 ] # Spring S2 = [ 4,6 ] # Summer S3 = [ 7,9 ] # Fall S4 = [10,12] # Winter #----------------------------------------------------------------------- # Settings for Output to Game Variables option. #----------------------------------------------------------------------- # Set this to true to output the current time to game variables. DATABASE_OUTPUT = true # Game Variable to be used for time output. TIME = 1 # Current Time , "03:12", etc SECONDS = 2 # Seconds, 1 - 60 MINUTES = 3 # Minutes, 1 - 60 HOURS = 4 # Minutes, 1 - 60 DAYS = 5 # Days, 1 - 365 DAYNAME = 6 # Names of day, defined avove WEEKDAY = 7 # Days in 1 week, 1 - 7 MONTH = 8 # Months, 1 - 12 MONTHNAM = 9 # Names of month, defined above MONTHDAY = 10 # Days in 1 month, 1 - 30 YEAR = 11 # Current Year, can be any integer SEASON = 12 # Seasons, 1 - 4 SEASONNAME = 13 # Names of season, defined above # Game Switches to be used for time output. NIGHT = 1 # This switch is on during night hours (2200-0400)(10pm-4am) DAWN = 2 # This switch is on during dawn hours (0500-0800)( 5am-8am) DAY = 3 # This switch is on during daytime hours (0900-1800)( 9am-6pm) SUNSET = 4 # This switch is on during sunset hours (1900-2100)( 7pm-9pm) # Season switches SPRING = 5 # This switch is on during spring season SUMMER = 6 # This switch is on during summer season FALL = 7 # This switch is on during fall season WINTER = 8 # This switch is on during winter season #----------------------------------------------------------------------- # Settings for time controlled screen toning #----------------------------------------------------------------------- # True will enable screen toning to be used by the script. USE_TONE = true # Sets the duration of tone changes (in frames) FADE_LENGTH = 120 # Defines tones to be used in the corresponding time periods defined above. # RED, GREEN, BLUE, GREY C1 = Tone.new(-187, -119, -17, 68) C2 = Tone.new( 17, -51, -102, 0) C3 = Tone.new( 0, 0, 0, 0) C4 = Tone.new( -68, -136, -34, 0) C5 = Tone.new(-187, -119, -17, 68) # Defines anti-tones A1 = Tone.new( 187, 119, 17, -68) A2 = Tone.new( -17, 51, 102, 0) A3 = Tone.new( 0, 0, 0, 0) A4 = Tone.new( 68, 136, 34, 0) A5 = Tone.new( 187, 119, 17, -68) #----------------------------------------------------------------------- # Misc settings #----------------------------------------------------------------------- # Automatically update time switches even if player is staying in 1 map # forever? If false, switches will only be updated when moving to ther map or # changing scene. AUTO_SWITCH = true end
#============================================================================== # Core Time System Engine #============================================================================== class Kylock_Time_System # sets instance variables def initialize $kts_map_data = load_data("Data/MapInfos.rvdata") @event_offset = (KTS::START_HOUR * 3600) + (KTS::START_DAY * 86400) + (KTS::START_MONTH * 2592000) + (KTS::START_YEAR * 31104000) @kts_stop = false $kts_event_tone = false $kts_battle_tone = true $kts_anti_tone = Tone.new(0,0,0,0) end def update if !@kts_stop @total_seconds = (Graphics.frame_count * KTS::SPEED / 60) + @event_offset @seconds = (@total_seconds) % 60 @minutes = (@total_seconds / 60) % 60 @hours = (@total_seconds / 3600) % 24 @days = (@total_seconds / 86400) % 365 @weeks = (@total_seconds / 604800) % 4 @months = (@total_seconds / 2592000) % 12 @years = (@total_seconds / 31104000) @monthday= (@total_seconds / 86400) % 30 @weekday = (@total_seconds / 86400) % 7 if KTS::AUTO_SWITCH update_season_swithces update_switches end update_tint if KTS::DATABASE_OUTPUT $game_variables[KTS::TIME] = getTime end end end def update_variables $game_variables[KTS::SECONDS] = @seconds $game_variables[KTS::MINUTES] = @minutes $game_variables[KTS::HOURS] = @hours $game_variables[KTS::DAYS] = @days $game_variables[KTS::DAYNAME] = getDayName $game_variables[KTS::WEEKDAY] = @weekday $game_variables[KTS::MONTH] = @months $game_variables[KTS::MONTHNAM] = getMonthName $game_variables[KTS::YEAR] = @years $game_variables[KTS::SEASON] = getSeasonName $game_variables[KTS::MONTHDAY] = @monthday end def update_switches if @period == 1 || @period == 5 $game_switches[KTS::NIGHT] = true else $game_switches[KTS::NIGHT] = false end if @period == 2 $game_switches[KTS::DAWN] = true else $game_switches[KTS::DAWN] = false end if @period == 3 $game_switches[KTS::DAY] = true else $game_switches[KTS::DAY] = false end if @period == 4 $game_switches[KTS::SUNSET] = true else $game_switches[KTS::SUNSET] = false end end def update_season_swithces if @months >= KTS::S1[0] && @months <= KTS::S1[1] @season = 1 $game_switches[KTS::SPRING] = true else $game_switches[KTS::SPRING] = false end if @months >= KTS::S2[0] && @months <= KTS::S2[1] @season = 2 $game_switches[KTS::SUMMER] = true else $game_switches[KTS::SUMMER] = false end if @months >= KTS::S3[0] && @months <= KTS::S3[1] @season = 3 $game_switches[KTS::FALL] = true else $game_switches[KTS::FALL] = false end if @months >= KTS::S4[0] && @months <= KTS::S4[1] @season = 4 $game_switches[KTS::WINTER] = true else $game_switches[KTS::WINTER] = false end end
def getTime if KTS::AMPM if @hours > 12 hours1 = @hours - 12 if hours1 > 9 time = sprintf("%02d:%02d" + " PM", hours1, @minutes) else time = sprintf("%01d:%02d" + " PM", hours1, @minutes) end else if @hours > 9 time = sprintf("%02d:%02d" + " AM", @hours, @minutes) else time = sprintf("%01d:%02d" + " AM", @hours, @minutes) end end return time else time = sprintf("%02d:%02d", @hours, @minutes) return time end end #----------------------------------------------------------------------- # Script Command Functions #----------------------------------------------------------------------- def stop @time_stopped = @total_seconds @kts_stop = true end def go total_seconds = (Graphics.frame_count * KTS::SPEED / 60) + @event_offset @event_offset -= (total_seconds - @time_stopped) @kts_stop = false end def sec(sec = 0) @event_offset += sec end def min(min = 0) @event_offset += min * 60 end def hours(hours = 0) @event_offset += hours * 3600 end def days(days = 0) @event_offset += days * 86400 end def week(week = 0) @event_offset += week * 604800 end def month(month = 0) @event_offset += month * 2592000 end def year(year = 0) @event_offset += year * 31104000 end def jump_to_hour(jhour = 0) while @hours != jhour @event_offset += 1 $kts.update end end #----------------------------------------------------------------------- # Script Support/Misc Functions #----------------------------------------------------------------------- def getDayName weekday = (@days % KTS::DAY_NAMES.length) return KTS::DAY_NAMES[weekday] end def getMonthName month = (@months % KTS::MONTH_NAMES.length) return KTS::MONTH_NAMES[month] end def getSeasonName return KTS::SEASON_NAMES[@season - 1] end #----------------------------------------------------------------------- # Screen Tone Functions #----------------------------------------------------------------------- def update_tint(duration = KTS::FADE_LENGTH) return if $BTEST if KTS::USE_TONE && !$kts_event_tone && $kts_map_data[$game_map.map_id].outside_tint? if @hours >= KTS::T1[0] and @hours <= KTS::T1[1] @period = 1 screen.start_tone_change(KTS::C1,duration) $kts_anti_tone = KTS::A1 elsif @hours >= KTS::T2[0] and @hours <= KTS::T2[1] @period = 2 screen.start_tone_change(KTS::C2,duration) $kts_anti_tone = KTS::A2 elsif @hours >= KTS::T3[0] and @hours <= KTS::T3[1] @period = 3 screen.start_tone_change(KTS::C3,duration) $kts_anti_tone = KTS::A3 elsif @hours >= KTS::T4[0] and @hours <= KTS::T4[1] @period = 4 screen.start_tone_change(KTS::C4,duration) $kts_anti_tone = KTS::A4 elsif @hours >= KTS::T5[0] and @hours <= KTS::T5[1] @period = 5 screen.start_tone_change(KTS::C5,duration) $kts_anti_tone = KTS::A5 end else # no tone if indoors if !$kts_map_data[$game_map.map_id].outside_tint? and !$kts_event_tone screen.start_tone_change(Tone.new(0,0,0,0),duration) end end end def screen if $game_temp.in_battle return $game_troop.screen else return $game_map.screen end end end
class Spriteset_Map #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- alias kts_initialize initialize def initialize if !@kts_stop && KTS::DATABASE_OUTPUT $kts.update_switches $kts.update_variables $kts.update_season_swithces end kts_initialize end end #============================================================================== # Instantly updates screen tone when a new map is loaded. #============================================================================== class Game_Map alias kts_setup setup def setup(map_id) kts_setup(map_id) $kts_event_tone = false $kts.update $kts.update_tint(0) end end
#============================================================================== # Instantly updates screen tone when a battle starts. #============================================================================== class Spriteset_Battle alias kts_create_battleback create_battleback def create_battleback $kts.update_tint(0) kts_create_battleback end end #============================================================================== # Temporarily disables auto-toning if an event tints the screen. #============================================================================== class Game_Interpreter alias kts_Interpreter_command_223 command_223 def command_223 $kts_event_tone = true kts_Interpreter_command_223 end end
#============================================================================== # Integrates the Time System into the Game System. #============================================================================== class Game_System # inits a KTS object alias kts_initialize initialize def initialize $kts=Kylock_Time_System.new kts_initialize end # Updates kts every game frame alias kts_update update def update $kts.update kts_update end end
#============================================================================== # Scans Map Names for Toning #============================================================================== class RPG::MapInfo def name # Definition prevents location scripts from reading anything within return @name.gsub(/\[.*\]/) {""} # brackets, including the brackets end def original_name return @name end def outside_tint? return @name.scan(/\[KTS\]/).size > 0 # old regexp: return @name.scan(/[\KTS]/).size > 0 end end
#============================================================================== # Sets up the time window for the menu. #============================================================================== class Window_KTS < Window_Base def initialize(x, y) super(x, y, 160, WLH + 32) refresh end def refresh self.contents.clear self.contents.draw_text(4, -6, 120, 32, $kts.getTime, 2) end def update super $kts.update self.contents.clear self.contents.draw_text(4, -6, 120, 32, $kts.getTime, 2) end end
#============================================================================== # Adds the time window to the menu. #============================================================================== class Scene_Menu < Scene_Base alias kts_start start def start kts_start @kts_window = Window_KTS.new(0,305) end alias kts_terminate terminate def terminate kts_terminate @kts_window.dispose end alias kts_update update def update kts_update @kts_window.update end end
#============================================================================== # Saves and Loads game time to/from save game file. #============================================================================== class Scene_File alias kts_write_save_data write_save_data def write_save_data(file) kts_write_save_data(file) Marshal.dump($kts, file) end alias kts_read_save_data read_save_data def read_save_data(file) kts_read_save_data(file) $kts = Marshal.load(file) end end
__________________________
|
|
|
|
|
|
|
|
|
Dec 8 2009, 01:25 AM
|

Group: Member
Posts: 1
Type: Writer
RM Skill: Beginner

|
Sorry if this has already been asked, but I didn't feel like reading 7 pages of comments, I hope you're not mad  In the changelog Kylock says that he fixed it so that events just don't disappear when their time is up and that the switches only activate when the map loads. However, apparently exiting to the menu causes the map to reload? Or something? What's especially weird is it only happens if I open the menu twice. So basically: Night goes on, event is still there. Open menu, close menu, event is still there. Open menu again, close menu again, event disappears. Anyone have any idea what is causing this to happen? Thanks in advance.
|
|
|
|
|
|
|
|
|
Dec 12 2009, 07:21 PM
|

Group: Member
Posts: 1
Type: None
RM Skill: Undisclosed

|
Hey not sure if this post is alive or dead. Anyways, great script - really nice. Only major, major, major flaw with it that I can see is the Update (refresh) feature is dead! I have a very large dungeon that a player must navigate to make it out by a certain time. I put the modifiers and code in the door to allow it to only open when the Night Time switch is set to True, however it does not work right. They have to walk about 235 paces up, and then back down to refresh the screen to allow the door to realize that it is night time. Like I said great script, less this major flaw (which will probably keep me from using it.) Does anybody out there know of a way to include dynamic updating of "Current Time/Status" that way we do not have to waste time (and potentially make our game boring) by flushing the screen for an update to happen?
***** UPDATE ******
Sorry for the above post. Thought the script could've offered up a little more refreshing capabilities, due to the miracle of parallel processing I have found a way to refresh time using the $KTS.update_switches, $KTS.update_variable commands. Now that door opens right up exactly when it is meant to be, and not a second before or after! Great going, and thank you all for your great work. This is truly going to be a great experience for my daughter's Christmas present!
***** UPDATE ******
Furthermore this morning, I created a beta-script that will allow for all NPC to have their current (x,y) location determined and upon the end of daytime they will walk off the screen. At the begining of daytime they will walk onto the screen to their designated (x,y) variables. Very cool - lot's of math envolved though (ran good on a Pentium 7.2GHz (not so well on a PIII 500MHz) but nice effect for added realism.)
This post has been edited by ronaldharsh: Dec 13 2009, 11:24 AM
|
|
|
|
|
|
|
|
|
Jan 7 2010, 10:26 PM
|

The Lazy Guy

Group: Revolutionary
Posts: 292
Type: Scripter
RM Skill: Undisclosed

|
QUOTE (reijubv @ Aug 22 2009, 05:42 PM)  I don't know where is Kylock now, but by some requests, I update this script by adding some features from my KTS MOD to this normal KTS. . . (if one day Kylock is back, it's up to him want to delete this or not) . . . here's the script, Version 1.6CODE #============================================================================== # ¦ Kylock's Time System VX 1.6 # 21.8.2009 #------------------------------------------------------------------------------ # Script by: Kylock # Modified by Reijubv #============================================================================== # NOTE from reijubv : # I modified this KTS so it will have (almost) same feature with KTS MOD, # I've added week, month, year, and season system, but not with auto weather. # I also modified some script's functions, like now days in game will have a # maximum number of 365, I also added some more variables to use. #============================================================================== # ? Change Log #------------------------------------------------------------------------------ # 1.0 - Original Release. # 1.1 - Corrected tinting issue at the start of a battle. Place this script # below any battle background scripts if you experience "jumpy tinting" # 1.2 - Corrected the accuracy of $kts.stop and $kts.go # 1.3 - $kts.stop really stops everything now. Also added game switches for # even easier eventing. # 1.4 - Fixed Battle Test compatibility (simulates normal daylight for battle # test instead of darkness). # Now switches and variables will only update when the map loads so that # events don't suddenly dissappear when their time is up. # Added $kts_anti_tone - returns an inverse tone color to allow sprites # to appear normally on a tinted screen. # 1.5 - Rewrote the regexp that finds the [KTS] in the map name. Hopefully # this resolves the wrong maps being tinted problem. # 1.6 - Improved by reijubv by adding week, month, year, auto weather and # season system, as in KTS MOD by reijubv. Also fixed some bugs. #============================================================================== # ? Auto-tone Instructions #------------------------------------------------------------------------------ # Maps designated as outdoors are the only maps to be affected by this # scripts use of auto-toning. To signify a map to be "outdoors", you must # include [KTS] In the name of the map. For example, you world map could be # named "World Map [KTS]" or "[KTS] World Map". Provisions are made later in # the script to remove [KTS] from the map name when it's read by another # script. This means that "[KTS]" won't show up in your Map Name Popup # windows. #============================================================================== # ? Script Function Calls #------------------------------------------------------------------------------ # The following are script commands that can be executed by using the # "Script..." command in your events. # ? $kts.stop - Stops time (can be used for cutscenes) # ? $kts.go - Resumes time (don't forget to use this!) # ? $kts.sec(n) - progresses time forward (n) seconds # ? $kts.min(n) - progresses time forward (n) minutes # ? $kts.hours(n) - progresses time forward (n) hours # ? $kts.days(n) - progresses time forward (n) days # ? $kts.weeks(n) - progresses time forward (n) weeks # ? $kts.months(n) - progresses time forward (n) months # ? $kts.years(n) - progresses time forward (n) years # ? $kts.jump_to_hour(n) - progresses time forward TO the specified hour. # Particularly useful in a situation where you # want a certain event to happen at a certain time, # or an Innkeeper who should wake the party up at # a certain hour. This command MAY cause your game # to appear to freeze for a few seconds on slower # computers. #============================================================================== # Credits : # Kylock # reijubv #==============================================================================
#============================================================================== # Stores variables and user defined settings for the time system. #============================================================================== module KTS #----------------------------------------------------------------------- # User Definable Clock Settings #----------------------------------------------------------------------- # Sets the speed multiplier of the clock. 1 is real time. A higher # value will give you a faster clock. Default is 100. SPEED = 100 #AMPM (True: 12-hour clock, False: 24-hour clock) AMPM = false # Sets the time at the start of your game. START_HOUR = 12 # 1 - 24 START_DAY = 1 # 1 - 30 START_MONTH= 1 # 1 - 12 START_YEAR = 2009 # 1 - ?? #----------------------------------------------------------------------- # If you want custom day names, edit away! #----------------------------------------------------------------------- DAY_NAMES = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday", "Saturday"] #----------------------------------------------------------------------- # If you want custom month names, edit too! #----------------------------------------------------------------------- MONTH_NAMES = ["January","February","March","April","May","June","July", "August","September","October","November","December"] #----------------------------------------------------------------------- # If you want custom season names, edit again! #----------------------------------------------------------------------- SEASON_NAMES = ["Spring","Summer","Fall","Winter"] #----------------------------------------------------------------------- # Settings for Time Periods, fortmat : [Start Hour, End Hour] #----------------------------------------------------------------------- T1 = [ 0,5 ] # Night T2 = [ 6,8 ] # Dawn T3 = [ 9,18] # Day T4 = [19,21] # Sunset T5 = [22,24] # Night #----------------------------------------------------------------------- # Settings for Season Periods, fortmat : [start_month,end_month] #----------------------------------------------------------------------- S1 = [ 1,3 ] # Spring S2 = [ 4,6 ] # Summer S3 = [ 7,9 ] # Fall S4 = [10,12] # Winter #----------------------------------------------------------------------- # Settings for Output to Game Variables option. #----------------------------------------------------------------------- # Set this to true to output the current time to game variables. DATABASE_OUTPUT = true # Game Variable to be used for time output. TIME = 1 # Current Time , "03:12", etc SECONDS = 2 # Seconds, 1 - 60 MINUTES = 3 # Minutes, 1 - 60 HOURS = 4 # Minutes, 1 - 60 DAYS = 5 # Days, 1 - 365 DAYNAME = 6 # Names of day, defined avove WEEKDAY = 7 # Days in 1 week, 1 - 7 MONTH = 8 # Months, 1 - 12 MONTHNAM = 9 # Names of month, defined above MONTHDAY = 10 # Days in 1 month, 1 - 30 YEAR = 11 # Current Year, can be any integer SEASON = 12 # Seasons, 1 - 4 SEASONNAME = 13 # Names of season, defined above # Game Switches to be used for time output. NIGHT = 1 # This switch is on during night hours (2200-0400)(10pm-4am) DAWN = 2 # This switch is on during dawn hours (0500-0800)( 5am-8am) DAY = 3 # This switch is on during daytime hours (0900-1800)( 9am-6pm) SUNSET = 4 # This switch is on during sunset hours (1900-2100)( 7pm-9pm) # Season switches SPRING = 5 # This switch is on during spring season SUMMER = 6 # This switch is on during summer season FALL = 7 # This switch is on during fall season WINTER = 8 # This switch is on during winter season #----------------------------------------------------------------------- # Settings for time controlled screen toning #----------------------------------------------------------------------- # True will enable screen toning to be used by the script. USE_TONE = true # Sets the duration of tone changes (in frames) FADE_LENGTH = 120 # Defines tones to be used in the corresponding time periods defined above. # RED, GREEN, BLUE, GREY C1 = Tone.new(-187, -119, -17, 68) C2 = Tone.new( 17, -51, -102, 0) C3 = Tone.new( 0, 0, 0, 0) C4 = Tone.new( -68, -136, -34, 0) C5 = Tone.new(-187, -119, -17, 68) # Defines anti-tones A1 = Tone.new( 187, 119, 17, -68) A2 = Tone.new( -17, 51, 102, 0) A3 = Tone.new( 0, 0, 0, 0) A4 = Tone.new( 68, 136, 34, 0) A5 = Tone.new( 187, 119, 17, -68) #----------------------------------------------------------------------- # Misc settings #----------------------------------------------------------------------- # Automatically update time switches even if player is staying in 1 map # forever? If false, switches will only be updated when moving to ther map or # changing scene. AUTO_SWITCH = true end
#============================================================================== # Core Time System Engine #============================================================================== class Kylock_Time_System # sets instance variables def initialize $kts_map_data = load_data("Data/MapInfos.rvdata") @event_offset = (KTS::START_HOUR * 3600) + (KTS::START_DAY * 86400) + (KTS::START_MONTH * 2592000) + (KTS::START_YEAR * 31104000) @kts_stop = false $kts_event_tone = false $kts_battle_tone = true $kts_anti_tone = Tone.new(0,0,0,0) end def update if !@kts_stop @total_seconds = (Graphics.frame_count * KTS::SPEED / 60) + @event_offset @seconds = (@total_seconds) % 60 @minutes = (@total_seconds / 60) % 60 @hours = (@total_seconds / 3600) % 24 @days = (@total_seconds / 86400) % 365 @weeks = (@total_seconds / 604800) % 4 @months = (@total_seconds / 2592000) % 12 @years = (@total_seconds / 31104000) @monthday= (@total_seconds / 86400) % 30 @weekday = (@total_seconds / 86400) % 7 if KTS::AUTO_SWITCH update_season_swithces update_switches end update_tint if KTS::DATABASE_OUTPUT $game_variables[KTS::TIME] = getTime end end end def update_variables $game_variables[KTS::SECONDS] = @seconds $game_variables[KTS::MINUTES] = @minutes $game_variables[KTS::HOURS] = @hours $game_variables[KTS::DAYS] = @days $game_variables[KTS::DAYNAME] = getDayName $game_variables[KTS::WEEKDAY] = @weekday $game_variables[KTS::MONTH] = @months $game_variables[KTS::MONTHNAM] = getMonthName $game_variables[KTS::YEAR] = @years $game_variables[KTS::SEASON] = getSeasonName $game_variables[KTS::MONTHDAY] = @monthday end def update_switches if @period == 1 || @period == 5 $game_switches[KTS::NIGHT] = true else $game_switches[KTS::NIGHT] = false end if @period == 2 $game_switches[KTS::DAWN] = true else $game_switches[KTS::DAWN] = false end if @period == 3 $game_switches[KTS::DAY] = true else $game_switches[KTS::DAY] = false end if @period == 4 $game_switches[KTS::SUNSET] = true else $game_switches[KTS::SUNSET] = false end end def update_season_swithces if @months >= KTS::S1[0] && @months <= KTS::S1[1] @season = 1 $game_switches[KTS::SPRING] = true else $game_switches[KTS::SPRING] = false end if @months >= KTS::S2[0] && @months <= KTS::S2[1] @season = 2 $game_switches[KTS::SUMMER] = true else $game_switches[KTS::SUMMER] = false end if @months >= KTS::S3[0] && @months <= KTS::S3[1] @season = 3 $game_switches[KTS::FALL] = true else $game_switches[KTS::FALL] = false end if @months >= KTS::S4[0] && @months <= KTS::S4[1] @season = 4 $game_switches[KTS::WINTER] = true else $game_switches[KTS::WINTER] = false end end
def getTime if KTS::AMPM if @hours > 12 hours1 = @hours - 12 if hours1 > 9 time = sprintf("%02d:%02d" + " PM", hours1, @minutes) else time = sprintf("%01d:%02d" + " PM", hours1, @minutes) end else if @hours > 9 time = sprintf("%02d:%02d" + " AM", @hours, @minutes) else time = sprintf("%01d:%02d" + " AM", @hours, @minutes) end end return time else time = sprintf("%02d:%02d", @hours, @minutes) return time end end #----------------------------------------------------------------------- # Script Command Functions #----------------------------------------------------------------------- def stop @time_stopped = @total_seconds @kts_stop = true end def go total_seconds = (Graphics.frame_count * KTS::SPEED / 60) + @event_offset @event_offset -= (total_seconds - @time_stopped) @kts_stop = false end def sec(sec = 0) @event_offset += sec end def min(min = 0) @event_offset += min * 60 end def hours(hours = 0) @event_offset += hours * 3600 end def days(days = 0) @event_offset += days * 86400 end def week(week = 0) @event_offset += week * 604800 end def month(month = 0) @event_offset += month * 2592000 end def year(year = 0) @event_offset += year * 31104000 end def jump_to_hour(jhour = 0) while @hours != jhour @event_offset += 1 $kts.update end end #----------------------------------------------------------------------- # Script Support/Misc Functions #----------------------------------------------------------------------- def getDayName weekday = (@days % KTS::DAY_NAMES.length) return KTS::DAY_NAMES[weekday] end def getMonthName month = (@months % KTS::MONTH_NAMES.length) return KTS::MONTH_NAMES[month] end def getSeasonName return KTS::SEASON_NAMES[@season - 1] end #----------------------------------------------------------------------- # Screen Tone Functions #----------------------------------------------------------------------- def update_tint(duration = KTS::FADE_LENGTH) return if $BTEST if KTS::USE_TONE && !$kts_event_tone && $kts_map_data[$game_map.map_id].outside_tint? if @hours >= KTS::T1[0] and @hours <= KTS::T1[1] @period = 1 screen.start_tone_change(KTS::C1,duration) $kts_anti_tone = KTS::A1 elsif @hours >= KTS::T2[0] and @hours <= KTS::T2[1] @period = 2 screen.start_tone_change(KTS::C2,duration) $kts_anti_tone = KTS::A2 elsif @hours >= KTS::T3[0] and @hours <= KTS::T3[1] @period = 3 screen.start_tone_change(KTS::C3,duration) $kts_anti_tone = KTS::A3 elsif @hours >= KTS::T4[0] and @hours <= KTS::T4[1] @period = 4 screen.start_tone_change(KTS::C4,duration) $kts_anti_tone = KTS::A4 elsif @hours >= KTS::T5[0] and @hours <= KTS::T5[1] @period = 5 screen.start_tone_change(KTS::C5,duration) $kts_anti_tone = KTS::A5 end else # no tone if indoors if !$kts_map_data[$game_map.map_id].outside_tint? and !$kts_event_tone screen.start_tone_change(Tone.new(0,0,0,0),duration) end end end def screen if $game_temp.in_battle return $game_troop.screen else return $game_map.screen end end end
class Spriteset_Map #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- alias kts_initialize initialize def initialize if !@kts_stop && KTS::DATABASE_OUTPUT $kts.update_switches $kts.update_variables $kts.update_season_swithces end kts_initialize end end #============================================================================== # Instantly updates screen tone when a new map is loaded. #============================================================================== class Game_Map alias kts_setup setup def setup(map_id) kts_setup(map_id) $kts_event_tone = false $kts.update $kts.update_tint(0) end end
#============================================================================== # Instantly updates screen tone when a battle starts. #============================================================================== class Spriteset_Battle alias kts_create_battleback create_battleback def create_battleback $kts.update_tint(0) kts_create_battleback end end #============================================================================== # Temporarily disables auto-toning if an event tints the screen. #============================================================================== class Game_Interpreter alias kts_Interpreter_command_223 command_223 def command_223 $kts_event_tone = true kts_Interpreter_command_223 end end
#============================================================================== # Integrates the Time System into the Game System. #============================================================================== class Game_System # inits a KTS object alias kts_initialize initialize def initialize $kts=Kylock_Time_System.new kts_initialize end # Updates kts every game frame alias kts_update update def update $kts.update kts_update end end
#============================================================================== # Scans Map Names for Toning #============================================================================== class RPG::MapInfo def name # Definition prevents location scripts from reading anything within return @name.gsub(/\[.*\]/) {""} # brackets, including the brackets end def original_name return @name end def outside_tint? return @name.scan(/\[KTS\]/).size > 0 # old regexp: return @name.scan(/[\KTS]/).size > 0 end end
#============================================================================== # Sets up the time window for the menu. #============================================================================== class Window_KTS < Window_Base def initialize(x, y) super(x, y, 160, WLH + 32) refresh end def refresh self.contents.clear self.contents.draw_text(4, -6, 120, 32, $kts.getTime, 2) end def update super $kts.update self.contents.clear self.contents.draw_text(4, -6, 120, 32, $kts.getTime, 2) end end
#============================================================================== # Adds the time window to the menu. #============================================================================== class Scene_Menu < Scene_Base alias kts_start start def start kts_start @kts_window = Window_KTS.new(0,305) end alias kts_terminate terminate def terminate kts_terminate @kts_window.dispose end alias kts_update update def update kts_update @kts_window.update end end
#============================================================================== # Saves and Loads game time to/from save game file. #============================================================================== class Scene_File alias kts_write_save_data write_save_data def write_save_data(file) kts_write_save_data(file) Marshal.dump($kts, file) end alias kts_read_save_data read_save_data def read_save_data(file) kts_read_save_data(file) $kts = Marshal.load(file) end end can you add the auto weather system? thanks... i'll study your KTS Mod and try to add the auto-weather system to this script while waiting....
__________________________
QUOTE Better off lazy, at least I'm not exhausted.
|
|
|
|
|
|
|
|
|
Feb 16 2010, 03:12 PM
|
Level 4

Group: Member
Posts: 54
Type: Writer
RM Skill: Beginner

|
Could someone please tell me where I'm going wrong? I want: Night People - Between 2100 & 0500 Dawn People - Between 0500 & 0900 Day People - Between 0900 & 1900 Sunset People - Between 1900 & 2100 So far the night one from this page works:  But the dawn one, which uses the same formula just it turns on a different switch doesn't:  And why is "Night" using the variable 4 slot? In the script it says it uses 1... QUOTE # [1] ON during night hours (2200-0400)(10pm-4am) # [2] ON during dawn hours (0500-0800)( 5am-8am) # [3] ON during daytime hours (0900-1800)( 9am-6pm) # [4] ON during sunset hours (1900-2100)( 7pm-9pm) I forever be in debt to the person that explains it to me.
__________________________
Current Project = Last Order
|
|
|
|
|
|
|
|
|
Feb 16 2010, 04:04 PM
|

The Lazy Guy

Group: Revolutionary
Posts: 292
Type: Scripter
RM Skill: Undisclosed

|
you can change the variable/switch to whatever slot you want..
__________________________
QUOTE Better off lazy, at least I'm not exhausted.
|
|
|
|
|
|
|
|
|
Feb 17 2010, 04:17 PM
|
Level 4

Group: Member
Posts: 54
Type: Writer
RM Skill: Beginner

|
OK I've sorted that... by using variables. Another question then.... how do I make it so that the clock goes to a set time at an event? I want my player to sleep and then wake up at 9am... But using the control variable "Set 004:Hour to 9" doesn't work.
__________________________
Current Project = Last Order
|
|
|
|
|
|
|
|
  |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
RPG RPG Revolution is an Privacy
Policy and Legal
|
|