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

Project1

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

麻烦帮忙看下这个脚本里的一个功能怎么用

 关闭 [复制链接]

Lv4.逐梦者

梦石
0
星屑
5550
在线时间
1569 小时
注册时间
2006-9-30
帖子
2042

开拓者

跳转到指定楼层
1
发表于 2008-3-18 00:14:29 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
  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(160, 0, 480, 416)
  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.       end
  92.     end
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # ● 描绘项目
  96.   #     index : 项目编号
  97.   #--------------------------------------------------------------------------
  98.   def draw_item(index)
  99.     item = @data[index]
  100.     case item
  101.     when RPG::Item
  102.       number = $game_party.item_number(item.id)
  103.     end
  104.       self.contents.font.color = normal_color
  105.     x = 4 + index % 2 * (205 + 32)
  106.     y = index / 2 * 32
  107.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  108.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  109.     bitmap = RPG::Cache.icon(item.icon_name)
  110.     opacity = self.contents.font.color == normal_color ? 255 : 128

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

  116.   self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  117.     self.contents.draw_text(x + 28, y, 212, 32, item.name.split(/,/)[0], 0)
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # ● 刷新帮助文本
  121.   #--------------------------------------------------------------------------
  122.   def update_help
  123.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  124.   end
  125. end
  126. module RPG
  127.   module Cache
  128.     def self.cluepic(filename)
  129.       self.load_bitmap("Graphics/cluepics/", filename)
  130.     end
  131.   end
  132. end
  133. class Window_ClueHelp < Window_Base
  134.   def initialize
  135.     super(50, 50, 380, 380)
  136.     self.contents = Bitmap.new(width - 32, height - 32)
  137.     self.z = 99999
  138.   end
  139.   def clear
  140.     self.contents.clear
  141.   end
  142.   def set_text(mes)
  143.     self.contents.clear
  144.     self.contents.font.color = normal_color
  145.     x = y = 0
  146.     @cursor_width = 0
  147.     if $game_temp.choice_start == 0
  148.       x = 8
  149.     end
  150.     if mes!= nil
  151.       text = mes.clone
  152.       begin
  153.         last_text = text.clone
  154.         text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  155.       end until text == last_text
  156.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  157.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  158.       end
  159.       text.gsub!(/\\\\/) { "\000" }
  160.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  161.       text.gsub!(/\\[Gg]/) { "\002" }
  162.       text.gsub!(/\\[Pp]\[([0-9]+)\]/) { "\003[#{$1}]" }
  163.       text.gsub!(/\\[Ee]/) { "\004" }
  164.       while ((c = text.slice!(/./m)) != nil)
  165.         if c == "\000"
  166.           c = "\\"
  167.         end
  168.         if c == "\001"
  169.           text.sub!(/\[([0-9]+)\]/, "")
  170.           color = $1.to_i
  171.           if color >= 0 and color <= 7
  172.             self.contents.font.color = text_color(color)
  173.           end
  174.           next
  175.         end
  176.       if c == "\002"
  177.           y += 1
  178.         x = 0
  179.         next
  180.       end
  181.       if c == "\003"
  182.         text.sub!(/\[([0-9]+)\]/, "")
  183.         t = RPG::Cache.cluepic("cluepic_#{$1}")
  184.         self.contents.blt(x, 32 * y, t, t.rect)
  185.         t.dispose
  186.         next
  187.       end
  188.         if c == "\004"
  189.           y += 1
  190.           x = 0
  191.           if y >= $game_temp.choice_start
  192.             x = 8
  193.           end
  194.           next
  195.         end
  196.         self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
  197.         x += self.contents.text_size(c).width
  198.       end
  199.     end
  200.   end
  201. end
  202. class Window_Item
  203.   alias new_refresh refresh
  204.   def refresh

  205.     @data = []
  206.     # 添加报务
  207.     for i in 1...$data_items.size
  208.       unless $data_items[i].name.split(/,/)
  209.         if $game_party.item_number(i) > 0
  210.           @data.push($data_items[i])
  211.       end
  212.       end
  213.     end
  214.   end
  215. end
  216. class Window_ShopBuy
  217. alias new_refresh refresh
  218.   def refresh
  219.     @data = []
  220.     for goods_item in @shop_goods
  221.       case goods_item[0]
  222.       when 0
  223.         item = $data_items[goods_item[1]]
  224.       when 1
  225.         item = $data_weapons[goods_item[1]]
  226.       when 2
  227.         item = $data_armors[goods_item[1]]
  228.       end
  229.       if item != nil
  230.         unless item.name.split(/,/)
  231.         @data.push(item)
  232.         end
  233.       end
  234.     end
  235.   end
  236. end
  237. class Window_ShopSell
  238. alias new_refresh refresh
  239.   def refresh
  240.      @data = []
  241.     for i in 1...$data_items.size
  242.       unless $data_items[i].name.split(/,/)
  243.       if $game_party.item_number(i) > 0
  244.         @data.push($data_items[i])
  245.       end
  246.     end
  247.     end
  248.   end
  249. end
  250. class Scene_Clue
  251.     def main
  252.           @spriteset = Spriteset_Map.new
  253.     @help_window = Window_ClueHelp.new
  254.     @help_window.visible = false
  255.     @clue_window = Window_Clue.new
  256.     @clue_window.opacity = 160
  257.     @clue_window.index = -1
  258.     @clue_window.clear
  259.     @clue_window.active = false
  260.     @class_window = Window_Command.new(160, ["侦探小说", "书信", "日记", "照片", "备用1", "备用2", "备用3"])
  261. @class_window.opacity = 160
  262.     @clue_window.help_window = @help_window
  263.        Graphics.transition
  264.     loop do
  265.       Graphics.update
  266.       Input.update
  267.       update
  268.       if $scene != self
  269.         break
  270.       end
  271.     end
  272.     Graphics.freeze
  273.     @spriteset.dispose
  274.     @help_window.dispose
  275.     @clue_window.dispose
  276.     @class_window.dispose
  277.   end  
  278. def update
  279.     @help_window.update
  280.     @clue_window.update
  281.     @class_window.update
  282.     if @class_window.active
  283.       update_class
  284.       return
  285.     end
  286.     if @clue_window.active
  287.       update_clue
  288.       return
  289.     end
  290.       if @help_window.active
  291.       update_help
  292.       return
  293.     end
  294.   end
  295.    def update_class
  296.    if Input.trigger?(Input::B)
  297.      $game_system.se_play($data_system.cancel_se)
  298.      $scene = Scene_Map.new
  299.    end
  300.    if Input.trigger?(Input::C)
  301.      $game_system.se_play($data_system.decision_se)
  302.     @class_window.active = false
  303.      @clue_window.active = true
  304.      @clue_window.index = 0
  305.      @clue_window.refresh(@class_window.index)
  306.      @help_window.visible = false
  307.    end
  308.    if Input.dir4 !=0
  309.      @clue_window.refresh(@class_window.index)
  310.    end
  311. end
  312.     def update_clue
  313. @help_window.visible = false
  314.     if Input.trigger?(Input::B)
  315.       $game_system.se_play($data_system.cancel_se)
  316.       @help_window.clear
  317.       @help_window.visible = false
  318.       @clue_window.active = false
  319.       @class_window.active = true
  320.       @clue_window.index = -1
  321.     end
  322.     if Input.trigger?(Input::C)
  323.       @item = @clue_window.item
  324.       unless @item.is_a?(RPG::Item)
  325.         $game_system.se_play($data_system.buzzer_se)
  326.         return
  327.       end
  328.       if $game_party.item_can_use?(@item.id)
  329.          $game_system.se_play(@item.menu_se)
  330.         if @item.consumable
  331.           $game_party.lose_item(@item.id, 1)
  332.           @clue_window.draw_item(@clue_window.index)
  333.         end
  334.         if $game_party.all_dead?
  335.           $scene = Scene_Gameover.new
  336.           return
  337.         end
  338.         if @item.common_event_id > 0
  339.           $game_temp.common_event_id = @item.common_event_id
  340.           $scene = Scene_Map.new
  341.           return
  342.         end
  343.       return
  344.       else
  345.         $game_system.se_play($data_system.decision_se)
  346.       @clue_window.active = false
  347.     @help_window.visible = true
  348.     @help_window.active = true
  349.         return
  350.       end
  351.      end  
  352.    
  353.   end
  354.   def update_help
  355.     @help_window.active = true
  356.   @help_window.visible = true
  357.   if Input.trigger?(Input::B)
  358.       $game_system.se_play($data_system.cancel_se)
  359.      @help_window.active = false
  360.    @help_window.visible = false
  361.     @clue_window.active = true
  362.   end
  363.   end
  364. end
