查看: 1849|回复: 2

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

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

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

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

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

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

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


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


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

  14. #物品说明栏  \V[n]显示第n号变量的值
  15. #            \E  换行
  16. #            \C[n]换用第n号颜色
  17. #            \N[n]显示第n号角色名称
  18. #            \P[n]显示在cluepics里的cluepic_n图片(照片什么的用吧= =)
  19. #暂时米想到还有什么其他的了= =
  20. ########################################################################
  21. class Window_Clue < Window_Selectable
  22.   def initialize
  23.     super(0, 85, 640, 380)
  24.     @column_max = 2
  25.     refresh(0)
  26.     self.index = 0
  27.   end
  28.   def item
  29.     return @data[self.index]
  30.   end
  31.   def clear
  32.     if self.contents != nil
  33.     self.contents.clear
  34.   end
  35.   end
  36.   def refresh(type)
  37.     if self.contents != nil
  38.       self.contents.dispose
  39.       self.contents = nil
  40.     end
  41.     @data = []
  42. case type
  43. when 0
  44.     for i in 1...$data_items.size
  45.       if $data_items[i].name.split(/,/)[1] == "0" and $game_party.item_number(i) > 0
  46.         @data.push($data_items[i])
  47.       end
  48.     end
  49. when 1
  50.     for i in 1...$data_items.size
  51.       if $game_party.item_number(i) > 0 and $data_items[i].name.split(/,/)[1] == "1"
  52.         @data.push($data_items[i])
  53.       end
  54.     end
  55. when 2
  56.     for i in 1...$data_items.size
  57.       if $game_party.item_number(i) > 0 and $data_items[i].name.split(/,/)[1] == "2"
  58.         @data.push($data_items[i])
  59.       end
  60.     end
  61. when 3
  62.     for i in 1...$data_items.size
  63.       if $game_party.item_number(i) > 0 and $data_items[i].name.split(/,/)[1] == "3"
  64.         @data.push($data_items[i])
  65.       end
  66.     end
  67. when 4
  68.     for i in 1...$data_items.size
  69.       if $game_party.item_number(i) > 0 and $data_items[i].name.split(/,/)[1] == "4"
  70.         @data.push($data_items[i])
  71.       end
  72.     end
  73. when 5
  74.     for i in 1...$data_items.size
  75.       if $game_party.item_number(i) > 0 and $data_items[i].name.split(/,/)[1] == "5"
  76.         @data.push($data_items[i])
  77.       end
  78.     end
  79. when 6
  80.     for i in 1...$data_items.size
  81.       if $game_party.item_number(i) > 0 and $data_items[i].name.split(/,/)[1] == "6"
  82.         @data.push($data_items[i])
  83.       end
  84.     end
  85.   end
  86. @item_max = @data.size
  87.     if @item_max > 0
  88.       self.contents = Bitmap.new(width - 32, row_max * 32)
  89.       for i in 0...@item_max
  90.         draw_item(i)
  91.         self.z=1896
  92.       end
  93.     end
  94.   end
  95.   #--------------------------------------------------------------------------
  96.   # ● 描绘项目
  97.   #     index : 项目编号
  98.   #--------------------------------------------------------------------------
  99.   def draw_item(index)
  100.     item = @data[index]
  101.     case item
  102.     when RPG::Item
  103.       number = $game_party.item_number(item.id)
  104.     end
  105.       self.contents.font.color = normal_color
  106.     x = 4 + index % 2 * (205 + 32)
  107.     y = index / 2 * 32
  108.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  109.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  110.     bitmap = RPG::Cache.icon(item.icon_name)
  111.     opacity = self.contents.font.color == normal_color ? 255 : 128

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

  117.   self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  118.     self.contents.draw_text(x + 28, y, 212, 32, item.name.split(/,/)[0], 0)
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   # ● 刷新帮助文本
  122.   #--------------------------------------------------------------------------
  123.   def update_help
  124.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  125.   end
  126. end
  127. module RPG
  128.   module Cache
  129.     def self.cluepic(filename)
  130.       self.load_bitmap("Graphics/cluepics/", filename)
  131.     end
  132.   end
  133. end
  134. class Window_ClueHelp < Window_Base
  135.   def initialize
  136.     super(50, 50, 380, 380)
  137.     self.contents = Bitmap.new(width - 32, height - 32)
  138.     self.z = 99999
  139.   end
  140.   def clear
  141.     self.contents.clear
  142.   end
  143.   def set_text(mes)
  144.     self.contents.clear
  145.     self.contents.font.color = normal_color
  146.     x = y = 0
  147.     @cursor_width = 0
  148.     if $game_temp.choice_start == 0
  149.       x = 8
  150.     end
  151.     if mes!= nil
  152.       text = mes.clone
  153.       begin
  154.         last_text = text.clone
  155.         text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  156.       end until text == last_text
  157.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  158.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  159.       end
  160.       text.gsub!(/\\\\/) { "\000" }
  161.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  162.       text.gsub!(/\\[Gg]/) { "\002" }
  163.       text.gsub!(/\\[Pp]\[([0-9]+)\]/) { "\003[#{$1}]" }
  164.       text.gsub!(/\\[Ee]/) { "\004" }
  165.       while ((c = text.slice!(/./m)) != nil)
  166.         if c == "\000"
  167.           c = "\"
  168.         end
  169.         if c == "\001"
  170.           text.sub!(/\[([0-9]+)\]/, "")
  171.           color = $1.to_i
  172.           if color >= 0 and color <= 7
  173.             self.contents.font.color = text_color(color)
  174.           end
  175.           next
  176.         end
  177.       if c == "\002"
  178.           y += 1
  179.         x = 0
  180.         next
  181.       end
  182.       if c == "\003"
  183.         text.sub!(/\[([0-9]+)\]/, "")
  184.         t = RPG::Cache.cluepic("cluepic_#{$1}")
  185.         self.contents.blt(x, 32 * y, t, t.rect)
  186.         t.dispose
  187.         next
  188.       end
  189.         if c == "\004"
  190.           y += 1
  191.           x = 0
  192.           if y >= $game_temp.choice_start
  193.             x = 8
  194.           end
  195.           next
  196.         end
  197.         self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
  198.         x += self.contents.text_size(c).width
  199.       end
  200.     end
  201.   end
  202. end
  203. class Scene_Clue
  204.     def main
  205.           @spriteset = Spriteset_Map.new
  206.     @help_window = Window_ClueHelp.new
  207.     @help_window.visible = false
  208.     @clue_window = Window_Clue.new
  209.     @clue_window.opacity = 160
  210.     @clue_window.index = -1
  211.     @clue_window.clear
  212.     @clue_window.active = false
  213.     @class_window = Window_Command.new(160, ["————"])
  214. @class_window.opacity = 160
  215.     @clue_window.help_window = @help_window
  216.        Graphics.transition
  217.     loop do
  218.       Graphics.update
  219.       Input.update
  220.       update
  221.       if $scene != self
  222.         break
  223.       end
  224.     end
  225.     Graphics.freeze
  226.     @spriteset.dispose
  227.     @help_window.dispose
  228.     @clue_window.dispose
  229.     @class_window.dispose
  230.   end  
  231. def update
  232.     @help_window.update
  233.     @clue_window.update
  234.     @class_window.update
  235.     if @class_window.active
  236.       update_class
  237.       return
  238.     end
  239.     if @clue_window.active
  240.       update_clue
  241.       return
  242.     end
  243.       if @help_window.active
  244.       update_help
  245.       return
  246.     end
  247.   end
  248.    def update_class
  249.    if Input.trigger?(Input::B)
  250.      $game_system.se_play($data_system.cancel_se)
  251.      $scene = Scene_Map.new
  252.    end
  253.    if Input.trigger?(Input::C)
  254.      $game_system.se_play($data_system.decision_se)
  255.     @class_window.active = false
  256.      @clue_window.active = true
  257.      @clue_window.index = 0
  258.      @clue_window.refresh(@class_window.index)
  259.      @help_window.visible = false
  260.    end
  261.    if Input.dir4 !=0
  262.      @clue_window.refresh(@class_window.index)
  263.    end
  264. end
  265.     def update_clue
  266. @help_window.visible = false
  267.     if Input.trigger?(Input::B)
  268.       $game_system.se_play($data_system.cancel_se)
  269.       @help_window.clear
  270.       @help_window.visible = false
  271.       @clue_window.active = false
  272.       @class_window.active = true
  273.       @clue_window.index = -1
  274.     end
  275.     if Input.trigger?(Input::C)
  276.       @item = @clue_window.item
  277.       unless @item.is_a?(RPG::Item)
  278.         $game_system.se_play($data_system.buzzer_se)
  279.         return
  280.       end
  281.       if $game_party.item_can_use?(@item.id)
  282.          $game_system.se_play(@item.menu_se)
  283.         if @item.consumable
  284.           $game_party.lose_item(@item.id, 1)
  285.           @clue_window.draw_item(@clue_window.index)
  286.         end
  287.         if $game_party.all_dead?
  288.           $scene = Scene_Gameover.new
  289.           return
  290.         end
  291.         if @item.common_event_id > 0
  292.           $game_temp.common_event_id = @item.common_event_id
  293.           $scene = Scene_Map.new
  294.           return
  295.         end
  296.       return
  297.       else
  298.         $game_system.se_play($data_system.decision_se)
  299.       @clue_window.active = false
  300.     @help_window.visible = true
  301.     @help_window.active = true
  302.         return
  303.       end
  304.      end  
  305.    
  306.   end
  307.   def update_help
  308.     @help_window.active = true
  309.   @help_window.visible = true
  310.   if Input.trigger?(Input::B)
  311.       $game_system.se_play($data_system.cancel_se)
  312.      @help_window.active = false
  313.    @help_window.visible = false
  314.     @clue_window.active = true
  315.   end
  316.   end
  317. end
复制代码
梦石
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.

在本版发帖返回顶部