밤낮 스크립트를 적용 해 봤는데 제 게임은 인생게임이라서,
잠을 자야하거든요.
닌텐도 게임 동숲처럼 할까, 아니면 목장이야기처럼 잘수 있게할까요?
질문은 딱 하나!!!!
밤 10시에 잣다가 8시에 일어날라고 할때는 .. 어떻게 해야하나요..
밑에는 스크립트입니다. 어떻게 해야 하나요오-!
module Game_Time
GNAME = ["초","분","시","일","요일","주째","월","년"] # 갯수는 변경하지 말것.
GMONTH = 12 # 달 최대 : 시작은 1부터
GWEEK = 4 # 주 최대 : 시작은 1부터
GWEEK_NAME = ["일","월","화","수","목","금","토"] # 요일 갯수 변경 가능.
GHOUR = [
[5,"밤",Tone.new(-128, -128, -32)], # 0 ~ 4
[1,"새벽",Tone.new(-80, -80, -48)], # 5
[5,"아침",Tone.new(-24, -24, -8)], # 6 ~ 10
[7,"점심",Tone.new(0,0,0)], # 11 ~ 5
[1,"초저녁",Tone.new(0, -60, -60)], # 6
[2,"저녁",Tone.new(-72, -72, -28)], # 7 ~ 8
[3,"밤",Tone.new(-128, -128, -32)] # 9 ~ 12
] # 시간 갯수 변경 가능
# [시간,이름구분(뭐...안쓸지도;;),색조]
GAMPM = true
GAMPM_NAME = ["오전","오후"]
# 오전,오후 변경 : 전체시간/2 - 미만이면 오전 이상이면 오후
# false 일 경우 전체 시간으로 표시.
GDURATION = 10 # 색조 변경 시간 단위:초
GMIN = 6 # 분 최대
GSEC = 6 # 초 최대
GSTART = [0,0,[0,0],0,0,0,0] # 시작 : 초, 분, [구분,시], 요일, 주, 달, 년
GTONE_EXCEPTIONMAP = [1,2] # 색조변경 적용할 맵
# 게임상에서 이벤트로 맵별 색조변경 바꾸고 싶으면 색조변경(1프레임)이벤트 넣어주고 할것.
GMAPSPEED = { 1 => 10 , 2 => 3 } # 맵별 시간 속도 설정
end
class Game_System < Game_System
attr_accessor :gtime # 시간
attr_accessor :gwindow # 윈도우 토글
attr_accessor :gspeed # 속도
attr_accessor :ghour # 시간
attr_accessor :gtotalhour # 전체 시간
attr_accessor :gtotalsec # 전체 초
attr_accessor :old_gspeed # 이전 속도 저장용
def initialize
super
@gtime = Game_Time::GSTART
@gwindow = true # true일 경우 시작하면서 시간 윈도우 표시
@old_gspeed = nil
@gspeed = 1 # 시간 흐름의 빠르기, 0일경우 시간 정지
@ghour = 0
for i in 0..@gtime[2][0]-1
@ghour += Game_Time::GHOUR[i][0]
end
@ghour += @gtime[2][1]
@gtotalhour = 0
for i in 0..Game_Time::GHOUR.size-1
@gtotalhour += Game_Time::GHOUR[i][0]
end
@gtotalsec = 0
update_gtime
end
def update
super
update_gtime
end
def update_gtime
cal_gtime_sec
cal_gtime_min
cal_gtime_hour
cal_gtime_week
cal_gtime_mon
cal_gtime_totalsec
end
def cal_gtime_totalsec
@gtotalsec = 0
@gtotalsec += @gtime[0]
@gtotalsec += Game_Time::GSEC*@gtime[1]
@gtotalsec += Game_Time::GSEC*Game_Time::GMIN*@ghour
@gtotalsec += Game_Time::GSEC*Game_Time::GMIN*@gtotalhour*@gtime[3]
@gtotalsec += Game_Time::GSEC*Game_Time::GMIN*@gtotalhour*(Game_Time::GWEEK_NAME.size)*@gtime[4]
@gtotalsec += Game_Time::GSEC*Game_Time::GMIN*@gtotalhour*(Game_Time::GWEEK_NAME.size)*Game_Time::GWEEK*@gtime[5]
@gtotalsec += Game_Time::GSEC*Game_Time::GMIN*@gtotalhour*(Game_Time::GWEEK_NAME.size)*Game_Time::GWEEK*Game_Time::GMONTH*@gtime[6]
end
def cal_gtime_sec
if @gtime[0] >= Game_Time::GSEC
@gtime[0] -= Game_Time::GSEC
@gtime[1] += 1
end
end
def cal_gtime_min
if @gtime[1] >= Game_Time::GMIN
@gtime[1] -= Game_Time::GMIN
@gtime[2][1] += 1
@ghour += 1
if @ghour >= @gtotalhour
@ghour -= @gtotalhour
end
end
end
def cal_gtime_hour
if @gtime[2][1] >= Game_Time::GHOUR[@gtime[2][0]][0]
@gtime[2][1] -= Game_Time::GHOUR[@gtime[2][0]][0]
@gtime[2][0] += 1
if @gtime[2][0] >= Game_Time::GHOUR.size
@gtime[2][0] -= Game_Time::GHOUR.size
@gtime[3] += 1
end
end
end
def cal_gtime_week
if @gtime[3] >= Game_Time::GWEEK_NAME.size
@gtime[3] -= Game_Time::GWEEK_NAME.size
@gtime[4] += 1
if @gtime[4] >= Game_Time::GWEEK
@gtime[4] -= Game_Time::GWEEK
@gtime[5] += 1
end
end
end
def cal_gtime_mon
if @gtime[5] >= Game_Time::GMONTH
@gtime[5] -= Game_Time::GMONTH
@gtime[6] += 1
end
end
def get_text_sec
return (@gtime[0].to_s + Game_Time::GNAME[0])
end
def get_text_min
return (@gtime[1].to_s + Game_Time::GNAME[1])
end
def get_text_hour_name
return (Game_Time::GHOUR[@gtime[2][0]][1])
end
def get_text_hour
return (@gtime[2][1].to_s + Game_Time::GNAME[2])
end
def get_text_week_name
return (Game_Time::GWEEK_NAME[@gtime[3]] + Game_Time::GNAME[4])
end
def get_text_week
return ((@gtime[4]+1).to_s + Game_Time::GNAME[5])
end
def get_text_month
return ((@gtime[5]+1).to_s + Game_Time::GNAME[6])
end
def get_text_year
return (@gtime[6].to_s + Game_Time::GNAME[7])
end
def get_text_ampm
if Game_Time::GAMPM
if @ghour < (@gtotalhour/2).to_i
ampm = @ghour.to_s
return (Game_Time::GAMPM_NAME[0] + " " + ampm + " " + Game_Time::GNAME[2])
else
ampm = (@ghour - (@gtotalhour/2).to_i).to_s
return (Game_Time::GAMPM_NAME[1] + " " + ampm + " " + Game_Time::GNAME[2])
end
else
return (@ghour.to_s + Game_Time::GNAME[2])
end
end
def set_gtime_text
text = get_text_year + " "
text += get_text_month + " "
text += get_text_week + " "
text += get_text_week_name + " "
text += get_text_ampm + " "
# text += get_text_hour_name + " "
# text += get_text_hour + " "
text += get_text_min + " "
text += get_text_sec + " "
# text += $game_system.gtotalsec.to_s
return text
end
end
class Window_Time < Window_Base
def initialize
super(0, 0, 544, WLH + 32)
self.opacity = 0
end
def set_text(text, align = 0)
if text != @text or align != @align
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, self.width - 40, WLH, text, align)
@text = text
@align = align
end
end
end
class Game_Screen < Game_Screen
def initialize
super
@gtone = false
@old_ghour = $game_system.gtime[2][0]
start_tone_change(Game_Time::GHOUR[$game_system.gtime[2][0]][2],0)
end
def update
super
if !Game_Time::GTONE_EXCEPTIONMAP.include?($game_map.map_id)
if !@gtone
@gtone = true
start_tone_change(Tone.new(0,0,0),0)
return
end
else
if @gtone
@gtone = false
start_tone_change(Game_Time::GHOUR[$game_system.gtime[2][0]][2],0)
return
end
if @old_ghour != $game_system.gtime[2][0]
@old_ghour = $game_system.gtime[2][0]
duration = Game_Time::GDURATION*(Graphics.frame_count/Graphics.frame_rate)
start_tone_change(Game_Time::GHOUR[$game_system.gtime[2][0]][2],duration)
end
end
end
end
class Scene_Map < Scene_Map
def initialize
super
@gtime_cnt = 0
@hwhw = Window_Time.new # 시간 표시 윈도우 설정
@hwhw.visible = false
end
def terminate
super
@hwhw.dispose # 시간 표시 윈도우 dispose
end
def update
super
if Game_Time::GMAPSPEED.keys.include?($game_map.map_id) and $game_system.old_gspeed.nil?
$game_system.old_gspeed = $game_system.gspeed
$game_system.gspeed = Game_Time::GMAPSPEED[$game_map.map_id]
else
if !$game_system.old_gspeed.nil?
$game_system.gspeed = $game_system.old_gspeed
$game_system.old_gspeed = nil
return
end
end
if $game_system.gwindow
@hwhw.visible = true if !@hwhw.visible
@hwhw.set_text($game_system.set_gtime_text) # 시간 표시
else
@hwhw.visible = false if @hwhw.visible
end
return if $game_system.gspeed == 0
if $game_system.gspeed < 0
$game_system.gspeed = 0
elsif $game_system.gspeed > 60
$game_system.gspeed = 60
end
if !(@gtime_cnt == Graphics.frame_count/(Graphics.frame_rate/$game_system.gspeed))
@gtime_cnt = Graphics.frame_count/(Graphics.frame_rate/$game_system.gspeed)
$game_system.gtime[0] += 1
end
end
end
어딜 바꿔야 할까-요오!