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

Project1

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

[已经解决] 用脚本改物品的颜色怎么用

[复制链接]

Lv1.梦旅人

梦石
0
星屑
56
在线时间
155 小时
注册时间
2015-1-10
帖子
157
跳转到指定楼层
1
发表于 2015-3-14 08:57:18 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 RyanBern 于 2015-3-14 09:17 编辑

RUBY 代码复制
  1. # 脚本功能:给不同物品显示不同颜色,类似暗黑破坏神,比如套装为绿色,超级为金色
  2. #           可以更改的种类包括物品、防具、特技、武器。
  3. #
  4. # 使用方法:对于不想为白色表示的物品,在描述中最后添加@6,@4一类的即可。
  5. #           数字为颜色编号,和对话框中的一样。
  6. # ——————————————————————————————————————
  7. module RPG
  8.   class Skill
  9.     def description
  10.       description = @description.split(/@/)[0]
  11.       return description != nil ? description : ''
  12.     end
  13.     def name_color_66RPG
  14.       name_color = @description.split(/@/)[1]
  15.       return name_color != nil ? name_color.to_i : 0
  16.     end
  17.   end
  18.   class Weapon
  19.     def description
  20.       description = @description.split(/@/)[0]
  21.       description = description != nil ? description : ''
  22.  
  23.       description.gsub!(/\\[Vv]\[([0-9]+)\]/){$game_variables[$1.to_i]}
  24.  
  25.       return description
  26.  
  27.     end
  28.     def desc
  29.       desc = @description.split(/@/)[1]
  30.       return desc != nil ? desc : "普通物品"
  31.     end
  32.     def name_color_66RPG
  33.       name_color = @description.split(/@/)[2]
  34.       return name_color != nil ? name_color.to_i : 0
  35.     end
  36.   end
  37.   class Item
  38.     def description
  39.       description = @description.split(/@/)[0]
  40.       return description != nil ? description : ''
  41.     end
  42.     def desc
  43.       desc = @description.split(/@/)[1]
  44.       return desc != nil ? desc : "普通物品"
  45.     end
  46.     def name_color_66RPG
  47.       name_color = @description.split(/@/)[2]
  48.       return name_color != nil ? name_color.to_i : 0
  49.     end
  50.   end
  51.   class Armor
  52.     def description
  53.       description = @description.split(/@/)[0]
  54.       description = description != nil ? description : ''
  55.  
  56.       description.gsub!(/\\[Vv]\[([0-9]+)\]/){$game_variables[$1.to_i]}
  57.  
  58.       return description
  59.  
  60.     end
  61.     def desc
  62.       desc = @description.split(/@/)[1]
  63.       return desc != nil ? desc : "普通物品"
  64.     end
  65.     def name_color_66RPG
  66.       name_color = @description.split(/@/)[2]
  67.       return name != nil ? name_color.to_i : 0
  68.     end
  69.   end
  70. end
  71. # ——————————————————————————————————————
  72. # 本脚本原创自[url]www.66rpg.com[/url],转载请保留此信息
  73. # ——————————————————————————————————————
  74. class Window_Base < Window
  75.   #--------------------------------------------------------------------------
  76.   # ● 描绘物品名
  77.   #     item : 物品
  78.   #     x    : 描画目标 X 坐标
  79.   #     y    : 描画目标 Y 坐标
  80.   #--------------------------------------------------------------------------
  81.   def draw_item_name(item, x, y)
  82.     if item == nil
  83.       return
  84.     end
  85.     bitmap = RPG::Cache.icon(item.icon_name)
  86.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  87.     self.contents.font.color = text_color(item.name_color_66RPG)
  88.     self.contents.draw_text(x + 28, y, 212, 32, item.name.to_s)
  89.   end
  90. end
  91. # ——————————————————————————————————————
  92. # 本脚本原创自[url]www.66rpg.com[/url],转载请保留此信息
  93. # ——————————————————————————————————————
  94. class Window_Item
  95.  
  96.   #--------------------------------------------------------------------------
  97.   # ● 描绘项目
  98.   #     index : 项目编号
  99.   #--------------------------------------------------------------------------
  100.   def draw_item(index)
  101.     item = @data[index]
  102.     case item
  103.     when RPG::Item
  104.       number = $game_party.item_number(item.id)
  105.     when RPG::Weapon
  106.       number = $game_party.weapon_number(item.id)
  107.     when RPG::Armor
  108.       number = $game_party.armor_number(item.id)
  109.     end
  110.     if item.is_a?(RPG::Item) and
  111.        $game_party.item_can_use?(item.id)
  112.       self.contents.font.color = text_color(item.name_color_66RPG)
  113.     else
  114.       self.contents.font.color = disabled_color
  115.     end
  116.     x = 4 + index % 2 * (288 + 32)
  117.     y = index / 2 * 32
  118.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  119.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  120.     bitmap = RPG::Cache.icon(item.icon_name)
  121.     opacity = self.contents.font.color == disabled_color ? 128 : 255
  122.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  123.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  124.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  125.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  126.   end
  127. end
  128. # ——————————————————————————————————————
  129. # 本脚本原创自[url]www.66rpg.com[/url],转载请保留此信息
  130. # ——————————————————————————————————————
  131. class Window_EquipItem < Window_Selectable
  132.   #--------------------------------------------------------------------------
  133.   # ● 项目的描绘
  134.   #     index : 项目符号
  135.   #--------------------------------------------------------------------------
  136.   def draw_item(index)
  137.     item = @data[index]
  138.     x = 4 + index % 2 * (0)
  139.     y = index / 1 * 32
  140.     case item
  141.     when RPG::Weapon
  142.       number = $game_party.weapon_number(item.id)
  143.     when RPG::Armor
  144.       number = $game_party.armor_number(item.id)
  145.     end
  146.     bitmap = RPG::Cache.icon(item.icon_name)
  147.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  148.     self.contents.font.color = text_color(item.name_color_66RPG)
  149.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  150.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  151.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  152.   end
  153. end
  154. # ——————————————————————————————————————
  155. # 本脚本原创自[url]www.66rpg.com[/url],转载请保留此信息
  156. # ——————————————————————————————————————
  157. class Window_ShopBuy < Window_Selectable
  158.   #--------------------------------------------------------------------------
  159.   # ● 描绘羡慕
  160.   #     index : 项目编号
  161.   #--------------------------------------------------------------------------
  162.   def draw_item(index)
  163.     item = @data[index]
  164.     # 获取物品所持数
  165.     case item
  166.     when RPG::Item
  167.       number = $game_party.item_number(item.id)
  168.     when RPG::Weapon
  169.       number = $game_party.weapon_number(item.id)
  170.     when RPG::Armor
  171.       number = $game_party.armor_number(item.id)
  172.     end
  173.     # 价格在所持金以下、并且所持数不是 99 的情况下为普通颜色
  174.     # 除此之外的情况设置为无效文字色
  175.     if item.price <= $game_party.gold and number < 99
  176.       self.contents.font.color = text_color(item.name_color_66RPG)
  177.     else
  178.       self.contents.font.color = disabled_color
  179.     end
  180.     x = 4
  181.     y = index * 32
  182.     rect = Rect.new(x, y, self.width - 32, 32)
  183.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  184.     bitmap = RPG::Cache.icon(item.icon_name)
  185.     opacity = self.contents.font.color == disabled_color ? 128 : 255
  186.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  187.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  188.     self.contents.draw_text(x + 240, y, 88, 32, item.price.to_s, 2)
  189.   end
  190. end
  191. # ——————————————————————————————————————
  192. # 本脚本原创自[url]www.66rpg.com[/url],转载请保留此信息
  193. # ——————————————————————————————————————
  194. class Window_ShopSell < Window_Selectable
  195.   #--------------------------------------------------------------------------
  196.   # ● 描绘项目
  197.   #     index : 项目标号
  198.   #--------------------------------------------------------------------------
  199.   def draw_item(index)
  200.     item = @data[index]
  201.     case item
  202.     when RPG::Item
  203.       number = $game_party.item_number(item.id)
  204.     when RPG::Weapon
  205.       number = $game_party.weapon_number(item.id)
  206.     when RPG::Armor
  207.       number = $game_party.armor_number(item.id)
  208.     end
  209.     # 可以卖掉的显示为普通颜色、除此之外设置成无效文字颜色
  210.     if item.price > 0
  211.       self.contents.font.color = text_color(item.name_color_66RPG)
  212.     else
  213.       self.contents.font.color = disabled_color
  214.     end
  215.     x = 4 + index % 2 * (288 + 32)
  216.     y = index / 2 * 32
  217.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  218.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  219.     bitmap = RPG::Cache.icon(item.icon_name)
  220.     opacity = self.contents.font.color == disabled_color ? 128 : 255
  221.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  222.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  223.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  224.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  225.   end
  226. end
  227.  
  228.  
  229. # ——————————————————————————————————————
  230. # 本脚本原创自[url]www.66rpg.com[/url],转载请保留此信息
  231. # ——————————————————————————————————————
  232. class Window_Skill
  233.   #--------------------------------------------------------------------------
  234.   # ● 描绘项目
  235.   #     index : 项目编号
  236.   #--------------------------------------------------------------------------
  237.   def draw_item(index)
  238.     skill = @data[index]
  239.     if @actor.skill_can_use?(skill.id)
  240.       self.contents.font.color = text_color(skill.name_color_66RPG)
  241.     else
  242.       self.contents.font.color = disabled_color
  243.     end
  244.     x = 4 + index % 2 * (288 + 32)
  245.     y = index / 2 * 32
  246.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  247.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  248.     bitmap = RPG::Cache.icon(skill.icon_name)
  249.     opacity = self.contents.font.color == disabled_color ? 128 : 255
  250.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  251.     self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  252.     self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  253.   end
  254. end
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269. #==============================================================================
  270. # ■ Harts_Window_ItemTitle
  271. #==============================================================================
  272.  
  273. class Harts_Window_ItemTitle < Window_Base
  274.   def initialize
  275.     super(0, 0, 160, 64)
  276.     self.contents = Bitmap.new(width - 32, height - 32)
  277.     self.contents.clear
  278.     self.contents.font.color = normal_color
  279.     self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
  280.   end
  281. end
  282.  
  283. #==============================================================================
  284. # ■ Harts_Window_ItemCommand
  285. #==============================================================================
  286.  
  287. class Harts_Window_ItemCommand < Window_Selectable
  288.   attr_accessor :commands
  289.   #--------------------------------------------------------------------------
  290.   # ● 初始化,生成commands窗口
  291.   #--------------------------------------------------------------------------
  292.   def initialize
  293.     super(0, 64, 160, 352)
  294.     self.contents = Bitmap.new(width - 32, height - 32)
  295.     @commands = []
  296.     #————————生成commands窗口
  297.     for i in 1...$data_items.size
  298.       if $game_party.item_number(i) > 0
  299.         push = true
  300.         for com in @commands
  301.           if com == $data_items[i].desc
  302.             push = false
  303.           end
  304.         end
  305.         if push == true
  306.           @commands.push($data_items[i].desc)
  307.         end
  308.       end
  309.     end
  310.     for i in 1...$data_weapons.size
  311.       if $game_party.weapon_number(i) > 0
  312.         push = true
  313.         for com in @commands
  314.           if com == $data_weapons[i].desc
  315.             push = false
  316.           end
  317.         end
  318.         if push == true
  319.           @commands.push($data_weapons[i].desc)
  320.         end
  321.       end
  322.     end
  323.     for i in 1...$data_armors.size
  324.       if $game_party.armor_number(i) > 0
  325.         push = true
  326.         for com in @commands
  327.           if com == $data_armors[i].desc
  328.             push = false
  329.           end
  330.         end
  331.         if push == true
  332.           @commands.push($data_armors[i].desc)
  333.         end
  334.       end
  335.     end
  336.     if @commands == []
  337.       @commands.push("普通物品")
  338.     end      
  339.     @item_max = @commands.size
  340.     refresh
  341.     self.index = 0
  342.   end
  343.   #--------------------------------------------------------------------------
  344.   #--------------------------------------------------------------------------
  345.   def refresh
  346.     self.contents.clear
  347.     for i in 0...@item_max
  348.       draw_item(i, normal_color)
  349.     end
  350.   end
  351.   #--------------------------------------------------------------------------
  352.   #--------------------------------------------------------------------------
  353.   def draw_item(index, color)
  354.     self.contents.font.color = color
  355.     y = index * 32
  356.     self.contents.draw_text(4, y, 128, 32, @commands[index])
  357.   end
  358.   #--------------------------------------------------------------------------
  359.   # 只描绘原文字
  360.   #--------------------------------------------------------------------------
  361.   def update_help
  362.     @help_window.set_text(@commands[self.index])
  363.   end
  364. end
  365.  
  366. #==============================================================================
  367. # ■ Window_Item
  368. #==============================================================================
  369.  
  370. class Harts_Window_ItemList < Window_Selectable
  371.   #--------------------------------------------------------------------------
  372.   #--------------------------------------------------------------------------
  373.   def initialize
  374.     super(160, 0, 480, 416)
  375.     refresh
  376.     self.index = 0
  377.   end
  378.   #--------------------------------------------------------------------------
  379.   #--------------------------------------------------------------------------
  380.   def item
  381.     return @data[self.index]
  382.   end
  383.   #--------------------------------------------------------------------------
  384.   #--------------------------------------------------------------------------
  385.   def refresh
  386.     if self.contents != nil
  387.       self.contents.dispose
  388.       self.contents = nil
  389.     end
  390.     @data = []
  391.   end
  392.   #--------------------------------------------------------------------------
  393.   #--------------------------------------------------------------------------
  394.   def set_item(command)
  395.     refresh
  396.     for i in 1...$data_items.size
  397.       if $game_party.item_number(i) > 0 and $data_items[i].desc == command
  398.         @data.push($data_items[i])
  399.       end
  400.     end
  401.     for i in 1...$data_weapons.size
  402.       if $game_party.weapon_number(i) > 0 and $data_weapons[i].desc == command
  403.         @data.push($data_weapons[i])
  404.       end
  405.     end
  406.     for i in 1...$data_armors.size
  407.       if $game_party.armor_number(i) > 0 and $data_armors[i].desc == command
  408.         @data.push($data_armors[i])
  409.       end
  410.     end
  411.     @item_max = @data.size
  412.     if @item_max > 0
  413.       self.contents = Bitmap.new(width - 32, row_max * 32)
  414.       self.contents.clear
  415.       for i in 0...@item_max
  416.         draw_item(i)
  417.       end
  418.     end
  419.   end
  420.   #--------------------------------------------------------------------------
  421.   #--------------------------------------------------------------------------
  422.   def item_number
  423.     return @item_max
  424.   end
  425.   #--------------------------------------------------------------------------
  426.   #--------------------------------------------------------------------------
  427.   def draw_item(index)
  428.     item = @data[index]
  429.     case item
  430.     when RPG::Item
  431.       number = $game_party.item_number(item.id)
  432.     when RPG::Weapon
  433.       number = $game_party.weapon_number(item.id)
  434.     when RPG::Armor
  435.       number = $game_party.armor_number(item.id)
  436.     end
  437.     if item.is_a?(RPG::Item) and
  438.       $game_party.item_can_use?(item.id)
  439.       self.contents.font.color = normal_color
  440.     else
  441.       self.contents.font.color = disabled_color
  442.     end
  443.     x = 4
  444.     y = index * 32
  445.     bitmap = RPG::Cache.icon(item.icon_name)
  446.     opacity = self.contents.font.color == normal_color ? 255 : 128
  447.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  448.     self.contents.font.color = text_color(item.name_color_66RPG)
  449.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  450.     self.contents.font.color = normal_color
  451.     self.contents.draw_text(x + 400, y, 16, 32, ":", 1)
  452.     self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2)
  453.   end
  454.   #--------------------------------------------------------------------------
  455.   #--------------------------------------------------------------------------
  456.   def update_help
  457.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  458.   end
  459. end
  460.  
  461. #==============================================================================
  462. # ■ Harts_Scene_Item
  463. #==============================================================================
  464.  
  465. class Scene_Item
  466.   #--------------------------------------------------------------------------
  467.   #--------------------------------------------------------------------------
  468.   def main
  469.     @itemtitle_window = Harts_Window_ItemTitle.new
  470.     @itemcommand_window = Harts_Window_ItemCommand.new
  471.     @command_index = @itemcommand_window.index
  472.     @itemlist_window = Harts_Window_ItemList.new
  473.     @itemlist_window.active = false
  474.     @help_window = Window_Help.new
  475.     @help_window.x = 0
  476.     @help_window.y = 416
  477.     @itemcommand_window.help_window = @help_window
  478.     @itemlist_window.help_window = @help_window
  479.     @target_window = Window_Target.new
  480.     @target_window.visible = false
  481.     @target_window.active = false
  482.     @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  483.     Graphics.transition
  484.     loop do
  485.       Graphics.update
  486.       Input.update
  487.       update
  488.       if $scene != self
  489.         break
  490.       end
  491.     end
  492.     Graphics.freeze
  493.     @itemtitle_window.dispose
  494.     @itemcommand_window.dispose
  495.     @itemlist_window.dispose
  496.     @help_window.dispose
  497.     @target_window.dispose
  498.   end
  499.   #--------------------------------------------------------------------------
  500.   #--------------------------------------------------------------------------
  501.   def update
  502.     @itemtitle_window.update
  503.     @itemcommand_window.update
  504.     @itemlist_window.update
  505.     @help_window.update
  506.     @target_window.update
  507.     if @command_index != @itemcommand_window.index
  508.       @command_index = @itemcommand_window.index
  509.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  510.     end
  511.     if @itemcommand_window.active
  512.       update_itemcommand
  513.       return
  514.     end
  515.     if @itemlist_window.active
  516.       update_itemlist
  517.       return
  518.     end
  519.     if @target_window.active
  520.       update_target
  521.       return
  522.     end
  523.   end
  524.   #--------------------------------------------------------------------------
  525.   #--------------------------------------------------------------------------
  526.   def update_itemcommand
  527.     if Input.trigger?(Input::B)
  528.       $game_system.se_play($data_system.cancel_se)
  529.       $scene = Scene_Menu.new(0)
  530.       return
  531.     end
  532.     if Input.trigger?(Input::C)
  533.       if @itemlist_window.item_number == 0
  534.         $game_system.se_play($data_system.buzzer_se)
  535.         return
  536.       end
  537.       $game_system.se_play($data_system.decision_se)
  538.       @itemcommand_window.active = false
  539.       @itemlist_window.active = true
  540.       @itemlist_window.index = 0
  541.       return
  542.     end
  543.   end
  544.   #--------------------------------------------------------------------------
  545.   #--------------------------------------------------------------------------
  546.   def update_itemlist
  547.     if Input.trigger?(Input::B)
  548.       $game_system.se_play($data_system.cancel_se)
  549.       @itemcommand_window.active = true
  550.       @itemlist_window.active = false
  551.       @itemlist_window.index = 0
  552.       @itemcommand_window.index = @command_index
  553.       return
  554.     end
  555.     if Input.trigger?(Input::C)
  556.       @item = @itemlist_window.item
  557.       unless @item.is_a?(RPG::Item)
  558.         $game_system.se_play($data_system.buzzer_se)
  559.         return
  560.       end
  561.       unless $game_party.item_can_use?(@item.id)
  562.         $game_system.se_play($data_system.buzzer_se)
  563.         return
  564.       end
  565.       $game_system.se_play($data_system.decision_se)
  566.       if @item.scope >= 3
  567.         @itemlist_window.active = false
  568.         @target_window.x = 304
  569.         @target_window.visible = true
  570.         @target_window.active = true
  571.         if @item.scope == 4 || @item.scope == 6
  572.           @target_window.index = -1
  573.         else
  574.           @target_window.index = 0
  575.         end
  576.       else
  577.         if @item.common_event_id > 0
  578.           $game_temp.common_event_id = @item.common_event_id
  579.           $game_system.se_play(@item.menu_se)
  580.             if @item.consumable
  581.               $game_party.lose_item(@item.id, 1)
  582.               @itemlist_window.draw_item(@itemlist_window.index)
  583.             end
  584.           $scene = Scene_Map.new
  585.           return
  586.         end
  587.       end
  588.       return
  589.     end
  590.   end
  591.   #--------------------------------------------------------------------------
  592.   #--------------------------------------------------------------------------
  593.   def update_target
  594.     if Input.trigger?(Input::B)
  595.       $game_system.se_play($data_system.cancel_se)
  596.       unless $game_party.item_can_use?(@item.id)
  597.         @itemlist_window.refresh
  598.       end
  599.       @itemlist_window.active = true
  600.       @target_window.visible = false
  601.       @target_window.active = false
  602.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  603.       return
  604.     end
  605.     if Input.trigger?(Input::C)
  606.       if $game_party.item_number(@item.id) == 0
  607.         $game_system.se_play($data_system.buzzer_se)
  608.         return
  609.       end
  610.       if @target_window.index == -1
  611.         used = false
  612.         for i in $game_party.actors
  613.           used |= i.item_effect(@item)
  614.         end
  615.       end
  616.       if @target_window.index >= 0
  617.         target = $game_party.actors[@target_window.index]
  618.         used = target.item_effect(@item)
  619.       end
  620.       if used
  621.         $game_system.se_play(@item.menu_se)
  622.         if @item.consumable
  623.           $game_party.lose_item(@item.id, 1)
  624.           @itemlist_window.draw_item(@itemlist_window.index)
  625.           @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  626.         end
  627.         @target_window.refresh
  628.         if $game_party.all_dead?
  629.           $scene = Scene_Gameover.new
  630.           return
  631.         end
  632.         if @item.common_event_id > 0
  633.           $game_temp.common_event_id = @item.common_event_id
  634.           $scene = Scene_Map.new
  635.           return
  636.         end
  637.       end
  638.       unless used
  639.         $game_system.se_play($data_system.buzzer_se)
  640.       end
  641.     return
  642.     end
  643.   end
  644. end
  645. =begin
  646. #==============================================================================
  647. # ■ RPG追加定义,使用@符号分类
  648. #==============================================================================
  649. module RPG
  650.   class Weapon
  651.     def description
  652.       description = @description.split(/·/)[0]
  653.       return description != nil ? description : ''
  654.     end
  655.     def desc
  656.       desc = @description.split(/·/)[1]
  657.       return desc != nil ? desc : "普通物品"
  658.     end
  659.   end
  660.   class Item
  661.     def description
  662.       description = @description.split(/·/)[0]
  663.       return description != nil ? description : ''
  664.     end
  665.     def desc
  666.       desc = @description.split(/·/)[1]
  667.       return desc != nil ? desc : "普通物品"
  668.     end
  669.   end
  670. end
  671. =end

