I got a new computer and now I have windows 7 which wont allow me to install and run RPG Maker Xp and I want to create a new game using VX and some of the scripts I had in my Xp game I liked especially Blizzards Advanced Time and Environment System. So I was wondering if anyone could convert Blizzards script to VX?
Type of script: Autonomous Timeflow and Environment Controller
Scripts I have:
I don't have many other scripts yet because I only just started but the ones I do have only affect the menu screen,
I also have KGC's mini script
The script I have already to change the tinting is KGC's daynight, here is the script
But I don't really like it that much compared to ATES and ATES is a lot better.
What it needs to do:
I basically need to it do everything that it already does just remove the clock if it makes things easier. I would also like the to make certain events and/or battles only occur at certain times which I don't remember if ATES does.
Here is the ATES script
If someone can do this then I would extremely greatful
Type of script: Autonomous Timeflow and Environment Controller
Scripts I have:
I don't have many other scripts yet because I only just started but the ones I do have only affect the menu screen,
I also have KGC's mini script
The script I have already to change the tinting is KGC's daynight, here is the script
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ ◆ Day-to-Night Phases - KGC_DayNight ◆ VX ◆
#_/ ◇ Last Update: 02/15/09 ◇
#_/ ◆ Translated by Mr. Anonymous ◆
#_/ ◆ KGC Site: ◆
#_/ ◆ http://ytomy.sakura.ne.jp/ ◆
#_/ ◆ Translator's Blog: ◆
#_/ ◆ http://mraprojects.wordpress.com ◆
#_/----------------------------------------------------------------------------
#_/ This script adds the concept of Day-to-Night phase shifting to your game.
#_/ Events that only occur during certain phase shifts, such as night, can be
#_/ created as well.
#_/============================================================================
#_/ Note: The event command "Tint Screen" doesn't function normally while this
#_/ script is running a phase shift. To use the Tint Screen function properly,
#_/ please refer to the directions.
#_/============================================================================
#_/ Installation: Insert above Main.
#_/----------------------------------------------------------------------------
#_/ Terminology: Phase refers to the current state of the day, such as "Noon".
#_/ ◆ Instructions For Usage ◆
#_/
#_/ ◆ Stop Day-to-Night ◆
#_/ When [DN_STOP] is inserted into a Map's name (after its given name), the
#_/ Day-to-Night change stops, the timer does not stop however, and if a phase
#_/ is currently active, such as "Night", the tint remains on the map.
#_/
#_/ ◆ Stop Day-to-Night and Time, Cancel Phase ◆
#_/
#_/ When [DN_VOID] is inserted into a Map's name (after its given name), the
#_/ Day-to-Night change stops, the timer is effectively frozen, and if a phase
#_/ is currently active, such as "Night", the tint is reverted back to normal.
#_/
#_/ ◆ Phase-Specific Encounters ◆
#_/
#_/ When [DN Phase#](Where Phase# refers to the phase. 0 = Noon, 1 = Evening,
#_/ 2 = Night, 3 = Morning) is inserted into a specified Troop's "Notes" box
#_/ in the Troops tab of the database, the specified Troop will only appear
#_/ under those conditions.
#_/
#_/ ◆ Event Script Functions ◆
#_/ The following commands are available using the "Script" item in events.
#_/
#_/ * stop_daynight
#_/ Day to Night change is stopped.
#_/
#_/ * start_daynight
#_/ Day to Night change is started.
#_/
#_/ * get_daynight_name
#_/ Name of present phase is acquired. This function only works in other
#_/ scripts.
#_/
#_/ * get_daynight_week (variable_id)
#_/ Appoints the day of the week to the given variable.
#_/
#_/ * get_daynight_week_name
#_/ Name of the present day is aquired. This function only works in other
#_/ scripts.
#_/
#_/ * change_daynight_phase(phase, duration, pass_days)
#_/ Changes the current phase to a new one. Handy for Inns and the like.
#_/ Example: change_daynight_phase (3, 1, 1)
#_/ This would make one day pass, change the phase to morning, with a
#_/ duration of one frame. Duration must be set to a minimum of 1.
#_/
#_/ * transit_daynight_phase(duration)
#_/ Forces the phase to change at the very moment you call this.
#_/ This appears to be bugged. No matter how I've called it, I get errors.
#_/
#_/ * set_daynight_default(duration)
#_/ Forces the tint of the current phase to reset to the initial phase.
#_/
#_/ * restore_daynight_phase(duration)
#_/ Forces the tint of the current phase to reset to its normal tint.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#=============================================================================#
# ★ Customization ★ #
#=============================================================================#
module KGC
module DayNight
# ◆ Day to Night Switch Method ◆
# 0. Time Lapse 1.Time passes with number of steps 2.Real Time
METHOD = 1
# ◆ Phase Variable ◆
# The present phase (of day and night) is stored here.
PHASE_VARIABLE = 11
# ◆ Passing Days Storage Variable ◆
# The passing days is stored here.
PASS_DAYS_VARIABLE = 12
# ◆ Stop On Event Toggle ◆
# Stops the Day/Night Timer when an event is run by player.
STOP_ON_EVENT = false
# ◆ Day/Night Tone In Battle ◆
# 0: None 1: Only Background 2: Background + Enemies
BG_TONE_IN_BATTLE = 0
# ◆ Setting Individual Phases ◆
# Each phase makes use of the Tint Screen function. The format as follows:
# ["Name", the color tone(Tint), time switch],
#
# [Name]
# Name of Phase
# *The name holds no significance.
# [Tint]
# The color tone of the entire screen.
# Please don't alter this if you don't grasp color tints.
# [Time Shift]
# The amount of steps taken until the next phase shift occurs.
# The following set up is for step-time change. (METHOD = 1)
#
# Simplified Example:
# ["Noon", Tone.new( 0, 0, 0), 300], # Phase 0
# ["Evening", Tone.new( -32, -96, -96), 100], # Phase 1
# ["Night", Tone.new(-128, -128, -32), 250], # Phase 2
# ["Morning", Tone.new( -48, -48, -16), 100], # Phase 3
#
PHASE = [
# Name Tint Time Shift
["MidMorning",Tone.new( 8, 12, 8), 300], # Phase 0
["Day", Tone.new( 32, 48, 32), 600], # Phase 1
["Mid-Day", Tone.new( 64, 64, 32), 600], # Phase 2
["Afternoon", Tone.new( 32, 48, 32), 400], # Phase 3
["Noon", Tone.new( 0, 0, 0), 200], # Phase 4
["Evening", Tone.new( -32, -64, -96), 200], # Phase 5
["Night", Tone.new(-128, -128, -32), 400], # Phase 6
["MidNight", Tone.new(-164, -164, -64), 300], # Phase 7
["Daybreak", Tone.new( -64, -64, 32), 150], # Phase 8
["Morning", Tone.new( -32, -48, 16), 200], # Phase 9
] # Do not remove this line!
# ◆ Real Time Setup ◆
# Replace the values in the about phase set-up if you wish to use real-time.
# This is only a template and may be altered freely.
# ["Noon", Tone.new( 0, 0, 0), 12], #Phase0 (Hour 12 [12:00PM])
# ["Evening", Tone.new( -32, -64, -96), 18], #Phase1 (Hour 18 [6:00PM] )
# ["Night", Tone.new(-128, -128, -32), 20], #Phase2 (Hour 20 [8:00PM] )
# ["MidNight", Tone.new(-164, -164, -64), 0], #Phase3 (Hour 0 [12:00AM])
# ["Daybreak", Tone.new( -64, -64, 32), 5], #Phase4 (Hour 5 [5:00AM] )
# ["Morning", Tone.new( -32, -48, 16), 7], #Phase5 (Hour 7 [7:00AM] )
# ◆ Real Time Setup Simplified ◆
# ["Noon", Tone.new( 0, 0, 0), 16], #Phase0 (16 o'clock [4:00PM])
# ["Evening", Tone.new( 0, -96, -96), 20], #Phase1 (20 o'clock [8:00PM])
# ["Night", Tone.new(-96, -96, -64), 6], #Phase2 (6 o'clock [6:00AM])
# ["Morning", Tone.new(-48, -48, -16), 10], #Phase3 (10 o'clock [10:00AM])
# ◆ Day Change ◆
# The day changes on the phase set here.
# 0.Day 1.Evening 2.Night 3. MidNight 4.Daybreak 5.Morning
PASS_DAY_PHASE = 3
# ◆ Fade Time (by frame) ◆
# The amount of frames it takes to fade into the next phase.
PHASE_DURATION = 564
# ◆ Day of the Week Names ◆
# This shouldn't be hard to figure out, I hope.
# When using the Real-Time method (2), this must be seven days.
# Values of these are 0, 1, 2, 3, 4, 5, 6
WEEK_NAME = ["Sun", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat"]
end
end
#==============================================================================#
# ★ END Customization ★ #
#==============================================================================#
$imported = {} if $imported == nil
$imported["DayNight"] = true
#------------------------------------------------------------------------------#
if $data_mapinfos == nil
$data_mapinfos = load_data("Data/MapInfos.rvdata")
end
#------------------------------------------------------------------------------#
module KGC::DayNight
BATTLE_TONE_NONE = 0 # Tone In Battle: None
BATTLE_TONE_BG = 1 # Tone In Battle: Background
BATTLE_TONE_FULL = 2 # Tone In Battle: Background + Enemies
METHOD_TIME = 0 # Time Lapse
METHOD_STEP = 1 # Time passes with number of steps
METHOD_RTIME = 2 # Real Time
# Whatever word(s) in the following lines are what are used to determine
# what is searched for in the Map Name or the "Notes" section of the database.
# Regular Expression Defined
module Regexp
# MapInfo Module
module MapInfo
# Day/Night Stop tag string
DAYNIGHT_STOP = /\[DN_STOP\]/i
# Day/Night Void tag string
DAYNIGHT_VOID = /\[DN_VOID\]/i
end
# Event Module
module Event
#Light Emission tag string
LUMINOUS = /\[(?:LUMINOUS|light)\]/i
end
# Troop Module
module Troop
# Appearance Phase tag string
APPEAR_PHASE = /\[DN((?:[ ]*[\-]?\d+(?:[ ]*,)?)+)\]/i
end
end
#--------------------------------------------------------------------------
# ○ 敵グループ出現判定
# troop : 判定対象の敵グループ
# phase : 判定するフェーズ
#--------------------------------------------------------------------------
def self.troop_appear?(troop, phase = $game_system.daynight_phase)
# 出現判定
unless troop.appear_daynight_phase.empty?
return false unless troop.appear_daynight_phase.include?(phase)
end
# 非出現判定
unless troop.nonappear_daynight_phase.empty?
return false if troop.nonappear_daynight_phase.include?(phase)
end
return true
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# □ KGC::Commands
#==============================================================================
module KGC
module Commands
module_function
#--------------------------------------------------------------------------
# ○ 昼夜切り替えを停止
#--------------------------------------------------------------------------
def stop_daynight
$game_system.daynight_change_enabled = false
end
#--------------------------------------------------------------------------
# ○ 昼夜切り替えを起動
#--------------------------------------------------------------------------
def start_daynight
$game_system.daynight_change_enabled = true
end
#--------------------------------------------------------------------------
# ○ 現在のフェーズ名を取得
#--------------------------------------------------------------------------
def get_daynight_name
return KGC::DayNight::PHASE[get_daynight_phase][0]
end
#--------------------------------------------------------------------------
# ○ 現在の曜日を取得
# variable_id : 代入する変数 ID
#--------------------------------------------------------------------------
def get_daynight_week(variable_id = 0)
if KGC::DayNight::METHOD == KGC::DayNight::METHOD_RTIME
week = Time.now.wday
else
days = $game_variables[KGC::DayNight::PASS_DAYS_VARIABLE]
week = (days % KGC::DayNight::WEEK_NAME.size)
end
if variable_id > 0
$game_variables[variable_id] = week
$game_map.need_refresh = true
end
return week
end
#--------------------------------------------------------------------------
# ○ 現在の曜日名を取得
#--------------------------------------------------------------------------
def get_daynight_week_name
return KGC::DayNight::WEEK_NAME[get_daynight_week]
end
#--------------------------------------------------------------------------
# ○ フェーズ切り替え
# phase : 切り替え後のフェーズ
# duration : 切り替え時間(フレーム)
# pass_days : 経過させる日数 (省略時: 0)
#--------------------------------------------------------------------------
def change_daynight_phase(phase,
duration = KGC::DayNight::PHASE_DURATION,
pass_days = 0)
$game_temp.manual_daynight_duration = duration
$game_system.daynight_counter = 0
$game_system.daynight_phase = phase
$game_variables[KGC::DayNight::PASS_DAYS_VARIABLE] += pass_days
$game_map.need_refresh = true
end
#--------------------------------------------------------------------------
# ○ 次のフェーズへ遷移
# duration : 切り替え時間(フレーム)
#--------------------------------------------------------------------------
def transit_daynight_phase(duration = KGC::DayNight::PHASE_DURATION)
$game_screen.transit_daynight_phase(duration)
$game_map.need_refresh = true
end
#--------------------------------------------------------------------------
# ○ デフォルトの色調に戻す
# duration : 切り替え時間(フレーム)
#--------------------------------------------------------------------------
def set_daynight_default(duration = KGC::DayNight::PHASE_DURATION)
$game_screen.set_daynight_default(duration)
$game_map.need_refresh = true
end
#--------------------------------------------------------------------------
# ○ 現在のフェーズを復元
# duration : 切り替え時間(フレーム)
#--------------------------------------------------------------------------
def restore_daynight_phase(duration = KGC::DayNight::PHASE_DURATION)
$game_screen.restore_daynight_phase(duration)
$game_map.need_refresh = true
end
end
end
class Game_Interpreter
include KGC::Commands
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ RPG::MapInfo
#==============================================================================
class RPG::MapInfo
#--------------------------------------------------------------------------
# ● マップ名取得
#--------------------------------------------------------------------------
def name
return @name.gsub(/\[.*\]/) { "" }
end
#--------------------------------------------------------------------------
# ○ オリジナルマップ名取得
#--------------------------------------------------------------------------
def original_name
return @name
end
#--------------------------------------------------------------------------
# ○ 昼夜切り替え停止
#--------------------------------------------------------------------------
def daynight_stop
return @name =~ KGC::DayNight::Regexp::MapInfo::DAYNIGHT_STOP
end
#--------------------------------------------------------------------------
# ○ 昼夜エフェクト無効
#--------------------------------------------------------------------------
def daynight_void
return @name =~ KGC::DayNight::Regexp::MapInfo::DAYNIGHT_VOID
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ RPG::Area
#==============================================================================
unless $@
class RPG::Area
#--------------------------------------------------------------------------
# ○ エンカウントリストの取得
#--------------------------------------------------------------------------
alias encounter_list_KGC_DayNight encounter_list
def encounter_list
list = encounter_list_KGC_DayNight.clone
# 出現条件判定
list.each_index { |i|
list[i] = nil unless KGC::DayNight.troop_appear?($data_troops[list[i]])
}
return list.compact
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ RPG::Troop
#==============================================================================
class RPG::Troop
#--------------------------------------------------------------------------
# ○ 昼夜切り替えのキャッシュ生成
#--------------------------------------------------------------------------
def create_daynight_cache
@__appear_daynight_phase = []
@__nonappear_daynight_phase = []
# 出現するフェーズ
if @name =~ KGC::DayNight::Regexp::Troop::APPEAR_PHASE
$1.scan(/[\-]?\d+/).each { |num|
phase = num.to_i
if phase < 0
# 出現しない
@__nonappear_daynight_phase << phase.abs
else
# 出現する
@__appear_daynight_phase << phase
end
}
end
end
#--------------------------------------------------------------------------
# ○ 出現するフェーズ
#--------------------------------------------------------------------------
def appear_daynight_phase
create_daynight_cache if @__appear_daynight_phase == nil
return @__appear_daynight_phase
end
#--------------------------------------------------------------------------
# ○ 出現しないフェーズ
#--------------------------------------------------------------------------
def nonappear_daynight_phase
create_daynight_cache if @__nonappear_daynight_phase == nil
return @__nonappear_daynight_phase
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :manual_daynight_duration # 手動フェーズ変更フラグ
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_KGC_DayNight initialize
def initialize
initialize_KGC_DayNight
@manual_daynight_duration = nil
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_writer :daynight_counter # フェーズ遷移カウンタ
attr_writer :daynight_change_enabled # 昼夜切り替え有効
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_KGC_DayNight initialize
def initialize
initialize_KGC_DayNight
@daynight_counter = 0
@daynight_change_enabled = true
end
#--------------------------------------------------------------------------
# ○ フェーズ遷移カウンタを取得
#--------------------------------------------------------------------------
def daynight_counter
@daynight_counter = 0 if @daynight_counter == nil
return @daynight_counter
end
#--------------------------------------------------------------------------
# ○ 現在のフェーズを取得
#--------------------------------------------------------------------------
def daynight_phase
return $game_variables[KGC::DayNight::PHASE_VARIABLE]
end
#--------------------------------------------------------------------------
# ○ 現在のフェーズを変更
#--------------------------------------------------------------------------
def daynight_phase=(value)
$game_variables[KGC::DayNight::PHASE_VARIABLE] = value
$game_map.need_refresh = true
end
#--------------------------------------------------------------------------
# ○ 昼夜切り替え有効フラグを取得
#--------------------------------------------------------------------------
def daynight_change_enabled
@daynight_change_enabled = 0 if @daynight_change_enabled == nil
return @daynight_change_enabled
end
#--------------------------------------------------------------------------
# ○ フェーズ進行
#--------------------------------------------------------------------------
def progress_daynight_phase
self.daynight_phase += 1
if self.daynight_phase >= KGC::DayNight::PHASE.size
self.daynight_phase = 0
end
$game_map.need_refresh = true
end
#--------------------------------------------------------------------------
# ○ 現在のフェーズオブジェクトを取得
#--------------------------------------------------------------------------
def daynight_phase_object
return KGC::DayNight::PHASE[daynight_phase]
end
#--------------------------------------------------------------------------
# ○ 以前のフェーズオブジェクトを取得
#--------------------------------------------------------------------------
def previous_daynight_phase_object
return KGC::DayNight::PHASE[daynight_phase - 1]
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Screen
#==============================================================================
class Game_Screen
DEFAULT_TONE = Tone.new(0, 0, 0)
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :daynight_tone # 昼夜の色調
#--------------------------------------------------------------------------
# ● クリア
#--------------------------------------------------------------------------
alias clear_KGC_DayNight clear
def clear
clear_KGC_DayNight
clear_daynight
end
#--------------------------------------------------------------------------
# ○ 昼夜切り替え用変数をクリア
#--------------------------------------------------------------------------
def clear_daynight
@daynight_tone = DEFAULT_TONE.clone
@daynight_x = 0
@daynight_y = 0
@frame_count = Graphics.frame_count
@daynight_tone_duration = 0
apply_daynight
end
#--------------------------------------------------------------------------
# ○ 昼夜の色調を適用
#--------------------------------------------------------------------------
def apply_daynight
return if $game_map == nil
if $game_temp.in_battle
if KGC::DayNight::BG_TONE_IN_BATTLE == KGC::DayNight::BATTLE_TONE_NONE
return
end
end
# 切り替えを無効化するマップの場合
if $game_map.daynight_void?
if @daynight_tone_changed
# 初期の色調に戻す
@tone = DEFAULT_TONE.clone
@daynight_tone_changed = false
end
@daynight_tone = @tone.clone
return
end
# フェーズがおかしければ修復
if $game_system.daynight_phase_object == nil
$game_system.daynight_phase = 0
end
# 現在の色調を適用
@tone = $game_system.daynight_phase_object[1].clone
@daynight_tone = @tone.clone
# 現実時間遷移の場合
if KGC::DayNight::METHOD == KGC::DayNight::METHOD_RTIME
time = Time.now
# マッチするフェーズに遷移
KGC::DayNight::PHASE.each_with_index { |phase, i|
if phase[2] <= time.hour
start_tone_change(phase[1], 1)
$game_system.daynight_phase = i
break
end
}
end
@daynight_tone_changed = true
end
#--------------------------------------------------------------------------
# ○ 色調の取得
#--------------------------------------------------------------------------
def tone
if $game_temp.in_battle
if KGC::DayNight::BG_TONE_IN_BATTLE <= KGC::DayNight::BATTLE_TONE_BG
return DEFAULT_TONE
end
end
return @tone
end
#--------------------------------------------------------------------------
# ● 色調変更の開始
# tone : 色調
# duration : 時間
#--------------------------------------------------------------------------
alias start_tone_change_KGC_DayNight start_tone_change
def start_tone_change(tone, duration)
duration = [duration, 1].max
start_tone_change_KGC_DayNight(tone, duration)
@daynight_tone_target = tone.clone
@daynight_tone_duration = duration
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias update_KGC_DayNight update
def update
update_KGC_DayNight
update_daynight_transit
end
#--------------------------------------------------------------------------
# ● 色調の更新
#--------------------------------------------------------------------------
alias update_tone_KGC_DayNight update_tone
def update_tone
update_tone_KGC_DayNight
if @daynight_tone_duration >= 1
d = @daynight_tone_duration
target = @daynight_tone_target
@daynight_tone.red = (@daynight_tone.red * (d - 1) + target.red) / d
@daynight_tone.green = (@daynight_tone.green * (d - 1) + target.green) / d
@daynight_tone.blue = (@daynight_tone.blue * (d - 1) + target.blue) / d
@daynight_tone.gray = (@daynight_tone.gray * (d - 1) + target.gray) / d
@daynight_tone_duration -= 1
end
end
#--------------------------------------------------------------------------
# ○ フェーズ遷移の更新
#--------------------------------------------------------------------------
def update_daynight_transit
# 手動切り替えが行われた場合
if $game_temp.manual_daynight_duration
start_tone_change($game_system.daynight_phase_object[1],
$game_temp.manual_daynight_duration)
$game_temp.manual_daynight_duration = nil
@daynight_tone_changed = true
end
return unless $game_system.daynight_change_enabled # 切り替えを
return if $game_map.daynight_stop? # 停止中
if KGC::DayNight::STOP_ON_EVENT
interpreter = ($game_temp.in_battle ? $game_troop.interpreter :
$game_map.interpreter)
return if interpreter.running? # イベント実行中
end
case KGC::DayNight::METHOD
when KGC::DayNight::METHOD_TIME # 時間
update_daynight_pass_time
when KGC::DayNight::METHOD_STEP # 歩数
update_daynight_step
when KGC::DayNight::METHOD_RTIME # 現実時間
update_daynight_real_time
end
end
#--------------------------------------------------------------------------
# ○ 遷移 : 時間経過
#--------------------------------------------------------------------------
def update_daynight_pass_time
# カウント増加量計算
inc_count = Graphics.frame_count - @frame_count
# 加算量がおかしい場合は戻る
if inc_count >= 100
@frame_count = Graphics.frame_count
return
end
# カウント加算
$game_system.daynight_counter += inc_count
@frame_count = Graphics.frame_count
# 状態遷移判定
count = $game_system.daynight_counter / Graphics.frame_rate
if count >= $game_system.daynight_phase_object[2]
transit_daynight_next
end
end
#--------------------------------------------------------------------------
# ○ 遷移 : 歩数
#--------------------------------------------------------------------------
def update_daynight_step
# 移動していなければ戻る
return if @daynight_x == $game_player.x && @daynight_y == $game_player.y
@daynight_x = $game_player.x
@daynight_y = $game_player.y
# カウント加算
$game_system.daynight_counter += 1
# 状態遷移判定
count = $game_system.daynight_counter
if count >= $game_system.daynight_phase_object[2]
transit_daynight_next
end
end
#--------------------------------------------------------------------------
# ○ 遷移 : 現実時間
#--------------------------------------------------------------------------
def update_daynight_real_time
time = Time.now
# 状態遷移判定
time1 = $game_system.daynight_phase_object[2]
transit = (time1 <= time.hour)
if $game_system.previous_daynight_phase_object != nil
time2 = $game_system.previous_daynight_phase_object[2]
if time1 < time2
transit &= (time.hour < time2)
end
end
if transit
transit_daynight_next
end
end
#--------------------------------------------------------------------------
# ○ 次の状態へ遷移
# duration : 遷移時間
#--------------------------------------------------------------------------
def transit_daynight_next(duration = KGC::DayNight::PHASE_DURATION)
$game_system.daynight_counter = 0
$game_system.progress_daynight_phase
# 日数経過判定
if $game_system.daynight_phase == KGC::DayNight::PASS_DAY_PHASE
$game_variables[KGC::DayNight::PASS_DAYS_VARIABLE] += 1
end
# 色調切り替え
start_tone_change($game_system.daynight_phase_object[1], duration)
@daynight_tone_changed = true
end
#--------------------------------------------------------------------------
# ○ デフォルトの状態(0, 0, 0)に戻す
# duration : 遷移時間
#--------------------------------------------------------------------------
def set_daynight_default(duration)
start_tone_change(DEFAULT_TONE, duration)
end
#--------------------------------------------------------------------------
# ○ 現在のフェーズを復元
# duration : 遷移時間
#--------------------------------------------------------------------------
def restore_daynight_phase(duration)
start_tone_change($game_system.daynight_phase_object[1], duration)
@daynight_tone_changed = true
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Map
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ● セットアップ
# map_id : マップ ID
#--------------------------------------------------------------------------
alias setup_KGC_DayNight setup
def setup(map_id)
setup_KGC_DayNight(map_id)
@screen.apply_daynight
end
#--------------------------------------------------------------------------
# ○ 昼夜切り替えを停止するか
#--------------------------------------------------------------------------
def daynight_stop?
info = $data_mapinfos[map_id]
return false if info == nil
return (info.daynight_stop || info.daynight_void)
end
#--------------------------------------------------------------------------
# ○ 昼夜切り替えが無効か
#--------------------------------------------------------------------------
def daynight_void?
info = $data_mapinfos[map_id]
return false if info == nil
return info.daynight_void
end
#--------------------------------------------------------------------------
# ● エンカウントリストの取得
#--------------------------------------------------------------------------
alias encounter_list_KGC_DayNight encounter_list
def encounter_list
list = encounter_list_KGC_DayNight.clone
# 出現条件判定
list.each_index { |i|
list[i] = nil unless KGC::DayNight.troop_appear?($data_troops[list[i]])
}
return list.compact
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Character
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# ○ 発光するか
#--------------------------------------------------------------------------
def luminous?
return false
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Event
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# ○ 発光するか
#--------------------------------------------------------------------------
def luminous?
return (@event.name =~ KGC::DayNight::Regexp::Event::LUMINOUS)
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Spriteset_Map
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
# ● ビューポートの作成
#--------------------------------------------------------------------------
alias create_viewports_KGC_DayNight create_viewports
def create_viewports
create_viewports_KGC_DayNight
@viewport1_2 = Viewport.new(0, 0,
@viewport1.rect.width, @viewport1.rect.height)
end
#--------------------------------------------------------------------------
# ● キャラクタースプライトの作成
#--------------------------------------------------------------------------
alias create_characters_KGC_DayNight create_characters
def create_characters
create_characters_KGC_DayNight
# 発光オブジェクトを @viewport1_2 に移動
@character_sprites.each { |sprite|
sprite.viewport = @viewport1_2 if sprite.character.luminous?
}
end
#--------------------------------------------------------------------------
# ● ビューポートの解放
#--------------------------------------------------------------------------
alias dispose_viewports_KGC_DayNight dispose_viewports
def dispose_viewports
dispose_viewports_KGC_DayNight
@viewport1_2.dispose
end
#--------------------------------------------------------------------------
# ● ビューポートの更新
#--------------------------------------------------------------------------
alias update_viewports_KGC_DayNight update_viewports
def update_viewports
update_viewports_KGC_DayNight
@viewport1_2.ox = $game_map.screen.shake
@viewport1_2.update
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Spriteset_Battle
#==============================================================================
if KGC::DayNight::BG_TONE_IN_BATTLE == KGC::DayNight::BATTLE_TONE_BG
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● バトルバックスプライトの作成
#--------------------------------------------------------------------------
alias create_battleback_KGC_DayNight create_battleback
def create_battleback
create_battleback_KGC_DayNight
if @battleback_sprite.wave_amp == 0
@battleback_sprite.tone = $game_troop.screen.daynight_tone
end
end
#--------------------------------------------------------------------------
# ● バトルフロアスプライトの作成
#--------------------------------------------------------------------------
alias create_battlefloor_KGC_DayNight create_battlefloor
def create_battlefloor
create_battlefloor_KGC_DayNight
@battlefloor_sprite.tone = $game_troop.screen.daynight_tone
end
end
end # <== if KGC::DayNight::BG_TONE_IN_BATTLE == KGC::DayNight::BATTLE_TONE_BG
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
alias start_KGC_DayNight start
def start
$game_map.screen.clear_daynight
start_KGC_DayNight
end
end
But I don't really like it that much compared to ATES and ATES is a lot better.
What it needs to do:
I basically need to it do everything that it already does just remove the clock if it makes things easier. I would also like the to make certain events and/or battles only occur at certain times which I don't remember if ATES does.
Here is the ATES script
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Advanced Time and Environment System (ATES) by Blizzard
# Version: 0.3
# Type: Autonomous Timeflow and Environment Controller
# Date v0.3: 11.3.2008
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This work is protected by the following license:
# #----------------------------------------------------------------------------
# #
# # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #
# # You are free:
# #
# # to Share - to copy, distribute and transmit the work
# # to Remix - to adapt the work
# #
# # Under the following conditions:
# #
# # Attribution. You must attribute the work in the manner specified by the
# # author or licensor (but not in any way that suggests that they endorse you
# # or your use of the work).
# #
# # Noncommercial. You may not use this work for commercial purposes.
# #
# # Share alike. If you alter, transform, or build upon this work, you may
# # distribute the resulting work only under the same or similar license to
# # this one.
# #
# # - For any reuse or distribution, you must make clear to others the license
# # terms of this work. The best way to do this is with a link to this web
# # page.
# #
# # - Any of the above conditions can be waived if you get permission from the
# # copyright holder.
# #
# # - Nothing in this license impairs or restricts the author's moral rights.
# #
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Compatibility:
#
# 99% compatible with SDK v1.x. 80% compatible with SDK 2.x. WILL corrupt old
# savegames. Can cause incompatibilty issues with DNS-es.
#
#
# Features:
#
# - complete control over and easy manipulating of time
# - nice day and night tinting
# - HUD clock optional
# - easier to control and more powerful than DDNS
#
#
# IMPORTANT NOTES:
#
# - This system has a working preconfiguration, be aware that a custom setup
# will need you to understand what each option does, so please read the
# configuration instructions.
# - Why does this system use switches to determine whether it's day or night?
# Simple: You can use conditions in enemy attacks to determine whether an
# attack should be used only at night or only at day.
#
#
# Instructions:
#
# - Explanation:
#
# This Time System will make your game have daytime and nighttime periods.
# The screen will be tinted accordingly. You can set up the length of the day
# Other features are explained below. Please be sure to configure this system
# appropriately.
#
#
# - Basic manipulation of ATES:
#
# This system is based upon your eventing. It will work basically if you
# want, but with a little bit of using the "Call Script" event command you
# are able to control this system fully. You can call following commands:
#
# ATES.on
# Turns ATES on.
#
# ATES.off
# Turns ATES off.
#
# ATES.tint_on
# Turns ATES's screen tinting on.
#
# ATES.tint_off
# Turns ATES's screen tinting off.
#
# ATES.active?
# Returns true if ATES is turned on, otherwise false.
#
# ATES.tinting?
# Returns true if ATES tinting is turned on, otherwise false.
#
# ATES.day?
# Returns true if it's day, otherwise false. Alternatively you can check the
# assigned switch instead.
#
# ATES.night?
# Returns true if it's night, otherwise false. Alternatively you can check
# the assigned switch instead.
#
# ATES.advance(M, H)
# This will make the time advanced by M minutes and H hours. Any negative
# value used will cancel the execution of this command.
#
# ATES.make_it_day
# This is a feature from DDNS which allows you to quickly jump to the
# daytime.
#
# ATES.make_it_night
# This is a feature from DDNS which allows you to quickly jump to the
# nighttime.
#
#
# - Enhancement hints:
#
# If you wish to implement the DDNS further into your game and e.g. allow
# different behavious of monsters during day and night, you only need to
# check the the state of the appropriate switch. e.g. If NSWITCH is turned
# on inflict "Sleep" on one enemy.
#
#
# Additional info:
#
# The daytime and nighttime tintings were tested appropriately and optimal
# tinting is being used.
# Keep in mind that ATES is initially turned off, you need to turn it on by
# using the ATES.on and ATES.tint_on commands together.
#
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
module ATES
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# switch ID of the "day" switch
DSWITCH = 51
# switch ID of the "night" switch
NSWITCH = 52
# length of a day in seconds in-game, can't be less than 36, is being
# quantized into intervals of 36 seconds
LENGTH = 360
# how much time is it when the "day" starts
DAY_START = 8
# how much time is it when the "night" starts
NIGHT_START = 20
# makes the screen brighter during the day
OVERLIGHTING = true
# makes the screen darker during the night, not recommended
OVERDARKENING = false
# display HUD clock
SHOW_CLOCK = true
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#============================================================================
# ATES::Time
#============================================================================
class Time
attr_accessor :min
attr_accessor :hour
def initialize(m, h)
@min, @hour = m, h
end
end
def self.on
$game_system.ates.active = true
return true
end
def self.off
$game_system.ates.active = false
return true
end
def self.tint_on
$game_system.ates.tinting = true
return true
end
def self.tint_off
$game_system.ates.tinting = false
return true
end
def self.active?
return $game_system.ates.active
end
def self.tinting?
return $game_system.ates.tinting
end
def self.day?
return ($game_system.ates.time.hour.between?(DAY_START, NIGHT_START - 1))
end
def self.night?
return (!self.day?)
end
def self.make_it_day
$game_system.ates.time.hour = DAY_START
$game_system.ates.time.min = 0
return true
end
def self.make_it_night
$game_system.ates.time.hour = NIGHT_START
$game_system.ates.time.min = 0
return true
end
def self.day_start
return DAY_START
end
def self.night_start
return NIGHT_START
end
def self.advance(m, h)
return false if [m, h].any? {|i| i < 0}
h += ($game_system.ates.time.min + m) / 60
$game_system.ates.time.min = ($game_system.ates.time.min + m) % 60
$game_system.ates.time.hour = ($game_system.ates.time.hour + h) % 24
return true
end
end
if ATES::DAY_START > ATES::NIGHT_START
raise 'ATEScfgError: A night can\'t start earlier than a day.'
elsif ATES::LENGTH < 36
raise 'ATEScfgError: A day\'s length must be equal to or greater than 36 seconds!'
end
#==============================================================================
# Game_System
#==============================================================================
class Game_System
attr_accessor :ates
attr_accessor :show_clock
alias init_ates_later initialize
def initialize
init_ates_later
@ates = Game_ATES.new
@show_clock = ATES::SHOW_CLOCK
end
end
#==============================================================================
# Game_ATES
#==============================================================================
class Game_ATES
attr_accessor :active
attr_accessor :tinting
attr_accessor :time
attr_accessor :frame_count
def initialize
@time = ATES::Time.new(0, 0)
@active = false
@tinting = false
@frame_count = 0
end
def get_tint
red = 0
green = 0
blue = 0
grey = 0
if ATES.day?
red = green = 0
day = ATES.day_start
night = ATES.night_start
ratio = ((@time.hour-day)*60+@time.min) * 255 / (60*(night-day))
if ratio >= 224
red = (232-ratio)*4
green = (208-ratio)*2
elsif ratio >= 192
red = ratio-192
green = 192-ratio
elsif ATES::OVERLIGHTING
if ratio >= 160
red = green = blue = 192-ratio
elsif ratio >= 96
red = green = blue = 32
elsif ratio >= 64
red = green = blue = ratio-64
end
end
else
red = green = -96
day = ATES.day_start
night = ATES.night_start
hour = (@time.hour >= night ? @time.hour : @time.hour+24)
ratio = ((hour-night)*60+@time.min) * 255 / (60*(day+24-night))
if ratio >= 224
red = (ratio-256)*2
green = (ratio-256)*2
blue = 255-ratio
elsif ratio >= 192
red = ratio-288
green = ratio-288
blue = ratio-192
elsif ATES::OVERDARKENING
if ratio >= 160
red = ratio-288
green = ratio-288
blue = ratio-192
elsif ratio >= 96
red = -128
green = -128
blue = -32
elsif ratio >= 64
red = -32-ratio
green = -32-ratio
blue = 64-ratio
end
end
end
return Tone.new(red, green, blue, grey)
end
def update
if @active
@frame_count += 1
ATES.advance(1, 0) if @frame_count % (ATES::LENGTH / 36) == 0
end
if ATES.day?
$game_map.need_refresh = true if $game_switches[ATES::NSWITCH]
$game_switches[ATES::DSWITCH] = true
$game_switches[ATES::NSWITCH] = false
else
$game_map.need_refresh = true if $game_switches[ATES::DSWITCH]
$game_switches[ATES::NSWITCH] = true
$game_switches[ATES::DSWITCH] = false
end
$game_screen.start_tone_change(get_tint, 0) if @tinting
end
end
#==============================================================================
# Bitmap
#==============================================================================
class Bitmap
if $tons_version == nil || $tons_version < 1.6
alias draw_text_shaded_later draw_text
end
def draw_text_full(x2, y2, w2 = 0, h2 = 0, text2 = '', a2 = 0)
if x2.is_a?(Rect)
x, y, w, h, text, a = x2.x, x2.y, x2.width, x2.height, y2, w2
else
x, y, w, h, text, a = x2, y2, w2, h2, text2, a2
end
save_color = self.font.color.clone
self.font.color = Color.new(0, 0, 0)
[x-1, x+1].each {|xx| [y-1, y+1].each {|yy|
draw_text_shaded_later(xx, yy, w, h, text, a)}}
self.font.color = save_color
draw_text_shaded_later(x, y, w, h, text, a)
end
end
#==============================================================================
# Clock
#==============================================================================
class Clock < Sprite
def initialize
super
self.x, self.y, self.z = 480, 8, 5000
self.bitmap = Bitmap.new(128, 32)
if $fontface != nil
self.bitmap.font.name = $fontface
elsif $defaultfonttype != nil
self.bitmap.font.name = $defaultfonttype
end
self.bitmap.font.size = 26
@odd = 0
draw if $game_system.ates.active
end
def draw
self.bitmap.clear
hours = $game_system.ates.time.hour
minutes = sprintf('%02d', $game_system.ates.time.min)
if @odd % 2 == 0
self.bitmap.draw_text_full(0, 0, 128, 32, "#{hours} #{minutes}", 2)
else
self.bitmap.draw_text_full(0, 0, 128, 32, "#{hours}:#{minutes}", 2)
end
@odd = (@odd + 1) % 2
end
end
#==============================================================================
# Scene_Map
#==============================================================================
class Scene_Map
alias main_ates_later main
def main
@clock = Clock.new if $game_system.show_clock
main_ates_later
@clock.dispose unless @clock == nil
end
alias update_ates_later update
def update
$game_system.ates.update
update_ates_later
@clock.draw if @clock != nil && $game_system.ates.frame_count % 40 == 0
end
alias transfer_player_ates_later transfer_player
def transfer_player
if ATES.active?
$game_screen.start_tone_change(Tone.new(0, 0, 0, 0), 0) unless ATES.tinting?
end
transfer_player_ates_later
end
end
If someone can do this then I would extremely greatful