此脚本原型是地图显示变量,被我改造成了变量控制的日夜系统:)
脚本功能:
日夜变化,1-24时的明暗效果,可在脚本中设置使用明暗效果的地图ID
分,时,年,月,日,星期,四季:全变量控制,可自行改变分的增进速度,各个单位的进制
并且可以随时调整分,时,年,月,日,星期,四季的数值。
可以控制脚本是否开启,窗口背景是否显示。
只有在地图时间才会流逝,并且对话时时间也不会流逝!
脚本在范例工程之中!此脚本请配合本人的工程使用。
我在66找了不少日夜系统,不是计算公式不能改就是没有明暗,要不就是不能自由控制……
这回终于做了个任意控制的了!这也是我做的第一个脚本吧!(在原基础上学习制作)
- #==============================================================================# 变量控制完美时间天气系统 V0.90 整合与重制作:牛肉面 # 原地图显变量脚本来自66rpg# 请使用本人配套范例工程#==============================================================================VAR_SWITCH = 5 # 工作开关VAR_REFRESH_SWITCH = 6 # 强制刷新COLOURMAPID = [1,3] # 使用天气明暗效果的地图ID#1、把窗口由透明变为不透明(包括第一次使用时),2、游戏中用脚本更改了$var$var = []$var = [[2,20,0],[1,70,0],[6,130,0],[5,210,0],[3,260,0]]#所有需要显示在地图并且刷新的变量,可在游戏中用脚本更改。#格式:[变量编号,x坐标,y坐标]#==============================================================================# ■ Window_XY#------------------------------------------------------------------------------# 显示坐标的窗口。#==============================================================================class Window_MapVar < Window_Base #注意前面那个window_var是文件名#--------------------------------------------------------------------------# ● 初始化窗口#--------------------------------------------------------------------------def initialize #=======================此处可任意调整窗口位置 super(0,0,640,64) # 窗口内容的不透明度 self.contents_opacity=255 self.contents = Bitmap.new(width - 32, height - 32) self.z=9999 #======================= @var_value_old = -1 @var = $var @var_a = [] for var_draw in $var @var_a[var_draw[0]] = $game_variables[var_draw[0]] end refreshend#--------------------------------------------------------------------------# ● 刷新#--------------------------------------------------------------------------def refresh if $game_switches[VAR_SWITCH] @var = $var # 记录现在变量数组结构 self.contents.clear # 清除以前的东西 for var_draw in @var @var_a[var_draw[0]] = $game_variables[var_draw[0]] # 记录现在的游戏变量 self.contents.draw_text(var_draw[1],var_draw[2],640,32,@var_a[var_draw[0]].to_s) self.contents.draw_text(45, 0, 32, 32, '时') self.contents.draw_text(95, 0, 32, 32, '分') self.contents.draw_text(185, 0, 32, 32, '年') self.contents.draw_text(235, 0, 32, 32, '月') self.contents.draw_text(285, 0, 32, 32, '日') #self.contents.draw_text(330, 0, 64, 32, '星期') @game_variables = $game_variables case @game_variables[20]# 控制窗口背景变量 1显示0消失 when 1 self.opacity=150 # 窗口的不透明度 self.back_opacity=150 # 窗口背景的不透明度 when 0 self.opacity=0 self.back_opacity=0 end case @game_variables[4] when 1 self.contents.draw_text(330, 0, 96, 32, '星期一') when 2 self.contents.draw_text(330, 0, 96, 32, '星期二') when 3 self.contents.draw_text(330, 0, 96, 32, '星期三') when 4 self.contents.draw_text(330, 0, 96, 32, '星期四') when 5 self.contents.draw_text(330, 0, 96, 32, '星期五') when 6 self.contents.draw_text(330, 0, 96, 32, '星期六') when 7 self.contents.draw_text(330, 0, 96, 32, '星期日') else self.contents.draw_text(330, 0, 96, 32, '星期日') end case @game_variables[7] when 1 self.contents.draw_text(420, 0, 64, 32, '春季') when 2 self.contents.draw_text(420, 0, 64, 32, '夏天') when 3 self.contents.draw_text(420, 0, 64, 32, '秋日') when 4 self.contents.draw_text(420, 0, 64, 32, '寒冬') end @game_switches = $game_switches if COLOURMAPID.include?($game_map.map_id) #@game_switches[4] case @game_variables[2] when 1 $game_screen.start_tone_change(Tone.new(-136,-136,-85,34),5) when 2 $game_screen.start_tone_change(Tone.new(-102,-102,-68,17),5) when 3 $game_screen.start_tone_change(Tone.new(-102,-102,-68,17),5) when 4 $game_screen.start_tone_change(Tone.new(-51,-51,-85,0),5) when 5 $game_screen.start_tone_change(Tone.new(-51,-51,-85,0),5) when 6 $game_screen.start_tone_change(Tone.new(-17,-17,-51,0),5) when 7 $game_screen.start_tone_change(Tone.new(-17,-17,-51,0),5) when 8 $game_screen.start_tone_change(Tone.new(0,0,0,0),5) when 9 $game_screen.start_tone_change(Tone.new(0,0,0,0),5) when 10 $game_screen.start_tone_change(Tone.new(0,0,0,0),5) when 11 $game_screen.start_tone_change(Tone.new(34,34,0,0),5) when 12 $game_screen.start_tone_change(Tone.new(34,34,0,0),5) when 13 $game_screen.start_tone_change(Tone.new(34,34,0,0),5) when 14 $game_screen.start_tone_change(Tone.new(17,17,0,0),5) when 15 $game_screen.start_tone_change(Tone.new(17,17,0,0),5) when 16 $game_screen.start_tone_change(Tone.new(17,17,0,0),5) when 17 $game_screen.start_tone_change(Tone.new(-17,-34,-68,0),5) when 18 $game_screen.start_tone_change(Tone.new(-17,-34,-68,0),5) when 19 $game_screen.start_tone_change(Tone.new(-102,-102,-68,17),5) when 20 $game_screen.start_tone_change(Tone.new(-102,-102,-68,17),5) when 21 $game_screen.start_tone_change(Tone.new(-102,-102,-68,17),5) when 22 $game_screen.start_tone_change(Tone.new(-136,-136,-85,34),5) when 23 $game_screen.start_tone_change(Tone.new(-136,-136,-85,34),5) when 0 $game_screen.start_tone_change(Tone.new(-136,-136,-85,34),5) end else $game_screen.start_tone_change(Tone.new(0,0,0,0),5) end end end end#--------------------------------------------------------------------------# ● 判断文字刷新。节约内存用#--------------------------------------------------------------------------def judge for var_draw in $var if @var_a[var_draw[0]] != $game_variables[var_draw[0]] #如果现在记录的变量和游戏变量不同,刷新 return true end end if $game_switches[VAR_REFRESH_SWITCH] # 强制刷新的时候,刷新 $game_switches[VAR_REFRESH_SWITCH] = false return true end return false endendclass Scene_Mapalias var_66rpg_main maindef main @var_window = Window_MapVar.new# @var_window.opacity = 0 var_66rpg_main @var_window.disposeend#--------------------------------------------------------------------------# ● 刷新画面#--------------------------------------------------------------------------alias var_66rpg_update updatedef update var_66rpg_update if $game_switches[VAR_SWITCH] @var_window.visible = true @var_window.refresh #if @var_window.judge else @var_window.visible = false endendend复制代码
复制代码此脚本不能直接外挂
本帖来自P1论坛作者a360015305,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:
https://rpg.blue/forum.php?mod=viewthread&tid=157451 若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。