Group: Member
Posts: 2
Type: Event Designer
RM Skill: Intermediate
i think that Kylock is an absolute genoius! this is an awesome script! i have Sat and read pages 1 through to 8 and Kylock i dont know how u put up with the whining little noobies sometimes lol oh no where do i put this script??? - this was my favourite lol. you know your stuff man! great job! and well done Reijubv! you too are a true master of the scripts! i myself rely on your great people to write things like #_________________________ # script #_________________________ # # if u wna do this then # type a number in here # put in the name that will appear in the HUD # #End
thanks for making my life easier! and kylock. you have done well not to intergrate any more features into this script as scripts like this make me (decent understanding of how scripts work and RISING) learn as i make random games up! GOOD JOB! *****
Group: Member
Posts: 4
Type: Developer
RM Skill: Undisclosed
QUOTE (Kylock @ May 17 2008, 07:46 AM)
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.
Thanks for posting this script man, it's excellent. However can you advise me on
1- How to view time and day with a CMS? (How do i go about ammeding the CMS? 2- If the first is too complicated then how can i use the "$kts.getTime" to print the time.......Details?
Group: Member
Posts: 15
Type: Artist
RM Skill: Beginner
I don't know if this is fixable or not, nor did I search for this in any previous posts, but when the I click new game from the title screen the time panel appears before the screen even goes black. Is there any way to fix this and make the time panel appear one second after the new game or saved game loads?
__________________________
Is it illegal to kill a man because it's a sin, or because war weren't declared?
Group: Member
Posts: 4
Type: Developer
RM Skill: Undisclosed
QUOTE (yarow12 @ Feb 28 2011, 12:08 AM)
I don't know if this is fixable or not, nor did I search for this in any previous posts, but when the I click new game from the title screen the time panel appears before the screen even goes black. Is there any way to fix this and make the time panel appear one second after the new game or saved game loads?
i have fixed my problem with the time display and CMS........
As far as your issue there. Could you not place the Time system script at a different point in the script list.
As long as its under mat's and above main??
Long shot.....Other than that convert to a CMS (Custom Menu system) As i dont get that with the one i use....
Group: Member
Posts: 7
Type: Developer
RM Skill: Beginner
QUOTE (darcangel @ Jul 13 2011, 09:08 AM)
Does anyone know how using a event to make the scene_map update automatically?
Actually i was wrong it's not the particular time, but rather everytime i go into a menu or end some sort of auto conversation the NPC'S disappear. My game starts in a village and when i go into the menu and exit again all the NPC'S disappear.
This post has been edited by rpghero123: Aug 16 2011, 01:00 PM
Group: Member
Posts: 3
Type: Scripter
RM Skill: Advanced
QUOTE (Kylock @ Jun 18 2008, 05:53 PM)
QUOTE (sargunster @ Jun 12 2008, 11:08 PM)
amazing! is this the final or will you add furthur updates? and for the the events only happening at night i have to pause, then unpause could you fix this? i really need to know now...
Events are only scanned for conditions when the map is loaded and event page conditions are evaluated. This is part of how rpg maker works. I don't see this as something that needs to be "fixed" with this script.
As far as when time periods change, these are updated when maps are reloaded as well. Without that, events, such as people just sort of appear and disappear and this doesn't give any game a very polished feel.
As far as your issue with pausing... not sure what it is exactly that you are doing to "pause" the game, but use these functions: 'Script: $kts.stop' and 'Script: $kts.go' They can be called from events or other scripts. This system shouldn't be so difficult to incorporate into other system or function scripts.... at all.
To answer the question about updates, this can be considered final unless bugs are discovered or someone recommends a feature that makes sense. I have no plans to integrate "weather effects" or "shadow effects" type systems. Day/Night and Time are enough. The game switches can be treated as global variables for the purposes of making other scripts that can use the time to function. I believe there is a certain amount of features that a person can add to a script to make it so that it's not as useful to everyone as it would be were it not so basic. I hope this makes sense...
It would be great if you could fix that conditions are only scanned when the map is loaded, because I am creating a system that creates an income, so that every day you get your money. But right now, it only works after leaving the map. So if the player stays in the same map for more than one hour (because the script is checking Hour=0) he will not get the income
Group: Member
Posts: 2
Type: Artist
RM Skill: Skilled
ANY ONE THAT WANTS THE SCRIPT TO UPDATE INSTANTLY WHEN CERTAIN TIMES COME.replace lines 158-172 with this edit from originalwij. Thankyou Kylock for the script and originalwij for the edit.
CODE
# 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 update_switches if KTS::DATABASE_OUTPUT $game_variables[KTS::TIME] = getTime end end end
Group: Member
Posts: 2
Type: None
RM Skill: Undisclosed
i can't believe no one ever asked this, but how do I get the time to stop when the player opens the menu. In games the menu is synonymous with pausing, so this should have been a default feature, I believe.
Group: Member
Posts: 2
Type: Developer
RM Skill: Skilled
So far the script works great! Ran into some problems at the start but now everything works as it should...
I am using SBS by Enu script, and animated battlers with that, and when it's night time the battlers also get tinted, as well as the attack animations, which makes them hard to see because of the dark background (No special battleback scripts were used, just the default one).
I've tried everything to "untint" the battlers so that it's easy for the player to see them, with no luck
Group: +Gold Member
Posts: 1,525
Type: Scripter
RM Skill: Undisclosed
I've edited the class Spriteset_Battle section, I don't have Enu's SBS handy, but it does work for the default battle system, and I've tried to write it in a way that should be compatible with any other battle system. If it doesn't work, post a link to Enu's SBS and I'll happily rewrite it
CODE
#============================================================================== # ¦ 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. #============================================================================== # ? 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_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 !$kts_map_data[$game_map.map_id].outside_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, excludes drawing enemies # with a tint. #============================================================================== class Spriteset_Battle #-------------------------------------------------------------------------- # * Create Battleback #-------------------------------------------------------------------------- alias kts_create_battleback create_battleback def create_battleback $kts.update_tint(0) kts_create_battleback end #-------------------------------------------------------------------------- # * Create Viewport #-------------------------------------------------------------------------- alias kts_create_viewports create_viewports def create_viewports kts_create_viewports @viewport15 = Viewport.new(0, 0, 544, 416) @viewport15.z = 1 end #-------------------------------------------------------------------------- # * Update Viewport #-------------------------------------------------------------------------- alias kts_update_viewports update_viewports def update_viewports kts_update_viewports @viewport15.update end #-------------------------------------------------------------------------- # * Dispose of Viewport #-------------------------------------------------------------------------- alias kts_dispose_viewports dispose_viewports def dispose_viewports kts_dispose_viewports @viewport15.dispose end #-------------------------------------------------------------------------- # * Create Enemy Sprite #-------------------------------------------------------------------------- alias kts_create_enemies create_enemies def create_enemies orig_viewport1 = @viewport1 orig_viewport15 = @viewport15 @viewport1 = @viewport15 kts_create_enemies @viewport15 = @viewport1 @viewport1 = orig_viewport1 end #-------------------------------------------------------------------------- # * Create Actor Sprite # By default, the actor image is not displayed, but a dummy sprite is # created for treating enemies and allies the same, if required. #-------------------------------------------------------------------------- alias kts_create_actors create_actors def create_actors orig_viewport1 = @viewport1 orig_viewport15 = @viewport15 @viewport1 = @viewport15 kts_create_actors @viewport15 = @viewport1 @viewport1 = orig_viewport1 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
__________________________
K.I.S.S. Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.
Group: Member
Posts: 1
Type: Developer
RM Skill: Beginner
(I have no idea if I'm necroposting, I just really want this to work, and I hope someone can help me out with this!) EDIT: Crap, this is necroposting... o.o
Ok. I'm going to start out by saying I cannot script myself a tuna fish sandwich, all I know how to o is copy and paste, find lines to copy and paste to, and change some numbers or things if the comments explain what does what, and even then I only change very few things.
I have read multiple replies asking for a dynamic updating script (or something), to where as soon as the clock changes to Day/Night whatever that the event will then change. I'm hoping someone will eventually have this down and help me with it? If you'd like a specific example, let me explain:
In my game "In the Dark", I've incorporated a day/night system to help with the game progression. The main idea is that during the day, parasites come out and make it nearly impossible to survive. However, during the night, the city street lights come on, and this one ghost comes out. The parasites then move to only the street lights, making the city somewhat safer to walk around in. Now, I am capable of making all the other things happen, I'd just like a way so that when it's night-time, the ghost event appears, the parasites go away. and the streetlight event changes to the lit one and not the off one. And when it's day, I can get the lights to go off, the ghost disappears, and the parasites come back out. But I don't want to have to make the character refresh the screen, or however you guys say it, for those changes to take place. Though to be perfectly honest, as soon as i copy the common event Kylock made for "Night people" and set the events to go on for that, I can't get it to work at all! I go in and out doors, pause/unpause, bring up the the menu, go back in, nothing can get the lamps to come up, or the ghost. (I haven't implemented the parasites yet.)
That may be one solution. Or, if I can have someone do this instead, I can take either way out of this predicament.
The character can walk around in the city at night, but once dawn comes(or before dawn comes) a message should pop up, saying that she should get inside before the sun rises. Once the character is inside, the day time and everything can take place, the events can change to the off and stuff, and if she should choose to go back outside then they can be shown as off. Or, when inside, a message will pop up when it becomes night again saying that it's safe to go outside again, and which all the events turn back on and yadda yadda.
Besides these points of concern, I love the script and I think it was scripted very well; the idea is great and It works perfectly otherwise. I just wish there was some way to make these things happen, possibly by the help of some more experienced programmer than I. ^^' I have tried some of the other scripts made by members that have been posted in a reply to this topic, such as Bladeboy05's. It also does nothing for me.
I'm sending all my thanks in advance! (Though expect some later if you are able to solve this, also~)
This post has been edited by NoctPanda: Mar 29 2013, 08:28 PM