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

Project1

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

[已经解决] 求物品分类的脚本

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
7 小时
注册时间
2009-1-1
帖子
263
跳转到指定楼层
1
发表于 2009-11-25 11:38:57 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
额……搜查了一下 发现都是合成物品分类……轩辕剑菜单物品分类……
额 轩辕剑那个还行……但是我不要和轩辕剑兼容的,要分离出来的,和原版兼容
求解

Lv4.逐梦者

梦石
0
星屑
6645
在线时间
1666 小时
注册时间
2008-10-29
帖子
6710

贵宾

2
发表于 2009-11-25 11:59:08 | 只看该作者
本帖最后由 后知后觉 于 2009-11-25 12:11 编辑

自己在主站搜索【复杂物品分类】


囧rz……
主页的物品分类被协和掉了- -
下面是我从以前的某个坑里挖出来的
有没有修改过我忘记了
- -
先试试看吧- -
  1. #==============================================================================
  2. # ■ Harts_Window_ItemTitle
  3. #==============================================================================

  4. class Harts_Window_ItemTitle < Window_Base
  5.   #--------------------------------------------------------------------------
  6.   # ● 初始化
  7.   #--------------------------------------------------------------------------
  8.   def initialize
  9.     super(0, 64, 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.     self.z = 6000
  15.     end
  16. end

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

  20. class Harts_Window_ItemCommand < Window_Selectable
  21.   attr_accessor :commands
  22.   #--------------------------------------------------------------------------
  23.   # ● 初始化
  24.   #--------------------------------------------------------------------------
  25.   def initialize
  26.     super(0, 128, 160, 352)
  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.     if @commands == []
  68.       @commands.push("普通物品")
  69.     end      
  70.     @item_max = @commands.size
  71.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  72.     refresh
  73.     self.index = 0
  74.     self.z = 9999
  75.     end
  76.   #--------------------------------------------------------------------------
  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.   #--------------------------------------------------------------------------
  88.   def draw_item(index, color)
  89.     self.contents.font.color = color
  90.     y = index * 32
  91.     self.contents.draw_text(4, y, 128, 32, @commands[index],1)
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ● 刷新帮助窗口
  95.   #--------------------------------------------------------------------------
  96.   def update_help
  97.     @help_window.set_text(@commands[self.index])
  98.   end
  99. end












  100. #==============================================================================
  101. # ■ Harts_Window_ItemList
  102. #==============================================================================

  103. class Harts_Window_ItemList < Window_Selectable
  104.   #--------------------------------------------------------------------------
  105.   # ● 初始化
  106.   #--------------------------------------------------------------------------
  107.   def initialize
  108.     super(160, 64, 480, 416)
  109.     refresh
  110.     self.index = -1
  111.   end
  112.   #--------------------------------------------------------------------------
  113.   # ● 获取物品
  114.   #--------------------------------------------------------------------------
  115.   def item
  116.     return @data[self.index]
  117.   end
  118.   #--------------------------------------------------------------------------
  119.   # ● 描绘
  120.   #--------------------------------------------------------------------------
  121.   def refresh
  122.     if self.contents != nil
  123.       self.contents.dispose
  124.       self.contents = nil
  125.     end
  126.     @data = []
  127.   end
  128.   #--------------------------------------------------------------------------
  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.   #--------------------------------------------------------------------------
  160.   def item_number
  161.     return @item_max
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ● 描绘实物
  165.   #--------------------------------------------------------------------------
  166.   def draw_item(index)
  167.     item = @data[index]
  168.     case item
  169.     when RPG::Item
  170.       number = $game_party.item_number(item.id)
  171.     when RPG::Weapon
  172.       number = $game_party.weapon_number(item.id)
  173.     when RPG::Armor
  174.       number = $game_party.armor_number(item.id)
  175.     end
  176.     if item.is_a?(RPG::Item) and
  177.       $game_party.item_can_use?(item.id)
  178.       self.contents.font.color = normal_color
  179.     else
  180.       self.contents.font.color = disabled_color
  181.     end
  182.     x = 4
  183.     y = index * 32
  184.     bitmap = RPG::Cache.icon(item.icon_name)
  185.     opacity = self.contents.font.color == normal_color ? 255 : 128
  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 + 400, y, 16, 32, ":", 1)
  189.     self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2)
  190.     self.z = 5000
  191.   end
  192.   #--------------------------------------------------------------------------
  193.   # ● 刷新帮助窗口
  194.   #--------------------------------------------------------------------------
  195.   def update_help
  196.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  197.   end
  198. end












  199. #==============================================================================
  200. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  201. #==============================================================================
  202. #==============================================================================
  203. # ■ Harts_Scene_Item
  204. #==============================================================================

  205. class Scene_Item
  206.   #--------------------------------------------------------------------------
  207.   # ● 主处理
  208.   #--------------------------------------------------------------------------
  209.   def main
  210.     @itemtitle_window = Harts_Window_ItemTitle.new
  211.     @itemcommand_window = Harts_Window_ItemCommand.new
  212.     @command_index = @itemcommand_window.index
  213.     @itemlist_window = Harts_Window_ItemList.new
  214.     @itemlist_window.active = false
  215.     @help_window = Window_Help.new
  216.     @help_window.x = 0
  217.     @help_window.y = 0
  218.     @itemcommand_window.help_window = @help_window
  219.     @itemlist_window.help_window = @help_window
  220.     @target_window = Window_Target.new
  221.     @target_window.visible = false
  222.     @target_window.active = false
  223.     @target_window.z = @itemlist_window.z + 9999
  224.     @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  225.     Graphics.transition
  226.     loop do
  227.       Graphics.update
  228.       Input.update
  229.       update
  230.       if $scene != self
  231.         break
  232.       end
  233.     end
  234.     Graphics.freeze
  235.     @itemtitle_window.dispose
  236.     @itemcommand_window.dispose
  237.     @itemlist_window.dispose
  238.     @help_window.dispose
  239.     @target_window.dispose
  240.   end
  241.   #--------------------------------------------------------------------------
  242.   # ● 刷新
  243.   #--------------------------------------------------------------------------
  244.   def update
  245.     @itemtitle_window.update
  246.     @itemcommand_window.update
  247.     @itemlist_window.update
  248.     @help_window.update
  249.     @target_window.update
  250.     if @command_index != @itemcommand_window.index
  251.       @command_index = @itemcommand_window.index
  252.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  253.     end
  254.     if @itemcommand_window.active
  255.       update_itemcommand
  256.       return
  257.     end
  258.     if @itemlist_window.active
  259.       update_itemlist
  260.       return
  261.     end
  262.     if @target_window.active
  263.       update_target
  264.       return
  265.     end
  266.   end
  267.   #--------------------------------------------------------------------------
  268.   # ● 选择种类
  269.   #--------------------------------------------------------------------------
  270.   def update_itemcommand
  271.     if Input.trigger?(Input::B)
  272.       $game_system.se_play($data_system.cancel_se)
  273. #★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  274.       if $game_switches[14] == true
  275.         $scene = Scene_Map.new
  276.         $game_switches[14] = false
  277.       else
  278.         # 切换到菜单画面
  279.         $scene = Scene_Menu.new(0)
  280.       end
  281. #▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
  282.       return
  283.     end
  284.     if Input.trigger?(Input::C)
  285.       if @itemlist_window.item_number == 0
  286.         $game_system.se_play($data_system.buzzer_se)
  287.         return
  288.       end
  289.       $game_system.se_play($data_system.decision_se)
  290.       @itemcommand_window.active = false
  291.       @itemlist_window.active = true
  292.       @itemlist_window.index = 0
  293.       return
  294.     end
  295.   end
  296.   #--------------------------------------------------------------------------
  297.   # ● 选择物品
  298.   #--------------------------------------------------------------------------
  299.   def update_itemlist
  300.     if Input.trigger?(Input::B)
  301.       $game_system.se_play($data_system.cancel_se)
  302.       @itemcommand_window.active = true
  303.       @itemlist_window.active = false
  304.       @itemlist_window.index = -1
  305.       @itemcommand_window.index = @command_index
  306.       return
  307.     end
  308.     if Input.trigger?(Input::C)
  309.       @item = @itemlist_window.item
  310.       unless @item.is_a?(RPG::Item)
  311.         $game_system.se_play($data_system.buzzer_se)
  312.         return
  313.       end
  314.       unless $game_party.item_can_use?(@item.id)
  315.         $game_system.se_play($data_system.buzzer_se)
  316.         return
  317.       end
  318.       $game_system.se_play($data_system.decision_se)
  319.       if @item.scope >= 3
  320.         @itemlist_window.active = false
  321.         @target_window.x = 304
  322.         @target_window.visible = true
  323.         @target_window.active = true
  324.         if @item.scope == 4 || @item.scope == 6
  325.           @target_window.index = -1
  326.         else
  327.           @target_window.index = 0
  328.         end
  329.       else
  330.         if @item.common_event_id > 0
  331.           $game_temp.common_event_id = @item.common_event_id
  332.           $game_system.se_play(@item.menu_se)
  333.             if @item.consumable
  334.               $game_party.lose_item(@item.id, 1)
  335.               @itemlist_window.draw_item(@itemlist_window.index)
  336.             end
  337.           $scene = Scene_Map.new
  338.           return
  339.         end
  340.       end
  341.       return
  342.     end
  343.   end
  344.   #--------------------------------------------------------------------------
  345.   # ● 选择对象
  346.   #--------------------------------------------------------------------------
  347.   def update_target
  348.     if Input.trigger?(Input::B)
  349.       $game_system.se_play($data_system.cancel_se)
  350.       unless $game_party.item_can_use?(@item.id)
  351.         @itemlist_window.refresh
  352.       end
  353.       @itemlist_window.active = true
  354.       @target_window.visible = false
  355.       @target_window.active = false
  356.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  357.       return
  358.     end
  359.     if Input.trigger?(Input::C)
  360.       if $game_party.item_number(@item.id) == 0
  361.         $game_system.se_play($data_system.buzzer_se)
  362.         return
  363.       end
  364.       if @target_window.index == -1
  365.         used = false
  366.         for i in $game_party.actors
  367.           used |= i.item_effect(@item)
  368.         end
  369.       end
  370.       if @target_window.index >= 0
  371.         target = $game_party.actors[@target_window.index]
  372.         used = target.item_effect(@item)
  373.       end
  374.       if used
  375.         $game_system.se_play(@item.menu_se)
  376.         if @item.consumable
  377.           $game_party.lose_item(@item.id, 1)
  378.           @itemlist_window.draw_item(@itemlist_window.index)
  379.           @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  380.         end
  381.         @target_window.refresh
  382.         if $game_party.all_dead?
  383.           $scene = Scene_Gameover.new
  384.           return
  385.         end
  386.         if @item.common_event_id > 0
  387.           $game_temp.common_event_id = @item.common_event_id
  388.           $scene = Scene_Map.new
  389.           return
  390.         end
  391.       end
  392.       unless used
  393.         $game_system.se_play($data_system.buzzer_se)
  394.       end
  395.     return
  396.     end
  397.   end
  398. end


  399. #==============================================================================
  400. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  401. #==============================================================================











复制代码
.
补充一下使用方法是在物品的说明文字后面加
@分类名字
比如
可以回复HP.@HP回复类
可以回复SP.@SP回复类
一条漂亮的围巾。@剧情道具











你知道得太多了

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-6 08:37

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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