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

Project1

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

[已经解决] xp整合系统(20项脚本)中的10物品分类如何自定义?

[复制链接]

Lv3.寻梦者

梦石
3
星屑
261
在线时间
223 小时
注册时间
2012-8-18
帖子
143
跳转到指定楼层
1
发表于 2014-5-18 23:20:13 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 ccqtxwd 于 2014-5-18 23:21 编辑

系统见https://rpg.blue/forum.php?mod=v ... amp;authorid=298774
我不知道如何自定义分类,作者说是加@,但具体我还是不会,怎么添加分类,是输入什么设置一个物品是一个分类的?
请教教我如何使用这个脚本的自定义功能
RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4.  
  5.  
  6. #==============================================================================
  7. # ■ Harts_Window_ItemTitle
  8. #==============================================================================
  9.  
  10. class Harts_Window_ItemTitle < Window_Base
  11.   def initialize
  12.     super(0, 0, 160, 64)
  13.     self.contents = Bitmap.new(width - 32, height - 32)
  14.     self.contents.clear
  15.     self.contents.font.color = normal_color
  16.     self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
  17.   end
  18. end
  19.  
  20. #==============================================================================
  21. # ■ Harts_Window_ItemCommand
  22. #==============================================================================
  23.  
  24. class Harts_Window_ItemCommand < Window_Selectable
  25.   attr_accessor :commands
  26.   #--------------------------------------------------------------------------
  27.   # ● 初始化,生成commands窗口
  28.   #--------------------------------------------------------------------------
  29.   def initialize
  30.     super(0, 64, 160, 352)
  31.     @commands = []
  32.     #————————生成commands窗口
  33.     for i in 1...$data_items.size
  34.       if $game_party.item_number(i) > 0
  35.         push = true
  36.         for com in @commands
  37.           if com == $data_items[i].desc
  38.             push = false
  39.           end
  40.         end
  41.         if push == true
  42.           @commands.push($data_items[i].desc)
  43.         end
  44.       end
  45.     end
  46.     for i in 1...$data_weapons.size
  47.       if $game_party.weapon_number(i) > 0
  48.         push = true
  49.         for com in @commands
  50.           if com == $data_weapons[i].desc
  51.             push = false
  52.           end
  53.         end
  54.         if push == true
  55.           @commands.push($data_weapons[i].desc)
  56.         end
  57.       end
  58.     end
  59.     for i in 1...$data_armors.size
  60.       if $game_party.armor_number(i) > 0
  61.         push = true
  62.         for com in @commands
  63.           if com == $data_armors[i].desc
  64.             push = false
  65.           end
  66.         end
  67.         if push == true
  68.           @commands.push($data_armors[i].desc)
  69.         end
  70.       end
  71.     end
  72.     if @commands == []
  73.       @commands.push("普通物品")
  74.     end      
  75.     @item_max = @commands.size
  76.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  77.     refresh
  78.     self.index = 0
  79.   end
  80.   #--------------------------------------------------------------------------
  81.   #--------------------------------------------------------------------------
  82.   def refresh
  83.     self.contents.clear
  84.     for i in 0...@item_max
  85.       draw_item(i, normal_color)
  86.     end
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   #--------------------------------------------------------------------------
  90.   def draw_item(index, color)
  91.     self.contents.font.color = color
  92.     y = index * 32
  93.     self.contents.draw_text(4, y, 128, 32, @commands[index])
  94.   end
  95.   #--------------------------------------------------------------------------
  96.   # 只描绘原文字
  97.   #--------------------------------------------------------------------------
  98.   def update_help
  99.     @help_window.set_text(@commands[self.index])
  100.   end
  101. end
  102.  
  103. #==============================================================================
  104. # ■ Window_Item
  105. #==============================================================================
  106.  
  107. class Harts_Window_ItemList < Window_Selectable
  108.   #--------------------------------------------------------------------------
  109.   #--------------------------------------------------------------------------
  110.   def initialize
  111.     super(160, 0, 480, 416)
  112.     refresh
  113.     self.index = 0
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   #--------------------------------------------------------------------------
  117.   def item
  118.     return @data[self.index]
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   #--------------------------------------------------------------------------
  122.   def refresh
  123.     if self.contents != nil
  124.       self.contents.dispose
  125.       self.contents = nil
  126.     end
  127.     @data = []
  128.   end
  129.   #--------------------------------------------------------------------------
  130.   #--------------------------------------------------------------------------
  131.   def set_item(command)
  132.     refresh
  133.     for i in 1...$data_items.size
  134.       if $game_party.item_number(i) > 0 and $data_items[i].desc == command
  135.         @data.push($data_items[i])
  136.       end
  137.     end
  138.     for i in 1...$data_weapons.size
  139.       if $game_party.weapon_number(i) > 0 and $data_weapons[i].desc == command
  140.         @data.push($data_weapons[i])
  141.       end
  142.     end
  143.     for i in 1...$data_armors.size
  144.       if $game_party.armor_number(i) > 0 and $data_armors[i].desc == command
  145.         @data.push($data_armors[i])
  146.       end
  147.     end
  148.     @item_max = @data.size
  149.     if @item_max > 0
  150.       self.contents = Bitmap.new(width - 32, row_max * 32)
  151.       self.contents.clear
  152.       for i in 0...@item_max
  153.         draw_item(i)
  154.       end
  155.     end
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   #--------------------------------------------------------------------------
  159.   def item_number
  160.     return @item_max
  161.   end
  162.   #--------------------------------------------------------------------------
  163.   #--------------------------------------------------------------------------
  164.   def draw_item(index)
  165.     item = @data[index]
  166.     case item
  167.     when RPG::Item
  168.       number = $game_party.item_number(item.id)
  169.     when RPG::Weapon
  170.       number = $game_party.weapon_number(item.id)
  171.     when RPG::Armor
  172.       number = $game_party.armor_number(item.id)
  173.     end
  174.     if item.is_a?(RPG::Item) and
  175.       $game_party.item_can_use?(item.id)
  176.       self.contents.font.color = normal_color
  177.     else
  178.       self.contents.font.color = disabled_color
  179.     end
  180.     x = 4
  181.     y = index * 32
  182.     bitmap = RPG::Cache.icon(item.icon_name)
  183.     opacity = self.contents.font.color == normal_color ? 255 : 128
  184.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  185.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  186.     self.contents.draw_text(x + 400, y, 16, 32, ":", 1)
  187.     self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2)
  188.   end
  189.   #--------------------------------------------------------------------------
  190.   #--------------------------------------------------------------------------
  191.   def update_help
  192.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  193.   end
  194. end
  195.  
  196. #==============================================================================
  197. # ■ Harts_Scene_Item
  198. #==============================================================================
  199.  
  200. class Scene_Item
  201.   #--------------------------------------------------------------------------
  202.   #--------------------------------------------------------------------------
  203.   def main
  204.     @itemtitle_window = Harts_Window_ItemTitle.new
  205.     @itemcommand_window = Harts_Window_ItemCommand.new
  206.     @command_index = @itemcommand_window.index
  207.     @itemlist_window = Harts_Window_ItemList.new
  208.     @itemlist_window.active = false
  209.     @help_window = Window_Help.new
  210.     @help_window.x = 0
  211.     @help_window.y = 416
  212.     @itemcommand_window.help_window = @help_window
  213.     @itemlist_window.help_window = @help_window
  214.     @target_window = Window_Target.new
  215.     @target_window.visible = false
  216.     @target_window.active = false
  217.     @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  218.     Graphics.transition
  219.     loop do
  220.       Graphics.update
  221.       Input.update
  222.       update
  223.       if $scene != self
  224.         break
  225.       end
  226.     end
  227.     Graphics.freeze
  228.     @itemtitle_window.dispose
  229.     @itemcommand_window.dispose
  230.     @itemlist_window.dispose
  231.     @help_window.dispose
  232.     @target_window.dispose
  233.   end
  234.   #--------------------------------------------------------------------------
  235.   #--------------------------------------------------------------------------
  236.   def update
  237.     @itemtitle_window.update
  238.     @itemcommand_window.update
  239.     @itemlist_window.update
  240.     @help_window.update
  241.     @target_window.update
  242.     if @command_index != @itemcommand_window.index
  243.       @command_index = @itemcommand_window.index
  244.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  245.     end
  246.     if @itemcommand_window.active
  247.       update_itemcommand
  248.       return
  249.     end
  250.     if @itemlist_window.active
  251.       update_itemlist
  252.       return
  253.     end
  254.     if @target_window.active
  255.       update_target
  256.       return
  257.     end
  258.   end
  259.   #--------------------------------------------------------------------------
  260.   #--------------------------------------------------------------------------
  261.   def update_itemcommand
  262.     if Input.trigger?(Input::B)
  263.       $game_system.se_play($data_system.cancel_se)
  264.       $scene = Scene_Menu.new(0)
  265.       return
  266.     end
  267.     if Input.trigger?(Input::C)
  268.       if @itemlist_window.item_number == 0
  269.         $game_system.se_play($data_system.buzzer_se)
  270.         return
  271.       end
  272.       $game_system.se_play($data_system.decision_se)
  273.       @itemcommand_window.active = false
  274.       @itemlist_window.active = true
  275.       @itemlist_window.index = 0
  276.       return
  277.     end
  278.   end
  279.   #--------------------------------------------------------------------------
  280.   #--------------------------------------------------------------------------
  281.   def update_itemlist
  282.     if Input.trigger?(Input::B)
  283.       $game_system.se_play($data_system.cancel_se)
  284.       @itemcommand_window.active = true
  285.       @itemlist_window.active = false
  286.       @itemlist_window.index = 0
  287.       @itemcommand_window.index = @command_index
  288.       return
  289.     end
  290.     if Input.trigger?(Input::C)
  291.       @item = @itemlist_window.item
  292.       unless @item.is_a?(RPG::Item)
  293.         $game_system.se_play($data_system.buzzer_se)
  294.         return
  295.       end
  296.       unless $game_party.item_can_use?(@item.id)
  297.         $game_system.se_play($data_system.buzzer_se)
  298.         return
  299.       end
  300.       $game_system.se_play($data_system.decision_se)
  301.       if @item.scope >= 3
  302.         @itemlist_window.active = false
  303.         @target_window.x = 304
  304.         @target_window.visible = true
  305.         @target_window.active = true
  306.         if @item.scope == 4 || @item.scope == 6
  307.           @target_window.index = -1
  308.         else
  309.           @target_window.index = 0
  310.         end
  311.       else
  312.         if @item.common_event_id > 0
  313.           $game_temp.common_event_id = @item.common_event_id
  314.           $game_system.se_play(@item.menu_se)
  315.             if @item.consumable
  316.               $game_party.lose_item(@item.id, 1)
  317.               @itemlist_window.draw_item(@itemlist_window.index)
  318.             end
  319.           $scene = Scene_Map.new
  320.           return
  321.         end
  322.       end
  323.       return
  324.     end
  325.   end
  326.   #--------------------------------------------------------------------------
  327.   #--------------------------------------------------------------------------
  328.   def update_target
  329.     if Input.trigger?(Input::B)
  330.       $game_system.se_play($data_system.cancel_se)
  331.       unless $game_party.item_can_use?(@item.id)
  332.         @itemlist_window.refresh
  333.       end
  334.       @itemlist_window.active = true
  335.       @target_window.visible = false
  336.       @target_window.active = false
  337.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  338.       return
  339.     end
  340.     if Input.trigger?(Input::C)
  341.       if $game_party.item_number(@item.id) == 0
  342.         $game_system.se_play($data_system.buzzer_se)
  343.         return
  344.       end
  345.       if @target_window.index == -1
  346.         used = false
  347.         for i in $game_party.actors
  348.           used |= i.item_effect(@item)
  349.         end
  350.       end
  351.       if @target_window.index >= 0
  352.         target = $game_party.actors[@target_window.index]
  353.         used = target.item_effect(@item)
  354.       end
  355.       if used
  356.         $game_system.se_play(@item.menu_se)
  357.         if @item.consumable
  358.           $game_party.lose_item(@item.id, 1)
  359.           @itemlist_window.draw_item(@itemlist_window.index)
  360.           @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  361.         end
  362.         @target_window.refresh
  363.         if $game_party.all_dead?
  364.           $scene = Scene_Gameover.new
  365.           return
  366.         end
  367.         if @item.common_event_id > 0
  368.           $game_temp.common_event_id = @item.common_event_id
  369.           $scene = Scene_Map.new
  370.           return
  371.         end
  372.       end
  373.       unless used
  374.         $game_system.se_play($data_system.buzzer_se)
  375.       end
  376.     return
  377.     end
  378.   end
  379. end
  380.  
  381. #==============================================================================
  382. # ■ RPG追加定义,使用@符号分类
  383. #==============================================================================
  384.  
  385. module RPG
  386.   class Weapon
  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 Item
  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.   class Armor
  407.     def description
  408.       description = @description.split(/@/)[0]
  409.       return description != nil ? description : ''
  410.     end
  411.     def desc
  412.       desc = @description.split(/@/)[1]
  413.       return desc != nil ? desc : "普通物品"
  414.     end
  415.   end
  416. end
  417.  
  418. #==============================================================================
  419. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  420. #==============================================================================

