Project1

标题: 关于得失物品提示和彩色物品名字脚本的冲突…… [打印本页]

作者: daiboy12    时间: 2010-7-20 16:41
标题: 关于得失物品提示和彩色物品名字脚本的冲突……
本帖最后由 daiboy12 于 2010-7-20 23:01 编辑

:'(我这个脚本白尝试修复多次了……还是不行啊……只好来这里请教了!

这个是彩色物品名称的。
  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.     end
  51.   end
  52. end

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

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

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

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

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

  235. #==============================================================================
  236. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  237. #==============================================================================
复制代码
这个是得失物品提示的
  1. # ————————————————————————————————————
  2. # 本脚本来自www.66rpg.com,转载请保留此信息
  3. # ————————————————————————————————————
  4.   
  5. # 注意!!!在对话后得到物品,请在对话后先用事件等待3帧,否则对话框来不及消失。

  6. # 新增获得经验值提示,喝水后回复提示和增减等级提示.

  7. # 开关定义:

  8. $不显示金钱窗口 = 41

  9. $不显示物品窗口 = 41

  10. $不显示武器窗口 = 41

  11. $不显示防具窗口 = 41

  12. # 以上开关,当打开的时候,获得物品将不会提示,比如默认打开41号开关,获得金钱不再提示

  13. # ————————————————————————————————————

  14. class Interpreter  
  15.   #--------------------------------------------------------------------------
  16.   # ● 增减金钱
  17.   #--------------------------------------------------------------------------
  18.   def command_125
  19.     value = operate_value(@parameters[0], @parameters[1], @parameters[2])
  20.     $game_party.gain_gold(value)
  21.     if $game_switches[$不显示金钱窗口]==false
  22.       carol3_66RPG = Window_Base.new((640-160)/2,128,180,100)
  23.       carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
  24.       if value >= 0
  25.         carol3_66RPG.contents.draw_text(0,0,240,32,"获得金钱:")
  26.         #——声效,可以自己改
  27.         Audio.se_play("Audio/SE/"+"006-System06",80,100)
  28.       else
  29.         carol3_66RPG.contents.draw_text(0,0,240,32,"失去金钱:")
  30.         #——声效,可以自己改
  31.         Audio.se_play("Audio/SE/"+"005-System05",80,100)
  32.       end   
  33.       carol3_66RPG.contents.draw_text(0,32,240,32,value.abs.to_s)
  34.       carol3_66RPG.contents.draw_text(0,32,140,32, $data_system.words.gold,2)
  35.       carol3_66RPG.opacity = 160
  36.       for i in 0..30
  37.         Graphics.update
  38.       end
  39.       for i in 0..10
  40.         carol3_66RPG.opacity -= 30
  41.         carol3_66RPG.contents_opacity -= 30
  42.         Graphics.update
  43.       end
  44.       carol3_66RPG.dispose
  45.     end
  46.     return true
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # ● 增减物品
  50.   #--------------------------------------------------------------------------
  51.   def command_126
  52.     value = operate_value(@parameters[1], @parameters[2], @parameters[3])
  53.     $game_party.gain_item(@parameters[0], value)
  54.     if $game_switches[$不显示物品窗口]==false
  55.       carol3_66RPG_item = $data_items[@parameters[0]]
  56.       carol3_66RPG = Window_Base.new((640-300)/2,128,300,100)
  57.       carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
  58.       if value >= 0
  59.         carol3_66RPG.contents.draw_text(0,0,240,32,"获得物品:")   
  60.         #——声效,可以自己改
  61.         Audio.se_play("Audio/SE/"+"006-System06",80,100)
  62.       else
  63.         carol3_66RPG.contents.draw_text(0,0,240,32,"失去物品:")   
  64.         #——声效,可以自己改
  65.         Audio.se_play("Audio/SE/"+"005-System05",80,100)
  66.       end
  67.       carol3_66RPG_bitmap = RPG::Cache.icon(carol3_66RPG_item.icon_name)
  68.       carol3_66RPG.contents.blt(0, 32, carol3_66RPG_bitmap, Rect.new(0, 0, 24, 24), 255)
  69.       carol3_66RPG.contents.font.color = name_color_66RPG
  70.       carol3_66RPG.contents.draw_text(0 + 28, 32, 212, 32, carol3_66RPG_item.name, 0)
  71.       carol3_66RPG.contents.draw_text(0, 32, 268, 32, "×"+value.abs.to_s, 2)
  72.       carol3_66RPG.opacity = 160
  73.       for i in 0..30
  74.         Graphics.update
  75.       end
  76.       for i in 0..10
  77.         carol3_66RPG.opacity -= 30
  78.         carol3_66RPG.contents_opacity -= 30
  79.         Graphics.update
  80.       end
  81.       carol3_66RPG.dispose
  82.     end
  83.     return true
  84.   end
  85.   #--------------------------------------------------------------------------
  86.   # ● 增减武器
  87.   #--------------------------------------------------------------------------
  88.   def command_127
  89.     value = operate_value(@parameters[1], @parameters[2], @parameters[3])
  90.     $game_party.gain_weapon(@parameters[0], value)
  91.     if $game_switches[$不显示武器窗口]==false
  92.       carol3_66RPG_item = $data_weapons[@parameters[0]]
  93.       carol3_66RPG = Window_Base.new((640-300)/2,128,300,100)
  94.       carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
  95.       if value >= 0
  96.         carol3_66RPG.contents.draw_text(0,0,240,32,"获得武器:")   
  97.         #——声效,可以自己改
  98.         Audio.se_play("Audio/SE/"+"006-System06",80,100)
  99.       else
  100.         carol3_66RPG.contents.draw_text(0,0,240,32,"失去武器:")   
  101.         #——声效,可以自己改
  102.         Audio.se_play("Audio/SE/"+"005-System05",80,100)
  103.       end
  104.       carol3_66RPG_bitmap = RPG::Cache.icon(carol3_66RPG_item.icon_name)
  105.       carol3_66RPG.contents.draw_text(0 + 28, 32, 212, 32, carol3_66RPG_item.name, 0)
  106.       carol3_66RPG.contents.draw_text(0, 32, 268, 32, "×"+value.abs.to_s, 2)
  107.       carol3_66RPG.opacity = 160
  108.       for i in 0..30
  109.         Graphics.update
  110.       end
  111.       for i in 0..10
  112.         carol3_66RPG.opacity -= 30
  113.         carol3_66RPG.contents_opacity -= 30
  114.         Graphics.update
  115.       end
  116.       carol3_66RPG.dispose
  117.     end
  118.     return true
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   # ● 增减防具
  122.   #--------------------------------------------------------------------------
  123.   def command_128
  124.     value = operate_value(@parameters[1], @parameters[2], @parameters[3])
  125.     $game_party.gain_armor(@parameters[0], value)
  126.     if $game_switches[$不显示防具窗口]==false
  127.       carol3_66RPG_item = $data_armors[@parameters[0]]
  128.       carol3_66RPG = Window_Base.new((640-300)/2,128,300,100)
  129.       carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
  130.       if value >= 0
  131.         carol3_66RPG.contents.draw_text(0,0,240,32,"获得防具:")   
  132.         #——声效,可以自己改
  133.         Audio.se_play("Audio/SE/"+"006-System06",80,100)
  134.       else
  135.         carol3_66RPG.contents.draw_text(0,0,240,32,"失去防具:")   
  136.         #——声效,可以自己改
  137.         Audio.se_play("Audio/SE/"+"005-System05",80,100)
  138.       end
  139.       carol3_66RPG_bitmap = RPG::Cache.icon(carol3_66RPG_item.icon_name)
  140.       carol3_66RPG.contents.blt(0, 32, carol3_66RPG_bitmap, Rect.new(0, 0, 24, 24), 255)
  141.       carol3_66RPG.contents.draw_text(0 + 28, 32, 212, 32, carol3_66RPG_item.name, 0)
  142.       carol3_66RPG.contents.draw_text(0, 32, 268, 32, "×"+value.abs.to_s, 2)
  143.       carol3_66RPG.opacity = 160
  144.       for i in 0..30
  145.         Graphics.update
  146.       end
  147.       for i in 0..10
  148.         carol3_66RPG.opacity -= 30
  149.         carol3_66RPG.contents_opacity -= 30
  150.         Graphics.update
  151.       end
  152.       carol3_66RPG.dispose
  153.     end
  154.     return true
  155.   end
  156.   def command_315
  157.     # 获取操作值
  158.     value = operate_value(@parameters[1], @parameters[2], @parameters[3])
  159.     # 处理重复
  160.     iterate_actor(@parameters[0]) do |actor|
  161.       # 更改角色 EXP
  162.       actor.exp += value
  163.     end
  164.       carol3_66RPG = Window_Base.new((640-160)/2,128,180,100)
  165.       carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
  166.       if value >= 0
  167.         carol3_66RPG.contents.draw_text(0,0,240,32,"获得经验:")
  168.         #——声效,可以自己改
  169.         Audio.se_play("Audio/SE/"+"006-System06",80,100)
  170.       else
  171.         carol3_66RPG.contents.draw_text(0,0,240,32,"失去经验:")
  172.         #——声效,可以自己改
  173.         Audio.se_play("Audio/SE/"+"005-System05",80,100)
  174.       end   
  175.       carol3_66RPG.contents.draw_text(0,32,240,32,value.abs.to_s)
  176.       carol3_66RPG.contents.draw_text(0,32,140,32, "exp",2)
  177.       carol3_66RPG.opacity = 160
  178.       for i in 0..30
  179.         Graphics.update
  180.       end
  181.       for i in 0..10
  182.         carol3_66RPG.opacity -= 30
  183.         carol3_66RPG.contents_opacity -= 30
  184.         Graphics.update
  185.       end
  186.       carol3_66RPG.dispose
  187.     return true
  188.   end
  189.   def command_314
  190.     # 处理重复
  191.     iterate_actor(@parameters[0]) do |actor|
  192.       # 角色全回复
  193.       actor.recover_all
  194.     end
  195.       carol3_66RPG = Window_Base.new((640-160)/2,128,120,60)
  196.       carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
  197.       carol3_66RPG.contents.draw_text(0,0,240,32,"完全恢复")
  198.         #——声效,可以自己改
  199.         Audio.se_play("Audio/SE/"+"105-Heal01",80,100)
  200.       carol3_66RPG.opacity = 160
  201.       for i in 0..30
  202.         Graphics.update
  203.       end
  204.       for i in 0..10
  205.         carol3_66RPG.opacity -= 30
  206.         carol3_66RPG.contents_opacity -= 30
  207.         Graphics.update
  208.       end
  209.       carol3_66RPG.dispose
  210.     # 继续
  211.     return true
  212.   end
  213.   def command_316
  214.     # 获取操作值
  215.     value = operate_value(@parameters[1], @parameters[2], @parameters[3])
  216.     # 处理重复
  217.     iterate_actor(@parameters[0]) do |actor|
  218.       # 更改角色的等级
  219.       actor.level += value
  220.     end
  221.           carol3_66RPG = Window_Base.new((640-160)/2,128,180,100)
  222.       carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
  223.       if value >= 0
  224.         carol3_66RPG.contents.draw_text(0,0,240,32,"等级提升:")
  225.         #——声效,可以自己改
  226.         Audio.se_play("Audio/SE/"+"006-System06",80,100)
  227.       else
  228.         carol3_66RPG.contents.draw_text(0,0,240,32,"等级下降:")
  229.         #——声效,可以自己改
  230.         Audio.se_play("Audio/SE/"+"005-System05",80,100)
  231.       end   
  232.       carol3_66RPG.contents.draw_text(0,32,240,32,value.abs.to_s)
  233.       carol3_66RPG.contents.draw_text(0,32,140,32, "级",2)
  234.       carol3_66RPG.opacity = 160
  235.       for i in 0..30
  236.         Graphics.update
  237.       end
  238.       for i in 0..10
  239.         carol3_66RPG.opacity -= 30
  240.         carol3_66RPG.contents_opacity -= 30
  241.         Graphics.update
  242.       end
  243.       carol3_66RPG.dispose
  244.     # 继续
  245.     return true
  246.   end
  247. end
复制代码
希望各位前辈帮我兼容一下!是不是得失物品的前面还需要定义?
作者: 额    时间: 2010-7-20 20:51
把得到物品提示的脚本放在物品颜色的脚本后面就可以了,至少我是这样的
作者: daiboy12    时间: 2010-7-20 23:00
解决了……在站内仔细搜索到现成的兼容脚本了

下次我会先认真搜索的不好意思……




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1