查看: 2118|回复: 7

[已经解决] 求助在下面的脚本中加个控制开关

  [复制链接]
梦石
0
星屑
720
在线时间
292 小时
注册时间
2007-1-6
回帖
143
发表于 2011-3-26 15:25:36 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 江南小帅瓜 于 2011-3-26 16:53 编辑

不想用的时候,地图上老是出现总击两个字。
  1. #==============================================================================
  2. # ■ Window_Veri
  3. #------------------------------------------------------------------------------
  4. #IamI版权所有    Yui部分修改   
  5. #==============================================================================
  6. # 说明:基本原理如下。Scene每帧调用一次这里的update方法,
  7. # update检查变量1是否改变,如果改变那么刷新画面。
  8. class Window_Veri < Window_Base
  9.   #--------------------------------------------------------------------------
  10.   # ● 初始化窗口
  11.   #--------------------------------------------------------------------------
  12.   def initialize
  13.     super(0, 100, 200,100)
  14.     self.opacity = 0
  15.     self.contents = Bitmap.new(width - 32, height - 32)
  16.     refresh
  17.   end
  18.   #--------------------------------------------------------------------------
  19.   # ● 刷新
  20.   #--------------------------------------------------------------------------
  21.   def refresh
  22.     #================加入===============
  23.     @lastvalue = $game_variables[34]
  24.     #===================================
  25.     self.contents.clear
  26.     #self.contents.draw_text(self.contents.rect,$game_variables[35].to_s)
  27.     self.contents.font.color = Color.new(255, 0 , 0, 255)
  28.     self.contents.draw_text(0, 35, 120, 30, "   总击")
  29.     self.contents.font.color = normal_color
  30.     self.contents.draw_text(2,35,120,30, $game_variables[34].to_s,2)
  31.   end
  32.   #--------------------------------------------------------------------------
  33.   # ● 重要,修改
  34.   #--------------------------------------------------------------------------
  35.   def update
  36.     refresh if @lastvalue != $game_variables[34]
  37.   end
  38.   #===========================================================================
  39. end
  40. class Scene_Map
  41.   alias old_main main
  42.   def main   
  43.     @veri = Window_Veri.new
  44.     @veri.x=10
  45.     @veri.y=280
  46.     old_main
  47.     @veri.dispose
  48.   end
  49. alias old_update update
  50.   def update
  51.     old_update
  52.     #==================重要=====================
  53.     @veri.update
  54.     #===========================================
  55.   end
  56. end
复制代码

虚構歪曲

梦石
0
星屑
354
在线时间
1196 小时
注册时间
2010-12-18
回帖
3842

贵宾

发表于 2011-3-26 15:54:53 | 显示全部楼层
  1. id = 5
  2. class Scene_Map
  3. alias :new_old_update :update unless method_defined? :new_old_update
  4.   def update
  5.     new_old_update
  6.     @veri.visible = $game_switches[id]
  7.   end
  8. end
复制代码
当id开关打开时显示……
回复

使用道具 举报

梦石
0
星屑
720
在线时间
292 小时
注册时间
2007-1-6
回帖
143
 楼主| 发表于 2011-3-26 16:22:11 | 显示全部楼层
回复 忧雪の伤 的帖子

@veri.visible = $game_switches[id]

出错。
回复

使用道具 举报

虚構歪曲

梦石
0
星屑
354
在线时间
1196 小时
注册时间
2010-12-18
回帖
3842

贵宾

发表于 2011-3-26 16:24:45 | 显示全部楼层
江南小帅瓜 发表于 2011-3-26 16:22
回复 忧雪の伤 的帖子

@veri.visible = $game_switches

表示测试完全无压力啊……
回复

使用道具 举报

梦石
0
星屑
720
在线时间
292 小时
注册时间
2007-1-6
回帖
143
 楼主| 发表于 2011-3-26 16:31:09 | 显示全部楼层
回复 忧雪の伤 的帖子

visible=' for nil NilClass
??
回复

使用道具 举报

虚構歪曲

梦石
0
星屑
354
在线时间
1196 小时
注册时间
2010-12-18
回帖
3842

贵宾

发表于 2011-3-26 16:33:01 | 显示全部楼层
Project1.rar (186.83 KB, 下载次数: 36)


自己试试吧……
回复

使用道具 举报

梦石
0
星屑
720
在线时间
292 小时
注册时间
2007-1-6
回帖
143
 楼主| 发表于 2011-3-26 16:43:06 | 显示全部楼层
回复 忧雪の伤 的帖子

开关5打开时,总击两个字就没有显示了。

点评

直接覆盖原脚本  发表于 2011-3-26 16:48
回复

使用道具 举报

虚構歪曲

梦石
0
星屑
354
在线时间
1196 小时
注册时间
2010-12-18
回帖
3842

贵宾

发表于 2011-3-26 16:47:48 | 显示全部楼层
  1. #==============================================================================
  2. # ■ Window_Veri
  3. #------------------------------------------------------------------------------
  4. #IamI版权所有    Yui部分修改   
  5. #==============================================================================
  6. # 说明:基本原理如下。Scene每帧调用一次这里的update方法,
  7. # update检查变量1是否改变,如果改变那么刷新画面。
  8. class Window_Veri < Window_Base
  9.   #--------------------------------------------------------------------------
  10.   # ● 初始化窗口
  11.   #--------------------------------------------------------------------------
  12.   def initialize
  13.     super(0, 100, 200,100)
  14.     self.opacity = 0
  15.     self.contents = Bitmap.new(width - 32, height - 32)
  16.     refresh
  17.   end
  18.   #--------------------------------------------------------------------------
  19.   # ● 刷新
  20.   #--------------------------------------------------------------------------
  21.   def refresh
  22.     #================加入===============
  23.     @lastvalue = $game_variables[34]
  24.     #===================================
  25.     self.contents.clear
  26.     #self.contents.draw_text(self.contents.rect,$game_variables[35].to_s)
  27.     self.contents.font.color = Color.new(255, 0 , 0, 255)
  28.     self.contents.draw_text(0, 35, 120, 30, "   总击")
  29.     self.contents.font.color = normal_color
  30.     self.contents.draw_text(2,35,120,30, $game_variables[34].to_s,2)
  31.   end
  32.   #--------------------------------------------------------------------------
  33.   # ● 重要,修改
  34.   #--------------------------------------------------------------------------
  35.   def update
  36.     refresh if @lastvalue != $game_variables[34]
  37.   end
  38.   #===========================================================================
  39. end
  40. class Scene_Map
  41.   alias old_main main
  42.   def main   
  43.     @veri = Window_Veri.new
  44.     @veri.x=10
  45.     @veri.y=280
  46.     old_main
  47.     @veri.dispose
  48.   end
  49. alias old_update update
  50.   def update
  51.     old_update
  52.     id = 5
  53.     @veri.visible = $game_switches[id]
  54.     #==================重要=====================
  55.     @veri.update
  56.     #===========================================
  57.   end
  58. end
复制代码

评分

参与人数 2星屑 +300 收起 理由
IamI + 298 认可答案
江南小帅瓜 + 2 谢谢

查看全部评分

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部