两个脚本是一起使用的,但是用不来,求大神教。。。

Lv4.逐梦者

梦石
3
星屑
6420
在线时间
1131 小时
注册时间
2007-12-26
帖子
2402
2
发表于 2015-3-14 09:16:01 | 只看该作者
数据库的说明后面,加@6,@4一类的符号试试
囡囚囨囚囨図囨囧
回复 支持 反对

使用道具 举报

Lv4.逐梦者 (版主)

梦石
0
星屑
9532
在线时间
5073 小时
注册时间
2013-6-21
帖子
3580

开拓者贵宾剧作品鉴家

3
发表于 2015-3-14 09:24:22 | 只看该作者
看样子是三个脚本整合到了一起。
物品颜色脚本+物品分类脚本+装备说明显示变量脚本。
使用的时候用'@'符合分隔说明文字,例如把回复剂的颜色设置为黄色,分类为“药品”,就这样写:
回复HP100点@药品@6
如果要省略颜色(缺省情况为白色)就这样写:
回复HP100点@药品
如果要省略颜色和分类(分类缺省情况为“普通物品”)就直接写自定义的说明就好。
不能只省略分类而不省略颜色。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
56
在线时间
155 小时
注册时间
2015-1-10
帖子
157
4
 楼主| 发表于 2015-3-14 09:44:22 | 只看该作者
