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

Project1

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

[RMVA发布] 事件 [物品选择处理] 时显示物品描述 1.0.0.0

[复制链接]

Lv6.析梦学徒

Fuzzy Ginkgo
Taciturn Knight

梦石
0
星屑
60650
在线时间
1933 小时
注册时间
2010-6-26
帖子
1605

烫烫烫开拓者

跳转到指定楼层
1
发表于 2012-1-16 21:00:04 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 orzfly 于 2012-1-16 21:34 编辑

感谢 http://rpg.blue/forum.php?mod=viewthread&tid=219639 的想法。

以下是代码。描述见脚本君开头。
  1. #encoding:utf-8
  2. ###############################################################################
  3. # ■ [VA] 事件 [物品选择处理] 时显示物品描述 1.0.0.0
  4. #------------------------------------------------------------------------------
  5. #  作者: orzFly [http://orzfly.com]
  6. #  脚本主页: http://rgss.orzfly.com/key-item-description-va
  7. #------------------------------------------------------------------------------
  8. =begin
  9. ### 概况
  10. 功能是在当使用事件 [物品选择处理] 的时候能够显示出物品描述。

  11. 物品描述的显示,默认情况下将显示于选择框上侧。
  12. 您可以在 [显示文章] 和 [物品选择处理] 之间插入一个**空白**的 [显示文章],
  13. 请注意一定是空白的,文本内容留空并且头像设置也留空。此时这个指令的:

  14. * 窗口背景: 代表物品描述是否出现。即 `$game_message.item_help_visible` 属性。
  15.    * [普通窗口] 即属性值 `0`,代表出现。
  16.    * [暗色背景] 即属性值 `1`,代表按下 Shift 键时出现。
  17.                 此时位置设置将不起作用。
  18.    * [透明窗口] 即属性值 `2`,代表不出现。

  19. * 显示位置 : 代表物品描述显示位置。即 `$game_message.item_help_position` 属性。
  20.    * [居上] 即属性值 `true`,代表出现在物品栏选择框上侧。
  21.    * [居下] 即属性值 `false`,代表出现在物品栏选择框下侧。

  22. ### 更新日志
  23. * **1.0.0.0** January 16, 2012
  24.    * 初版。
  25. =end
  26. ###############################################################################
  27. #==============================================================================
  28. # ■ Window_Message (Patch: orzfly_key_item_description)
  29. #------------------------------------------------------------------------------
  30. #  显示文字信息的窗口。
  31. #==============================================================================

  32. class Window_Message < Window_Base
  33.   #--------------------------------------------------------------------------
  34.   # ● 生成所有窗口 (Patch: orzfly_key_item_description)
  35.   #--------------------------------------------------------------------------
  36.   alias create_all_windows_orzfly_key_item_description create_all_windows
  37.   def create_all_windows
  38.     create_all_windows_orzfly_key_item_description
  39.     @item_window.help_window = Window_Help.new
  40.     @item_window.help_window.openness = 0
  41.   end
  42.   #--------------------------------------------------------------------------
  43.   # ● 更新所有窗口 (Patch: orzfly_key_item_description)
  44.   #--------------------------------------------------------------------------
  45.   alias update_all_windows_orzfly_key_item_description update_all_windows
  46.   def update_all_windows
  47.     update_all_windows_orzfly_key_item_description
  48.     @item_window.help_window.update
  49.   end
  50.   #--------------------------------------------------------------------------
  51.   # ● 释放所有窗口 (Patch: orzfly_key_item_description)
  52.   #--------------------------------------------------------------------------
  53.   alias dispose_all_windows_orzfly_key_item_description dispose_all_windows
  54.   def dispose_all_windows
  55.     dispose_all_windows_orzfly_key_item_description
  56.     @item_window.help_window.dispose
  57.   end
  58. end

  59. #==============================================================================
  60. # ■ Window_KeyItem (Patch: orzfly_key_item_description)
  61. #------------------------------------------------------------------------------
  62. #  此窗口使用于事件指令中的“选择物品”功能。
  63. #==============================================================================

  64. class Window_KeyItem < Window_ItemList
  65.   #--------------------------------------------------------------------------
  66.   # ● 打开窗口 (Rewrite: orzfly_key_item_description)
  67.   #--------------------------------------------------------------------------
  68.   def open
  69.     self.help_window.open if $game_message.item_help_visible == 0
  70.     super
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # ● 关闭窗口 (Rewrite: orzfly_key_item_description)
  74.   #--------------------------------------------------------------------------
  75.   def close
  76.     self.help_window.close if $game_message.item_help_visible == 0
  77.     super
  78.   end
  79.   #--------------------------------------------------------------------------
  80.   # ● 更新窗口的位置 (Rewrite: orzfly_key_item_description)
  81.   #--------------------------------------------------------------------------
  82.   def update_placement
  83.     if $game_message.item_help_visible == 0
  84.       if $game_message.item_help_position
  85.         if @message_window.y >= Graphics.height / 2
  86.           self.help_window.y = 0
  87.           self.y = help_window.height
  88.         else
  89.           self.help_window.y = Graphics.height -
  90.                                self.help_window.height - self.height
  91.           self.y = Graphics.height - self.height
  92.         end
  93.       else
  94.         if @message_window.y >= Graphics.height / 2
  95.           self.y = 0
  96.           self.help_window.y = self.height
  97.         else
  98.           self.help_window.y = Graphics.height - help_window.height
  99.           self.y = Graphics.height - self.help_window.height - self.height
  100.         end
  101.       end
  102.     elsif $game_message.item_help_visible == 1
  103.       if @message_window.y >= Graphics.height / 2
  104.         self.y = 0
  105.         self.help_window.y = self.height
  106.       else
  107.         self.help_window.y = Graphics.height -
  108.                              self.help_window.height - self.height
  109.         self.y = Graphics.height - self.height
  110.       end
  111.     else
  112.       if @message_window.y >= Graphics.height / 2
  113.         self.y = 0
  114.       else
  115.         self.y = Graphics.height - height
  116.       end
  117.     end
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # ● “确定”和“取消”的处理 (Rewrite: orzfly_key_item_description)
  121.   #--------------------------------------------------------------------------
  122.   def process_handling
  123.     return unless open? && active
  124.     if $game_message.item_help_visible == 1
  125.       if Input.press?(:A)
  126.         self.help_window.open  if self.help_window.close?
  127.       else
  128.         self.help_window.close if self.help_window.open?
  129.       end
  130.     end
  131.     return super
  132.   end
  133. end

  134. #==============================================================================
  135. # ■ Game_Interpreter (Patch: orzfly_key_item_description)
  136. #------------------------------------------------------------------------------
  137. #  事件指令的解释器。
  138. #   本类在 Game_Map、Game_Troop、Game_Event 类的内部使用。
  139. #==============================================================================

  140. class Game_Interpreter
  141.   #--------------------------------------------------------------------------
  142.   # ● 显示文字 (Rewrite: orzfly_key_item_description)
  143.   #--------------------------------------------------------------------------
  144.   def command_101
  145.     wait_for_message
  146.     $game_message.face_name = @params[0]
  147.     $game_message.face_index = @params[1]
  148.     $game_message.background = @params[2]
  149.     $game_message.position = @params[3]
  150.     while next_event_code == 401       # 文字数据
  151.       @index += 1
  152.       $game_message.add(@list[@index].parameters[0])
  153.     end
  154.     case next_event_code
  155.     when 101
  156.       begin
  157.         if   @list[@index + 2].code          == 401 then
  158.           if @list[@index + 3].code          == 104 and
  159.              @list[@index + 2].parameters[0] == ""  and
  160.              @list[@index + 1].parameters[0] == ""  and
  161.              @list[@index + 1].parameters[1] == 0   then
  162.             @index += 1
  163.             $game_message.item_help_visible  = @list[@index].parameters[2]
  164.             $game_message.item_help_position = @list[@index].parameters[3] == 0
  165.             @index += 2
  166.             setup_item_choice(@list[@index].parameters)
  167.           end
  168.         end
  169.       rescue
  170.       end
  171.     when 102  # 显示选项
  172.       @index += 1
  173.       setup_choices(@list[@index].parameters)
  174.     when 103  # 数值输入的处理
  175.       @index += 1
  176.       setup_num_input(@list[@index].parameters)
  177.     when 104  # 物品选择的处理
  178.       @index += 1
  179.       setup_item_choice(@list[@index].parameters)
  180.     end
  181.     wait_for_message
  182.   end
  183. end

  184. #==============================================================================
  185. # ■ Game_Message (Patch: orzfly_key_item_description)
  186. #------------------------------------------------------------------------------
  187. #  处理信息窗口状态、文字显示、选项等的类。本类的实例请参考 $game_message 。
  188. #==============================================================================

  189. class Game_Message
  190.   #--------------------------------------------------------------------------
  191.   # ● 定义实例变量 (Patch: orzfly_key_item_description)
  192.   #--------------------------------------------------------------------------
  193.   attr_accessor :item_help_visible        # 物品选择: 显示方式
  194.   attr_accessor :item_help_position       # 物品选择: 显示位置
  195.   #--------------------------------------------------------------------------
  196.   # ● 清除 (Patch: orzfly_key_item_description)
  197.   #--------------------------------------------------------------------------
  198.   alias clear_orzfly_key_item_description clear
  199.   def clear
  200.     clear_orzfly_key_item_description
  201.     @item_help_visible = 0
  202.     @item_help_position = true
  203.   end
  204. end
