Quiero un script que haga oferta de dias.
Me explico, quiero que en la tienda, a veces diga: Hoy tengo en oferta las pociones, y te cuesten la mitad.
Creo que es muy complicado.. Es posible?
Gracias
Quiero un script que haga oferta de dias.
Me explico, quiero que en la tienda, a veces diga: Hoy tengo en oferta las pociones, y te cuesten la mitad.
Creo que es muy complicado.. Es posible?
Gracias
Pregunta:
Cómo cuentas los días? Creaste una variable que cuenta el tiempo? O utilizas una script que va cambiando el tiempo?
Porque si no tienes eso, pues tienes que crearlo para que los días sean diferentes.
No es complicado. Sólo responde esta pregunta y te podríamos dar alguna solución.
Ummm...
Variables y Condicionales.
Primero tendrás que ver como harás que pasen los días, en mi caso utilizaré este script
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/ ◆ Day-to-Night Phases - KGC_DayNight ◆ VX ◆
#_/ ◇ Last update : 2008/03/08 ◇
#_/ ◆ Translated by Mr. Anonymous ◆
#_/-----------------------------------------------------------------------------
#_/ 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.
#_/ TR: Cuando pongas en el nombre de un mapa [DN_VOID] el tiempo no pasará, pero la oscuridad o luz seguirá.
#_/ ◆ 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.
#_/ TR: Cuando pongas en el nombre de un mapa [DN_VOID] el tiempo no pasará y siempre será de día ahí.
#_/ ◆ 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.
#_/ TR: Cuando pongas en las notetags de un enemigo [DN Phase#] Donde # sería 0 = Día, 1 = Tarde, 2 = Noche, 3 = Mañana,
#_/ esta tropa solo saldrá durante esa fase del día.
#_/ ◆ Event Script Functions ◆
#_/ The following commands are available using the "Script" item in events.
#_/
#_/ * stop_daynight
#_/ Day to Night change is stopped.
#_/ TR: No habrán cambios entre el día y la noche
#_/ * start_daynight
#_/ Day to Night change is started.
#_/ TR: Habrán cambios entre el día y la noche
#_/ * get_daynight_name
#_/ Name of present phase is acquired. This function only works in other
#_/ scripts.
#_/ TR: Nombre de la presente fase del día, solo para usarlo en otros scripts
#_/ * get_daynight_week (variable_id)
#_/ Appoints the day of the week to the given variable.
#_/ TR: Anota el día de la semana en la id de la variable.
#_/ * get_daynight_week_name
#_/ Name of the present day is aquired. This function only works in other
#_/ scripts.
#_/ TR: Guarda el nombre del día presente para usarlo con otros 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.
#_/ TR: Cambia la fase del día al que desees, en el ejemplo el 3 cambiará la fase
#_/ del día a Mañana, Pasará un día y durará un frame(El cambio de tonalidad)
#_/ * 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.
#_/ TR: NO SIRVE
#_/ * set_daynight_default(duration)
#_/ Forces the tint of the current phase to reset to the initial phase.
#_/ TR: Tinta la fase del día para resetearla al inicial
#_/ * 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. Lapso Temporal 1.Pasa con el número de pasos 2.Tiempo real
METHOD = 2
# ◆ Phase Variable ◆
# Esta será la variable de la estación de un día.
PHASE_VARIABLE = 11
# ◆ Passing Days Storage Variable ◆
# Los días serán anotados en esta variable.
PASS_DAYS_VARIABLE = 12
# ◆ Stop On Event Toggle ◆
# Para el contador de Día/Noche durante un evento?
STOP_ON_EVENT = false
# ◆ Phases During Combat ◆
# true = Solo el fondo de combate será tintado.
# false = Fondo de combate y enemigos serán tintados.
TONE_BACK_ONLY_IN_BATTLE = false
# ◆ Setting Individual Phases ◆
# Cada fase tintará la pantalla de X color, usando el siguiente formato:
# ["Nombre", Tinte, Switch de tiempo],
#
# [Name]
# Nombre de la fase
# *Realmente no tiene importancia.
# [Tint]
# El tono que se aplicará a la pantalla durante la fase.
# Por favor, no cambies esto si no quieres confundir el script.
# [Time Shift]
# Cuantos pasos se requieren para que la fase funcione.
# Esto solo funciona si el método elegido es el paso a paso. (METHOD = 1)
PHASE = [
["Día", Tone.new( 0, 0, 0), 16], #Phase0 (16 o'clock [4:00PM])
["Tarde", Tone.new( 0, -96, -96), 20], #Phase1 (20 o'clock [8:00PM])
["Noche", Tone.new(-96, -96, -64), 6], #Phase2 (6 o'clock [6:00AM])
["Mañana", Tone.new(-48, -48, -16), 10], #Phase3 (10 o'clock [10:00AM])
]
# ◆ Real Time Setup ◆
# Reemplaza los valores en la parte de arriba si elegiste el método de tiempo real.
# ["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 ◆
# Un día nuevo comienza en la:
# 0.Día 1.Tarde 2.Noche 3.Mañana
PASS_DAY_PHASE = 3
# ◆ Fade Time (by frame) ◆
# Cuanto tardará en cambiar a cierta fase.
PHASE_DURATION = 60
# ◆ Day of the Week Names ◆
# No debería ser tan difícil de figurar...Creo.
# Cuando utilizas el método de tiempo real (= 2), DEBEN ser 7 días.
# Los valores de la variable comienzan así: 0, 1, 2, 3, 4, 5, 6 (Siendo 0 Domingo)
WEEK_NAME = ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"]
end
end
#------------------------------------------------------------------------------#
$imported = {} if $imported == nil
$imported["DayNight"] = true
if $data_mapinfos == nil
$data_mapinfos = load_data("Data/MapInfos.rvdata")
end
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
# Unless you know what you're doing, it's best not to alter anything beyond #
# this point, as this only affects the tags used for the Map name. #
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
module KGC::DayNight
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
# Base 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
# Base 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::Commands
module_function
#--------------------------------------------------------------------------
# ○ 昼夜切り替えを停止
#--------------------------------------------------------------------------
def stop_daynight
$game_system.daynight_change_enabled = false
end
#--------------------------------------------------------------------------
# ○ 昼夜切り替えを起動
#--------------------------------------------------------------------------
def start_daynight
$game_system.daynight_change_enabled = true
end
#--------------------------------------------------------------------------
# ○ Preset Phase is aquired.
#--------------------------------------------------------------------------
def get_daynight_name
return KGC::DayNight::PHASE[get_daynight_phase][0]
end
#--------------------------------------------------------------------------
# ○ Obtain DayNight Week and store it in a variable.
# variable_id : Variable 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
end
return week
end
#--------------------------------------------------------------------------
# ○ Present Day of the Week is aquired.
#--------------------------------------------------------------------------
def get_daynight_week_name
return KGC::DayNight::WEEK_NAME[get_daynight_week]
end
#--------------------------------------------------------------------------
# ○ Phase Shift
# phase : Phase
# duration : Shift Time(In Frames)
# pass_days : Passing Days (When argument is omitted: 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
#--------------------------------------------------------------------------
# ○ Transit Daynight Phase
# duration : Shift Time(In Frames)
#--------------------------------------------------------------------------
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
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
#--------------------------------------------------------------------------
# ○ Generate DayNight Cache
#--------------------------------------------------------------------------
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
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
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :daynight_tone # 昼夜の色調
#--------------------------------------------------------------------------
# ● クリア
#--------------------------------------------------------------------------
alias clear_KGC_DayNight clear
def clear
clear_KGC_DayNight
clear_daynight
end
#--------------------------------------------------------------------------
# ○ 昼夜切り替え用変数をクリア
#--------------------------------------------------------------------------
def clear_daynight
@default_tone = Tone.new(0, 0, 0)
# 移動判定用座標初期化
@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_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 && KGC::DayNight::TONE_BACK_ONLY_IN_BATTLE
return @default_tone
else
return @tone
end
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
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Spriteset_Battle
#==============================================================================
if KGC::DayNight::TONE_BACK_ONLY_IN_BATTLE
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
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
alias start_KGC_DayNight start
def start
$game_map.screen.clear_daynight
start_KGC_DayNight
end
end
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/ The original untranslated version of this script can be found here:
#
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
El script está parcialmente traducido por mi para que comprendas lo que debes modificar y lo que no.(Lo he dejado para que funcione en tiempo real, tome los datos del PC, hora y día para realizar los cambios del script)
No debes saber de scripts para realizar condiciones y efectos de variables; en este caso deberás usar la variable N°12 (Te recomiendo llamarla días de la semana) mientras que la N°11 guardará la fase del día (Te recomiendo llamarla fase del día).
Debes realizar un evento con condiciones y efectos(7 en total, sin excepciones).
Si la variable N°12 es = 0
Tienda normal
Si la variable N°12 es = 1
Tienda normal
Si la variable N°12 es = 2
Tienda normal
Si la variable N°12 es = 3 (Miércoles)
Tienda con precios diferentes u objetos diferentes.
Si la variable N°12 es = 4
Tienda normal
Si la variable N°12 es = 5 (Viernes)
Tienda con objetos diferentes (¿Por que no?)
Si la variable N°12 es = 6 (Sábado)
Tienda con precios bajos.
Te doy el trabajo de buscar un script de price changer, te doy el de KGC por que encontrar sus scripts ya no es tarea fácil. (También puedes crear dos objetos con el mismo nombre, pero con diferente precio)
Esop.
Usa engines. Dentro del evento simplemente coloca:
<>Operaciones de variable: 001: aleatorio entre 1 y 10.
<> Condiciones y efectos : Variable 001 >= 8
<> ¡ Hoy tengo las pociones a mitad de precio!
<>Excepción
<> ¿Que quieres comprar?
<>
<> FIN
Puedes modificar la variable y eso.