RyanBern 发表于 2015-3-14 09:24
看样子是三个脚本整合到了一起。
物品颜色脚本+物品分类脚本+装备说明显示变量脚本。
使用的时候用'@'符合 ...



分类怎么弄,如果按照你的方法,那样药品不都就没名字了?都叫“药品”了?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
56
在线时间
155 小时
注册时间
2015-1-10
帖子
157
5
 楼主| 发表于 2015-3-14 09:45:59 | 只看该作者
RyanBern 发表于 2015-3-14 09:24
看样子是三个脚本整合到了一起。
物品颜色脚本+物品分类脚本+装备说明显示变量脚本。
使用的时候用'@'符合 ...

是要改脚本吗?
回复 支持 反对

使用道具 举报

Lv4.逐梦者 (版主)

梦石
0
星屑
9532
在线时间
5073 小时
注册时间
2013-6-21
帖子
3580

开拓者贵宾剧作品鉴家

6
发表于 2015-3-14 10:12:50 | 只看该作者
小孩纸大呵呵 发表于 2015-3-14 09:45
是要改脚本吗?

不需要改脚本,设置方式如下:

效果如图

评分

参与人数 1梦石 +1 收起 理由
myownroc + 1 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
56
在线时间
155 小时
注册时间
2015-1-10
帖子
157
7
 楼主| 发表于 2015-3-14 10:17:57 | 只看该作者
RyanBern 发表于 2015-3-14 10:12
不需要改脚本,设置方式如下:

效果如图

谢谢,已经解决!
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9280
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

8
发表于 2015-3-14 11:58:54 | 只看该作者
description的意思是介绍,这个脚本是让你在物品的介绍的结尾加@XXX什么的然后获取物品名字的颜色···
那么问题解决了···@hys11111 @RyanBernQ

点评

你是不是又没仔细看脚本  发表于 2015-3-14 12:21
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-22 21:18

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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