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

Project1

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

[已经解决] 道具分类 分类栏 显示 (2VIP)

[复制链接]

Lv5.捕梦者

梦石
0
星屑
35138
在线时间
4164 小时
注册时间
2007-12-15
帖子
10061
跳转到指定楼层
1
发表于 2012-5-11 09:10:22 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 忧雪の伤 于 2012-5-12 12:09 编辑


如图所示 用高级物品分类脚本
如果道具分类超过一页情况,向下拉动后,左侧分类栏目名称不显示 但是底下的说明有显示 请问如何修改。

脚本如下
  1. # ————————————————————————————————————
  2. # 本脚本来自[url]www.66rpg.com[/url],转载请保留此信息
  3. # ————————————————————————————————————

  4. #==============================================================================
  5. # ■ Harts_Window_ItemTitle
  6. #==============================================================================

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

  16. #==============================================================================
  17. # ■ Harts_Window_ItemCommand
  18. #==============================================================================

  19. class Harts_Window_ItemCommand < Window_Selectable
  20.   attr_accessor :commands
  21.   #--------------------------------------------------------------------------
  22.   # ● 初始化,生成commands窗口
  23.   #--------------------------------------------------------------------------
  24.   def initialize
  25.     super(0, 64, 160, 352)
  26.     self.contents = Bitmap.new(width - 32, height - 32)
  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.     refresh
  73.     self.index = 0
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   #--------------------------------------------------------------------------
  77.   def refresh
  78.     self.contents.clear
  79.     for i in 0...@item_max
  80.       draw_item(i, normal_color)
  81.     end
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   #--------------------------------------------------------------------------
  85.   def draw_item(index, color)
  86.     self.contents.font.color = color
  87.     y = index * 32
  88.     self.contents.draw_text(4, y, 128, 32, @commands[index])
  89.   end
  90.   #--------------------------------------------------------------------------
  91.   # 只描绘原文字
  92.   #--------------------------------------------------------------------------
  93.   def update_help
  94.     @help_window.set_text(@commands[self.index])
  95.   end
  96. end

  97. #==============================================================================
  98. # ■ Window_Item
  99. #==============================================================================

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

  188. #==============================================================================
  189. # ■ Harts_Scene_Item
  190. #==============================================================================

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

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

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


复制代码

评分

参与人数 1星屑 +10 收起 理由
忧雪の伤 + 10 code 收费

查看全部评分

Lv1.梦旅人

梦石
0
星屑
50
在线时间
53 小时
注册时间
2011-11-13
帖子
67
2
发表于 2012-5-11 10:05:38 | 只看该作者
你可以像猪一样的生活,但你永远都不能像猪那样快乐!

帮顶

评分

参与人数 1星屑 -20 收起 理由
zhixin1997 -20

查看全部评分

奇迹も、魔法も、あるんだよ
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
49
在线时间
186 小时
注册时间
2012-5-8
帖子
987
3
发表于 2012-5-11 12:29:21 | 只看该作者
这个应该是自动分类的,只要你的物品或防具或武器,加好备注就好了,可以往下拉动的,备注@:
看什么看,没看过大坑啊!
-------------------------炫翼-----------------------------
剧情:4%
地图:2%
系统:7%
优化:3%
脚本:25%
--------------------------炫翼----------------------------

      工作室


广告位招租....  
回复

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
35138
在线时间
4164 小时
注册时间
2007-12-15
帖子
10061
4
 楼主| 发表于 2012-5-11 14:13:10 | 只看该作者
每样道具后面的备注都有了,目前问题就在于分类过多的时候,就会出现如首帖所示现象,
饰品此类描述虽然在最下方窗口中现实,但是没有在左侧分类栏中现实出来。
虽然不影响使用,不过前面空着很难看- -
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
49
在线时间
186 小时
注册时间
2012-5-8
帖子
987
5
发表于 2012-5-12 12:07:20 | 只看该作者
那我们可以把一些类型一样的装备该更改成一样的备注,
节约空间,就可以显示别的分类类型了,
或者在不需要的类型面前加上:@.
他就不会显示了。
看什么看,没看过大坑啊!
-------------------------炫翼-----------------------------
剧情:4%
地图:2%
系统:7%
优化:3%
脚本:25%
--------------------------炫翼----------------------------

      工作室


