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

Project1

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

[已经解决] 能不能让【物品】与【装备】在菜单分开整理?

[复制链接]

Lv2.观梦者

梦石
0
星屑
478
在线时间
750 小时
注册时间
2012-11-10
帖子
924
跳转到指定楼层
1
发表于 2013-7-11 01:44:42 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
在“物品”里面,装备和其他杂七杂八的物品会混在一起,看着很不舒服,有没有办法让【物品】放一堆,让【装备】放一堆?

评分

参与人数 1星屑 +20 收起 理由
怪蜀黍 + 20 手动认可答案奖励

查看全部评分

有本事就来阻止我啊,主体单元『天照』!

Lv1.梦旅人

梦石
0
星屑
60
在线时间
93 小时
注册时间
2013-6-14
帖子
75
来自 2楼
发表于 2013-7-11 09:25:35 | 只看该作者
有个物品分类脚本,不晓得你问的是不是这个
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================

module RPG
  class Weapon
    def description
      description = @description.split(/@/)[0]
      return description != nil ? description : ''
    end
    def desc
      desc = @description.split(/@/)[1]
      return desc != nil ? desc : "普通物品"
    end
  end
  class Item
    def description
      description = @description.split(/@/)[0]
      return description != nil ? description : ''
    end
    def desc
      desc = @description.split(/@/)[1]
      return desc != nil ? desc : "普通物品"
    end
  end
  class Armor
    def description
      description = @description.split(/@/)[0]
      return description != nil ? description : ''
    end
    def desc
      desc = @description.split(/@/)[1]
      return desc != nil ? desc : "普通物品"
    end
  end
end

class Harts_Window_ItemTitle < Window_Base
  def initialize
    super(0, 0, 160, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, 120, 32, Vocab::item, 1)
  end
end

class Harts_Window_ItemCommand < Window_Selectable
  attr_accessor :commands
  def initialize
    super(0, 64, 160, 296)
    self.index = 0
    refresh
  end
  
def addcommand
   @commands = []
   for i in 1...$data_items.size
     if $game_party.item_number($data_items) > 0
       push = true
       for com in @commands
         if com == $data_items.desc
           push = false
         end
       end
       if push == true
         @commands.push($data_items.desc)
       end
     end
   end
   for i in 1...$data_weapons.size
     if $game_party.item_number($data_weapons) > 0
       push = true
       for com in @commands
         if com == $data_weapons.desc
           push = false
           end
         end
         if push == true
           @commands.push($data_weapons.desc)
         end
       end
     end
     for i in 1...$data_armors.size
       if $game_party.item_number($data_armors) > 0
         push = true
         for com in @commands
           if com == $data_armors.desc
             push = false
           end
         end
         if push == true
           @commands.push($data_armors.desc)
         end
       end
     end
     if @commands == []
       @commands.push("普通物品")
     end      
     @item_max = @commands.size
  end
  
def refresh
    addcommand
    create_contents
    for i in 0...@item_max
      draw_item(i, normal_color)
    end
  end
  
  def draw_item(index, color)
    y = index * WLH
    self.contents.font.color = color
    if @commands[index] != nil
      self.contents.draw_text(4,y, 172, WLH, @commands[index])
    end
  end

  def update_help
    @help_window.set_text(@commands[self.index])
  end
end

class Harts_Window_ItemList < Window_Selectable
  
  def initialize
    super(160, 0, 384, 360)
    self.index = 0
    refresh
  end
  
  def item
    return @data[self.index]
  end
  
  def refresh
    @data = []
  end
  
  def set_item(command)
    refresh
    for i in 1...$data_items.size
      if $game_party.item_number($data_items) > 0  and $data_items.desc == command
        @data.push($data_items)
      end
    end
    for i in 1...$data_weapons.size
      if $game_party.item_number($data_weapons) > 0  and $data_weapons.desc == command
        @data.push($data_weapons)
      end
    end
    for i in 1...$data_armors.size
      if $game_party.item_number($data_armors) > 0  and $data_armors.desc == command
        @data.push($data_armors)
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      self.contents.clear
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  
  def item_number
    return @item_max
  end
  
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    item = @data[index]
    if item != nil
      number = $game_party.item_number(item)
      enabled = $game_party.item_can_use?(item)
      rect.width -= 4
      draw_item_name(item, rect.x, rect.y, enabled)
      self.contents.draw_text(rect, sprintf(":%2d", number), 2)
    end
  end
  
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end
class Harts_Window_Help < Window_Base
  
  def initialize
    super(0, 360, 544, WLH + 32)
  end

  def set_text(text, align = 0)
    if text != @text or align != @align
      self.contents.clear
      self.contents.font.color = normal_color
      self.contents.draw_text(4, 0, self.width - 40, WLH , text, align)
      @text = text
      @align = align
    end
  end
end

