Project1

标题: 整合物品颜色和物品分类两个剧本 [打印本页]

作者: 反斗奇彬    时间: 2015-10-25 17:10
标题: 整合物品颜色和物品分类两个剧本
本帖最后由 反斗奇彬 于 2015-10-25 17:18 编辑

这个是物品分类脚本
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. #可以自定义设置物品分类,利用物品描述,每个描述后面添加@物品分类即可。

  5. #==============================================================================
  6. # ■ Harts_Window_ItemTitle
  7. #==============================================================================

  8. class Harts_Window_ItemTitle < Window_Base
  9.   def initialize
  10.     super(0, 0, 160, 64)
  11.     self.contents = Bitmap.new(width - 32, height - 32)
  12.     self.contents.clear
  13.     self.contents.font.color = normal_color
  14.     self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
  15.   end
  16. end

  17. #==============================================================================
  18. # ■ Harts_Window_ItemCommand
  19. #==============================================================================

  20. class Harts_Window_ItemCommand < Window_Selectable
  21.   attr_accessor :commands
  22.   #--------------------------------------------------------------------------
  23.   # ● 初始化,生成commands窗口
  24.   #--------------------------------------------------------------------------
  25.   def initialize
  26.     super(0, 64, 160, 352)
  27.     @commands = []
  28.     #————————生成commands窗口
  29.     for i in 1...$data_items.size
  30.       if $game_party.item_number(i) > 0
  31.         push = true
  32.         for com in @commands
  33.           if com == $data_items[i].desc
  34.             push = false
  35.           end
  36.         end
  37.         if push == true
  38.           @commands.push($data_items[i].desc)
  39.         end
  40.       end
  41.     end
  42.     for i in 1...$data_weapons.size
  43.       if $game_party.weapon_number(i) > 0
  44.         push = true
  45.         for com in @commands
  46.           if com == $data_weapons[i].desc
  47.             push = false
  48.           end
  49.         end
  50.         if push == true
  51.           @commands.push($data_weapons[i].desc)
  52.         end
  53.       end
  54.     end
  55.     for i in 1...$data_armors.size
  56.       if $game_party.armor_number(i) > 0
  57.         push = true
  58.         for com in @commands
  59.           if com == $data_armors[i].desc
  60.             push = false
  61.           end
  62.         end
  63.         if push == true
  64.           @commands.push($data_armors[i].desc)
  65.         end
  66.       end
  67.     end
  68.     if @commands == []
  69.       @commands.push("普通物品")
  70.     end      
  71.     @item_max = @commands.size
  72.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  73.     refresh
  74.     self.index = 0
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   #--------------------------------------------------------------------------
  78.   def refresh
  79.     self.contents.clear
  80.     for i in 0...@item_max
  81.       draw_item(i, normal_color)
  82.     end
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   #--------------------------------------------------------------------------
  86.   def draw_item(index, color)
  87.     self.contents.font.color = color
  88.     y = index * 32
  89.     self.contents.draw_text(4, y, 128, 32, @commands[index])
  90.   end
  91.   #--------------------------------------------------------------------------
  92.   # 只描绘原文字
  93.   #--------------------------------------------------------------------------
  94.   def update_help
  95.     @help_window.set_text(@commands[self.index])
  96.   end
  97. end

  98. #==============================================================================
  99. # ■ Window_Item
  100. #==============================================================================

  101. class Harts_Window_ItemList < Window_Selectable
  102.   #--------------------------------------------------------------------------
  103.   #--------------------------------------------------------------------------
  104.   def initialize
  105.     super(160, 0, 480, 416)
  106.     refresh
  107.     self.index = 0
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   #--------------------------------------------------------------------------
  111.   def item
  112.     return @data[self.index]
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   #--------------------------------------------------------------------------
  116.   def refresh
  117.     if self.contents != nil
  118.       self.contents.dispose
  119.       self.contents = nil
  120.     end
  121.     @data = []
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   #--------------------------------------------------------------------------
  125.   def set_item(command)
  126.     refresh
  127.     for i in 1...$data_items.size
  128.       if $game_party.item_number(i) > 0 and $data_items[i].desc == command
  129.         @data.push($data_items[i])
  130.       end
  131.     end
  132.     for i in 1...$data_weapons.size
  133.       if $game_party.weapon_number(i) > 0 and $data_weapons[i].desc == command
  134.         @data.push($data_weapons[i])
  135.       end
  136.     end
  137.     for i in 1...$data_armors.size
  138.       if $game_party.armor_number(i) > 0 and $data_armors[i].desc == command
  139.         @data.push($data_armors[i])
  140.       end
  141.     end
  142.     @item_max = @data.size
  143.     if @item_max > 0
  144.       self.contents = Bitmap.new(width - 32, row_max * 32)
  145.       self.contents.clear
  146.       for i in 0...@item_max
  147.         draw_item(i)
  148.       end
  149.     end
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   #--------------------------------------------------------------------------
  153.   def item_number
  154.     return @item_max
  155.   end
  156.   #--------------------------------------------------------------------------
  157.   #--------------------------------------------------------------------------
  158.   def draw_item(index)
  159.     item = @data[index]
  160.     case item
  161.     when RPG::Item
  162.       number = $game_party.item_number(item.id)
  163.     when RPG::Weapon
  164.       number = $game_party.weapon_number(item.id)
  165.     when RPG::Armor
  166.       number = $game_party.armor_number(item.id)
  167.     end
  168.     if item.is_a?(RPG::Item) and
  169.       $game_party.item_can_use?(item.id)
  170.       self.contents.font.color = normal_color
  171.     else
  172.       self.contents.font.color = disabled_color
  173.     end
  174.     x = 4
  175.     y = index * 32
  176.     bitmap = RPG::Cache.icon(item.icon_name)
  177.     opacity = self.contents.font.color == normal_color ? 255 : 128
  178.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  179.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  180.     self.contents.draw_text(x + 400, y, 16, 32, ":", 1)
  181.     self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2)
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   #--------------------------------------------------------------------------
  185.   def update_help
  186.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  187.   end
  188. end

  189. #==============================================================================
  190. # ■ Harts_Scene_Item
  191. #==============================================================================

  192. class Scene_Item
  193.   #--------------------------------------------------------------------------
  194.   #--------------------------------------------------------------------------
  195.   def main
  196.     @itemtitle_window = Harts_Window_ItemTitle.new
  197.     @itemcommand_window = Harts_Window_ItemCommand.new
  198.     @command_index = @itemcommand_window.index
  199.     @itemlist_window = Harts_Window_ItemList.new
  200.     @itemlist_window.active = false
  201.     @help_window = Window_Help.new
  202.     @help_window.x = 0
  203.     @help_window.y = 416
  204.     @itemcommand_window.help_window = @help_window
  205.     @itemlist_window.help_window = @help_window
  206.     @target_window = Window_Target.new
  207.     @target_window.visible = false
  208.     @target_window.active = false
  209.     @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  210.     Graphics.transition
  211.     loop do
  212.       Graphics.update
  213.       Input.update
  214.       update
  215.       if $scene != self
  216.         break
  217.       end
  218.     end
  219.     Graphics.freeze
  220.     @itemtitle_window.dispose
  221.     @itemcommand_window.dispose
  222.     @itemlist_window.dispose
  223.     @help_window.dispose
  224.     @target_window.dispose
  225.   end
  226.   #--------------------------------------------------------------------------
  227.   #--------------------------------------------------------------------------
  228.   def update
  229.     @itemtitle_window.update
  230.     @itemcommand_window.update
  231.     @itemlist_window.update
  232.     @help_window.update
  233.     @target_window.update
  234.     if @command_index != @itemcommand_window.index
  235.       @command_index = @itemcommand_window.index
  236.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  237.     end
  238.     if @itemcommand_window.active
  239.       update_itemcommand
  240.       return
  241.     end
  242.     if @itemlist_window.active
  243.       update_itemlist
  244.       return
  245.     end
  246.     if @target_window.active
  247.       update_target
  248.       return
  249.     end
  250.   end
  251.   #--------------------------------------------------------------------------
  252.   #--------------------------------------------------------------------------
  253.   def update_itemcommand
  254.     if Input.trigger?(Input::B)
  255.       $game_system.se_play($data_system.cancel_se)
  256.       $scene = Scene_Menu.new(0)
  257.       return
  258.     end
  259.     if Input.trigger?(Input::C)
  260.       if @itemlist_window.item_number == 0
  261.         $game_system.se_play($data_system.buzzer_se)
  262.         return
  263.       end
  264.       $game_system.se_play($data_system.decision_se)
  265.       @itemcommand_window.active = false
  266.       @itemlist_window.active = true
  267.       @itemlist_window.index = 0
  268.       return
  269.     end
  270.   end
  271.   #--------------------------------------------------------------------------
  272.   #--------------------------------------------------------------------------
  273.   def update_itemlist
  274.     if Input.trigger?(Input::B)
  275.       $game_system.se_play($data_system.cancel_se)
  276.       @itemcommand_window.active = true
  277.       @itemlist_window.active = false
  278.       @itemlist_window.index = 0
  279.       @itemcommand_window.index = @command_index
  280.       return
  281.     end
  282.     if Input.trigger?(Input::C)
  283.       @item = @itemlist_window.item
  284.       unless @item.is_a?(RPG::Item)
  285.         $game_system.se_play($data_system.buzzer_se)
  286.         return
  287.       end
  288.       unless $game_party.item_can_use?(@item.id)
  289.         $game_system.se_play($data_system.buzzer_se)
  290.         return
  291.       end
  292.       $game_system.se_play($data_system.decision_se)
  293.       if @item.scope >= 3
  294.         @itemlist_window.active = false
  295.         @target_window.x = 304
  296.         @target_window.visible = true
  297.         @target_window.active = true
  298.         if @item.scope == 4 || @item.scope == 6
  299.           @target_window.index = -1
  300.         else
  301.           @target_window.index = 0
  302.         end
  303.       else
  304.         if @item.common_event_id > 0
  305.           $game_temp.common_event_id = @item.common_event_id
  306.           $game_system.se_play(@item.menu_se)
  307.             if @item.consumable
  308.               $game_party.lose_item(@item.id, 1)
  309.               @itemlist_window.draw_item(@itemlist_window.index)
  310.             end
  311.           $scene = Scene_Map.new
  312.           return
  313.         end
  314.       end
  315.       return
  316.     end
  317.   end
  318.   #--------------------------------------------------------------------------
  319.   #--------------------------------------------------------------------------
  320.   def update_target
  321.     if Input.trigger?(Input::B)
  322.       $game_system.se_play($data_system.cancel_se)
  323.       unless $game_party.item_can_use?(@item.id)
  324.         @itemlist_window.refresh
  325.       end
  326.       @itemlist_window.active = true
  327.       @target_window.visible = false
  328.       @target_window.active = false
  329.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  330.       return
  331.     end
  332.     if Input.trigger?(Input::C)
  333.       if $game_party.item_number(@item.id) == 0
  334.         $game_system.se_play($data_system.buzzer_se)
  335.         return
  336.       end
  337.       if @target_window.index == -1
  338.         used = false
  339.         for i in $game_party.actors
  340.           used |= i.item_effect(@item)
  341.         end
  342.       end
  343.       if @target_window.index >= 0
  344.         target = $game_party.actors[@target_window.index]
  345.         used = target.item_effect(@item)
  346.       end
  347.       if used
  348.         $game_system.se_play(@item.menu_se)
  349.         if @item.consumable
  350.           $game_party.lose_item(@item.id, 1)
  351.           @itemlist_window.draw_item(@itemlist_window.index)
  352.           @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  353.         end
  354.         @target_window.refresh
  355.         if $game_party.all_dead?
  356.           $scene = Scene_Gameover.new
  357.           return
  358.         end
  359.         if @item.common_event_id > 0
  360.           $game_temp.common_event_id = @item.common_event_id
  361.           $scene = Scene_Map.new
  362.           return
  363.         end
  364.       end
  365.       unless used
  366.         $game_system.se_play($data_system.buzzer_se)
  367.       end
  368.     return
  369.     end
  370.   end
  371. end

  372. #==============================================================================
  373. # ■ RPG追加定义,使用@符号分类
  374. #==============================================================================

  375. module RPG
  376.   class Weapon
  377.     def description
  378.       description = @description.split(/@/)[0]
  379.       return description != nil ? description : ''
  380.     end
  381.     def desc
  382.       desc = @description.split(/@/)[1]
  383.       return desc != nil ? desc : "普通物品"
  384.     end
  385.   end
  386.   class Item
  387.     def description
  388.       description = @description.split(/@/)[0]
  389.       return description != nil ? description : ''
  390.     end
  391.     def desc
  392.       desc = @description.split(/@/)[1]
  393.       return desc != nil ? desc : "普通物品"
  394.     end
  395.   end
  396.   class Armor
  397.     def description
  398.       description = @description.split(/@/)[0]
  399.       return description != nil ? description : ''
  400.     end
  401.     def desc
  402.       desc = @description.split(/@/)[1]
  403.       return desc != nil ? desc : "普通物品"
  404.     end
  405.   end
  406. end

  407. #==============================================================================
  408. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  409. #==============================================================================
