查看: 1793|回复: 2

[已经解决] 如何修改物品选择项之间的间隔?

[复制链接]
梦石
0
星屑
50
在线时间
31 小时
注册时间
2014-7-3
回帖
11
发表于 2014-11-28 16:26:17 | 显示全部楼层 |阅读模式

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

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

×
如图,使用的是线索仓库脚本

想请教一下大家怎么改变这几个物品之间的间隔……

LKL5[0W6JVDNZ0LL7$_@@{A.jpg


↓我自行修改后的脚本……


[pre lang="ruby" line="1"]#####################################################################
#简陋的线索仓库= =
#
#偷懒用了物品栏= =
#调用$scene = Scene_Clue.new
#物品名+“,”+类别代号+“,”+颜色代号= =
#比如"照片,3,1"显示出来是照片类,粉色字= =
#类别代号:   0 :侦探小说   1 :书信  2 :日记  3 :照片  4 :备用1  
#5 :备用2  6 :备用3
#(名称是胡乱设的说= =可以自己改~删掉大概也米关系吧= =)
#颜色代号: 和帮助里一样的说
#如果物品设置的不能使用,按回车显示出的就是物品说明```
#可以使用的话就挂公共事件= =

#物品说明栏  \V[n]显示第n号变量的值
#            \E  换行
#            \C[n]换用第n号颜色
#            \N[n]显示第n号角色名称
#            \P[n]显示在cluepics里的cluepic_n图片(照片什么的用吧= =)
#暂时米想到还有什么其他的了= =
########################################################################
class Window_Clue < Window_Selectable
  def initialize
    super(0, 85, 640, 380)
    @column_max = 2
    refresh(0)
    self.index = 0
  end
  def item
    return @data[self.index]
  end
  def clear
    if self.contents != nil
    self.contents.clear
  end
  end
  def refresh(type)
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
case type
when 0
    for i in 1...$data_items.size
      if $data_items.name.split(/,/)[1] == "0" and $game_party.item_number(i) > 0
        @data.push($data_items)
      end
    end
when 1
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0 and $data_items.name.split(/,/)[1] == "1"
        @data.push($data_items)
      end
    end
when 2
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0 and $data_items.name.split(/,/)[1] == "2"
        @data.push($data_items)
      end
    end
when 3
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0 and $data_items.name.split(/,/)[1] == "3"
        @data.push($data_items)
      end
    end
when 4
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0 and $data_items.name.split(/,/)[1] == "4"
        @data.push($data_items)
      end
    end
when 5
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0 and $data_items.name.split(/,/)[1] == "5"
        @data.push($data_items)
      end
    end
when 6
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0 and $data_items.name.split(/,/)[1] == "6"
        @data.push($data_items)
      end
    end
  end
@item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
        self.z=1896
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 描绘项目
  #     index : 项目编号
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    end
      self.contents.font.color = normal_color
    x = 4 + index % 2 * (205 + 32)
    y = index / 2 * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128

if !item.name.split(/,/)[2].nil?
     self.contents.font.color = text_color(item.name.split(/,/)[2].to_i)
   else
     self.contents.font.color = text_color(7)
   end

  self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, item.name.split(/,/)[0], 0)
  end
  #--------------------------------------------------------------------------
  # ● 刷新帮助文本
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end
module RPG
  module Cache
    def self.cluepic(filename)
      self.load_bitmap("Graphics/cluepics/", filename)
    end
  end
end
class Window_ClueHelp < Window_Base
  def initialize
    super(50, 50, 380, 380)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.z = 99999
  end
  def clear
    self.contents.clear
  end
  def set_text(mes)
    self.contents.clear
    self.contents.font.color = normal_color
    x = y = 0
    @cursor_width = 0
    if $game_temp.choice_start == 0
      x = 8
    end
    if mes!= nil
      text = mes.clone
      begin
        last_text = text.clone
        text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
      end until text == last_text
      text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
        $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
      end
      text.gsub!(/\\\\/) { "\000" }
      text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
      text.gsub!(/\\[Gg]/) { "\002" }
      text.gsub!(/\\[Pp]\[([0-9]+)\]/) { "\003[#{$1}]" }
      text.gsub!(/\\[Ee]/) { "\004" }
      while ((c = text.slice!(/./m)) != nil)
        if c == "\000"
          c = "\\"
        end
        if c == "\001"
          text.sub!(/\[([0-9]+)\]/, "")
          color = $1.to_i
          if color >= 0 and color <= 7
            self.contents.font.color = text_color(color)
          end
          next
        end
      if c == "\002"
          y += 1
        x = 0
        next
      end
      if c == "\003"
        text.sub!(/\[([0-9]+)\]/, "")
        t = RPG::Cache.cluepic("cluepic_#{$1}")
        self.contents.blt(x, 32 * y, t, t.rect)
        t.dispose
        next
      end
        if c == "\004"
          y += 1
          x = 0
          if y >= $game_temp.choice_start
            x = 8
          end
          next
        end
        self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
        x += self.contents.text_size(c).width
      end
    end
  end
end
class Scene_Clue
    def main
          @spriteset = Spriteset_Map.new
    @help_window = Window_ClueHelp.new
    @help_window.visible = false
    @clue_window = Window_Clue.new
    @clue_window.opacity = 160
    @clue_window.index = -1
    @clue_window.clear
    @clue_window.active = false
    @class_window = Window_Command.new(160, ["————"])
@class_window.opacity = 160
    @clue_window.help_window = @help_window
       Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @spriteset.dispose
    @help_window.dispose
    @clue_window.dispose
    @class_window.dispose
  end  
def update
    @help_window.update
    @clue_window.update
    @class_window.update
    if @class_window.active
      update_class
      return
    end
    if @clue_window.active
      update_clue
      return
    end
      if @help_window.active
      update_help
      return
    end
  end
   def update_class
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     $scene = Scene_Map.new
   end
   if Input.trigger?(Input::C)
     $game_system.se_play($data_system.decision_se)
    @class_window.active = false
     @clue_window.active = true
     @clue_window.index = 0
     @clue_window.refresh(@class_window.index)
     @help_window.visible = false
   end
   if Input.dir4 !=0
     @clue_window.refresh(@class_window.index)
   end
end
    def update_clue
@help_window.visible = false
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @help_window.clear
      @help_window.visible = false
      @clue_window.active = false
      @class_window.active = true
      @clue_window.index = -1
    end
    if Input.trigger?(Input::C)
      @item = @clue_window.item
      unless @item.is_a?(RPG::Item)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if $game_party.item_can_use?(@item.id)
         $game_system.se_play(@item.menu_se)
        if @item.consumable
          $game_party.lose_item(@item.id, 1)
          @clue_window.draw_item(@clue_window.index)
        end
        if $game_party.all_dead?
          $scene = Scene_Gameover.new
          return
        end
        if @item.common_event_id > 0
          $game_temp.common_event_id = @item.common_event_id
          $scene = Scene_Map.new
          return
        end
      return
      else
        $game_system.se_play($data_system.decision_se)
      @clue_window.active = false
    @help_window.visible = true
    @help_window.active = true
        return
      end
     end  
   
  end
  def update_help
    @help_window.active = true
  @help_window.visible = true
  if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
     @help_window.active = false
   @help_window.visible = false
    @clue_window.active = true
  end
  end
end[/pre]
梦石
0
星屑
76
在线时间
1379 小时
注册时间
2012-7-5
回帖
1643

开拓者

发表于 2014-11-30 13:06:42 | 显示全部楼层
你给的脚本第107行
    x = 4 + index % 2 * (205 + 32)
修改红字部分即可

评分

参与人数 1星屑 +150 收起 理由
RyanBern + 150 认可答案

查看全部评分


  -fk: -azogi:
回复

使用道具 举报

梦石
0
星屑
50
在线时间
31 小时
注册时间
2014-7-3
回帖
11
 楼主| 发表于 2014-12-7 12:48:26 | 显示全部楼层
kuerlulu 发表于 2014-11-30 13:06
你给的脚本第107行
    x = 4 + index % 2 * (205 + 32)
修改红字部分即可

谢了,主要是我自己解决完了,我这个新手以后还是自己解决问题吧
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部