Jump to content
Gump

Gumps QSB (Quest System Basic) [BETA 1.20] *Updated April 7th*

Recommended Posts

Current Version: BETA 1.20
System(Script Collection) Author: Matt Sully (Gump)
Download: Download BETA 1.20 (click)

 


Apologies for the lack of formatting on this post.

 

 

CHANGELOG:

============
BETA 1.20 UPDATE: The included DataManager now overwrites a single method. Still looking for a way to properly alias the last overwritten method. Quests can also now have any amount of required Game Variables & Switches settings. Read the Version Changelog included with the download (in the demos script section) for more details.

BETA 1.18 UPDATE: Crashfix for completing & unfinishing item requirement Quests. This was a bad and obvious crash, can't believe it slipped by me in the BETA 1.17 release.

BETA 1.17 UPDATE: Bugfix for Quest Manager crashing if it had to handle 100+ quests. The QM is now capable of handling up to 99,999 active quests.
- New Quest Properties settings: Game Variables and Game Switches. See included documentation for more information. These new Quest Properties settings are optional, therefore old Quest Properties from old versions of the QSB are fully compatible.
- New System Settings for a couple things.
- A few minor bugfixes/tweaks.
- Updated Forum Post for QSB to account for new stuff

BETA 1.10 UPDATE: New optional system included - Gumps LevelUP Messenger. New logic within QSB to "un-finish" Quests that require items if the player had all the items and finished the Quest, but lost some
of them or sold them without finishing the Quest. If that happens now, the 'Finished' Quest will be detected
and switched back to 'Active'.

BETA 1.08 UPDATE: Quest Properties have been reformatted to be a lot more user friendly. Big thanks again to Zeriab for that methodology of setting up data. The ACTIVE_SIZE_MAX setting denoting the max. amount of active quests is also theoretically limitless in its maximum setting. More settings have also been added, including support for Active Size Max Items (key items that can increase your max. active quests) and more. Check the included documentation for more information.

BETA 1.02 UPDATE: Settings are now a lot more user friendly. check included documentation for more details.

BETA 1.00 UPDATE: A quick release, all changes are documented within the script readme files. The Module script has been separated into a few scripts. One for System Settings, another for Quest Properties.

A lot more settings now. To see everything that was added, check the README(Version Info) Changelog.

Quest data created with the ALPHA version is compatible, but it must be imported. You must also redo all your settings.

Find the Beta download attached to this post.

Information:
I created this system for my first commercial game (WIP). It is an easy to use Quest System that provides feedback windows to the player via Scene_Map.

Quests in this system have 3 stages: Active, Finished, and Complete.

When a new Quest becomes Active, a feedback popup window appears for a few seconds informing the player. The same thing also happens when a quest is Finished and Completed. When a Quest is Completed, a second popup window appears on screen, displaying the rewards earned for that Quest.

* Feedback windows are processed and animated within Scene_Map, and do not interrupt player movement. They will also only appear if the game is "not busy" doing something.

Also included with this system is a Quest Manager scene, intended to be accessed via the main menu by the player. This Scene allows the player to view the current status of all Active/Finished Quests (currently, it does not have any options to display Completed Quests).