广告位招租....  
回复

使用道具 举报

Lv3.寻梦者

双子人

梦石
0
星屑
3175
在线时间
3617 小时
注册时间
2009-4-4
帖子
4154

开拓者

6
发表于 2012-5-12 12:27:49 | 只看该作者
本帖最后由 hys111111 于 2012-5-12 12:32 编辑
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================


  4. #==============================================================================
  5. # ■ Harts_Window_ItemTitle
  6. #==============================================================================

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

  16. #==============================================================================
  17. # ■ Harts_Window_ItemCommand
  18. #==============================================================================

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

  99. #==============================================================================
  100. # ■ Window_Item
  101. #==============================================================================

  102. class Harts_Window_ItemList < Window_Selectable
  103.   #--------------------------------------------------------------------------
  104.   #--------------------------------------------------------------------------
  105.   def initialize
  106.     super(160, 0, 480, 416)
  107.     refresh
  108.     self.index = 0
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   #--------------------------------------------------------------------------
  112.   def item
  113.     return @data[self.index]
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   #--------------------------------------------------------------------------
  117.   def refresh
  118.     if self.contents != nil
  119.       self.contents.dispose
  120.       self.contents = nil
  121.     end
  122.     @data = []
  123.   end
  124.   #--------------------------------------------------------------------------
  125.   #--------------------------------------------------------------------------
  126.   def set_item(command)
  127.     refresh
  128.     for i in 1...$data_items.size
  129.       if $game_party.item_number(i) > 0 and $data_items[i].desc == command
  130.         @data.push($data_items[i])
  131.       end
  132.     end
  133.     for i in 1...$data_weapons.size
  134.       if $game_party.weapon_number(i) > 0 and $data_weapons[i].desc == command
  135.         @data.push($data_weapons[i])
  136.       end
  137.     end
  138.     for i in 1...$data_armors.size
  139.       if $game_party.armor_number(i) > 0 and $data_armors[i].desc == command
  140.         @data.push($data_armors[i])
  141.       end
  142.     end
  143.     @item_max = @data.size
  144.     if @item_max > 0
  145.       self.contents = Bitmap.new(width - 32, row_max * 32)
  146.       self.contents.clear
  147.       for i in 0...@item_max
  148.         draw_item(i)
  149.       end
  150.     end
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   #--------------------------------------------------------------------------
  154.   def item_number
  155.     return @item_max
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   #--------------------------------------------------------------------------
  159.   def draw_item(index)
  160.     item = @data[index]
  161.     #—— 取得具体物品数量 ——
  162.     case item
  163.     when RPG::Item
  164.       number = $game_party.item_number(item.id)
  165.     when RPG::Weapon
  166.       number = $game_party.weapon_number(item.id)
  167.     when RPG::Armor
  168.       number = $game_party.armor_number(item.id)
  169.     end
  170.     #—— 给出物品的颜色 ——
  171.     if item.is_a?(RPG::Item)
  172.       if $game_party.item_can_use?(item.id)
  173.         self.contents.font.color = normal_color
  174.       else
  175.         self.contents.font.color = disabled_color
  176.       end
  177.     else
  178.       if item.is_a?(RPG::Weapon)#武器不能装备用灰色
  179.         if $data_classes[$data_actors[$game_variables[1]+1].class_id].weapon_set.include?(item.id)
  180.           self.contents.font.color = normal_color
  181.         else
  182.           self.contents.font.color = disabled_color
  183.          end
  184.       end

  185.       if item.is_a?(RPG::Armor)#防具不能装备用灰色
  186.         if $data_classes[$data_actors[$game_variables[1]+1].class_id].armor_set.include?(item.id)
  187.           self.contents.font.color = normal_color
  188.         else
  189.           self.contents.font.color = disabled_color
  190.          end
  191.       end
  192.     end

  193.     x = 4
  194.     y = index * 32
  195.     bitmap = RPG::Cache.icon(item.icon_name)
  196.     opacity = self.contents.font.color == normal_color ? 255 : 128
  197.     self.contents.blt(x, y , bitmap, Rect.new(0, 0, 32, 32), opacity)#物品图标用32*32
  198.     self.contents.draw_text(x + 40, y, 212, 32, item.name, 0)
  199.     self.contents.draw_text(x + 240, y, 16, 32, "×", 1) if $game_party.item_number(item.id)>1
  200.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2) if $game_party.item_number(item.id)>1
  201.   end
  202.   #--------------------------------------------------------------------------
  203.   #--------------------------------------------------------------------------
  204.   def update_help
  205.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  206.   end
  207. end

  208. #==============================================================================
  209. # ■ Harts_Scene_Item
  210. #==============================================================================

  211. class Scene_Item
  212.   #--------------------------------------------------------------------------
  213.   #--------------------------------------------------------------------------
  214.   def main
  215.     @itemtitle_window = Harts_Window_ItemTitle.new
  216.     @itemcommand_window = Harts_Window_ItemCommand.new
  217.     @command_index = @itemcommand_window.index
  218.     @itemlist_window = Harts_Window_ItemList.new
  219.     @itemlist_window.active = false
  220.     @help_window = Window_Help.new
  221.     @help_window.x = 0
  222.     @help_window.y = 416
  223.     @itemcommand_window.help_window = @help_window
  224.     @itemlist_window.help_window = @help_window
  225.     @target_window = Window_Target.new
  226.     @target_window.visible = false
  227.     @target_window.active = false
  228.     @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  229.     Graphics.transition
  230.     loop do
  231.       Graphics.update
  232.       Input.update
  233.       update
  234.       if $scene != self
  235.         break
  236.       end
  237.     end
  238.     Graphics.freeze
  239.     @itemtitle_window.dispose
  240.     @itemcommand_window.dispose
  241.     @itemlist_window.dispose
  242.     @help_window.dispose
  243.     @target_window.dispose
  244.   end
  245.   #--------------------------------------------------------------------------
  246.   #--------------------------------------------------------------------------
  247.   def update
  248.     @itemtitle_window.update
  249.     @itemcommand_window.update
  250.     @itemlist_window.update
  251.     @help_window.update
  252.     @target_window.update
  253.     if @command_index != @itemcommand_window.index
  254.       @command_index = @itemcommand_window.index
  255.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  256.     end
  257.     if @itemcommand_window.active
  258.       update_itemcommand
  259.       return
  260.     end
  261.     if @itemlist_window.active
  262.       update_itemlist
  263.       return
  264.     end
  265.     if @target_window.active
  266.       update_target
  267.       return
  268.     end
  269.   end
  270.   #--------------------------------------------------------------------------
  271.   #--------------------------------------------------------------------------
  272.   def update_itemcommand
  273.     if Input.trigger?(Input::B)
  274.       $game_system.se_play($data_system.cancel_se)
  275.       $scene = Scene_Map.new
  276. #      $scene = Scene_Menu.new(1)
  277.       return
  278.     end
  279.     if Input.trigger?(Input::C)
  280.       if @itemlist_window.item_number == 0
  281.         $game_system.se_play($data_system.buzzer_se)
  282.         return
  283.       end
  284.       $game_system.se_play($data_system.decision_se)
  285.       @itemcommand_window.active = false
  286.       @itemlist_window.active = true
  287.       @itemlist_window.index = 0
  288.       return
  289.     end
  290.   end
  291.   #--------------------------------------------------------------------------
  292.   #--------------------------------------------------------------------------
  293.   def update_itemlist
  294.     if Input.trigger?(Input::B)
  295.       $game_system.se_play($data_system.cancel_se)
  296.       @itemcommand_window.active = true
  297.       @itemlist_window.active = false
  298.       @itemlist_window.index = 0
  299.       @itemcommand_window.index = @command_index
  300.       return
  301.     end
  302.     if Input.trigger?(Input::C)
  303.       @item = @itemlist_window.item

  304.       
  305.       target_actor = $game_party.actors[0]#@item_target_window_equip.index]
  306.       if target_actor.equippable?(@item)# and $game_party.item_can_equip?(target_actor,@item)
  307.         $scene = Scene_Equip.new
  308.       end
  309. #      unless @item.is_a?(RPG::Item)
  310. #        $game_system.se_play($data_system.buzzer_se)
  311. #        return
  312. #      end
  313.       unless $game_party.item_can_use?(@item.id)
  314.         $game_system.se_play($data_system.buzzer_se)
  315.         return
  316.       end
  317.       $game_system.se_play($data_system.decision_se)
  318.       if @item.scope >= 3
  319.         @itemlist_window.active = false
  320.         @target_window.x = 304
  321.         @target_window.visible = true
  322.         @target_window.active = true
  323.         if @item.scope == 4 || @item.scope == 6
  324.           @target_window.index = -1
  325.         else
  326.           @target_window.index = 0
  327.         end
  328.       else
  329.         if @item.common_event_id > 0
  330.          
  331.           #      #下一句在使用物品时获得物品id
  332.           $game_variables[20] = @item.id
  333.          
  334.           $game_temp.common_event_id = @item.common_event_id
  335.           $game_system.se_play(@item.menu_se)
  336.             if @item.consumable
  337.               $game_party.lose_item(@item.id, 1)
  338.               @itemlist_window.draw_item(@itemlist_window.index)
  339.             end
  340.           $scene = Scene_Map.new
  341.           return
  342.         end
  343.       end
  344.       return
  345.     end
  346.   end
  347.   #--------------------------------------------------------------------------
  348.   #--------------------------------------------------------------------------
  349.   def update_target
  350.     if Input.trigger?(Input::B)
  351.       $game_system.se_play($data_system.cancel_se)
  352.       unless $game_party.item_can_use?(@item.id)
  353.         @itemlist_window.refresh
  354.       end
  355.       @itemlist_window.active = true
  356.       @target_window.visible = false
  357.       @target_window.active = false
  358.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  359.       return
  360.     end
  361.     if Input.trigger?(Input::C)
  362.       if $game_party.item_number(@item.id) == 0
  363.         $game_system.se_play($data_system.buzzer_se)
  364.         return
  365.       end
  366.       if @target_window.index == -1
  367.         used = false
  368.         for i in $game_party.actors
  369.           used |= i.item_effect(@item)
  370.         end
  371.       end
  372.       if @target_window.index >= 0
  373.         target = $game_party.actors[@target_window.index]
  374.         used = target.item_effect(@item)
  375.       end
  376.       if used
  377.         $game_system.se_play(@item.menu_se)
  378.         if @item.consumable
  379.           $game_party.lose_item(@item.id, 1)
  380.           @itemlist_window.draw_item(@itemlist_window.index)
  381.           @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  382.         end
  383.         @target_window.refresh
  384.         if $game_party.all_dead?
  385.           $scene = Scene_Gameover.new
  386.           return
  387.         end
  388.         if @item.common_event_id > 0
  389.           $game_temp.common_event_id = @item.common_event_id
  390.           $scene = Scene_Map.new
  391.           return
  392.         end
  393.       end
  394.       unless used
  395.         $game_system.se_play($data_system.buzzer_se)
  396.       end
  397.     return
  398.     end
  399.   end
  400. end

  401. #==============================================================================
  402. # ■ RPG追加定义,使用@符号分类
  403. #==============================================================================

  404. module RPG
  405.   class Weapon
  406.     def description
  407.       description = @description.split(/@/)[0]
  408.       return description != nil ? description : ''
  409.     end
  410.     def desc
  411.       desc = @description.split(/@/)[1]
  412.       return desc != nil ? desc : "普通物品"
  413.     end
  414.   end
  415.   class Item
  416.     def description
  417.       description = @description.split(/@/)[0]
  418.       return description != nil ? description : ''
  419.     end
  420.     def desc
  421.       desc = @description.split(/@/)[1]
  422.       return desc != nil ? desc : "普通物品"
  423.     end
  424.   end
  425.   class Armor
  426.     def description
  427.       description = @description.split(/@/)[0]
  428.       return description != nil ? description : ''
  429.     end
  430.     def desc
  431.       desc = @description.split(/@/)[1]
  432.       return desc != nil ? desc : "普通物品"
  433.     end
  434.   end
  435. end

  436. #==============================================================================
  437. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  438. #==============================================================================
复制代码
OK,这个脚本显示已经正常

效果gif图
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-20 18:50

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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