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

Project1

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

[已经过期] 装备颜色脚本怎么添加颜色

[复制链接]

Lv1.梦旅人

梦石
0
星屑
47
在线时间
253 小时
注册时间
2012-8-2
帖子
248
跳转到指定楼层
1
发表于 2012-11-12 21:33:14 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
   就系统哪几个颜色不够用呢。
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. #
  5. # 脚本功能:给不同物品显示不同颜色,类似暗黑破坏神,比如套装为绿色,超级为金色
  6. #           可以更改的种类包括物品、防具、特技、武器。
  7. #
  8. # 使用方法:对于不想为白色表示的物品,在描述中最后添加@6,@4一类的即可。
  9. #           数字为颜色编号,和对话框中的一样。
  10. # ——————————————————————————————————————
  11. module RPG
  12.   class Skill
  13.     def description
  14.       description = @description.split(/#/)[0]
  15.       return description != nil ? description : ''
  16.     end
  17.     def name_color_66RPG
  18.       name_color = @description.split(/#/)[1]
  19.       return name_color != nil ? name_color.to_i : 0
  20.     end
  21.   end
  22.   class Weapon
  23.     def description
  24.       description = @description.split(/#/)[0]
  25.       return description != nil ? description : ''
  26.     end
  27.     def name_color_66RPG
  28.       name_color = @description.split(/#/)[1]
  29.       return name_color != nil ? name_color.to_i : 0
  30.     end
  31.   end
  32.   class Item
  33.     def description
  34.       description = @description.split(/#/)[0]
  35.       return description != nil ? description : ''
  36.     end
  37.     def name_color_66RPG
  38.       name_color = @description.split(/#/)[1]
  39.       return name_color != nil ? name_color.to_i : 0
  40.     end
  41.   end
  42.   class Armor
  43.     def description
  44.       description = @description.split(/#/)[0]
  45.       return description != nil ? description : ''
  46.     end
  47.     def name_color_66RPG
  48.       name_color = @description.split(/#/)[1]
  49.       return name != nil ? name_color.to_i : 0
  50.       ef description
  51.     end
  52.   end
  53. end

  54. # ——————————————————————————————————————
  55. # 本脚本原创自www.66rpg.com,转载请保留此信息
  56. # ——————————————————————————————————————
  57. class Window_Base < Window
  58.   #--------------------------------------------------------------------------
  59.   # ● 描绘物品名
  60.   #     item : 物品
  61.   #     x    : 描画目标 X 坐标
  62.   #     y    : 描画目标 Y 坐标
  63.   #--------------------------------------------------------------------------
  64.   def draw_item_name(item, x, y)
  65.     if item == nil
  66.       return
  67.     end
  68.     bitmap = RPG::Cache.icon(item.icon_name)
  69.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  70.     self.contents.font.color = text_color(item.name_color_66RPG)
  71.     self.contents.draw_text(x + 28, y, 212, 32, item.name.to_s)
  72.   end
  73. end

  74. # ——————————————————————————————————————
  75. # 本脚本原创自www.66rpg.com,转载请保留此信息
  76. # ——————————————————————————————————————
  77. class Window_Item
  78.   #--------------------------------------------------------------------------
  79.   # ● 描绘项目
  80.   #     index : 项目编号
  81.   #--------------------------------------------------------------------------
  82.   def draw_item(index)
  83.     item = @data[index]
  84.     case item
  85.     when RPG::Item
  86.       number = $game_party.item_number(item.id)
  87.     when RPG::Weapon
  88.       number = $game_party.weapon_number(item.id)
  89.     when RPG::Armor
  90.       number = $game_party.armor_number(item.id)
  91.     end
  92.     if item.is_a?(RPG::Item) and
  93.        $game_party.item_can_use?(item.id)
  94.       self.contents.font.color = text_color(item.name_color_66RPG)
  95.     else
  96.       self.contents.font.color = disabled_color
  97.     end
  98.     x = 4 + index % 2 * (288 + 32)
  99.     y = index / 2 * 32
  100.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  101.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  102.     bitmap = RPG::Cache.icon(item.icon_name)
  103.     opacity = self.contents.font.color == disabled_color ? 128 : 255
  104.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  105.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  106.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  107.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  108.   end
  109. end

  110. # ——————————————————————————————————————
  111. # 本脚本原创自www.66rpg.com,转载请保留此信息
  112. # ——————————————————————————————————————
  113. class Window_EquipItem < Window_Selectable
  114.   #--------------------------------------------------------------------------
  115.   # ● 项目的描绘
  116.   #     index : 项目符号
  117.   #--------------------------------------------------------------------------
  118.   def draw_item(index)
  119.     item = @data[index]
  120.     x = 4 + index % 2 * (288 + 32)
  121.     y = index / 2 * 32
  122.     case item
  123.     when RPG::Weapon
  124.       number = $game_party.weapon_number(item.id)
  125.     when RPG::Armor
  126.       number = $game_party.armor_number(item.id)
  127.     end
  128.     bitmap = RPG::Cache.icon(item.icon_name)
  129.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  130.     self.contents.font.color = text_color(item.name_color_66RPG)
  131.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  132.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  133.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  134.   end
  135. end

  136. # ——————————————————————————————————————
  137. # 本脚本原创自www.66rpg.com,转载请保留此信息
  138. # ——————————————————————————————————————
  139. class Window_ShopBuy < Window_Selectable
  140.   #--------------------------------------------------------------------------
  141.   # ● 描绘羡慕
  142.   #     index : 项目编号
  143.   #--------------------------------------------------------------------------
  144.   def draw_item(index)
  145.     item = @data[index]
  146.     # 获取物品所持数
  147.     case item
  148.     when RPG::Item
  149.       number = $game_party.item_number(item.id)
  150.     when RPG::Weapon
  151.       number = $game_party.weapon_number(item.id)
  152.     when RPG::Armor
  153.       number = $game_party.armor_number(item.id)
  154.     end
  155.     # 价格在所持金以下、并且所持数不是 99 的情况下为普通颜色
  156.     # 除此之外的情况设置为无效文字色
  157.     if item.price <= $game_party.gold and number < 99
  158.       self.contents.font.color = text_color(item.name_color_66RPG)
  159.     else
  160.       self.contents.font.color = disabled_color
  161.     end
  162.     x = 4
  163.     y = index * 32
  164.     rect = Rect.new(x, y, self.width - 32, 32)
  165.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  166.     bitmap = RPG::Cache.icon(item.icon_name)
  167.     opacity = self.contents.font.color == disabled_color ? 128 : 255
  168.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  169.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  170.     self.contents.draw_text(x + 240, y, 88, 32, item.price.to_s, 2)
  171.   end
  172. end

  173. # ——————————————————————————————————————
  174. # 本脚本原创自www.66rpg.com,转载请保留此信息
  175. # ——————————————————————————————————————
  176. class Window_ShopSell < Window_Selectable
  177.   #--------------------------------------------------------------------------
  178.   # ● 描绘项目
  179.   #     index : 项目标号
  180.   #--------------------------------------------------------------------------
  181.   def draw_item(index)
  182.     item = @data[index]
  183.     case item
  184.     when RPG::Item
  185.       number = $game_party.item_number(item.id)
  186.     when RPG::Weapon
  187.       number = $game_party.weapon_number(item.id)
  188.     when RPG::Armor
  189.       number = $game_party.armor_number(item.id)
  190.     end
  191.     # 可以卖掉的显示为普通颜色、除此之外设置成无效文字颜色
  192.     if item.price > 0
  193.       self.contents.font.color = text_color(item.name_color_66RPG)
  194.     else
  195.       self.contents.font.color = disabled_color
  196.     end
  197.     x = 4 + index % 2 * (288 + 32)
  198.     y = index / 2 * 32
  199.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  200.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  201.     bitmap = RPG::Cache.icon(item.icon_name)
  202.     opacity = self.contents.font.color == disabled_color ? 128 : 255
  203.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  204.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  205.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  206.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  207.   end
  208. end
  209.   
  210. # ——————————————————————————————————————
  211. # 本脚本原创自www.66rpg.com,转载请保留此信息
  212. # ——————————————————————————————————————
  213. class Window_Skill
  214.   #--------------------------------------------------------------------------
  215.   # ● 描绘项目
  216.   #     index : 项目编号
  217.   #--------------------------------------------------------------------------
  218.   def draw_item(index)
  219.     skill = @data[index]
  220.     if @actor.skill_can_use?(skill.id)
  221.       self.contents.font.color = text_color(skill.name_color_66RPG)
  222.     else
  223.       self.contents.font.color = disabled_color
  224.     end
  225.     x = 4 + index % 2 * (288 + 32)
  226.     y = index / 2 * 32
  227.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  228.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  229.     bitmap = RPG::Cache.icon(skill.icon_name)
  230.     opacity = self.contents.font.color == disabled_color ? 128 : 255
  231.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  232.     self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  233.     self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  234.   end
  235. end

复制代码

Lv1.梦旅人

路人党员

梦石
0
星屑
51
在线时间
2276 小时
注册时间
2010-12-30
帖子
3225
2
发表于 2012-11-13 15:16:44 | 只看该作者
必须在Window_Base做改动
本人擅长XP,如果有脚本或者Ruby方面的问题欢迎发电邮到[email protected]咨询,本人很少检查电邮所以不一定会及时回复,本人不会直接出手解决问题只会提供一个方向,所以谢绝伸手党
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
568 小时
注册时间
2012-9-7
帖子
611
3
发表于 2012-11-13 16:13:35 | 只看该作者
本帖最后由 wingzeroplus 于 2012-11-13 16:19 编辑

在Window_Base里面改这一段(下面是我自己改的,仅供参考)
#--------------------------------------------------------------------------
  # ● 获取文字色
  #     n : 文字色编号 (0~7)
  #--------------------------------------------------------------------------
  def text_color(n)
    case n
    when 0
      return Color.new(255, 255, 255, 255) #白色
    when 1
      return Color.new(128, 128, 255, 255) #深蓝
    when 2
      return Color.new(255, 128, 128, 255) #红色
    when 3
      return Color.new(128, 255, 128, 255) #绿色
    when 4
      return Color.new(128, 255, 255, 255) #蓝色
    when 5
      return Color.new(255, 100, 255, 255) #紫色
    when 6
      return Color.new(255, 255, 128, 255) #黄色
    when 7
      return Color.new(192, 192, 192, 255) #灰色
    when 8
      return Color.new(182, 51, 250, 255)  #深紫
    when 9
      return Color.new(225,117,42, 255)  #金黄色
    when 10
      return Color.new(245,151,189, 255) #粉红色
    else
      normal_color
    end
  end

不够自己往后面加
再到 Window_Message下
这个地方:
# 更改文字色
          text.sub!(/\[([0-9]+)\]/, "")
          color = $1.to_i
          if color >= 0 and color <= 7

把7改为你自己设置的上限即可亲测对装备颜色有效

评分

参与人数 1星屑 +66 收起 理由
hys111111 + 66 我很赞同

查看全部评分

FTM正式版已经发布,点击图片开启传送门
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-9 19:34

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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