| 
 
| 赞 | 0 |  
| VIP | 0 |  
| 好人卡 | 0 |  
| 积分 | 1 |  
| 经验 | 4869 |  
| 最后登录 | 2017-5-17 |  
| 在线时间 | 124 小时 |  
 Lv1.梦旅人 
	梦石0 星屑50 在线时间124 小时注册时间2009-9-4帖子31 | 
| 想用颜色脚本给装备加上名字颜色 又想用装备等级限制脚本限制这个装备.
 贴上两个脚本
 
 装备颜色脚本
 
 #==============================================================================
 # 本脚本来自www.66RPG.com,使用和转载请保留此信息
 #==============================================================================
 #
 # 脚本功能:给不同物品显示不同颜色,类似暗黑破坏神,比如套装为绿色,超级为金色
 #           可以更改的种类包括物品、防具、特技、武器。
 #
 # 使用方法:对于不想为白色表示的物品,在描述中最后添加@6,@4一类的即可。
 #           数字为颜色编号,和对话框中的一样。
 # ——————————————————————————————————————
 module RPG
 class Skill
 def description
 description = @description.split(/@/)[0]
 return description != nil ? description : '
 end
 def name_color_66RPG
 name_color = @description.split(/@/)[1]
 return name_color != nil ? name_color.to_i : 0
 end
 end
 class Weapon
 def description
 description = @description.split(/@/)[0]
 return description != nil ? description : '
 end
 def name_color_66RPG
 name_color = @description.split(/@/)[1]
 return name_color != nil ? name_color.to_i : 0
 end
 end
 class Item
 def description
 description = @description.split(/@/)[0]
 return description != nil ? description : '
 end
 def name_color_66RPG
 name_color = @description.split(/@/)[1]
 return name_color != nil ? name_color.to_i : 0
 end
 end
 class Armor
 def description
 description = @description.split(/@/)[0]
 return description != nil ? description : '
 end
 def name_color_66RPG
 name_color = @description.split(/@/)[1]
 return name != nil ? name_color.to_i : 0
 end
 end
 end
 
 # ——————————————————————————————————————
 # 本脚本原创自www.66rpg.com,转载请保留此信息
 # ——————————————————————————————————————
 class Window_Base < Window
 #--------------------------------------------------------------------------
 # ● 描绘物品名
 #     item : 物品
 #     x    : 描画目标 X 坐标
 #     y    : 描画目标 Y 坐标
 #--------------------------------------------------------------------------
 def draw_item_name(item, x, y)
 if item == nil
 return
 end
 bitmap = RPG::Cache.icon(item.icon_name)
 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
 self.contents.font.color = text_color(item.name_color_66RPG)
 self.contents.draw_text(x + 28, y, 212, 32, item.name.to_s)
 end
 end
 
 # ——————————————————————————————————————
 # 本脚本原创自www.66rpg.com,转载请保留此信息
 # ——————————————————————————————————————
 class Window_Item
 #--------------------------------------------------------------------------
 # ● 描绘项目
 #     index : 项目编号
 #--------------------------------------------------------------------------
 def draw_item(index)
 item = @data[index]
 case item
 when RPG::Item
 number = $game_party.item_number(item.id)
 when RPG::Weapon
 number = $game_party.weapon_number(item.id)
 when RPG::Armor
 number = $game_party.armor_number(item.id)
 end
 if item.is_a?(RPG::Item) and
 $game_party.item_can_use?(item.id)
 self.contents.font.color = text_color(item.name_color_66RPG)
 else
 self.contents.font.color = disabled_color
 end
 x = 4 + index % 2 * (288 + 32)
 y = index / 2 * 32
 rect = Rect.new(x, y, self.width / @column_max - 32, 32)
 self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
 bitmap = RPG::Cache.icon(item.icon_name)
 opacity = self.contents.font.color == disabled_color ? 128 : 255
 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
 self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
 self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
 self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
 end
 end
 
 # ——————————————————————————————————————
 # 本脚本原创自www.66rpg.com,转载请保留此信息
 # ——————————————————————————————————————
 class Window_EquipItem < Window_Selectable
 #--------------------------------------------------------------------------
 # ● 项目的描绘
 #     index : 项目符号
 #--------------------------------------------------------------------------
 def draw_item(index)
 item = @data[index]
 x = 4 + index % 2 * (288 + 32)
 y = index / 2 * 32
 case item
 when RPG::Weapon
 number = $game_party.weapon_number(item.id)
 when RPG::Armor
 number = $game_party.armor_number(item.id)
 end
 bitmap = RPG::Cache.icon(item.icon_name)
 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
 self.contents.font.color = text_color(item.name_color_66RPG)
 self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
 self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
 self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
 end
 end
 
 # ——————————————————————————————————————
 # 本脚本原创自www.66rpg.com,转载请保留此信息
 # ——————————————————————————————————————
 class Window_ShopBuy < Window_Selectable
 #--------------------------------------------------------------------------
 # ● 描绘羡慕
 #     index : 项目编号
 #--------------------------------------------------------------------------
 def draw_item(index)
 item = @data[index]
 # 获取物品所持数
 case item
 when RPG::Item
 number = $game_party.item_number(item.id)
 when RPG::Weapon
 number = $game_party.weapon_number(item.id)
 when RPG::Armor
 number = $game_party.armor_number(item.id)
 end
 # 价格在所持金以下、并且所持数不是 99 的情况下为普通颜色
 # 除此之外的情况设置为无效文字色
 if item.price <= $game_party.gold and number < 99
 self.contents.font.color = text_color(item.name_color_66RPG)
 else
 self.contents.font.color = disabled_color
 end
 x = 4
 y = index * 32
 rect = Rect.new(x, y, self.width - 32, 32)
 self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
 bitmap = RPG::Cache.icon(item.icon_name)
 opacity = self.contents.font.color == disabled_color ? 128 : 255
 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
 self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
 self.contents.draw_text(x + 240, y, 88, 32, item.price.to_s, 2)
 end
 end
 
 # ——————————————————————————————————————
 # 本脚本原创自www.66rpg.com,转载请保留此信息
 # ——————————————————————————————————————
 class Window_ShopSell < Window_Selectable
 #--------------------------------------------------------------------------
 # ● 描绘项目
 #     index : 项目标号
 #--------------------------------------------------------------------------
 def draw_item(index)
 item = @data[index]
 case item
 when RPG::Item
 number = $game_party.item_number(item.id)
 when RPG::Weapon
 number = $game_party.weapon_number(item.id)
 when RPG::Armor
 number = $game_party.armor_number(item.id)
 end
 # 可以卖掉的显示为普通颜色、除此之外设置成无效文字颜色
 if item.price > 0
 self.contents.font.color = text_color(item.name_color_66RPG)
 else
 self.contents.font.color = disabled_color
 end
 x = 4 + index % 2 * (288 + 32)
 y = index / 2 * 32
 rect = Rect.new(x, y, self.width / @column_max - 32, 32)
 self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
 bitmap = RPG::Cache.icon(item.icon_name)
 opacity = self.contents.font.color == disabled_color ? 128 : 255
 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
 self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
 self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
 self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
 end
 end
 
 # ——————————————————————————————————————
 # 本脚本原创自www.66rpg.com,转载请保留此信息
 # ——————————————————————————————————————
 class Window_Skill
 #--------------------------------------------------------------------------
 # ● 描绘项目
 #     index : 项目编号
 #--------------------------------------------------------------------------
 def draw_item(index)
 skill = @data[index]
 if @actor.skill_can_use?(skill.id)
 self.contents.font.color = text_color(skill.name_color_66RPG)
 else
 self.contents.font.color = disabled_color
 end
 x = 4 + index % 2 * (288 + 32)
 y = index / 2 * 32
 rect = Rect.new(x, y, self.width / @column_max - 32, 32)
 self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
 bitmap = RPG::Cache.icon(skill.icon_name)
 opacity = self.contents.font.color == disabled_color ? 128 : 255
 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
 self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
 self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
 end
 end
 
 #==============================================================================
 # 本脚本来自www.66RPG.com,使用和转载请保留此信息
 #==============================================================================
 
 
 
 
 
 
 
 
 
 装备等级限制脚本
 
 module RPG
 class Weapon
 def level
 return 1 if @description.split(/LV/)[1] == nil
 return @description.split(/LV/)[1]
 end
 def str
 return 1 if @description.split(/STR/)[1] == nil
 return @description.split(/STR/)[1]
 end
 def dex
 return 1 if @description.split(/DEX/)[1] == nil
 return @description.split(/DEX/)[1]
 end
 def agi
 return 1 if @description.split(/AGI/)[1] == nil
 return @description.split(/AGI/)[1]
 end
 def int
 return 1 if @description.split(/INT/)[1] == nil
 return @description.split(/INT/)[1]
 end
 #    def description
 #      return @description.split(/LV/)[0] + "{装备等级" + level + "}"
 #    end
 end
 class Armor
 def level
 return 1 if @description.split(/LV/)[1] == nil
 return @description.split(/LV/)[1]
 end
 def str
 return 1 if @description.split(/STR/)[1] == nil
 return @description.split(/STR/)[1]
 end
 def dex
 return 1 if @description.split(/DEX/)[1] == nil
 return @description.split(/DEX/)[1]
 end
 def agi
 return 1 if @description.split(/AGI/)[1] == nil
 return @description.split(/AGI/)[1]
 end
 def int
 return 1 if @description.split(/INT/)[1] == nil
 return @description.split(/INT/)[1]
 end
 #    def description
 #      return @description.split(/LV/)[0] + "{装备等级" + level + "}"
 #    end
 end
 end
 
 class Game_Actor < Game_Battler
 #--------------------------------------------------------------------------
 # ● 可以装备判定
 #     item : 物品
 #--------------------------------------------------------------------------
 def equipable?(item)
 # 武器的情况
 if item.is_a?(RPG::Weapon)
 # 包含当前的职业可以装备武器的场合
 if $data_classes[@class_id].weapon_set.include?(item.id) and item.level.to_i<=@level
 if item.str.to_i<= str and item.dex.to_i<= dex and item.agi.to_i<= agi and item.int.to_i<= int
 return true
 end
 end
 end
 # 防具的情况
 if item.is_a?(RPG::Armor)
 # 不包含当前的职业可以装备武器的场合
 if $data_classes[@class_id].armor_set.include?(item.id) and item.level.to_i<=@level
 if item.str.to_i<= str and item.dex.to_i<= dex and item.agi.to_i<= agi and item.int.to_i<= int
 return true
 end
 end
 end
 return false
 end
 end
 #==============================================================================
 # ■ Window_EquipItem
 #------------------------------------------------------------------------------
 #  装备画面、显示浏览变更装备的候补物品的窗口。
 #==============================================================================
 
 class Window_EquipItem < Window_Selectable
 #--------------------------------------------------------------------------
 # ● 刷新
 #--------------------------------------------------------------------------
 def refresh
 if self.contents != nil
 self.contents.dispose
 self.contents = nil
 end
 @data = []
 # 添加可以装备的武器
 if @equip_type == 0
 weapon_set = $data_classes[@actor.class_id].weapon_set
 for i in 1...$data_weapons.size
 if $game_party.weapon_number(i) > 0 and weapon_set.include?(i) and @actor.equipable?($data_weapons)
 @data.push($data_weapons)
 end
 end
 end
 # 添加可以装备的防具
 if @equip_type != 0
 armor_set = $data_classes[@actor.class_id].armor_set
 for i in 1...$data_armors.size
 if $game_party.armor_number(i) > 0 and armor_set.include?(i) and @actor.equipable?($data_armors)
 if $data_armors.kind == @equip_type-1
 @data.push($data_armors)
 end
 end
 end
 end
 # 添加空白
 @data.push(nil)
 # 生成位图、描绘全部项目
 @item_max = @data.size
 self.contents = Bitmap.new(width - 32, row_max * 32)
 for i in 0...@item_max-1
 draw_item(i)
 end
 end
 end
 
 
 
 求助!
 
 
 792167485于2011-7-23 21:01补充以下内容:
 猫了个B  突然间又行了.
 自行结贴,,,,,绝非恶搞 版主别砍我ID.
 把这帖子拖到垃圾箱去吧
 | 
 |