复制代码

评分

参与人数 3星屑 +1400 收起 理由
lsu666666 + 700 精品文章
忧雪の伤 + 100 宋体瞎眼
越前リョーマ + 600 好东西

查看全部评分

我的言论只代表我个人的观点,不代表雇主及/或任何第三方的立场。
Opinions expressed are solely my own and do not express the views or opinions of my employer and/or any third parties.
捐赠 | GitHub

Lv1.梦旅人

梦石
0
星屑
149
在线时间
664 小时
注册时间
2011-9-25
帖子
241
2
发表于 2012-1-16 21:22:41 | 只看该作者
物品选择处理默认只能选择贵重物品的吧?楼主顺便也改成能处理普通物品了吗

点评

不會改腳本,求教學……  发表于 2012-1-16 21:42
自己去Window_KeyItem内改去  发表于 2012-1-16 21:31
不知裝甲武器那些行不行?  发表于 2012-1-16 21:25
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
121 小时
注册时间
2011-7-19
帖子
89
3
发表于 2012-1-16 21:30:49 | 只看该作者
首先支持一個!!

然後我又發現一個疑問,不知為何我在事件中插入腳本,無論是插入「$game_message.item_help_visible  = false」還是「$game_message.item_help_visible  = true」最後都會變成不顯示