复制代码
这个是物品颜色脚本
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  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. # 本脚本原创自[url]www.66rpg.com[/url],转载请保留此信息
  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. # 本脚本原创自[url]www.66rpg.com[/url],转载请保留此信息
  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. # 本脚本原创自[url]www.66rpg.com[/url],转载请保留此信息
  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. # 本脚本原创自[url]www.66rpg.com[/url],转载请保留此信息
  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. # 本脚本原创自[url]www.66rpg.com[/url],转载请保留此信息
  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. # 本脚本原创自[url]www.66rpg.com[/url],转载请保留此信息
  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. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  237. #==============================================================================
复制代码
怎样把两个脚本整合起来,目前测试不冲突,但是用了分类脚本的话用颜色就没有效果
作者: 汪汪    时间: 2015-10-25 17:42
本帖最后由 汪汪 于 2015-10-25 18:02 编辑

#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
#
# 脚本功能:给不同物品显示不同颜色,类似暗黑破坏神,比如套装为绿色,超级为金色
#           可以更改的种类包括物品、防具、特技、武器。
#
# 使用方法:对于不想为白色表示的物品,在描述中最后添加@6,@4一类的即可。
#           数字为颜色编号,和对话框中的一样。
# ——————————————————————————————————————

  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


把这里面的  split(/@/)[1]  中的[1]改成[2],然后先写上面那个脚本的,再加这个脚本的.
作者: 反斗奇彬    时间: 2015-10-26 14:25
汪汪 发表于 2015-10-25 17:42
#==============================================================================
# 本脚本来自www.66RP ...

已经找到方法了,还是谢谢你




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