复制代码


这个脚本是站上找的,里面的图片显示的功能我不知道是怎么使用的

介绍说是\P[n]显示在cluepics里的cluepic_n图片.

我在游戏文件夹中建了个叫cluepics的文件夹,然后在道具介绍里写

\p[图片名] 没用

\p[cluepic_图片名] 也不对

本人纯美工,对脚本一点也不通……

麻烦谁指点下~
版务信息:本贴由楼主自主结贴~

Lv1.梦旅人

梦石
0
星屑
64
在线时间
4352 小时
注册时间
2007-8-31
帖子
1982
2
发表于 2008-3-18 00:17:41 | 只看该作者
图片名必需是cluepic_n
比如cluepic_1
\P[1]
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
我真是王小二过年,一年不如一年。目前正在寻找状态中,努力找回当初的动力!
“底蕴制作者”—asperta最新博客开通!以后将在这里更新制作进度报告!
我的作品官网:http://www.asperta.org/
ASPERTA世界论坛:http://bbs.asperta.org/


回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
5550
在线时间
1569 小时
注册时间
2006-9-30
帖子
2042

开拓者

3
 楼主| 发表于 2008-3-18 00:20:15 | 只看该作者
{/fd} 这样啊…… 了解了…

那如果要显示一个 640x480的,要怎么改呢?

