查看: 2563|回复: 12

[已经解决] 请教使用了随机属性怎么自定义物品的颜色

[复制链接]
梦石
0
星屑
2294
在线时间
610 小时
注册时间
2016-4-10
回帖
24
发表于 2017-5-20 15:30:25 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 封尘 于 2017-6-17 10:44 编辑

本人不才,想让物品和装备一样拥有颜色,当然这个颜色是自己设定的,于是稍微在随机属性脚本里添加了一点东西,以下是脚本[pre lang="ruby"]#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window   
  def draw_item_name(item, x, y, enabled = true)
    if item != nil
      draw_icon(item.icon_index, x, y, enabled)
      
      if RPG::Weapon
       self.contents.font.color = text_color(item.text_color.to_i)
     end
   
      if RPG::Armor
     self.contents.font.color = text_color(item.text_color.to_i)
     end
     
       if RPG::Item
      case item.id
      when 1
        self.contents.font.color = text_color(24)
        when 3
        self.contents.font.color = text_color(30)
        when 4,15,19,36,81,172
       self.contents.font.color = text_color(24)
        when 5,29,6,38,7,2,107,152..154,174
       self.contents.font.color = text_color(6)
       when 8..14,16,18,20,39,42,108,122,123,159,175
       self.contents.font.color = text_color(30)
        when 21,23..28,40,44,45,53,55..64,80,102,103,109,176,201..210
        self.contents.font.color = text_color(27)
       when 22,31,35,161
        self.contents.font.color = text_color(0)
        when 30,48..51,105,110,113..115,125..137,162,165
        self.contents.font.color = text_color(17)
        when 33,37,101,106,158,173
       self.contents.font.color = text_color(1)
        when 41,111,112
        self.contents.font.color = text_color(18)
        when 71..77,104,160,177
        self.contents.font.color = text_color(2)
      end
end

      self.contents.font.color.alpha = enabled ? 255 : 128
      self.contents.draw_text(x + 24, y, 172, WLH, item.name)
    end
  end
end
[/pre]
但是使用后道具的颜色是改了,但是得到的装备颜色就变得乱七八糟,我想知道这是什么原因呢?或者说如何将武器、防具、物品彻底区分开呢?希望大神能够帮帮我
梦石
0
星屑
2294
在线时间
610 小时
注册时间
2016-4-10
回帖
24
 楼主| 发表于 2017-6-17 14:33:41 | 显示全部楼层
自己摸索了下 原来是我自己用语错误,这里应该这样改
  1. #==============================================================================
  2. # ■ Window_Base
  3. #==============================================================================
  4. class Window_Base < Window   
  5.   def draw_item_name(item, x, y, enabled = true)
  6.     if item != nil
  7.       draw_icon(item.icon_index, x, y, enabled)
  8. #~       self.contents.font.color = text_color(item.text_color.to_i)
  9.       
  10.        if item.is_a?(RPG::Weapon)
  11.       self.contents.font.color = text_color(item.text_color.to_i)
  12.     end
  13.    
  14.        if item.is_a?(RPG::Armor)
  15.       self.contents.font.color = text_color(item.text_color.to_i)
  16.     end
  17.        if item.is_a?(RPG::Item)
  18.       case item.id
  19.        when 1#该数字为物品ID
  20.        self.contents.font.color = text_color(24)
  21.        when 3
  22.        self.contents.font.color = text_color(30)
  23.        when 4,15,19,36,81,172
  24.        self.contents.font.color = text_color(24)
  25.        when 5,29,6,38,7,2,107,152..154,174
  26.        self.contents.font.color = text_color(6)
  27.        when 8..14,16,18,20,39,42,108,122,123,159,175
  28.        self.contents.font.color = text_color(30)
  29.        when 21,23..28,40,44,45,53,55..64,80,102,103,109,176,201..210
  30.        self.contents.font.color = text_color(27)
  31.        when 22,31,35,161
  32.        self.contents.font.color = text_color(0)
  33.        when 30,48..51,105,110,113..115,125..137,162,165
  34.        self.contents.font.color = text_color(17)
  35.        when 33,37,101,106,158,173
  36.        self.contents.font.color = text_color(1)
  37.        when 41,111,112
  38.        self.contents.font.color = text_color(18)
  39.        when 71..77,104,160,177
  40.        self.contents.font.color = text_color(2)
  41.      end
  42. end
  43.       self.contents.font.color.alpha = enabled ? 255 : 128
  44.       self.contents.draw_text(x + 24, y, 172, WLH, item.name)
  45.     end
  46.   end
  47. end
复制代码
请版主帮忙结帖
回复

使用道具 举报

梦石
0
星屑
468
在线时间
59 小时
注册时间
2017-6-13
回帖
99
发表于 2017-6-18 11:34:55 | 显示全部楼层
aaaaaaaaaaaaaaa教我怎么做啦。我是新人

点评

请问是哪一个不会,如果只是改物品的颜色那就是二楼的做法,当然前提是你用了P叔整合系统里的随机属性的脚本。  发表于 2017-6-18 15:24
回复

使用道具 举报

梦石
0
星屑
468
在线时间
59 小时
注册时间
2017-6-13
回帖
99
发表于 2017-6-19 01:38:22 | 显示全部楼层
不是,我是新人啦!那个脚本编写怎么开始写,我真迷茫了

点评

脚本编写在图书馆里有教程,自己去学,一个完整的自创脚本不是一会儿就能学会的。  发表于 2017-6-19 13:59
回复

使用道具 举报

梦石
0
星屑
468
在线时间
59 小时
注册时间
2017-6-13
回帖
99
发表于 2017-6-19 01:41:29 | 显示全部楼层
对了,关于游戏美工方向,如CG,这个要而外用PS做了后  用文件夹单独存放吗

点评

我的游戏里没有用到CG,想提问请另外开贴。  发表于 2017-6-19 14:01
回复

使用道具 举报

梦石
0
星屑
50
在线时间
28 小时
注册时间
2015-5-22
回帖
11
发表于 2017-6-19 06:33:03 | 显示全部楼层

点评

这个网站域名:福利94,感觉打不开是不是因为不是什么健康网站咧。。。  发表于 2017-6-29 17:47
打不开,要翻墙?  发表于 2017-6-28 19:08
回复

使用道具 举报

头像被屏蔽
梦石
0
星屑
88
在线时间
631 小时
注册时间
2014-8-4
回帖
3243
发表于 2017-6-28 19:11:01 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 1 0

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部