点评

現在可以了謝謝~  发表于 2012-1-16 21:41
抱歉我注释里写错了 233 请重新阅读此帖现在的注释…… 另外强烈建议用简单的事件方法!  发表于 2012-1-16 21:35
在处理前加一个空的显示文章,让那个显示位置居上= =  发表于 2012-1-16 21:33
回复 支持 反对

使用道具 举报

Lv6.析梦学徒

Fuzzy Ginkgo
Taciturn Knight

梦石
0
星屑
60650
在线时间
1933 小时
注册时间
2010-6-26
帖子
1605

烫烫烫开拓者

4
 楼主| 发表于 2012-1-16 21:52:32 | 只看该作者
xuzhengchi 发表于 2012-1-16 21:22
物品选择处理默认只能选择贵重物品的吧?楼主顺便也改成能处理普通物品了吗 ...

@xuzhengchi @xiangelt
Window_KeyItem里有一个self.category = :key_item
改:key_item即可。

:item #物品
:weapon #武器
:armor #防具
:key_item #关键物品

只能选一个~233

点评

soga.感谢  发表于 2012-1-16 21:57
我的言论只代表我个人的观点,不代表雇主及/或任何第三方的立场。
Opinions expressed are solely my own and do not express the views or opinions of my employer and/or any third parties.
捐赠 | GitHub
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
121 小时
注册时间
2011-7-19
帖子
89
5
发表于 2012-1-16 22:14:28 | 只看该作者
@orzfly

現在武器/防具是能顯示出來了,可是不能選……

点评

能用的==只是不能賣出~  发表于 2012-1-17 19:14
我是说贵重物品的设定里是【不能使用】……  发表于 2012-1-17 16:28
在上述情況下,貴重物品是可以點的……  发表于 2012-1-17 11:58
没记错的话贵重物品也不能使用 = = 其实直接装备做成物品就可以了。  发表于 2012-1-17 02:49
期待ing……  发表于 2012-1-16 23:10
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
196 小时
注册时间
2010-10-20
帖子
143
6
发表于 2012-1-17 10:36:12 | 只看该作者
支持一下……
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
301
在线时间
573 小时
注册时间
2005-10-27
帖子
1164
7
发表于 2012-1-17 10:46:03 | 只看该作者
灰常好的东东弥补了VA这个功能的小小疏忽
认真地猥琐,猥琐地认真
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
378
在线时间
483 小时
注册时间
2011-12-16
帖子
212
8
发表于 2012-2-1 16:45:23 | 只看该作者
楼主好厉害啊~~~~
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
552
在线时间
464 小时
注册时间
2009-10-11
帖子
407
9
发表于 2012-2-11 03:28:26 | 只看该作者
雖然還在研究這個腳本中...但是謝謝樓主發布這個好用的程式囉!

点评

这种算水的 - - 警告一次 卖萌无用  发表于 2012-2-11 03:52
因为现实太残酷、所以我们都在打造虚幻的天堂。如果现实不再残酷,也是因为有这快乐的天堂。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
24 小时
注册时间
2012-7-14
帖子
9
10
发表于 2012-8-25 13:26:22 | 只看该作者
太感谢LZ了,我正在发愁呢对于新版本的脚本搜集!
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-2 17:19

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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