All Feedback Windows, and all Windows within the Quest Manager scene are fully animated (meaning they animate on and off the screen, they don't just 'pop' into existance on the screen).

Virtually all Vocabulary within the system is easily changeable. All Vocab variables are located at the top of the QUEST module.

There are various other settings available at the top of the QUEST module as well, in fact there are more settings in the public port of QSB(Quest System Basic) than there are in the private version I am using for my game.

All scripts and additional README files are included within the DEMO. You will find the Demo attached to this post as a file. Download it, open it in VX ACE and check it out.

Legal Info:
All Legal information is within the README(TERMS OF USE) script inside of the DEMO. The TLDR for Legal on this script is: You may modify and release modifications for this system, you may freely use this system(QSB) in any free or commercial game, you must provide credit to the script author if you use this system. Please see the Readme(TERMS OF USE) for more detailed information on this subject.

Other Info:
Quests may have up to 4 required items (with any amount for each item). If a player has all the required items for a quest with required items, then that quest is automatically pushed to the "Finished" state (but must still be cashed in aka "Completed" by the player).

Quests may have up to 5 reward items (or none at all). Items are rewarded when the player cashes in, or "Completes" a quest.

Quests without item requirements, Game Variable or Game Switch requiremenets require manual calling of the method to finish that quest when it is appropriate.

For more information, review the comments at the top of all scripts and be sure to review all README files within the demos script section.


Feedback/etc:
Also, screenshots? Sorry, no screenshots yet. I am looking for feedback though. Additionally if you have any ideas for QSB feel free to suggest them here in this topic.

Share this post


Link to post
Share on other sites

Some screenshots will be included with the next update (lack of internet, therefore its a little inconvenient).

 

I'm also thinking of finding a way to use the currently available variable & switch settings as possible tags for objective settings. I think it could workout good (and just have the objective 'hidden' if it is a var/switch setting with no defined objective).

 

Also looking for more ideas, ways to make this better or allow more customization.

 

With the latest BETA taking care of switch and variable settings, its time to do objectives (I think) and get some suggestions into the system. Problem is there are only a few suggestions right now (and I've released on multiple sites). My fault, happens, when you release a system like this without screenshots/video. :(

Share this post


Link to post
Share on other sites

tried the this out and found there was a prob with  window base line 83 (it happened when I opened the menu while your quest  was still up,

will now test the second version

Share this post


Link to post
Share on other sites

Yes, I believe I have that bug already reported. I think its a dispose error, though the way you explained it may help me figure out whats causing it (the other explanation I got regarding that bug was a little odd).

 

I'd like to fix it. Please post back when you've tested the latest version, if its still happening and provide as many details as you can.

 

And sorry in advance if my response/patching is delayed by a couple days -- no internet at home.

Share this post


Link to post
Share on other sites

Made a mistake it was the latest version. I looked at all the parts of your scripts and I think the prob is located in [QSB] WINDOWS. it looks a lot like a different script I used how had a similar porb.

 

Share this post


Link to post
Share on other sites

hi, sry for my english.

If i use your script with Advanced Game Time + Night/Day v1.3.6.1 script i have a error in save game when i want load game:

 

 

Script 'Advanced Game Time' line 203: NoMethodError occured

undefined method 'hour' for nil:NilClass

 

 

Advanced Game Time + Night/Day v1.3.6.1 script:

 

 

#Advanced Game Time + Night/Day v1.3.6.1
#----------#
#Features: Provides a series of functions to set and recall current game time
# as well customizable tints based on current game time to give the
# appearance of night and day in an advanced and customizable way.
#
#Usage: Script calls:
# GameTime.sec? #current second
# GameTime.min? #current minute
# GameTime.hour? #current hour
# GameTime.hour_nom? #current hour (12-hour)
# GameTime.day? #current day of month
# GameTime.day_week? #current day of the week
# GameTime.month? #current month
# GameTime.year? #current year
# GameTime.year_post("set") #changes the year post to set
# GameTime.pause_tint(true/false) #pauses/unpauses tint
# GameTime.notime(true/false) #stops time based on true/false
# GameTime.change(s,m,h,d,dw,mn,y) #manually set the time
# seconds,minutes,hours,days,weekday,months,years
# any can be nil to not be changed
# GameTime.set("handle",n) #increases a certain time portion
# valid arguments are:
# addsec,addmin,addhour,addday
# addmonth,addyear
# and:
# remsec,remmin,remhour,remday
# remmonth,remyear
# GameTime.clock?(true/false) #hides/shows the clock
# GameTime.save_time #saves the current time
# GameTime.load_time #loads the saved time
#
# Message Codes:
# GTSEC #Inputs the current second
# GTMIN #Inputs the current minute
# GTHOUR #Inputs the current hour
# GTDAYN #Inputs the day of the month
# GTDAYF #Inputs the day of the week (full)
# GTDAYA #Inputs the day of the week (abbreviated)
# GTMONN #Inputs the month of the year
# GTMONF #Inputs the name of the month (full)
# GTMONA #Inputs the name of the month (abbreviated)
# GTYEAR #Inputs the current year
#
# Map Note Tags: (These go in the note box of Map Properties)
# Notint #These maps will not tint!
# Notime #Stops time from moving in that map
#
#Customization: Set below, in comments.
#
#Examples: GameTime.pause_tint = false
# GameTime.change(nil,30,4,1,1,1,2012)
# GameTime.set("addyear",5)
# GameTime.clock?(true)
#
#----------#
#-- Script by: V.M of D.T
#
#- Questions or comments can be:
# posted on the thread for the script
# given by email: sumptuaryspade@live.ca
# provided on facebook: http://www.facebook.com/DaimoniousTailsGames
# posed on site: daimonioustails.wordpress.com
#
#--- Free to use in any non-commercial project with credit given
#-- License required for commercial project use

#_# BEGIN_CUSTOMIZATION #_#

#Wether or not to set time to PC (Real) Time
USE_REAL_TIME = false
#Time does not increase while the message window is visible:
NOTIMEMESSAGE = true
#Time does not increase unless you are on the map
PAUSE_IN_MENUS = true
#Time does not increase if you are in battle
NOBATTLETIME = false
#Clock is shown
USECLOCK = true
#Set to true to have the clock show up in the menu!
USECLOCK_MENU = true
#Set the format for the clock both in and out of menu
#1. hh:mm am/pm
#2. Sun dd hh:mm am/pm
#3. hh:mm (24 hour clock)
#4. Sun dd hh:mm (24 hour clock)
#5. Custom clock, see below
CLOCK_FORMAT = 3
MENU_CLOCK_FORMAT = 5
#Clock window background opacity
CLOCK_BACK = 255
#Button to be used to toggle the clock
CLOCK_TOGGLE = :alt
#X and Y position of clock
CLOCK_X = 0
CLOCK_Y = 0
#Finetune the width of the clock window here:
CLOCK_WIDTH = 110
#Whether or not those little dots on the clock blink
USE_BLINK = true
#The speed at which they blink
BLINK_SPEED = 40
#Here is where you would insert the array of commands for the custom clock:
CUSTOM_CLOCK = ["weekshort"," ","day"," ","year","yearp"]
CUSTOM_CLOCK2 = ["hour12","blinky","min"]
#Available commands for CUSTOM_CLOCK:
# "sec" - seconds "min" - minutes
# "hour" - hour (24) "hour12" - hour (12)
# "meri" - AM/PM "day" - day of the month
# "weekshort" - day of the week abbr
# "weeklong" - day of the week long
# "month" - month "monthshort" - month name abbr
# "monthlong" - month name
# "year" - year "yearp" - year post
# "blinky" - those blinky dots


#Using KHAS lighting effects script? Turn this on to use that tint
USE_KHAS = false
#Using Victor Engine Light effects? Turn this on to use that tint
USE_VICTOR = false
#Variables that count down each gametime second/minute
TIMER_VARIABLES = [7]

#Use Tint in the Battles
BATTLE_TINT = true

#Time it takes for a second (or minute) to pass, in frames
#(Frame rate is 60 frames per second)
TIMELAPSE = 300
#Whether to use seconds or not
NOSECONDS = false
#Number of seconds in a minute
SECONDSINMIN = 60
#Number of minutes in an hour
MINUTESINHOUR = 60
#Number of hours in a day
HOURSINDAY = 24
#Names of the days (As little or as many days in the week as you want)
DAYNAMES = ["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"]
#Day name abbreviations
DAYNAMESABBR = ["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"]
#Number of days in each month (Also represents number of months in a year)
MONTHS = [31,28,31,30,31,30,31,31,30,31,30,31]
#Names of the months
MONTHNAMES = ["January","February","March","April","May","June",
"July","August","September","October","November","December"]
#Abrreviated names of the months
MONTHNAMESABBR = ["Jan","Feb","Mar","Apr","May","Jun",
"Jul","Aug","Sep","Oct","Nov","Dec"]
#The default letters to be posted before the year in dates
DEFAULT_YEAR_POST = ""
#NOT YET IMPLEMENTED *IGNORE*
USE_PERIODS = true

#Gradual tint effects! (The hardest part)
#It may look daunting, and it is, but here is where you put the tint
#to be shown at each hour (the actual tint is usually somewhere in between)
#The number of Color.new objects here must equal the number of hours in a day
#Starts from hour 0 (or 12am)
#A color object is -> Color.new(r,g,b,a)
# Where r is red,g is green,b is blue,and a is opacity and all are (0-255)
TINTS = [Color.new(30,0,40,155),
Color.new(20,0,30,135),
Color.new(20,0,30,135),
Color.new(10,0,30,135),
Color.new(10,0,20,125),
Color.new(0,0,20,125),
Color.new(80,20,20,125),
Color.new(130,40,10,105),
Color.new(80,20,10,85),
Color.new(0,0,0,65),
Color.new(0,0,0,35),
Color.new(0,0,0,15),
Color.new(0,0,0,0),
Color.new(0,0,0,0),
Color.new(0,0,0,5),
Color.new(0,0,0,15),
Color.new(0,0,0,25),
Color.new(0,0,10,55),
Color.new(80,20,20,85),
Color.new(130,40,30,105),
Color.new(80,20,40,125),
Color.new(10,0,50,135),
Color.new(20,0,60,135),
Color.new(30,0,70,155)]

#NOT YET IMPLEMENTED *IGNORE*
PERIODS = [["Night",0,5],
["Morning",6,11],
["Afternoon",12,17],
["Evening",18,23]]

$gametimeclockvisible = false
#_# END CUSTOMIZATION #_#

module GameTime
def self.run
$game_time = Current_Time.new
$game_time_tint = Sprite_TimeTint.new
end
def self.update
return if $game_message.busy? and NOTIMEMESSAGE
if !SceneManager.scene.is_a?(Scene_Map) and PAUSE_IN_MENUS
return $game_time_tint.update if SceneManager.scene.is_a?(Scene_Title)
return unless SceneManager.scene.is_a?(Scene_Battle) and !NOBATTLETIME
end
$game_time.update
$game_time_tint = Sprite_TimeTint.new if $game_time_tint.disposed?
$game_time_tint.update unless @pause_tint
end
def self.sec?
return $game_time.sec
end
def self.min?
return $game_time.min
end
def self.hour?
return $game_time.hour
end
def self.hour_nom?
hour = $game_time.hour
hour -= 12 if hour > 11
hour = 12 if hour == 0
return hour
end
def self.day?
return $game_time.day if USE_REAL_TIME
return $game_time.day + 1
end
def self.day_week?
return $game_time.dayweek
end
def self.day_name
return DAYNAMES[$game_time.dayweek-1] if USE_REAL_TIME
return DAYNAMES[$game_time.dayweek]
end
def self.day_name_abbr
return DAYNAMESABBR[$game_time.dayweek-1] if USE_REAL_TIME
return DAYNAMESABBR[$game_time.dayweek]
end
def self.month_name_abbr
return MONTHNAMESABBR[$game_time.month-1] if USE_REAL_TIME
return MONTHNAMESABBR[$game_time.month]
end
def self.month?
return $game_time.month if USE_REAL_TIME
return $game_time.month + 1
end
def self.month_name
return MONTHNAMES[$game_time.month-1] if USE_REAL_TIME
return MONTHNAMES[$game_time.month]
end
def self.year?
return $game_time.year
end
def self.pause_tint(set)
@pause_tint = set
end
def self.change(s = nil,m = nil,h = nil,d = nil,dw = nil, mn = nil,y = nil)
$game_time.manual(s,m,h,d,dw,mn,y)
end
def self.set(handle,n)
$game_time.forward(handle,n)
end
def self.clock?(set)
SceneManager.scene.clock_visible?(set)
end
def self.year_post(set)
$game_time.year_post = set
end
def self.save_time
$saved_game_time = $game_time.dup
end
def self.load_time
$game_time = $saved_game_time.dup
end
def self.no_time_map
note = $game_map.map_note
/Notime/ =~ note
return false unless $~
return true
end
def self.notime(set)
$game_time.notime = set
end

class Current_Time

attr_reader :sec
attr_reader :min
attr_reader :hour
attr_reader :day
attr_reader :dayweek
attr_reader :month
attr_reader :year
attr_accessor :year_post
attr_accessor :notime

def initialize
reset_all_values
end
def reset_all_values
@sec = 0
@min = 0
@hour = 0
@day = 0
@dayweek = 0
@month = 0
@year = 0
@notime = false
@year_post = DEFAULT_YEAR_POST
end
def update
return realtime if USE_REAL_TIME
return if GameTime.no_time_map or @notime
return unless Graphics.frame_count % TIMELAPSE == 0
NOSECONDS ? addmin(1) : addsec(1)
update_timers
end
def update_timers
return unless TIMER_VARIABLES.size > 0
for i in TIMER_VARIABLES
$game_variables[i] -= 1 unless $game_variables[i] == 0
end
end
def realtime
@sec = Time.now.sec
@sec = 0 if @sec == 60
@min = Time.now.min
@hour = Time.now.hour
@day = Time.now.day
@dayweek = Time.now.wday
@month = Time.now.month
@year = Time.now.year
0
end
def addsec(s)
@sec += s
return unless @sec == SECONDSINMIN
@sec = 0
addmin(1)
end
def addmin(m)
@min += m
return unless @min == MINUTESINHOUR
@min = 0
addhour(1)
end
def addhour(h)
@hour += h
return unless @hour == HOURSINDAY
@hour = 0
addday(1)
end
def addday(d)
@day += d
@dayweek += d
@dayweek = 0 if @dayweek == DAYNAMES.size
return unless @day == MONTHS[@month]
@day = 0
addmonth(1)
end
def addmonth(mn)
@month += mn
return unless @month == MONTHS.size
@month = 0
addyear(1)
end
def addyear(y)
@year += y
end
def manual(s = nil,m = nil,h = nil,d = nil,dw = nil,mn = nil,y = nil)
@sec = s if !s.nil?
@sec = SECONDSINMIN - 1 if @sec >= SECONDSINMIN
@min = m if !m.nil?
@min = MINUTESINHOUR - 1 if @min >= MINUTESINHOUR
@hour = h if !h.nil?
@hour = HOURSINDAY - 1 if @hour >= HOURSINDAY
@day = d if !d.nil?
@day = MONTHS[@month] - 1 if @day >= MONTHS[@month]
@dayweek = dw if !dw.nil?
@dayweek = 0 if @dayweek >= DAYNAMES.size
@month = mn if !mn.nil?
@month = MONTHS.size - 1 if @month >= MONTHS.size
@year = y if !y.nil?
end
def forward(handle,n)
handle = handle.to_s + "(1)"
n.times do |s| eval(handle) end
end
def remsec(s)
@sec -= s
return unless @sec == -1
@sec = SECONDSINMIN
remmin(1)
end
def remmin(m)
@min -= m
return unless @min == -1
@min = MINUTESINHOUR
remhour(1)
end
def remhour(h)
@hour -= h
return unless @hour == -1
@hour = HOURSINDAY - 1
remday(1)
end
def remday(d)
@day -= d
@dayweek -= d
@dayweek = DAYNAMES.size - 1 if @dayweek == -1
return unless @day == -1
@day = MONTHS[@month] - 1
remmonth(1)
end
def remmonth(mn)
@month -= mn
return unless @month == -1
@month = MONTHS.size - 1
remyear(1)
end
def remyear(y)
@year -= y
end
end

class Sprite_TimeTint < Sprite_Base
def initialize(viewport = nil)
super(viewport)
self.z = 1
create_contents
update
end
def create_contents
self.bitmap = Bitmap.new(Graphics.width,Graphics.height)
self.visible = false
end
def update
return use_default if SceneManager.scene.is_a?(Scene_Battle) and BATTLE_TINT
return use_khas if USE_KHAS
return use_victor if USE_VICTOR
return use_default
end
def use_default
return if self.disposed?
create_contents if self.bitmap.height != Graphics.height
create_contents if self.bitmap.width != Graphics.width
self.visible = SceneManager.scene.is_a?(Scene_Map)
self.visible = true if SceneManager.scene.is_a?(Scene_Battle) and BATTLE_TINT
self.visible = false if SceneManager.scene.is_a?(Scene_Title)
self.visible = false if no_tint
self.bitmap.clear if no_tint
return unless self.visible
ctint = TINTS[$game_time.hour]
ntint = TINTS[$game_time.hour + 1] unless $game_time.hour + 1 == HOURSINDAY
ntint = TINTS[0] if $game_time.hour + 1 == HOURSINDAY
return if ctint.nil? or ntint.nil?
min = $game_time.min
r = ctint.red.to_f - ((ctint.red.to_f - ntint.red) * (min.to_f / MINUTESINHOUR))
g = ctint.green.to_f - ((ctint.green.to_f - ntint.green) * (min.to_f / MINUTESINHOUR))
b = ctint.blue.to_f - ((ctint.blue.to_f - ntint.blue) * (min.to_f / MINUTESINHOUR))
a = ctint.alpha.to_f - ((ctint.alpha.to_f - ntint.alpha) * (min.to_f / MINUTESINHOUR))
self.bitmap.clear
self.bitmap.fill_rect(0,0,Graphics.width,Graphics.height,Color.new(r,g,b,a))
end
def use_khas
begin
temp = $game_map.light_surface.opacity
rescue
return
end
self.visible = false
$game_map.effect_surface.change_color(0,0,0,0) if no_tint
$game_map.effect_surface.set_alpha(0) if no_tint
return if no_tint
ctint = TINTS[$game_time.hour]
ntint = TINTS[$game_time.hour + 1] unless $game_time.hour + 1 == HOURSINDAY
ntint = TINTS[0] if $game_time.hour + 1 == HOURSINDAY
min = $game_time.min
r = ctint.red.to_f - ((ctint.red.to_f - ntint.red) * (min.to_f / MINUTESINHOUR))
g = ctint.green.to_f - ((ctint.green.to_f - ntint.green) * (min.to_f / MINUTESINHOUR))
b = ctint.blue.to_f - ((ctint.blue.to_f - ntint.blue) * (min.to_f / MINUTESINHOUR))
a = ctint.alpha.to_f - ((ctint.alpha.to_f - ntint.alpha) * (min.to_f / MINUTESINHOUR))
$game_map.effect_surface.change_color(0,r,g,
$game_map.effect_surface.set_alpha(a)
end
def no_tint
return if $game_map.nil?
note = $game_map.map_note
/Notint/ =~ note
return false unless $~
return true
end
def use_victor
return if $game_map.nil?
self.visible = false
$game_map.screen.shade.change_color(0,0,0,0) if no_tint
$game_map.screen.shade.change_opacity(0) if no_tint
return if no_tint
$game_map.screen.shade.show if !$game_map.screen.shade.visible
ctint = TINTS[$game_time.hour]
ntint = TINTS[$game_time.hour + 1] unless $game_time.hour + 1 == HOURSINDAY
ntint = TINTS[0] if $game_time.hour + 1 == HOURSINDAY
min = $game_time.min
r = ctint.red.to_f - ((ctint.red.to_f - ntint.red) * (min.to_f / MINUTESINHOUR))
g = ctint.green.to_f - ((ctint.green.to_f - ntint.green) * (min.to_f / MINUTESINHOUR))
b = ctint.blue.to_f - ((ctint.blue.to_f - ntint.blue) * (min.to_f / MINUTESINHOUR))
a = ctint.alpha.to_f - ((ctint.alpha.to_f - ntint.alpha) * (min.to_f / MINUTESINHOUR))
$game_map.screen.shade.change_color(r,g,b,0)
$game_map.screen.shade.change_opacity(a,0)
end
end

class Window_GameClock < Window_Base
def initialize
super(CLOCK_X,CLOCK_Y,CLOCK_WIDTH,clock_height)
self.opacity = CLOCK_BACK unless SceneManager.scene.is_a?(Scene_Menu)
update
self.visible = $gametimeclockvisible unless SceneManager.scene.is_a?(Scene_Menu)
end
def clock_height
return 80 if !CUSTOM_CLOCK2.nil? and CLOCK_FORMAT == 5 and SceneManager.scene.is_a?(Scene_Map)
return 80 if !CUSTOM_CLOCK2.nil? and MENU_CLOCK_FORMAT == 5 and SceneManager.scene.is_a?(Scene_Menu)
return 56
end
def update
contents.clear
if SceneManager.scene.is_a?(Scene_Map)
v = CLOCK_FORMAT
else
v = MENU_CLOCK_FORMAT
end
string = normal_clock if v == 1
string = dated_clock if v == 2
string = military_clock if v == 3
string = dated_military_clock if v == 4
string = custom(CUSTOM_CLOCK) if v == 5
string2 = custom(CUSTOM_CLOCK2) if !CUSTOM_CLOCK2.nil? and v == 5
contents.draw_text(0,0,contents.width,24,string,1)
contents.draw_text(0,24,contents.width,24,string2,1) if !CUSTOM_CLOCK2.nil? and v == 5
end
def military_clock
hour = $game_time.hour
minute = $game_time.min
if hour < 10 then hour = " " + hour.to_s else hour.to_s end
if minute < 10 then minute = "0" + minute.to_s else minute.to_s end
string = hour.to_s + blinky + minute.to_s
return string
end
def dated_military_clock
hour = $game_time.hour
minute = $game_time.min
dayweek = DAYNAMESABBR[$game_time.dayweek]
day = $game_time.day
day += 1 unless USE_REAL_TIME
if hour < 10 then hour = " " + hour.to_s else hour.to_s end
if minute < 10 then minute = "0" + minute.to_s else minute.to_s end
if day < 10 then day = " " + day.to_s end
string = dayweek.to_s + " " + day.to_s + " "
string += hour.to_s + blinky + minute.to_s
return string
end
def normal_clock
meri = "AM"
minute = $game_time.min
hour = $game_time.hour
if hour > 11 then meri = "PM" end
if hour == 0 then hour = 12; meri = "AM" end
if hour > 12 then hour -= 12 end
if hour < 10 then hour = " " + hour.to_s else hour.to_s end
if minute < 10 then minute = "0" + minute.to_s else minute.to_s end
string = hour.to_s + blinky + minute.to_s + " " + meri
return string
end
def dated_clock
meri = "AM"
hour = $game_time.hour
minute = $game_time.min
dayweek = DAYNAMESABBR[$game_time.dayweek]
day = $game_time.day
day += 1 unless USE_REAL_TIME
if hour > 11 then meri = "PM" end
if hour == 0 then hour = 12; meri = "AM" end
if hour > 12 then hour -= 12 end
if hour < 10 then hour = " " + hour.to_s else hour.to_s end
if minute < 10 then minute = "0" + minute.to_s else minute.to_s end
if day < 10 then day = " " + day.to_s end
string = dayweek.to_s + " " + day.to_s + " "
string += hour.to_s + blinky + minute.to_s + " " + meri
return string
end
def blinky
return ":" unless USE_BLINK
return " " if Graphics.frame_count % BLINK_SPEED > (BLINK_SPEED / 2)
return ":"
end
def custom(array)
sec = $game_time.sec
sec = "0" + sec.to_s if sec < 10
hour = $game_time.hour
hour >= 12 ? meri = "PM" : meri = "AM"
hour = " " + hour.to_s if hour < 10
hour12 = $game_time.hour
hour12 -= 12 if hour12 > 12
hour12 = 12 if hour12 == 0
minute = $game_time.min
minute = "0" + minute.to_s if minute < 10
dayweek = DAYNAMESABBR[$game_time.dayweek]
dayweekn = DAYNAMES[$game_time.dayweek]
day = $game_time.day
day += 1 unless USE_REAL_TIME
month = $game_time.month
month += 1 unless USE_REAL_TIME
monthn = MONTHNAMES[$game_time.month]
monthna = MONTHNAMESABBR[$game_time.month]
year = $game_time.year
string = ""
for command in array
case command
when "sec"
string += sec.to_s
when "min"
string += minute.to_s
when "hour"
string += hour.to_s
when "hour12"
string += hour12.to_s
when "meri"
string += meri.to_s
when "weekshort"
string += dayweek.to_s
when "weeklong"
string += dayweekn.to_s
when "day"
string += day.to_s
when "month"
string += month.to_s
when "monthshort"
string += monthna.to_s
when "monthlong"
string += monthn.to_s
when "year"
string += year.to_s
when "yearp"
string += $game_time.year_post
when "blinky"
string += blinky
else
string += command.to_s
end
end
return string
end
end

end

GameTime.run

class Window_Base < Window
alias real_time_convert_escape_characters convert_escape_characters
def convert_escape_characters(text)
result = real_time_convert_escape_characters(text)
result.gsub!(/GTSEC/) { GameTime.sec? }
result.gsub!(/GTMIN/) { GameTime.min? }
result.gsub!(/GTHOUR/) { GameTime.hour? }
result.gsub!(/GTDAYN/) { GameTime.day? }
result.gsub!(/GTDAYF/) { GameTime.day_name }
result.gsub!(/GTDAYA/) { GameTime.day_name_abbr }
result.gsub!(/GTMONF/) { GameTime.month? }
result.gsub!(/GTMONN/) { GameTime.month_name }
result.gsub!(/GTMONA/) { GameTime.month_name_abbr }
result.gsub!(/GTYEAR/) { GameTime.year? }
result
end
end

class Scene_Base
alias game_time_update update
def update
game_time_update
GameTime.update
end
end

class Scene_Map
alias game_time_post_transfer post_transfer
alias game_time_init create_all_windows
alias game_time_map_update update
alias game_time_start start
def start
game_time_start
$game_time_tint.update
end
def create_all_windows
game_time_init
@gametimeclock = GameTime::Window_GameClock.new if USECLOCK
end
def post_transfer
$game_time_tint.update
game_time_post_transfer
end
def update
game_time_map_update
return unless USECLOCK
@gametimeclock.update unless SceneManager.scene != self
if Input.trigger?(CLOCK_TOGGLE) and @gametimeclock.nil? == false
@gametimeclock.visible ? @gametimeclock.visible = false : @gametimeclock.visible = true
$gametimeclockvisible = @gametimeclock.visible
end
end
def clock_visible?(set)
@gametimeclock.visible = set
end
def update_encounter
if $game_player.encounter
$game_time_tint.use_default
SceneManager.call(Scene_Battle)
end
end
end

class Game_Map
def map_note
return @map.note unless @map.nil?
end
end

class Scene_Menu
alias gt_start start
alias gt_update update
def start
gt_start
@clock = GameTime::Window_GameClock.new if USECLOCK_MENU
return if @clock.nil?
@clock.x = 0
@clock.y = @gold_window.y - @clock.height
@clock.width = @gold_window.width
@clock.create_contents
end
def update
gt_update
@clock.update unless @clock.nil?
@clock.contents.clear if SceneManager.scene != self and !@clock.nil?
end
end


module DataManager
class << self
alias gametime_msc make_save_contents
alias gametime_esc extract_save_contents
alias gametime_sng setup_new_game
end
def self.make_save_contents
contents = gametime_msc
contents[:gametime] = $game_time
contents
end
def self.extract_save_contents(contents)
gametime_esc(contents)
$game_time = contents[:gametime]
end
def self.setup_new_game
gametime_sng
$game_time = GameTime::Current_Time.new
end
end
 

 

 

 

 

Pls help me i m a noob coder.

Thx.

 

EDIT: I make Gump's script befor a time script and it's ok.

Edited by azmin

Share this post


Link to post
Share on other sites

hi, sry for my english.

If i use your script with Advanced Game Time + Night/Day v1.3.6.1 script i have a error in save game when i want load game:

 

 

Script 'Advanced Game Time' line 203: NoMethodError occured

undefined method 'hour' for nil:NilClass

 

 

Advanced Game Time + Night/Day v1.3.6.1 script:

 

 

 

#Advanced Game Time + Night/Day v1.3.6.1
#----------#
#Features: Provides a series of functions to set and recall current game time
# as well customizable tints based on current game time to give the
# appearance of night and day in an advanced and customizable way.
#
#Usage: Script calls:
# GameTime.sec? #current second
# GameTime.min? #current minute
# GameTime.hour? #current hour
# GameTime.hour_nom? #current hour (12-hour)
# GameTime.day? #current day of month
# GameTime.day_week? #current day of the week
# GameTime.month? #current month
# GameTime.year? #current year
# GameTime.year_post("set") #changes the year post to set
# GameTime.pause_tint(true/false) #pauses/unpauses tint
# GameTime.notime(true/false) #stops time based on true/false
# GameTime.change(s,m,h,d,dw,mn,y) #manually set the time
# seconds,minutes,hours,days,weekday,months,years
# any can be nil to not be changed
# GameTime.set("handle",n) #increases a certain time portion
# valid arguments are:
# addsec,addmin,addhour,addday
# addmonth,addyear
# and:
# remsec,remmin,remhour,remday
# remmonth,remyear
# GameTime.clock?(true/false) #hides/shows the clock
# GameTime.save_time #saves the current time
# GameTime.load_time #loads the saved time
#
# Message Codes:
# GTSEC #Inputs the current second
# GTMIN #Inputs the current minute
# GTHOUR #Inputs the current hour
# GTDAYN #Inputs the day of the month
# GTDAYF #Inputs the day of the week (full)
# GTDAYA #Inputs the day of the week (abbreviated)
# GTMONN #Inputs the month of the year
# GTMONF #Inputs the name of the month (full)
# GTMONA #Inputs the name of the month (abbreviated)
# GTYEAR #Inputs the current year
#
# Map Note Tags: (These go in the note box of Map Properties)
# Notint #These maps will not tint!
# Notime #Stops time from moving in that map
#
#Customization: Set below, in comments.
#
#Examples: GameTime.pause_tint = false
# GameTime.change(nil,30,4,1,1,1,2012)
# GameTime.set("addyear",5)
# GameTime.clock?(true)
#
#----------#
#-- Script by: V.M of D.T
#
#- Questions or comments can be:
# posted on the thread for the script
# given by email: sumptuaryspade@live.ca
# provided on facebook: http://www.facebook.com/DaimoniousTailsGames
# posed on site: daimonioustails.wordpress.com
#
#--- Free to use in any non-commercial project with credit given
#-- License required for commercial project use

#_# BEGIN_CUSTOMIZATION #_#

#Wether or not to set time to PC (Real) Time
USE_REAL_TIME = false
#Time does not increase while the message window is visible:
NOTIMEMESSAGE = true
#Time does not increase unless you are on the map
PAUSE_IN_MENUS = true
#Time does not increase if you are in battle
NOBATTLETIME = false
#Clock is shown
USECLOCK = true
#Set to true to have the clock show up in the menu!
USECLOCK_MENU = true
#Set the format for the clock both in and out of menu
#1. hh:mm am/pm
#2. Sun dd hh:mm am/pm
#3. hh:mm (24 hour clock)
#4. Sun dd hh:mm (24 hour clock)
#5. Custom clock, see below
CLOCK_FORMAT = 3
MENU_CLOCK_FORMAT = 5
#Clock window background opacity
CLOCK_BACK = 255
#Button to be used to toggle the clock
CLOCK_TOGGLE = :alt
#X and Y position of clock
CLOCK_X = 0
CLOCK_Y = 0
#Finetune the width of the clock window here:
CLOCK_WIDTH = 110
#Whether or not those little dots on the clock blink
USE_BLINK = true
#The speed at which they blink
BLINK_SPEED = 40
#Here is where you would insert the array of commands for the custom clock:
CUSTOM_CLOCK = ["weekshort"," ","day"," ","year","yearp"]
CUSTOM_CLOCK2 = ["hour12","blinky","min"]
#Available commands for CUSTOM_CLOCK:
# "sec" - seconds "min" - minutes
# "hour" - hour (24) "hour12" - hour (12)
# "meri" - AM/PM "day" - day of the month
# "weekshort" - day of the week abbr
# "weeklong" - day of the week long
# "month" - month "monthshort" - month name abbr
# "monthlong" - month name
# "year" - year "yearp" - year post
# "blinky" - those blinky dots


#Using KHAS lighting effects script? Turn this on to use that tint
USE_KHAS = false
#Using Victor Engine Light effects? Turn this on to use that tint
USE_VICTOR = false
#Variables that count down each gametime second/minute
TIMER_VARIABLES = [7]

#Use Tint in the Battles
BATTLE_TINT = true

#Time it takes for a second (or minute) to pass, in frames
#(Frame rate is 60 frames per second)
TIMELAPSE = 300
#Whether to use seconds or not
NOSECONDS = false
#Number of seconds in a minute
SECONDSINMIN = 60
#Number of minutes in an hour
MINUTESINHOUR = 60
#Number of hours in a day
HOURSINDAY = 24
#Names of the days (As little or as many days in the week as you want)
DAYNAMES = ["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"]
#Day name abbreviations
DAYNAMESABBR = ["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"]
#Number of days in each month (Also represents number of months in a year)
MONTHS = [31,28,31,30,31,30,31,31,30,31,30,31]
#Names of the months
MONTHNAMES = ["January","February","March","April","May","June",
"July","August","September","October","November","December"]
#Abrreviated names of the months
MONTHNAMESABBR = ["Jan","Feb","Mar","Apr","May","Jun",
"Jul","Aug","Sep","Oct","Nov","Dec"]
#The default letters to be posted before the year in dates
DEFAULT_YEAR_POST = ""
#NOT YET IMPLEMENTED *IGNORE*
USE_PERIODS = true

#Gradual tint effects! (The hardest part)
#It may look daunting, and it is, but here is where you put the tint
#to be shown at each hour (the actual tint is usually somewhere in between)
#The number of Color.new objects here must equal the number of hours in a day
#Starts from hour 0 (or 12am)
#A color object is -> Color.new(r,g,b,a)
# Where r is red,g is green,b is blue,and a is opacity and all are (0-255)
TINTS = [Color.new(30,0,40,155),
Color.new(20,0,30,135),
Color.new(20,0,30,135),
Color.new(10,0,30,135),
Color.new(10,0,20,125),
Color.new(0,0,20,125),
Color.new(80,20,20,125),
Color.new(130,40,10,105),
Color.new(80,20,10,85),
Color.new(0,0,0,65),
Color.new(0,0,0,35),
Color.new(0,0,0,15),
Color.new(0,0,0,0),
Color.new(0,0,0,0),
Color.new(0,0,0,5),
Color.new(0,0,0,15),
Color.new(0,0,0,25),
Color.new(0,0,10,55),
Color.new(80,20,20,85),
Color.new(130,40,30,105),
Color.new(80,20,40,125),
Color.new(10,0,50,135),
Color.new(20,0,60,135),
Color.new(30,0,70,155)]

#NOT YET IMPLEMENTED *IGNORE*
PERIODS = [["Night",0,5],
["Morning",6,11],
["Afternoon",12,17],
["Evening",18,23]]

$gametimeclockvisible = false
#_# END CUSTOMIZATION #_#

module GameTime
def self.run
$game_time = Current_Time.new
$game_time_tint = Sprite_TimeTint.new
end
def self.update
return if $game_message.busy? and NOTIMEMESSAGE
if !SceneManager.scene.is_a?(Scene_Map) and PAUSE_IN_MENUS
return $game_time_tint.update if SceneManager.scene.is_a?(Scene_Title)
return unless SceneManager.scene.is_a?(Scene_Battle) and !NOBATTLETIME
end
$game_time.update
$game_time_tint = Sprite_TimeTint.new if $game_time_tint.disposed?
$game_time_tint.update unless @pause_tint
end
def self.sec?
return $game_time.sec
end
def self.min?
return $game_time.min
end
def self.hour?
return $game_time.hour
end
def self.hour_nom?
hour = $game_time.hour
hour -= 12 if hour > 11
hour = 12 if hour == 0
return hour
end
def self.day?
return $game_time.day if USE_REAL_TIME
return $game_time.day + 1
end
def self.day_week?
return $game_time.dayweek
end
def self.day_name
return DAYNAMES[$game_time.dayweek-1] if USE_REAL_TIME
return DAYNAMES[$game_time.dayweek]
end
def self.day_name_abbr
return DAYNAMESABBR[$game_time.dayweek-1] if USE_REAL_TIME
return DAYNAMESABBR[$game_time.dayweek]
end
def self.month_name_abbr
return MONTHNAMESABBR[$game_time.month-1] if USE_REAL_TIME
return MONTHNAMESABBR[$game_time.month]
end
def self.month?
return $game_time.month if USE_REAL_TIME
return $game_time.month + 1
end
def self.month_name
return MONTHNAMES[$game_time.month-1] if USE_REAL_TIME
return MONTHNAMES[$game_time.month]
end
def self.year?
return $game_time.year
end
def self.pause_tint(set)
@pause_tint = set
end
def self.change(s = nil,m = nil,h = nil,d = nil,dw = nil, mn = nil,y = nil)
$game_time.manual(s,m,h,d,dw,mn,y)
end
def self.set(handle,n)
$game_time.forward(handle,n)
end
def self.clock?(set)
SceneManager.scene.clock_visible?(set)
end
def self.year_post(set)
$game_time.year_post = set
end
def self.save_time
$saved_game_time = $game_time.dup
end
def self.load_time
$game_time = $saved_game_time.dup
end
def self.no_time_map
note = $game_map.map_note
/Notime/ =~ note
return false unless $~
return true
end
def self.notime(set)
$game_time.notime = set
end

class Current_Time

attr_reader :sec
attr_reader :min
attr_reader :hour
attr_reader :day
attr_reader :dayweek
attr_reader :month
attr_reader :year
attr_accessor :year_post
attr_accessor :notime

def initialize
reset_all_values
end
def reset_all_values
@sec = 0
@min = 0
@hour = 0
@day = 0
@dayweek = 0
@month = 0
@year = 0
@notime = false
@year_post = DEFAULT_YEAR_POST
end
def update
return realtime if USE_REAL_TIME
return if GameTime.no_time_map or @notime
return unless Graphics.frame_count % TIMELAPSE == 0
NOSECONDS ? addmin(1) : addsec(1)
update_timers
end
def update_timers
return unless TIMER_VARIABLES.size > 0
for i in TIMER_VARIABLES
$game_variables[i] -= 1 unless $game_variables[i] == 0
end
end
def realtime
@sec = Time.now.sec
@sec = 0 if @sec == 60
@min = Time.now.min
@hour = Time.now.hour
@day = Time.now.day
@dayweek = Time.now.wday
@month = Time.now.month
@year = Time.now.year
0
end
def addsec(s)
@sec += s
return unless @sec == SECONDSINMIN
@sec = 0
addmin(1)
end
def addmin(m)
@min += m
return unless @min == MINUTESINHOUR
@min = 0
addhour(1)
end
def addhour(h)
@hour += h
return unless @hour == HOURSINDAY
@hour = 0
addday(1)
end
def addday(d)
@day += d
@dayweek += d
@dayweek = 0 if @dayweek == DAYNAMES.size
return unless @day == MONTHS[@month]
@day = 0
addmonth(1)
end
def addmonth(mn)
@month += mn
return unless @month == MONTHS.size
@month = 0
addyear(1)
end
def addyear(y)
@year += y
end
def manual(s = nil,m = nil,h = nil,d = nil,dw = nil,mn = nil,y = nil)
@sec = s if !s.nil?
@sec = SECONDSINMIN - 1 if @sec >= SECONDSINMIN
@min = m if !m.nil?
@min = MINUTESINHOUR - 1 if @min >= MINUTESINHOUR
@hour = h if !h.nil?
@hour = HOURSINDAY - 1 if @hour >= HOURSINDAY
@day = d if !d.nil?
@day = MONTHS[@month] - 1 if @day >= MONTHS[@month]
@dayweek = dw if !dw.nil?
@dayweek = 0 if @dayweek >= DAYNAMES.size
@month = mn if !mn.nil?
@month = MONTHS.size - 1 if @month >= MONTHS.size
@year = y if !y.nil?
end
def forward(handle,n)
handle = handle.to_s + "(1)"
n.times do |s| eval(handle) end
end
def remsec(s)
@sec -= s
return unless @sec == -1
@sec = SECONDSINMIN
remmin(1)
end
def remmin(m)
@min -= m
return unless @min == -1
@min = MINUTESINHOUR
remhour(1)
end
def remhour(h)
@hour -= h
return unless @hour == -1
@hour = HOURSINDAY - 1
remday(1)
end
def remday(d)
@day -= d
@dayweek -= d
@dayweek = DAYNAMES.size - 1 if @dayweek == -1
return unless @day == -1
@day = MONTHS[@month] - 1
remmonth(1)
end
def remmonth(mn)
@month -= mn
return unless @month == -1
@month = MONTHS.size - 1
remyear(1)
end
def remyear(y)
@year -= y
end
end

class Sprite_TimeTint < Sprite_Base
def initialize(viewport = nil)
super(viewport)
self.z = 1
create_contents
update
end
def create_contents
self.bitmap = Bitmap.new(Graphics.width,Graphics.height)
self.visible = false
end
def update
return use_default if SceneManager.scene.is_a?(Scene_Battle) and BATTLE_TINT
return use_khas if USE_KHAS
return use_victor if USE_VICTOR
return use_default
end
def use_default
return if self.disposed?
create_contents if self.bitmap.height != Graphics.height
create_contents if self.bitmap.width != Graphics.width
self.visible = SceneManager.scene.is_a?(Scene_Map)
self.visible = true if SceneManager.scene.is_a?(Scene_Battle) and BATTLE_TINT
self.visible = false if SceneManager.scene.is_a?(Scene_Title)
self.visible = false if no_tint
self.bitmap.clear if no_tint
return unless self.visible
ctint = TINTS[$game_time.hour]
ntint = TINTS[$game_time.hour + 1] unless $game_time.hour + 1 == HOURSINDAY
ntint = TINTS[0] if $game_time.hour + 1 == HOURSINDAY
return if ctint.nil? or ntint.nil?
min = $game_time.min
r = ctint.red.to_f - ((ctint.red.to_f - ntint.red) * (min.to_f / MINUTESINHOUR))
g = ctint.green.to_f - ((ctint.green.to_f - ntint.green) * (min.to_f / MINUTESINHOUR))
b = ctint.blue.to_f - ((ctint.blue.to_f - ntint.blue) * (min.to_f / MINUTESINHOUR))
a = ctint.alpha.to_f - ((ctint.alpha.to_f - ntint.alpha) * (min.to_f / MINUTESINHOUR))
self.bitmap.clear
self.bitmap.fill_rect(0,0,Graphics.width,Graphics.height,Color.new(r,g,b,a))
end
def use_khas
begin
temp = $game_map.light_surface.opacity
rescue
return
end
self.visible = false
$game_map.effect_surface.change_color(0,0,0,0) if no_tint
$game_map.effect_surface.set_alpha(0) if no_tint
return if no_tint
ctint = TINTS[$game_time.hour]
ntint = TINTS[$game_time.hour + 1] unless $game_time.hour + 1 == HOURSINDAY
ntint = TINTS[0] if $game_time.hour + 1 == HOURSINDAY
min = $game_time.min
r = ctint.red.to_f - ((ctint.red.to_f - ntint.red) * (min.to_f / MINUTESINHOUR))
g = ctint.green.to_f - ((ctint.green.to_f - ntint.green) * (min.to_f / MINUTESINHOUR))
b = ctint.blue.to_f - ((ctint.blue.to_f - ntint.blue) * (min.to_f / MINUTESINHOUR))
a = ctint.alpha.to_f - ((ctint.alpha.to_f - ntint.alpha) * (min.to_f / MINUTESINHOUR))
$game_map.effect_surface.change_color(0,r,g,
$game_map.effect_surface.set_alpha(a)
end
def no_tint
return if $game_map.nil?
note = $game_map.map_note
/Notint/ =~ note
return false unless $~
return true
end
def use_victor
return if $game_map.nil?
self.visible = false
$game_map.screen.shade.change_color(0,0,0,0) if no_tint
$game_map.screen.shade.change_opacity(0) if no_tint
return if no_tint
$game_map.screen.shade.show if !$game_map.screen.shade.visible
ctint = TINTS[$game_time.hour]
ntint = TINTS[$game_time.hour + 1] unless $game_time.hour + 1 == HOURSINDAY
ntint = TINTS[0] if $game_time.hour + 1 == HOURSINDAY
min = $game_time.min
r = ctint.red.to_f - ((ctint.red.to_f - ntint.red) * (min.to_f / MINUTESINHOUR))
g = ctint.green.to_f - ((ctint.green.to_f - ntint.green) * (min.to_f / MINUTESINHOUR))
b = ctint.blue.to_f - ((ctint.blue.to_f - ntint.blue) * (min.to_f / MINUTESINHOUR))
a = ctint.alpha.to_f - ((ctint.alpha.to_f - ntint.alpha) * (min.to_f / MINUTESINHOUR))
$game_map.screen.shade.change_color(r,g,b,0)
$game_map.screen.shade.change_opacity(a,0)
end
end

class Window_GameClock < Window_Base
def initialize
super(CLOCK_X,CLOCK_Y,CLOCK_WIDTH,clock_height)
self.opacity = CLOCK_BACK unless SceneManager.scene.is_a?(Scene_Menu)
update
self.visible = $gametimeclockvisible unless SceneManager.scene.is_a?(Scene_Menu)
end
def clock_height
return 80 if !CUSTOM_CLOCK2.nil? and CLOCK_FORMAT == 5 and SceneManager.scene.is_a?(Scene_Map)
return 80 if !CUSTOM_CLOCK2.nil? and MENU_CLOCK_FORMAT == 5 and SceneManager.scene.is_a?(Scene_Menu)
return 56
end
def update
contents.clear
if SceneManager.scene.is_a?(Scene_Map)
v = CLOCK_FORMAT
else
v = MENU_CLOCK_FORMAT
end
string = normal_clock if v == 1
string = dated_clock if v == 2
string = military_clock if v == 3
string = dated_military_clock if v == 4
string = custom(CUSTOM_CLOCK) if v == 5
string2 = custom(CUSTOM_CLOCK2) if !CUSTOM_CLOCK2.nil? and v == 5
contents.draw_text(0,0,contents.width,24,string,1)
contents.draw_text(0,24,contents.width,24,string2,1) if !CUSTOM_CLOCK2.nil? and v == 5
end
def military_clock
hour = $game_time.hour
minute = $game_time.min
if hour < 10 then hour = " " + hour.to_s else hour.to_s end
if minute < 10 then minute = "0" + minute.to_s else minute.to_s end
string = hour.to_s + blinky + minute.to_s
return string
end
def dated_military_clock
hour = $game_time.hour
minute = $game_time.min
dayweek = DAYNAMESABBR[$game_time.dayweek]
day = $game_time.day
day += 1 unless USE_REAL_TIME
if hour < 10 then hour = " " + hour.to_s else hour.to_s end
if minute < 10 then minute = "0" + minute.to_s else minute.to_s end
if day < 10 then day = " " + day.to_s end
string = dayweek.to_s + " " + day.to_s + " "
string += hour.to_s + blinky + minute.to_s
return string
end
def normal_clock
meri = "AM"
minute = $game_time.min
hour = $game_time.hour
if hour > 11 then meri = "PM" end
if hour == 0 then hour = 12; meri = "AM" end
if hour > 12 then hour -= 12 end
if hour < 10 then hour = " " + hour.to_s else hour.to_s end
if minute < 10 then minute = "0" + minute.to_s else minute.to_s end
string = hour.to_s + blinky + minute.to_s + " " + meri
return string
end
def dated_clock
meri = "AM"
hour = $game_time.hour
minute = $game_time.min
dayweek = DAYNAMESABBR[$game_time.dayweek]
day = $game_time.day
day += 1 unless USE_REAL_TIME
if hour > 11 then meri = "PM" end
if hour == 0 then hour = 12; meri = "AM" end
if hour > 12 then hour -= 12 end
if hour < 10 then hour = " " + hour.to_s else hour.to_s end
if minute < 10 then minute = "0" + minute.to_s else minute.to_s end
if day < 10 then day = " " + day.to_s end
string = dayweek.to_s + " " + day.to_s + " "
string += hour.to_s + blinky + minute.to_s + " " + meri
return string
end
def blinky
return ":" unless USE_BLINK
return " " if Graphics.frame_count % BLINK_SPEED > (BLINK_SPEED / 2)
return ":"
end
def custom(array)
sec = $game_time.sec
sec = "0" + sec.to_s if sec < 10
hour = $game_time.hour
hour >= 12 ? meri = "PM" : meri = "AM"
hour = " " + hour.to_s if hour < 10
hour12 = $game_time.hour
hour12 -= 12 if hour12 > 12
hour12 = 12 if hour12 == 0
minute = $game_time.min
minute = "0" + minute.to_s if minute < 10
dayweek = DAYNAMESABBR[$game_time.dayweek]
dayweekn = DAYNAMES[$game_time.dayweek]
day = $game_time.day
day += 1 unless USE_REAL_TIME
month = $game_time.month
month += 1 unless USE_REAL_TIME
monthn = MONTHNAMES[$game_time.month]
monthna = MONTHNAMESABBR[$game_time.month]
year = $game_time.year
string = ""
for command in array
case command
when "sec"
string += sec.to_s
when "min"
string += minute.to_s
when "hour"
string += hour.to_s
when "hour12"
string += hour12.to_s
when "meri"
string += meri.to_s
when "weekshort"
string += dayweek.to_s
when "weeklong"
string += dayweekn.to_s
when "day"
string += day.to_s
when "month"
string += month.to_s
when "monthshort"
string += monthna.to_s
when "monthlong"
string += monthn.to_s
when "year"
string += year.to_s
when "yearp"
string += $game_time.year_post
when "blinky"
string += blinky
else
string += command.to_s
end
end
return string
end
end

end

GameTime.run

class Window_Base < Window
alias real_time_convert_escape_characters convert_escape_characters
def convert_escape_characters(text)
result = real_time_convert_escape_characters(text)
result.gsub!(/GTSEC/) { GameTime.sec? }
result.gsub!(/GTMIN/) { GameTime.min? }
result.gsub!(/GTHOUR/) { GameTime.hour? }
result.gsub!(/GTDAYN/) { GameTime.day? }
result.gsub!(/GTDAYF/) { GameTime.day_name }
result.gsub!(/GTDAYA/) { GameTime.day_name_abbr }
result.gsub!(/GTMONF/) { GameTime.month? }
result.gsub!(/GTMONN/) { GameTime.month_name }
result.gsub!(/GTMONA/) { GameTime.month_name_abbr }
result.gsub!(/GTYEAR/) { GameTime.year? }
result
end
end

class Scene_Base
alias game_time_update update
def update
game_time_update
GameTime.update
end
end

class Scene_Map
alias game_time_post_transfer post_transfer
alias game_time_init create_all_windows
alias game_time_map_update update
alias game_time_start start
def start
game_time_start
$game_time_tint.update
end
def create_all_windows
game_time_init
@gametimeclock = GameTime::Window_GameClock.new if USECLOCK
end
def post_transfer
$game_time_tint.update
game_time_post_transfer
end
def update
game_time_map_update
return unless USECLOCK
@gametimeclock.update unless SceneManager.scene != self
if Input.trigger?(CLOCK_TOGGLE) and @gametimeclock.nil? == false
@gametimeclock.visible ? @gametimeclock.visible = false : @gametimeclock.visible = true
$gametimeclockvisible = @gametimeclock.visible
end
end
def clock_visible?(set)
@gametimeclock.visible = set
end
def update_encounter
if $game_player.encounter
$game_time_tint.use_default
SceneManager.call(Scene_Battle)
end
end
end

class Game_Map
def map_note
return @map.note unless @map.nil?
end
end

class Scene_Menu
alias gt_start start
alias gt_update update
def start
gt_start
@clock = GameTime::Window_GameClock.new if USECLOCK_MENU
return if @clock.nil?
@clock.x = 0
@clock.y = @gold_window.y - @clock.height
@clock.width = @gold_window.width
@clock.create_contents
end
def update
gt_update
@clock.update unless @clock.nil?
@clock.contents.clear if SceneManager.scene != self and !@clock.nil?
end
end


module DataManager
class << self
alias gametime_msc make_save_contents
alias gametime_esc extract_save_contents
alias gametime_sng setup_new_game
end
def self.make_save_contents
contents = gametime_msc
contents[:gametime] = $game_time
contents
end
def self.extract_save_contents(contents)
gametime_esc(contents)
$game_time = contents[:gametime]
end
def self.setup_new_game
gametime_sng
$game_time = GameTime::Current_Time.new
end
end
 

 

 

 

 

Pls help me i m a noob coder.

Thx.

 

EDIT: I make Gump's script befor a time script and it's ok.

 

Glad you were able to get it working with different script ordering.

 

I'll be releasing an update for the QSB soon that will make it more compatible (and the datamanager will be fully aliased, and much simpler).

Share this post


Link to post
Share on other sites

This is going to be a really newb question but, where do I find your script and how do I implement it?

Also, do I need to know HOW to script in order to use yours?

How is creating quests handled?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted