设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1351|回复: 3
打印 上一主题 下一主题

游戏中改某类字体颜色

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
55
在线时间
9 小时
注册时间
2006-4-26
帖子
444
跳转到指定楼层
1
发表于 2007-7-26 23:31:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
这是显示变量的脚本
  1. #==========================================================================
  2. # 本脚本来自www.66rpg.com,用于任何游戏请保留此信息。别以为加密就可以del哦
  3. #==========================================================================

  4. VAR_SWITCH = 1          # 26号开关打开此脚本才工作,关闭则停止运算,并且透明
  5. VAR_REFRESH_SWITCH = 27  # 27号开关控制强制刷新,使用时机:1、把窗口由透明变为不透明(包括第一次使用时),2、游戏中用脚本更改了$var



  6. $var = []


  7. #==============================================================================
  8. # ■ Window_XY
  9. #------------------------------------------------------------------------------
  10. #  显示坐标的窗口。
  11. #==============================================================================
  12. class Window_Var < Window_Base#注意前面那个window_xy是文件名

  13. #--------------------------------------------------------------------------
  14. # ● 初始化窗口
  15. #--------------------------------------------------------------------------
  16. def initialize


  17.    super(-16, -16, 640+32, 480+32)#最后面那个数字是宽要显示多个需要改大,前面一个是长~
  18.    self.contents = Bitmap.new(width - 32, height - 32)
  19.    self.back_opacity = 255  # 这个是背景透明
  20.    self.opacity = 255       # 这个是边框和背景都透明
  21.    self.contents_opacity = 255       # 这个是内容透明
  22.    self.visible = false
  23.    self.z=9999
  24.    if $game_switches[55] == true
  25.    self.contents.font.color = zhuangtai_color
  26. end
  27.    if $game_switches[54] == true
  28.    self.contents.font.color = normal_color
  29. end
  30.    @var = $var
  31.    @var_a = []
  32.    for var_draw in $var
  33.      @var_a[var_draw[0]] = $game_variables[var_draw[0]]
  34.    end   
  35.    refresh
  36. end

  37. #--------------------------------------------------------------------------
  38. # ● 刷新
  39. #--------------------------------------------------------------------------
  40. def refresh
  41.    if $game_switches[VAR_SWITCH]
  42.      @var = $var         # 记录现在变量数组结构
  43.      self.contents.clear # 清除以前的东西
  44.      for var_draw in @var
  45.        @var_a[var_draw[0]] = $game_variables[var_draw[0]] # 记录现在的游戏变量
  46.        self.contents.draw_text(var_draw[1],var_draw[2],640,32,@var_a[var_draw[0]].to_s)
  47.      end
  48.    end
  49. end
  50. #--------------------------------------------------------------------------
  51. # ● 判断文字刷新。节约内存用
  52. #--------------------------------------------------------------------------
  53. def judge
  54.    for var_draw in $var
  55.      if @var_a[var_draw[0]] != $game_variables[var_draw[0]] #如果现在记录的变量和游戏变量不同,刷新
  56.        return true
  57.      end
  58.    end
  59.    if $game_switches[VAR_REFRESH_SWITCH]  # 强制刷新的时候,刷新
  60.      $game_switches[VAR_REFRESH_SWITCH] = false
  61.      return true
  62.    end
  63.    return false
  64. end
  65. end

  66. class Scene_Map
  67. alias xy_66rpg_main main
  68. def main
  69.    @var_window = Window_Var.new
  70.    @var_window.opacity = 0
  71.    xy_66rpg_main
  72.    @var_window.dispose
  73. end
  74. #--------------------------------------------------------------------------
  75. # ● 刷新画面
  76. #--------------------------------------------------------------------------
  77. alias var_66rpg_update update

  78. def update

  79.    var_66rpg_update
  80.   if $game_switches[55] == true
  81.    $var = [[202,85,13],[203,85,32],[204,85,50],[205,85,68],[206,85,86],[207,85,104],[208,85,122],[211,85,140],[210,85,158]] #所有需要显示在地图并且刷新的变量,可在游戏中用脚本更改。格式:[变量编号,x坐标,y坐标]
  82. end
  83. if $game_switches[54] == true
  84.   $var = [[202,188,440],[203,218,440],[204,275,440],[205,304,440],[206,384,440],[207,39,448],[209,503,358],[227,540,358],[228,575,358],[229,610,358],[230,503,392],[231,540,392],[232,575,392],[233,610,392]] #所有需要显示在地图并且刷新的变量,可在游戏中用脚本更改。格式:[变量编号,x坐标,y坐标]
  85. end
  86.    if $game_switches[55] == true
  87.    $game_variables[202] = $game_actors[1].atk
  88.    $game_variables[203] = $game_actors[1].pdef
  89.    $game_variables[204] = $game_actors[1].int
  90.    $game_variables[205] = $game_actors[1].mdef
  91.    $game_variables[206] = $game_actors[1].maxsp
  92.    $game_variables[207] = $game_actors[1].exp
  93.    $game_variables[208] = $game_actors[1].dex
  94.    $game_variables[211] = 100
  95.    $game_variables[210] = $game_variables[1]
  96. end
  97. if $game_switches[54] == true
  98.    $game_variables[202] = $game_actors[1].hp
  99.    $game_variables[203] = $game_actors[1].maxhp
  100.    $game_variables[204] = $game_actors[1].sp
  101.    $game_variables[205] = $game_actors[1].maxsp
  102.    $game_variables[206] = $game_actors[1].exp
  103.    $game_variables[207] = $game_actors[1].level
  104. end
  105.    if $game_switches[VAR_SWITCH]
  106.      @var_window.visible = true      
  107.      @var_window.refresh if @var_window.judge
  108.    else
  109.      @var_window.visible = false
  110.    end
  111. end
  112. end
  113. #==========================================================================
  114. # 本脚本来自www.66rpg.com,用于任何游戏请保留此信息。别以为加密就可以del哦
  115. #==========================================================================