评分

参与人数 1星屑 +35 收起 理由
天地有正气 + 35 手动认可奖励

查看全部评分

取名不慎,我的名字是BobCheng,做游戏什么的,其实是安慰自己而已。
很烧脑的推理游戏
猜不到结局的故事

Lv5.捕梦者

梦石
0
星屑
33071
在线时间
5103 小时
注册时间
2012-11-19
帖子
4878

开拓者

2
发表于 2014-5-19 07:25:52 | 只看该作者
在 物品/武器/防具 的说明后面,加上一个 @ 符号,后面写该物品的分类名。
分类名可随便写,比如:任务物品,珍贵物品,,,等。没写分类名的,默认为普通物品。

评分

参与人数 2星屑 +80 收起 理由
天地有正气 + 70 认可答案
邪月长啸 + 10 我很赞同

查看全部评分

xp vx va mv  va mz 各类型脚本/插件定制
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
211
在线时间
845 小时
注册时间
2014-5-5
帖子
944
3
发表于 2014-5-19 12:45:09 | 只看该作者
芯大已经解答了
那我就补充张图吧

QQ图片20140519124417.jpg (9.6 KB, 下载次数: 8)

QQ图片20140519124417.jpg

评分

参与人数 1星屑 +70 收起 理由
天地有正气 + 70 我很赞同

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-21 21:43

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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