那个显示框的大小似乎不够……
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
64
在线时间
4352 小时
注册时间
2007-8-31
帖子
1982
4
发表于 2008-3-18 00:22:07 | 只看该作者
640x480的就直接用事件,显示图片就行了!
我真是王小二过年,一年不如一年。目前正在寻找状态中,努力找回当初的动力!
“底蕴制作者”—asperta最新博客开通!以后将在这里更新制作进度报告!
我的作品官网:http://www.asperta.org/
ASPERTA世界论坛:http://bbs.asperta.org/


回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
5550
在线时间
1569 小时
注册时间
2006-9-30
帖子
2042

开拓者

5
 楼主| 发表于 2008-3-18 00:25:01 | 只看该作者
我是想设置一个道具在平时|不能使用|,只有在这里才能通过介绍看到

显示其中的图片…是这个意思

要是公共事件的话就能在平时的菜单看了…
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
5550
在线时间
1569 小时
注册时间
2006-9-30
帖子
2042

开拓者

6
 楼主| 发表于 2008-3-18 00:32:38 | 只看该作者
{/fd}

能不能调整显示框的大小?

或者是|不能使用|的道具也可以设置成.点回车能调用公共事件?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
64
在线时间
4352 小时
注册时间
2007-8-31
帖子
1982
7
发表于 2008-3-18 00:37:51 | 只看该作者
楼主什么意思? 理解不能!
我真是王小二过年,一年不如一年。目前正在寻找状态中,努力找回当初的动力!
“底蕴制作者”—asperta最新博客开通!以后将在这里更新制作进度报告!
我的作品官网:http://www.asperta.org/
ASPERTA世界论坛:http://bbs.asperta.org/


回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
5550
在线时间
1569 小时
注册时间
2006-9-30
帖子
2042

开拓者

8
 楼主| 发表于 2008-3-18 00:43:11 | 只看该作者
{/pz}…………

这个…… 大概了解了~  

也没什么问题了
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-7-23 21:25

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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