class Harts_Window_MenuStatus < Window_Selectable

  def initialize(x, y)
    super(x, y, 288, 416)
    refresh
    self.active = false
    self.index = -1
  end

  def refresh
    self.contents.clear
    @item_max = $game_party.members.size
    for actor in $game_party.members
      x = 8
      y = actor.index * 96 + WLH / 2
      draw_actor_name(actor, x, y)
      draw_actor_class(actor, x + 120, y)
      draw_actor_level(actor, x, y + WLH * 1)
      draw_actor_state(actor, x, y + WLH * 2)
      draw_actor_hp(actor, x + 120, y + WLH * 1)
      draw_actor_mp(actor, x + 120, y + WLH * 2)
    end
  end

  def update_cursor
    if @index < 0               
      self.cursor_rect.empty
    elsif @index < @item_max  
      self.cursor_rect.set(0, @index * 96, contents.width, 96)
    elsif @index >= 100        
      self.cursor_rect.set(0, (@index - 100) * 96, contents.width, 96)
    else                       
      self.cursor_rect.set(0, 0, contents.width, @item_max * 96)
    end
  end
end

class Scene_Item < Scene_Base
  def start
    super
    create_menu_background
    @viewport = Viewport.new(0, 0, 544, 416)
    @itemtitle_window = Harts_Window_ItemTitle.new
    @itemcommand_window = Harts_Window_ItemCommand.new
    @command_index = @itemcommand_window.index
    @itemcommand_window.refresh
    @itemlist_window = Harts_Window_ItemList.new
    @itemlist_window.active = false
    @help_window = Harts_Window_Help.new
    @help_window.viewport = @viewport
    @target_window = Harts_Window_MenuStatus.new(96, 0)
    @itemcommand_window.help_window = @help_window
    @itemlist_window.help_window = @help_window
    @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
    hide_target_window
  end

  def terminate
    super
    dispose_menu_background
    @viewport.dispose
    @itemtitle_window.dispose
    @itemcommand_window.dispose
    @itemlist_window.dispose
    @help_window.dispose
    @target_window.dispose
  end

  def return_scene
    $scene = Scene_Menu.new(0)
  end

  def update
    super
    update_menu_background
    @help_window.update
    @itemlist_window.update
    @itemcommand_window.update
    @target_window.update
    @itemcommand_window.refresh
    if @command_index != @itemcommand_window.index
      @itemlist_window.index = 0
      @command_index = @itemcommand_window.index
      @itemcommand_window.update_help
      @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
    end
    if @itemcommand_window.active
      @itemcommand_window.update_help
      update_itemcommand
    elsif @itemlist_window.active
      update_itemlist
    elsif @target_window.active
      update_target_selection
    end
  end

  def update_itemcommand
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
      return
    end
    if Input.trigger?(Input::C)
      if @itemlist_window.item_number == 0
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      @itemcommand_window.active = false
      @itemlist_window.index = 0
      @itemlist_window.active = true
      return
    end
  end

  def update_itemlist
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @itemcommand_window.active = true
      @itemlist_window.active = false
      @itemcommand_window.index = @command_index
    elsif Input.trigger?(Input::C)
      @item = @itemlist_window.item
      if @item != nil
        $game_party.last_item_id = @item.id
      end
      if $game_party.item_can_use?(@item)
        Sound.play_decision
        determine_item
      else
        Sound.play_buzzer
      end
    end
  end

  def determine_item
    if @item.for_friend?
      show_target_window(@itemlist_window.index % 2 == 0)
      if @item.for_all?
        @target_window.index = 99
      else
        if $game_party.last_target_index < @target_window.item_max
          @target_window.index = $game_party.last_target_index
        else
          @target_window.index = 0
        end
      end
    else
      use_item_nontarget
    end
  end

  def update_target_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      if $game_party.item_number(@item) == 0
        @itemlist_window.refresh                 
      end
      @itemlist_window.active = true
      @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
      hide_target_window
      @itemlist_window.active = true
    elsif Input.trigger?(Input::C)
      if not $game_party.item_can_use?(@item)
        Sound.play_buzzer
      else
        determine_target
      end
    end
  end

  def determine_target
    used = false
    if @item.for_all?
      for target in $game_party.members
        target.item_effect(target, @item)
        used = true unless target.skipped
      end
    else
      $game_party.last_target_index = @target_window.index
      target = $game_party.members[@target_window.index]
      target.item_effect(target, @item)
      used = true unless target.skipped
    end
    if used
      use_item_nontarget
    else
      Sound.play_buzzer
    end
  end

  def show_target_window(right)
    @itemlist_window.active = false
    width_remain = 544 - @target_window.width
    @target_window.x = right ? width_remain : 0
    @target_window.visible = true
    @target_window.active = true
    if right
      @viewport.rect.set(0, 0, width_remain, 416)
      @viewport.ox = 0
    else
      @viewport.rect.set(@target_window.width, 0, width_remain, 416)
      @viewport.ox = @target_window.width
    end
  end

  def hide_target_window
    @target_window.visible = false
    @target_window.active = false
    @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
    @viewport.rect.set(0, 0, 544, 416)
    @viewport.ox = 0
  end

  def use_item_nontarget
    Sound.play_use_item
    $game_party.consume_item(@item)
    @itemlist_window.draw_item(@itemlist_window.index)
    @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
    @target_window.refresh
    if $game_party.all_dead?
      $scene = Scene_Gameover.new
    elsif @item.common_event_id > 0
      $game_temp.common_event_id = @item.common_event_id
      $scene = Scene_Map.new
    end
  end
end

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

点评

是这个,谢谢。  发表于 2013-7-11 10:05

评分

参与人数 1星屑 +60 收起 理由
怪蜀黍 + 60 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-24 15:35

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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