Project1
标题:
在地图上显示天数的累计
[打印本页]
作者:
我要疯了
时间:
2009-5-15 06:44
提示:
作者被禁止或删除 内容自动屏蔽
作者:
飘渺北极雪
时间:
2009-5-15 06:49
提示:
作者被禁止或删除 内容自动屏蔽
作者:
我要疯了
时间:
2009-5-15 07:00
提示:
作者被禁止或删除 内容自动屏蔽
作者:
黑鏻
时间:
2009-5-15 07:28
修改好了,请打开“脚本编辑器”(或按F11),找到Main,在它的上面随便“插入”,随便弄个名字。最后,本人不会脚本,但看得懂一点点。
下面图标的地址我标了个记号,以下显示的是变量1,找到下面标记的地方,如果不想用变量1就换吧~~
#==============================================================================
# ◎ Window_MapVar
#------------------------------------------------------------------------------
# ◎ 地图右下显示变量窗口
#------------------------------------------------------------------------------
# 制作者:绿梨子红苹果
# 个人主页:vbgm.9126.com
# E-Mail:
[email protected]
# QQ:42378361
#==============================================================================
class Window_MapVar < Window_Base
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize
# 在这里设定窗口的位置啦(x,y,宽,高),记住要为窗口框架留上下左右各16象素。
# 默认一个字符的宽和高只有20左右的,这里单位为“金”,加上8位数字。
super(480,420,160,60)
# 窗口的不透明度(0 ~ 255)。范围外的数值会自动修正。
# 注:255为不透明,0为完全透明……这个参数为零则只显示窗口内容而没有窗口,
# 实际上这样做不如不载入窗口背景图,更加节约内存……不过比较麻烦就是。
self.opacity=64
# 窗口背景的不透明度(0 ~ 255)。范围外的数值会自动修正。
# 注:就是窗口那个蓝色的背景啦……受上面参数影响
self.back_opacity=128
# 窗口内容的不透明度(0 ~ 255)。范围外的数值会自动修正。
# 注:窗口内的文字等内容,除非你是想画个空窗口,否则千万不要设0。
self.contents_opacity=255
# 这个不用管他,必定要写的
self.contents = Bitmap.new(width - 32, height - 32)
# 建立记录变量原始值,用于判断变量值是否改变,一定要保证不会是变量原来的值
@var_value_old = -1
# 载入想要显示的图片就可以了,这里推荐是24*24的标准RM图标
@var_icon = Bitmap.new("Graphics/Icons/035-Item04") ###※图标的地址
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
# 在这里加上判断语句,就可以完成变量值改变才刷新的效果,节约资源
if @var_value_old==$game_party.gold then
return
end
# 先清空内容啦
self.contents.clear
# 计算系统data里金钱单位的字符宽度
cx = contents.text_size($data_system.words.gold).width
# 设定字色为白色。生成RGB颜色参数(红,绿,蓝),这个不用我来说吧...
self.contents.font.color = Color.new(255,255,255)
# 绘制金钱数字。记住要用“.to_s”将数字转换为字符!
# 注:这里24是留着画24*24图标的,104表示所有字符总宽
self.contents.draw_text(24, 0, 104-cx, 28, $game_variables[1].to_s, 2) #[1]为的是变量1
# 设定字色为金色
self.contents.font.color = Color.new(255,255,0)
# 绘制金钱单位。
# 注:128=160(窗口宽)-32
self.contents.draw_text(128-cx, 0, cx, 28, "天")#$data_system.words.gold)
# 最后画上需要的图标就可以啦,blt方法详见RM帮助文档啦...
self.contents.blt(0, 2, @var_icon, Rect.new(0, 0, 24, 24))
end
end
复制代码
[LINE]1,#dddddd[/LINE]
版主对此帖的认可:『正确解答,补上悬赏积分,感激你的热情帮助...』,积分『+350』。
作者:
larbi
时间:
2009-5-15 07:44
class Scene_Map
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
# 生成活动块
@spriteset = Spriteset_Map.new
# 生成信息窗口
@message_window = Window_Message.new
@time_date_window = Window_Time_Date.new
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换的话就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放活动块
@spriteset.dispose
# 释放信息窗口
@message_window.dispose
@time_date_window.dispose
# 标题画面切换中的情况下
if $scene.is_a?(Scene_Title)
# 淡入淡出画面
Graphics.transition
Graphics.freeze
end
end
alias timedate_update update
def update
@time_date_window.update
timedate_update
end # end def update
#-----------------------------------------
class Window_Time_Date < Window_Base
#-----------------------------------------
def initialize
super(0, 0, 130, 55)
self.contents = Bitmap.new(width - 32, height - 32)
$game_variables[3] = 1
$game_variables[4] = 1
$game_variables[5] = 1
refresh
end # end def initialize
def refresh
@total_sec = Graphics.frame_count
if $game_variables[3] >= 30 + 1
$game_variables[3] = 1
$game_variables[4] += 1
end # end if $game_variables[3] >= 30 + 1
if $game_variables[4] >= 12 + 1
$game_variables[4] = 1
$game_variables[5] += 1
end # end if $game_variables[4] >= 12 + 1
text_day = ["","1日","2日","3日","4日","5日","6日","7日","8日","9日","10日",
"11日","12日","13日","14日","15日","16日","17日","18日","19日","20日",
"21日","22日","23日","24日","25日","26日","27日","28日","29日","30日",][$game_variables[3]]
text_month = ["","1月","2月","3月","4月","5月","6月","7月","8月","9月","10月",
"11月","12月",][$game_variables[4]]
text_year = ["", "第1年","第2年","第3年","第4年"][$game_variables[5]]
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0, -5, 128, 32, text_month)
self.contents.font.color = normal_color
self.contents.draw_text(45, -5, 128, 32, text_day)
self.contents.font.color = normal_color
self.contents.draw_text(65, -5, 128, 32,text_year)
end # end def refresh
def update
super
refresh
end
end
end
复制代码
变量3对应天数,变量4对应月份,变量5对应年 [LINE]1,#dddddd[/LINE]
版主对此帖的认可:『正确解答,补上悬赏积分,感激你的热情帮助...』,积分『+350』。
作者:
hitlerson
时间:
2009-5-15 08:02
class Scene_Map
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
# 生成活动块
@spriteset = Spriteset_Map.new
# 生成信息窗口
@message_window = Window_Message.new
@time_date_window = Window_Time_Date.new
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换的话就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放活动块
@spriteset.dispose
# 释放信息窗口
@message_window.dispose
@time_date_window.dispose
# 标题画面切换中的情况下
if $scene.is_a?(Scene_Title)
# 淡入淡出画面
Graphics.transition
Graphics.freeze
end
end
alias timedate_update update
def update
@time_date_window.update
timedate_update
end # end def update
#-----------------------------------------
class Window_Time_Date < Window_Base
#-----------------------------------------
def initialize
super(0, 0, 200, 55)
self.contents = Bitmap.new(width - 32, height - 32)
$game_variables[3] = 1
$game_variables[4] = 1
$game_variables[5] = 1
refresh
end # end def initialize
def refresh
$game_variables[3] += 0.1#日期速度
if $game_variables[3] >= 30 + 1
$game_variables[3] = 1
$game_variables[4] += 1
end # end if $game_variables[3] >= 30 + 1
if $game_variables[4] >= 12 + 1
$game_variables[4] = 1
$game_variables[5] += 1
end # end if $game_variables[4] >= 12 + 1
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0, -5, 128, 32, "#{$game_variables[3]}月")
self.contents.font.color = normal_color
self.contents.draw_text(45, -5, 128, 32, "#{$game_variables[4]}日")
self.contents.font.color = normal_color
self.contents.draw_text(100, -5, 128, 32,"第#{$game_variables[5]}年")
end # end def refresh
def update
super
refresh
end
end
end
复制代码
# end def refresh
听说这样格式的脚本是暴动写的。。。
这个还真是强大!!!!!!!!!!
小改了下,能用了,自己调节日子的速度吧 [LINE]1,#dddddd[/LINE]
系统信息:本贴由本区版主认可为正确答案,66RPG感谢您的热情解答~
作者:
larbi
时间:
2009-5-15 08:04
0.0...LS好厉害,赶快更新到自己的游戏里面>.<
我的那个是按照新手教程写的...-w-...
作者:
黑鏻
时间:
2009-5-15 08:08
hitlerson兄真行,可惜我这人从未认真去学过某个脚本。{/dk}
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1