复制代码


可见33行起
在改字体颜色了.
但是这里是不刷新的。
只会在开某个窗口后关闭
它才刷新.
如果我把
   if $game_switches[55] == true
   self.contents.font.color = zhuangtai_color
end
   if $game_switches[54] == true
   self.contents.font.color = normal_color
end
句拿到update中
又会出现self的错误.
杂弄?

版务信息:本贴由楼主自主结贴~
群:13283861

Lv1.梦旅人

梦石
0
星屑
55
在线时间
9 小时
注册时间
2006-4-26
帖子
444
2
 楼主| 发表于 2007-7-26 23:31:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
这是显示变量的脚本
  1. #==========================================================================
  2. # 本脚本来自www.66rpg.com,用于任何游戏请保留此信息。别以为加密就可以del哦
  3. #==========================================================================

  4. VAR_SWITCH = 1          # 26号开关打开此脚本才工作,关闭则停止运算,并且透明
  5. VAR_REFRESH_SWITCH = 27  # 27号开关控制强制刷新,使用时机:1、把窗口由透明变为不透明(包括第一次使用时),2、游戏中用脚本更改了$var



  6. $var = []


  7. #==============================================================================
  8. # ■ Window_XY
  9. #------------------------------------------------------------------------------
  10. #  显示坐标的窗口。
  11. #==============================================================================
  12. class Window_Var < Window_Base#注意前面那个window_xy是文件名

  13. #--------------------------------------------------------------------------
  14. # ● 初始化窗口
  15. #--------------------------------------------------------------------------
  16. def initialize


  17.    super(-16, -16, 640+32, 480+32)#最后面那个数字是宽要显示多个需要改大,前面一个是长~
  18.    self.contents = Bitmap.new(width - 32, height - 32)
  19.    self.back_opacity = 255  # 这个是背景透明
  20.    self.opacity = 255       # 这个是边框和背景都透明
  21.    self.contents_opacity = 255       # 这个是内容透明
  22.    self.visible = false
  23.    self.z=9999
  24.    if $game_switches[55] == true
  25.    self.contents.font.color = zhuangtai_color
  26. end
  27.    if $game_switches[54] == true
  28.    self.contents.font.color = normal_color
  29. end
  30.    @var = $var
  31.    @var_a = []
  32.    for var_draw in $var
  33.      @var_a[var_draw[0]] = $game_variables[var_draw[0]]
  34.    end   
  35.    refresh
  36. end

  37. #--------------------------------------------------------------------------
  38. # ● 刷新
  39. #--------------------------------------------------------------------------
  40. def refresh
  41.    if $game_switches[VAR_SWITCH]
  42.      @var = $var         # 记录现在变量数组结构
  43.      self.contents.clear # 清除以前的东西
  44.      for var_draw in @var
  45.        @var_a[var_draw[0]] = $game_variables[var_draw[0]] # 记录现在的游戏变量
  46.        self.contents.draw_text(var_draw[1],var_draw[2],640,32,@var_a[var_draw[0]].to_s)
  47.      end
  48.    end
  49. end
  50. #--------------------------------------------------------------------------
  51. # ● 判断文字刷新。节约内存用
  52. #--------------------------------------------------------------------------
  53. def judge
  54.    for var_draw in $var
  55.      if @var_a[var_draw[0]] != $game_variables[var_draw[0]] #如果现在记录的变量和游戏变量不同,刷新
  56.        return true
  57.      end
  58.    end
  59.    if $game_switches[VAR_REFRESH_SWITCH]  # 强制刷新的时候,刷新
  60.      $game_switches[VAR_REFRESH_SWITCH] = false
  61.      return true
  62.    end
  63.    return false
  64. end
  65. end

  66. class Scene_Map
  67. alias xy_66rpg_main main
  68. def main
  69.    @var_window = Window_Var.new
  70.    @var_window.opacity = 0
  71.    xy_66rpg_main
  72.    @var_window.dispose
  73. end
  74. #--------------------------------------------------------------------------
  75. # ● 刷新画面
  76. #--------------------------------------------------------------------------
  77. alias var_66rpg_update update

  78. def update

  79.    var_66rpg_update
  80.   if $game_switches[55] == true
  81.    $var = [[202,85,13],[203,85,32],[204,85,50],[205,85,68],[206,85,86],[207,85,104],[208,85,122],[211,85,140],[210,85,158]] #所有需要显示在地图并且刷新的变量,可在游戏中用脚本更改。格式:[变量编号,x坐标,y坐标]
  82. end
  83. if $game_switches[54] == true
  84.   $var = [[202,188,440],[203,218,440],[204,275,440],[205,304,440],[206,384,440],[207,39,448],[209,503,358],[227,540,358],[228,575,358],[229,610,358],[230,503,392],[231,540,392],[232,575,392],[233,610,392]] #所有需要显示在地图并且刷新的变量,可在游戏中用脚本更改。格式:[变量编号,x坐标,y坐标]
  85. end
  86.    if $game_switches[55] == true
  87.    $game_variables[202] = $game_actors[1].atk
  88.    $game_variables[203] = $game_actors[1].pdef
  89.    $game_variables[204] = $game_actors[1].int
  90.    $game_variables[205] = $game_actors[1].mdef
  91.    $game_variables[206] = $game_actors[1].maxsp
  92.    $game_variables[207] = $game_actors[1].exp
  93.    $game_variables[208] = $game_actors[1].dex
  94.    $game_variables[211] = 100
  95.    $game_variables[210] = $game_variables[1]
  96. end
  97. if $game_switches[54] == true
  98.    $game_variables[202] = $game_actors[1].hp
  99.    $game_variables[203] = $game_actors[1].maxhp
  100.    $game_variables[204] = $game_actors[1].sp
  101.    $game_variables[205] = $game_actors[1].maxsp
  102.    $game_variables[206] = $game_actors[1].exp
  103.    $game_variables[207] = $game_actors[1].level
  104. end
  105.    if $game_switches[VAR_SWITCH]
  106.      @var_window.visible = true      
  107.      @var_window.refresh if @var_window.judge
  108.    else
  109.      @var_window.visible = false
  110.    end
  111. end
  112. end
  113. #==========================================================================
  114. # 本脚本来自www.66rpg.com,用于任何游戏请保留此信息。别以为加密就可以del哦
  115. #==========================================================================
复制代码


可见33行起
在改字体颜色了.
但是这里是不刷新的。
只会在开某个窗口后关闭
它才刷新.
如果我把
   if $game_switches[55] == true
   self.contents.font.color = zhuangtai_color
end
   if $game_switches[54] == true
   self.contents.font.color = normal_color
end
句拿到update中
又会出现self的错误.
杂弄?

版务信息:本贴由楼主自主结贴~
群:13283861

Lv2.观梦者

梦石
0
星屑
431
在线时间
125 小时
注册时间
2006-11-2
帖子
1200
3
发表于 2007-7-26 23:52:06 | 只看该作者
放到 refresh 试试。
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
和记忆一起封存着的ID...
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
9 小时
注册时间
2006-4-26
帖子
444
4
 楼主| 发表于 2007-7-27 00:01:14 | 只看该作者
谢了.
不过我已经把颜色的数字该成了变量..
居然行通了
.
但是还是采用你的方法咯..
群:13283861
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2026-7-2 00:53

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表