查看: 16150|回复: 11

[整合系统] 收集的VA脚本 分享给大家

[复制链接]
梦石
0
星屑
1461
在线时间
815 小时
注册时间
2013-8-3
回帖
355
发表于 2016-7-9 21:53:42 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 小小西 于 2016-7-10 15:03 编辑

PS:这些脚本都是在自己制作游戏的时候收集的,首先在这里要非常感谢这些脚本的创始人,66RPG有你们更精彩。
有的脚本由于个人需要已经被修改过了,脚本的使用方法我直接写在脚本最上面,我就不发范例了。
目前还未发现哪个脚本有冲突现象,有的话请大家及时汇报以便更改。
这里有很多常见的脚本,有的人会说我闲着蛋疼,那么就让我蛋疼一次吧!

建议先打上基础脚本,有的脚本会用到,先放进脚本编辑器无妨,不然有的脚本会报错(特别是 By喵呜喵5 的脚本)。
[fold=基础脚本]
  1. #==============================================================================
  2. # ■ 基础脚本
  3. #------------------------------------------------------------------------------
  4. #   请将基础脚本放在我的所有脚本之上。
  5. #
  6. #   Tips: 什么是基础脚本?
  7. #
  8. #     这个基础脚本包含我自己的脚本中经常使用的一些【完全相同】的代码
  9. #     虽然不能保证百分百兼容,但是基础脚本中所有的代码都能与大部分脚本和谐共处
  10. #     相应的,如果基础脚本中的某些代码与其他脚本发生了冲突
  11. #     只能证明,我脚本的【思路】和那个脚本【必定会发生冲突】
  12. #     这种情况下,即使我将脚本改写成一个不需要基础脚本的版本,冲突仍然会发生
  13. #
  14. #==============================================================================

  15. $m5script ||= {}; $m5script[:ScriptData] ||= {}
  16. $m5script[:M5Base] = 20160320
  17. #--------------------------------------------------------------------------
  18. # ● 版本检查
  19. #
  20. #     M5script.version(ver) 检查脚本版本是否高于指定版本
  21. #--------------------------------------------------------------------------
  22. module M5script
  23.   def self.version(ver,hint = "喵呜喵5基础脚本版本过低!",key = :M5Base, h2="")
  24.     version = $m5script[key.to_sym] || $m5script[key.to_s] || raise(h2)
  25.     raise(hint) if (ver > version)
  26.   end
  27. end
  28. #--------------------------------------------------------------------------
  29. # ● 读取备注、匹配文本
  30. #
  31. #     M5script::M5note.match_text(text, note[, option, &block])
  32. #     匹配文本的基本指令
  33. #
  34. #     text   : 文本内容(String)
  35. #     note   : 需要匹配的文字(String)
  36. #     option : 匹配文本的设置的哈希表
  37. #       :default 缺省值(nil)
  38. #       :value   待匹配文字是否包含内容(true)
  39. #       :list    是否返回全部匹配结果的数组(nil)
  40. #     &block : 成功匹配时执行的回调
  41. #
  42. #     M5script::M5note.map_note(map, note[, option, &block])
  43. #     读取地图备注
  44. #
  45. #     M5script::M5note.event_note(map, id, note[, option, &block])
  46. #     读取活动事件页的第一条指令,如果为注释则进行匹配
  47. #
  48. #--------------------------------------------------------------------------
  49. module M5script; module M5note; class << self
  50.   def match_text(text, note, *option, &block)
  51.     config = option[0].is_a?(Hash) ?
  52.       [option[0][:default], option[0][:value], option[0][:list]] : option
  53.     default, value, list =  *config
  54.     value = true if value.nil?
  55.     return list ? [] : default if text.empty?
  56.     all_result = []
  57.     text.each_line do |line|
  58.       line.chomp!
  59.       if value
  60.         result = /^\s*<\s*#{note}\s+(\S+)\s*>\s*$/ =~ line ? $1 : nil
  61.         next unless result
  62.         yield(result) if block_given?
  63.         return result unless list
  64.         all_result << result
  65.       else
  66.         return true if /^\s*<\s*#{note}\s*>\s*$/ =~ line
  67.       end
  68.     end
  69.     return false unless value
  70.     list ? all_result : default
  71.   end
  72.   def map_note(map, *args)
  73.     text = load_data(sprintf("Data/Map%03d.rvdata2", map)).note
  74.     match_text(text, *args)
  75.   end
  76.   def event_note(map, id, *args)
  77.     begin
  78.       if map == $game_map.map_id then page = $game_map.events[id]
  79.       else
  80.         ev = load_data(sprintf("Data/Map%03d.rvdata2", map)).events[id]
  81.         (page = Game_Event.new(map,ev)).refresh
  82.       end
  83.       page.empty? ? raise : ev_list = page.list
  84.     rescue then return match_text('', *args)
  85.     end
  86.     text = ''
  87.     ev_list.each do |c|
  88.       c.code == 108 || c.code == 408 || break
  89.       text += c.parameters[0] + "\n"
  90.     end
  91.     match_text(text, *args)
  92.   end
  93. end; end; end
  94. #--------------------------------------------------------------------------
  95. # ● 读取物品备注
  96. #--------------------------------------------------------------------------
  97. class RPG::BaseItem
  98.   def m5note *a,&b; M5script::M5note.match_text(@note,*a,&b); end
  99. end
  100. #--------------------------------------------------------------------------
  101. # ● 与旧版基础脚本的兼容
  102. #--------------------------------------------------------------------------
  103. class << M5script
  104.   def match_text *a,&b;      M5script::M5note.match_text *a,&b; end
  105.   def read_map_note *a,&b;   M5script::M5note.map_note *a,&b;   end
  106.   def read_event_note *a,&b; M5script::M5note.event_note *a,&b; end
  107. end
  108. #--------------------------------------------------------------------------
  109. # ● 精灵 Sprite_M5_Base / Sprite_M5
  110. #--------------------------------------------------------------------------
  111. class Sprite_M5_Base < Sprite
  112.   def dispose
  113.     dispose_bitmap
  114.     super
  115.   end
  116.   def dispose_bitmap; end
  117. end
  118. class Sprite_M5 < Sprite_M5_Base; end
  119. #--------------------------------------------------------------------------
  120. # ● 显示端口 Viewport_M5
  121. #--------------------------------------------------------------------------
  122. class Viewport_M5 < Viewport; end
  123. #--------------------------------------------------------------------------
  124. # ● 精灵组 Spriteset_M5
  125. #--------------------------------------------------------------------------
  126. class Spriteset_M5
  127.   def update; end
  128.   def dispose; end
  129. end
  130. #--------------------------------------------------------------------------
  131. # ● 自动更新释放精灵以及显示端口
  132. #--------------------------------------------------------------------------
  133. class Scene_Base
  134.   alias m5_20141113_update_basic update_basic
  135.   def update_basic
  136.     m5_20141113_update_basic
  137.     instance_variables.each do |varname|
  138.       ivar = instance_variable_get(varname)
  139.       ivar.update if ivar.is_a?(Sprite_M5) && !ivar.disposed?
  140.       ivar.update if ivar.is_a?(Spriteset_M5)
  141.     end
  142.   end
  143.   alias m5_20141113_terminate terminate
  144.   def terminate
  145.     m5_20141113_terminate
  146.     instance_variables.each do |varname|
  147.       ivar = instance_variable_get(varname)
  148.       ivar.dispose if ivar.is_a?(Sprite_M5_Base)
  149.       ivar.dispose if ivar.is_a?(Spriteset_M5)
  150.       ivar.dispose if ivar.is_a?(Viewport_M5)
  151.     end
  152.   end
  153. end
  154. #--------------------------------------------------------------------------
  155. # ● 获取控制符的参数(这个方法会破坏原始数据)
  156. #
  157. #     m5_obtain_escape_param(text)
  158. #--------------------------------------------------------------------------
  159. class Window_Base
  160.   def m5_obtain_escape_param(text)
  161.     text.slice!(/^\[.*?\]/)[1..-2] rescue ""
  162.   end
  163. end
  164. #--------------------------------------------------------------------------
  165. # ● 字体大小调整
  166. #
  167. #     include M5script::M5_Window_FontSize
  168. #
  169. #     m5_font_width       默认文字宽度
  170. #     m5_font_height      默认文字高度
  171. #     m5_font_size_change 调整文字大小
  172. #--------------------------------------------------------------------------
  173. module M5script; module M5_Window_FontSize
  174.   def m5_font_size_change(width = m5_font_width, height = m5_font_height)
  175.     contents.font.size = 40
  176.     contents.font.size -= 1 while text_size("口").width > width if width
  177.     contents.font.size -= 1 while text_size("口").height > height if height
  178.   end
  179.   def m5_font_width;  return nil; end
  180.   def m5_font_height; return nil; end
  181. end;end
  182. class Window_Base
  183.   alias m5_20140728_reset_font_settings reset_font_settings
  184.   def reset_font_settings
  185.     m5_20140728_reset_font_settings
  186.     m5_font_size_change if respond_to?(:m5_font_size_change)
  187.   end
  188.   alias m5_20140728_create_contents create_contents
  189.   def create_contents
  190.     m5_20140728_create_contents
  191.     m5_font_size_change if respond_to?(:m5_font_size_change)
  192.   end
  193. end
  194. #--------------------------------------------------------------------------
  195. # ● M5script::Window_Cal
  196. #
  197. #     计算一段文字大小时使用的临时窗口
  198. #
  199. #     cal_all_text_height(text) 计算总高度
  200. #     cal_all_text_width(text)  计算最大宽度
  201. #     calc_line_width(text)     计算单行宽度
  202. #     m5_contents               要描绘目标文字的contents
  203. #     line_height               设置每行文字的高度
  204. #--------------------------------------------------------------------------
  205. module M5script; class Window_Cal < Window_Base
  206.   attr_writer :line_height, :m5_contents
  207.   def initialize
  208.     super(0, 0, Graphics.width, Graphics.height)
  209.     self.visible = false
  210.     @text = ""
  211.     @line_height = nil
  212.     @m5_contents = nil
  213.   end
  214.   def line_height
  215.     return @line_height if @line_height
  216.     super
  217.   end
  218.   def initialize_contents
  219.     if @m5_contents
  220.       self.contents.dispose
  221.       self.contents = @m5_contents.clone
  222.     end
  223.   end
  224.   def cal_all_text_height(text)
  225.     initialize_contents
  226.     reset_font_settings
  227.     @text = text.clone
  228.     all_text_height = 1
  229.     convert_escape_characters(@text).each_line do |line|
  230.       all_text_height += calc_line_height(line, false)
  231.     end
  232.     @m5_contents = nil
  233.     return all_text_height
  234.   end
  235.   def cal_all_text_width(text)
  236.     initialize_contents
  237.     reset_font_settings
  238.     @text = text.clone
  239.     all_text_width = 1
  240.     convert_escape_characters(@text).each_line do |line|
  241.       all_text_width = [all_text_width,calc_line_width(line,false)].max
  242.     end
  243.     @m5_contents = nil
  244.     return all_text_width
  245.   end
  246.   def calc_line_width(target, need_refresh = true)
  247.     initialize_contents if need_refresh
  248.     reset_font_settings
  249.     text = target.clone
  250.     pos = {:x => 0, :y => 0, :new_x => 0, :height => Graphics.height}
  251.     process_character(text.slice!(0, 1), text, pos) until text.empty?
  252.     @m5_contents = nil if need_refresh
  253.     return pos[:x]
  254.   end
  255.   def process_new_line(text, pos);end
  256.   def draw_text(*args);end
  257. end; end
  258. #--------------------------------------------------------------------------
  259. # ● 自动计算大小和位置并包含背景的信息显示窗口
  260. #
  261. #     M5script::Window_Var
  262. #
  263. #     cal    计算窗口大小使用的临时窗口,M5script::Window_Cal 的实例
  264. #     config 窗口设置的哈希表,使用了以下键值:
  265. #            :X :X2 :Y :Y2 :Z :BACK :SX :SY
  266. #--------------------------------------------------------------------------
  267. module M5script; class Window_Var < Window_Base
  268.   def initialize(config, cal = nil)
  269.     get_config(config)
  270.     @dispose_flag = true unless cal
  271.     @size_window = cal || M5script::Window_Cal.new
  272.     super(0,0,0,0)
  273.     self.arrows_visible = false
  274.     self.z = @config[:Z]
  275.     self.openness = 0
  276.     create_back_sprite
  277.   end
  278.   def get_config(config)
  279.     @config = config.clone
  280.     @config[:SX] ||= 0
  281.     @config[:SY] ||= 0
  282.     @config[:Z] ||= 0
  283.   end
  284.   def create_back_sprite
  285.     return unless @config[:BACK]
  286.     self.opacity = 0
  287.     bitmap = Cache.system(@config[:BACK]) rescue nil
  288.     return unless bitmap
  289.     @background_sprite = Sprite.new
  290.     @background_sprite.x, @background_sprite.y = @config[:SX], @config[:SY]
  291.     @background_sprite.z = self.z - 1
  292.     @background_sprite.bitmap = bitmap
  293.   end
  294.   def update_placement
  295.     if @config[:X] && @config[:X2]
  296.       self.width = (@config[:X2] - @config[:X]).abs
  297.     else
  298.       @size_window.m5_contents = self.contents
  299.       self.width  = @size_window.cal_all_text_width(@word)
  300.       self.width += standard_padding * 2
  301.     end
  302.     if @config[:Y] && @config[:Y2]
  303.       self.height = (@config[:Y2] - @config[:Y]).abs
  304.     else
  305.       @size_window.m5_contents = self.contents
  306.       self.height = @size_window.cal_all_text_height(@word)
  307.       self.height += standard_padding * 2
  308.     end
  309.     create_contents
  310.   end
  311.   def update_position
  312.     if    @config[:X]  then self.x = @config[:X]
  313.     elsif @config[:X2] then self.x = @config[:X2] - self.width
  314.     else                    self.x = 0
  315.     end
  316.     if    @config[:Y]  then self.y = @config[:Y]
  317.     elsif @config[:Y2] then self.y = @config[:Y2] - self.height
  318.     else                    self.y = 0
  319.     end
  320.   end
  321.   def dispose
  322.     super
  323.     @size_window.dispose if @dispose_flag
  324.     @background_sprite.dispose if @background_sprite
  325.   end
  326. end; end
  327. #--------------------------------------------------------------------------
  328. # ● 生成TXT
  329. #
  330. #     M5script.creat_text(name,word,type)
  331. #--------------------------------------------------------------------------
  332. module M5script
  333.   def self.creat_text(name,word,type = 'w')
  334.     content = File.open("#{name}",type)
  335.     content.puts word
  336.     content.close
  337.   end
  338. end
  339. #--------------------------------------------------------------------------
  340. # ● 打开地址
  341. #
  342. #     M5script.open_url(addr)
  343. #--------------------------------------------------------------------------
  344. module M5script
  345.   def self.open_url(addr)
  346.     api = Win32API.new('shell32.dll','ShellExecuteA','pppppi','i')
  347.     api.call(0,'open',addr,0, 0, 1)
  348.   end
  349. end
  350. #--------------------------------------------------------------------------
  351. # ● 读取、写入Game.ini
  352. #
  353. #     M5script::M5ini.get(key, default_value[, section])
  354. #     M5script::M5ini.write(key, value[, section])
  355. #--------------------------------------------------------------------------
  356. module M5script; module M5ini; class << self
  357.   def filename; './Game.ini'; end
  358.   def default_section; 'M5script'; end
  359.   def get(key, default_value, section = default_section)
  360.     buffer = [].pack('x256')
  361.     api = Win32API.new('kernel32','GetPrivateProfileString','ppppip', 'i')
  362.     l = api.call(section, key, default_value, buffer, buffer.size, filename)
  363.     return buffer[0, l]
  364.   end
  365.   def write(key, value, section = default_section)
  366.     api = Win32API.new('kernel32','WritePrivateProfileString','pppp', 'i')
  367.     api.call(section, key, value.to_s, filename)
  368.   end
  369. end; end; end
复制代码
[/fold]
[fold=基础脚本]
  1. #----------------------------------------------------------------------------
  2. # ● Taroxd 基础设置
  3. #    定义了一些经常会用到的方法。
  4. #----------------------------------------------------------------------------
  5. #
  6. # 模块或类
  7. #   方法名(参数) { block } / 别名 -> 返回值的类型或介绍
  8. #     方法的介绍。
  9. #     如果返回值没有给出,表明返回值无意义或没有确定的类型。
  10. #
  11. # Module
  12. #   get_access_control(method_name) -> Symbol or nil
  13. #     获取方法的访问控制。返回 :public, :protected, :private 或 nil(未定义)
  14. #     method_name 为字符串或符号(Symbol),下同。
  15. #
  16. #   def_after(method_name) { |args| block } -> method_name
  17. #   def_after(method_name, hook) -> method_name
  18. #     重定义方法 method_name。
  19. #     第一种形式中,将 block 定义为方法,在原方法之后调用。
  20. #     第二种形式中,
  21. #     * 如果 hook 为符号或字符串,那么会在原方法之后调用对应的方法。
  22. #     * 如果 hook 可以响应方法 call,那么会在原方法之后调用 call。
  23. #     * 如果 hook 是 UnboundMethod,那么会将 hook 绑定到对象后调用。
  24. #
  25. #     不改变原方法的返回值和访问控制。
  26. #     无论哪种调用,参数都和原来的参数相同。
  27. #     以下 def_* 的所有方法均有这两种形式。为了方便起见只写出第一种。
  28. #
  29. #     例:
  30. #     class Game_Actor < Game_Battler
  31. #       def_after :initialize do |actor_id|
  32. #         @my_attribute = actor_id
  33. #       end
  34. #     end
  35. #
  36. #   def_after!(method_name) { |args| block } -> method_name
  37. #     与 def_after 类似,但改变原方法的返回值。
  38. #
  39. #   def_before(method_name) { |args| block } -> method_name
  40. #     与 def_after 类似,但在原方法之前调用。
  41. #
  42. #   def_with(method_name) { |old, args| block } -> method_name
  43. #     与 def_after! 类似,但参数不同。old 参数是原方法的返回值。
  44. #
  45. #   def_chain(method_name) { |old, args| block } -> method_name
  46. #     与 def_with 类似,但 old 参数为对应原方法的一个 Method 对象。
  47. #
  48. #   def_and(method_name) { |args| block } -> method_name
  49. #     与 def_after 类似,但仅当原方法的返回值为真时调用。
  50. #     仅当原方法的返回值为真时,才会改变原方法的返回值。
  51. #
  52. #   def_or(method_name) { |args| block } -> method_name
  53. #     与 def_after 类似,但仅当原方法的返回值为伪时调用。
  54. #     仅当原方法的返回值为假时,才会改变原方法的返回值。
  55. #
  56. #   def_if(method_name) { |args| block } -> method_name
  57. #     与 def_before 类似,但仅当调用结果为真时调用原方法。
  58. #     仅当调用的结果为假时,改变原方法的返回值为 nil。
  59. #
  60. #   def_unless(method_name) { |args| block } -> method_name
  61. #     与 def_before 类似,但仅当调用结果为假时调用原方法。
  62. #     仅当调用的结果为真时,改变原方法的返回值为 nil。
  63. #
  64. # Taroxd::ReadNote
  65. #   该模块由以下类 extend。
  66. #   RPG::BaseItem
  67. #   RPG::Map
  68. #   RPG::Event(将事件名称作为备注)
  69. #   RPG::Tileset
  70. #   RPG::Class::Learning
  71. #
  72. #   note_i(method_name, default = 0)
  73. #     定义方法 method_name,读取备注中 <method_name x> 形式的内容。其中 x 为整数。
  74. #     读取到的话,定义的方法会返回读取到的整数值,否则返回 default。
  75. #
  76. #   例:RPG::UsableItem.note_i :item_cost
  77. #
  78. #   note_f(method_name, default = 0.0)
  79. #     与 note_i 类似,但读取的是实数。
  80. #
  81. #   note_s(method_name, default = '')
  82. #     与 note_i 类似,但读取的是字符串。
  83. #
  84. #   note_bool(method_name)
  85. #     定义 method_name 方法,判断备注中是否存在 <method_name> 子字符串。
  86. #     特别地,若 method_name 以问号或感叹号结尾,读取内容中不需要包含问号、感叹号。
  87. #     (上面几个方法也是一样)
  88. #
  89. # Taroxd::DisposeBitmap
  90. #   dispose
  91. #     释放位图后调用父类的 dispose 方法。
  92. #
  93. # Spriteset_Map / Spriteset_Battle
  94. #   self.use_sprite(SpriteClass)
  95. #   self.use_sprite(SpriteClass) { block }
  96. #     在 Spriteset 中使用一个 SpriteClass 的精灵。
  97. #     如果给出 block,则生成精灵使用的参数是 block 在 Spriteset 的上下文中执行后的返回值。
  98. #     自动管理精灵的生成、更新、释放。
  99. #
  100. #    例:Spriteset_Map.use_sprite(Sprite_OnMap) { @viewport1 }
  101. #
  102. # Fixnum
  103. #   id -> self
  104. #     返回 self。这使得之后一些方法的参数既可以用数据库的数据,也可以用整数。
  105. #
  106. # Enumerable
  107. #   sum(base = 0) { |element| block }
  108. #     对所有元素 yield 后求和。base 为初始值。
  109. #     没有 block 参数时,对所有元素求和。
  110. #
  111. #   例:
  112. #   class Game_Unit
  113. #     def tgr_sum
  114. #       alive_members.sum(&:tgr)
  115. #     end
  116. #   end
  117. #
  118. #   pi(base = 1) { |element| block }
  119. #     与 sum 类似,但对所有元素求积。
  120. #
  121. # Game_BaseItem
  122. #   id / item_id -> Fixnum
  123. #     返回物品 id。
  124. #
  125. # Game_BattlerBase
  126. #   mtp -> Numeric
  127. #     返回 max_tp。
  128. #
  129. #   initialized? -> true
  130. #     返回 true。
  131. #
  132. # Game_Battler
  133. #   note_objects -> Enumerator
  134. #   note_objects { |obj| ... } -> self
  135. #     迭代战斗者拥有的所有带有备注的对象。
  136. #    (角色、职业、装备、技能、敌人、状态等)
  137. #     没有 block 给出时,返回 Enumerator 对象。
  138. #
  139. #   note -> String
  140. #     返回数据库对象的备注。
  141. #
  142. #   equips / weapons / armors -> []
  143. #     返回空数组。
  144. #
  145. #   skill?(skill) -> true / false
  146. #     判断是否拥有技能。skill 可以为技能 ID,也可以为 RPG::Skill 的实例。
  147. #
  148. #   skill_learn?(skill) -> true / false
  149. #     判断是否习得技能。skill 可以为技能 ID,也可以为 RPG::Skill 的实例。
  150. #
  151. # Game_Actor
  152. #   data_object -> RPG::Actor
  153. #     返回数据库对象,等价于 actor。
  154. #
  155. #   weapon?(item) / armor?(item) -> true / false
  156. #     检测是否装备对应的物品。item 可以为装备 ID,也可以为 RPG::EquipItem 的实例。
  157. #
  158. #   initialized? -> true / false
  159. #     判断角色是否已经初始化。
  160. #
  161. # Game_Enemy
  162. #   id -> Fixnum
  163. #     返回敌人 id。
  164. #
  165. #   data_object -> RPG::Enemy
  166. #     返回数据库对象,等价于 enemy。
  167. #
  168. #   skills -> Array
  169. #     返回敌人的所有技能实例的数组。
  170. #     skill? 方法判断是否拥有技能与该数组有关。
  171. #
  172. #   basic_skills -> Array
  173. #     返回敌人行动列表中的技能 ID 的数组(元素可以重复)。
  174. #     skill_learn? 方法判断是否学会技能与该数组有关。
  175. #
  176. # Game_Actors
  177. #   include Enumerable
  178. #
  179. #   each -> Enumerator
  180. #   each { |actor| block } -> self
  181. #     迭代已经初始化的每个角色。
  182. #     如果没有给出 block,返回一个 Enumerator 对象。
  183. #
  184. #   include?(actor)
  185. #     角色是否已经初始化。actor 可以为 Game_Actor / RPG::Actor 的对象或 ID。
  186. #
  187. # Game_Unit
  188. #   include Enumerable
  189. #
  190. #   each -> Enumerator
  191. #   each { |battler| block } -> self
  192. #     迭代队伍中的每个成员。
  193. #     如果没有给出 block,返回一个 Enumerator 对象。
  194. #     等价于 members.each。
  195. #
  196. #   each_member -> Enumerator / self
  197. #     each 的别名。
  198. #
  199. #   self[*args] / slice(*args) -> Game_Actor / Array / nil
  200. #     等价于 members[*args]
  201. #
  202. #   empty? -> true / false
  203. #     判断队伍是否为空。
  204. #
  205. #   size / length -> Integer
  206. #     返回队伍人数。
  207. #
  208. # Game_Party
  209. #   include?(actor) -> true / false
  210. #     队伍中是否存在角色。actor 可以为 Game_Actor / RPG::Actor 的对象或 ID。
  211. #
  212. # Game_Map
  213. #   id -> Fixnum
  214. #     返回地图 ID。
  215. #
  216. #   data_object -> RPG::Map
  217. #     返回数据库对象。
  218. #
  219. #   note -> String
  220. #     返回备注内容。
  221. #
  222. # Game_CharacterBase
  223. #   same_pos?(character) -> true / false
  224. #     判定是否处在相同位置。
  225. #     character 是任意能够响应方法 x 和 y 的对象。
  226. #     仅作为点(x, y)进行比较,不考虑 Game_Vehicle 的地图 ID 等问题。
  227. #
  228. #-----------------------------------------------------------------------------

  229. module Taroxd end

  230. module Taroxd::Def

  231.   Singleton = Module.new { Object.send :include, self }
  232.   Module.send :include, self

  233.   def get_access_control(sym)
  234.     return :public    if public_method_defined?    sym
  235.     return :protected if protected_method_defined? sym
  236.     return :private   if private_method_defined?   sym
  237.     nil
  238.   end

  239.   template = lambda do |singleton|
  240.     if singleton
  241.       klass = 'singleton_class'
  242.       get_method = 'method'
  243.       define = 'define_singleton_method'
  244.     else
  245.       klass = 'self'
  246.       get_method = 'instance_method'
  247.       define = 'define_method'
  248.     end
  249.     %(
  250.       def <name>(sym, hook = nil, &b)
  251.         access = #{klass}.get_access_control sym
  252.         old = #{get_method} sym
  253.         if b
  254.           #{define} sym, &b
  255.           hook = #{get_method} sym
  256.         end
  257.         if hook.respond_to? :to_sym
  258.           hook = hook.to_sym
  259.           #{define} sym do |*args, &block|
  260.             <pattern_sym>
  261.           end
  262.         elsif hook.respond_to? :call
  263.           #{define} sym do |*args, &block|
  264.             <pattern_call>
  265.           end
  266.         elsif hook.kind_of? UnboundMethod
  267.           #{define} sym do |*args, &block|
  268.             <pattern_unbound>
  269.           end
  270.         end
  271.         #{klass}.send access, sym
  272.         sym
  273.       end
  274.     )
  275.   end

  276.   # 保存模板和替换 'hook(' 字符串的字符
  277.   template = {false => template.call(false), true => template.call(true)}

  278.   # 替换掉 pattern 中的语法
  279.   gsub_pattern = lambda do |pattern, singleton|
  280.     old = singleton ? 'old' : 'old.bind(self)'
  281.     pattern.gsub('*', '*args, &block')
  282.            .gsub(/old(\()?/) { $1 ? "#{old}.call(" : old }
  283.   end

  284.   # 存入代替 "hook(" 的字符串
  285.   template['sym']     = '__send__(hook, '
  286.   template['call']    = 'hook.call('
  287.   template['unbound'] = 'hook.bind(self).call('

  288.   # 获取定义方法内容的字符串
  289.   # 得到的代码较长,请输出查看
  290.   code = lambda do |name, pattern, singleton|
  291.     pattern = gsub_pattern.call(pattern, singleton)
  292.     template[singleton]
  293.       .sub('<name>', name)
  294.       .gsub(/<pattern_(\w+?)>/) { pattern.gsub('hook(', template[$1]) }
  295.   end

  296.   main = TOPLEVEL_BINDING.eval('self')

  297.   # 定义 def_ 系列方法的方法
  298.   define_singleton_method :def_ do |name, pattern|
  299.     name = "#{__method__}#{name}"
  300.     module_eval code.call(name, pattern, false)
  301.     Singleton.module_eval code.call("singleton_#{name}", pattern, true)
  302.     main.define_singleton_method name, &Kernel.method(name)
  303.   end

  304.   # 实际定义 def_ 系列的方法
  305.   def_ :after,  'ret = old(*); hook(*); ret'
  306.   def_ :after!, 'old(*); hook(*)'
  307.   def_ :before, 'hook(*); old(*)'
  308.   def_ :with,   'hook(old(*), *)'
  309.   def_ :chain,  'hook(old, *)'
  310.   def_ :and,    'old(*) && hook(*)'
  311.   def_ :or,     'old(*) || hook(*)'
  312.   def_ :if,     'old(*) if hook(*)'
  313.   def_ :unless, 'old(*) unless hook(*)'
  314. end

  315. module Taroxd::ReadNote

  316.   include RPG
  317.   BaseItem.extend        self
  318.   Map.extend             self
  319.   Event.extend           self
  320.   Tileset.extend         self
  321.   Class::Learning.extend self

  322.   # 获取 note 的方法
  323.   def note_method
  324.     :note
  325.   end

  326.   # 事件名称作为备注
  327.   def Event.note_method
  328.     :name
  329.   end

  330.   # 备注模板
  331.   def note_any(name, default, re, capture)
  332.     name = name.to_s
  333.     mark = name.slice!(/[?!]\Z/)
  334.     re = re.source if re.kind_of?(Regexp)
  335.     re = "/<#{name.gsub('_', '\s*')}#{re}>/i"
  336.     default = default.inspect
  337.     class_eval %{
  338.       def #{name}
  339.         return @#{name} if instance_variable_defined? :@#{name}
  340.         @#{name} = #{note_method} =~ #{re} ? (#{capture}) : (#{default})
  341.       end
  342.     }, __FILE__, __LINE__
  343.     alias_method name + mark, name if mark
  344.   end

  345.   def note_i(name, default = 0)
  346.     note_any(name, default, '\s*(-?\d+)', '$1.to_i')
  347.   end

  348.   def note_f(name, default = 0.0)
  349.     note_any(name, default, '\s*(-?\d+(?:\.\d+)?)', '$1.to_f')
  350.   end

  351.   def note_s(name, default = '')
  352.     note_any(name, default, '\s*(\S.*)', '$1')
  353.   end

  354.   def note_bool(name)
  355.     note_any(name, false, '', 'true')
  356.   end
  357. end

  358. module Taroxd::DisposeBitmap
  359.   def dispose
  360.     bitmap.dispose if bitmap
  361.     super
  362.   end
  363. end

  364. module Taroxd::SpritesetDSL

  365.   # 方法名
  366.   CREATE_METHOD_NAME  = :create_taroxd_sprites
  367.   UPDATE_METHOD_NAME  = :update_taroxd_sprites
  368.   DISPOSE_METHOD_NAME = :dispose_taroxd_sprites

  369.   # 定义管理精灵的方法
  370.   def self.extended(klass)
  371.     klass.class_eval do
  372.       sprites = nil

  373.       define_method CREATE_METHOD_NAME do
  374.         sprites = klass.sprite_list.map do |sprite_class, get_args|
  375.           if get_args
  376.             sprite_class.new(*instance_eval(&get_args))
  377.           else
  378.             sprite_class.new
  379.           end
  380.         end
  381.       end

  382.       define_method(UPDATE_METHOD_NAME)  { sprites.each(&:update)  }
  383.       define_method(DISPOSE_METHOD_NAME) { sprites.each(&:dispose) }
  384.     end
  385.   end

  386.   def use_sprite(klass, &get_args)
  387.     sprite_list.push [klass, get_args]
  388.   end

  389.   def sprite_list
  390.     @_taroxd_use_sprite ||= []
  391.   end

  392.   # 在一系列方法上触发钩子
  393.   def sprite_method_hook(name)
  394.     def_after :"create_#{name}",  CREATE_METHOD_NAME
  395.     def_after :"update_#{name}",  UPDATE_METHOD_NAME
  396.     def_after :"dispose_#{name}", DISPOSE_METHOD_NAME
  397.   end
  398. end

  399. class Fixnum < Integer
  400.   alias_method :id, :to_int
  401. end

  402. module Enumerable
  403.   def sum(base = 0)
  404.     block_given? ? inject(base) { |a, e| a + yield(e) } : inject(base, :+)
  405.   end

  406.   def pi(base = 1)
  407.     block_given? ? inject(base) { |a, e| a * yield(e) } : inject(base, :*)
  408.   end
  409. end

  410. class Game_BaseItem
  411.   attr_reader :item_id
  412.   alias_method :id, :item_id
  413. end

  414. class Game_BattlerBase

  415.   def initialized?
  416.     true
  417.   end

  418.   def mtp
  419.     max_tp
  420.   end
  421. end

  422. class Game_Battler < Game_BattlerBase

  423.   # 迭代拥有备注的对象
  424.   def note_objects
  425.     return to_enum(__method__) unless block_given?
  426.     states.each { |e| yield e }
  427.     equips.each { |e| yield e if e }
  428.     skills.each { |e| yield e }
  429.     yield data_object
  430.     yield self.class if actor?
  431.   end

  432.   def regenerate_tp
  433.     self.tp += max_tp * trg
  434.   end

  435.   def data_object
  436.     raise NotImplementedError
  437.   end

  438.   def note
  439.     data_object.note
  440.   end

  441.   def id
  442.     data_object.id
  443.   end

  444.   def skills
  445.     (basic_skills | added_skills).sort.map { |id| $data_skills[id] }
  446.   end

  447.   def equips
  448.     []
  449.   end
  450.   alias_method :weapons, :equips
  451.   alias_method :armors,  :equips
  452.   alias_method :basic_skills, :equips

  453.   def skill?(skill)
  454.     basic_skills.include?(skill.id) || added_skills.include?(skill.id)
  455.   end

  456.   def skill_learn?(skill)
  457.     basic_skills.include?(skill.id)
  458.   end
  459. end

  460. class Game_Actor < Game_Battler

  461.   alias_method :data_object, :actor

  462.   def weapon?(weapon)
  463.     @equips.any? { |item| item.id == weapon.id && item.is_weapon? }
  464.   end

  465.   def armor?(armor)
  466.     @equips.any? { |item| item.id == armor.id && item.is_armor? }
  467.   end

  468.   def initialized?
  469.     $game_actors.include?(self)
  470.   end

  471.   private

  472.   def basic_skills
  473.     @skills
  474.   end
  475. end

  476. class Game_Enemy < Game_Battler

  477.   alias_method :data_object, :enemy
  478.   alias_method :id, :enemy_id

  479.   def basic_skills
  480.     enemy.actions.map(&:skill_id)
  481.   end
  482. end

  483. class Game_Actors

  484.   include Enumerable

  485.   def each
  486.     return to_enum(__method__) unless block_given?
  487.     @data.each { |actor| yield actor if actor }
  488.     self
  489.   end

  490.   def include?(actor)
  491.     @data[actor.id]
  492.   end
  493. end

  494. class Game_Unit

  495.   include Enumerable

  496.   def to_a
  497.     members
  498.   end

  499.   def each
  500.     return to_enum(__method__) unless block_given?
  501.     members.each { |battler| yield battler }
  502.     self
  503.   end
  504.   alias_method :each_member, :each

  505.   def [](*args)
  506.     members[*args]
  507.   end
  508.   alias_method :slice, :[]

  509.   def empty?
  510.     members.empty?
  511.   end

  512.   def size
  513.     members.size
  514.   end
  515.   alias_method :length, :size
  516. end

  517. class Game_Party < Game_Unit
  518.   def include?(actor)
  519.     @actors.include?(actor.id)
  520.   end
  521. end

  522. class Game_Map

  523.   alias_method :id, :map_id

  524.   def data_object
  525.     @map
  526.   end

  527.   def note
  528.     @map.note
  529.   end
  530. end

  531. class Game_CharacterBase
  532.   def same_pos?(character)
  533.     @x == character.x && @y == character.y
  534.   end
  535. end

  536. class Spriteset_Map
  537.   extend Taroxd::SpritesetDSL
  538.   sprite_method_hook :timer
  539. end

  540. class Spriteset_Battle
  541.   extend Taroxd::SpritesetDSL
  542.   sprite_method_hook :timer
  543. end
复制代码
[/fold]
1、这是事件党必备的脚本,个人觉得防卡效果最好的。
[fold=【超级防卡脚本】]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #==============================================================================
  3. # +++ MOG - Simple Anti Lag (V1.0) +++
  4. #==============================================================================
  5. # By Moghunter
  6. # http://www.atelier-rgss.com
  7. #==============================================================================
  8. # Sistema de antilag.
  9. #==============================================================================
  10. # Para desativar ou ativar o sistema de antilag use o comando abaixo
  11. #
  12. # $game_system.anti_lag = true      
  13. #
  14. #==============================================================================
  15. # NOTA - Este script não funciona em mapas com efeito LOOP.
  16. #
  17. #==============================================================================
  18. module MOG_ANTI_LAG
  19.   #Area que será atualizada fora da tela.
  20.   UPDATE_OUT_SCREEN_RANGE = 5
  21. end

  22. #==============================================================================
  23. # ■ Game_System
  24. #==============================================================================
  25. class Game_System
  26.   attr_accessor :anti_lag
  27.   
  28. #--------------------------------------------------------------------------
  29. # ● Initialize
  30. #--------------------------------------------------------------------------   
  31.   alias mog_antilag_initialize initialize
  32.   def initialize
  33.       @anti_lag = true
  34.       mog_antilag_initialize
  35.   end  
  36. end

  37. #==============================================================================
  38. # ■ Game_Character
  39. #==============================================================================
  40. class Game_Event < Game_Character
  41.   
  42.   attr_accessor :can_update            

  43.   #--------------------------------------------------------------------------
  44.   # ● Initialize
  45.   #--------------------------------------------------------------------------
  46.   alias mog_anti_lag_initialize initialize
  47.   def initialize(map_id, event)
  48.       mog_anti_lag_initialize(map_id, event)
  49.       @can_update = true
  50.       @anti_lag = true
  51.       if $game_map.loop_horizontal? or $game_map.loop_vertical?
  52.          @anti_lag = false
  53.       end
  54.   end
  55.    
  56. #--------------------------------------------------------------------------
  57. # ● Check Event on Screen
  58. #--------------------------------------------------------------------------
  59. def update_anti_lag
  60.      unless $game_system.anti_lag
  61.          @can_update = true
  62.          return
  63.      end  
  64.      anti_lag_event_on_screen
  65. end
  66.    
  67. #--------------------------------------------------------------------------
  68. # ● Event On Screen
  69. #--------------------------------------------------------------------------
  70. def anti_lag_event_on_screen
  71.      @can_update = false
  72.      out_screen = MOG_ANTI_LAG::UPDATE_OUT_SCREEN_RANGE
  73.      px = ($game_map.display_x).truncate
  74.      py = ($game_map.display_y).truncate
  75.      distance_x = @x - px
  76.      distance_y = @y - py
  77.      if distance_x.between?(0 - out_screen, 16 + out_screen) and   
  78.         distance_y.between?(0 - out_screen, 19 + out_screen)
  79.         @can_update = true
  80.      end
  81. end
  82.   
  83. #--------------------------------------------------------------------------
  84. # ● Update
  85. #--------------------------------------------------------------------------     
  86.   alias mog_anti_lag_update update
  87.   def update
  88.       update_anti_lag unless !@anti_lag
  89.       return if !@can_update
  90.       mog_anti_lag_update
  91.   end
  92. end

  93. #==============================================================================
  94. # ■ Sprite Character
  95. #==============================================================================
  96. class Sprite_Character < Sprite_Base

  97. #--------------------------------------------------------------------------
  98. # ● Check Can Update Sprite
  99. #--------------------------------------------------------------------------      
  100.   def check_can_update_sprite
  101.       if self.visible and !@character.can_update
  102.          reset_sprite_effects
  103.       end        
  104.       self.visible = @character.can_update           
  105.   end
  106.   
  107. #--------------------------------------------------------------------------
  108. # ● Reset Sprite Effects
  109. #--------------------------------------------------------------------------         
  110.   def reset_sprite_effects
  111.       dispose_animation
  112.   end
  113.   
  114. #--------------------------------------------------------------------------
  115. # ● Update
  116. #--------------------------------------------------------------------------           
  117.   alias mog_anti_lag_update update
  118.   def update
  119.       if $game_system.anti_lag and @character.is_a?(Game_Event)
  120.          check_can_update_sprite
  121.          return unless self.visible
  122.       end   
  123.       mog_anti_lag_update
  124.   end
  125.   
  126. end

  127. $mog_rgss3_anti_lag = true
复制代码
[/fold]
2、这个应该是非常常见的脚本,不过为了集合一下还是发上来吧。
[fold=详细的状态显示脚本]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #==============================================================================
  3. #
  4. # ▼ Yanfly Engine Ace - Ace Status Menu v1.01
  5. # -- Last Updated: 2011.12.26
  6. # -- Level: Normal
  7. # -- Requires: n/a
  8. #
  9. #==============================================================================

  10. $imported = {} if $imported.nil?
  11. $imported["YEA-StatusMenu"] = true

  12. #==============================================================================
  13. # ▼ Updates
  14. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  15. # 2011.12.26 - Compatibility Update: Rename Actor
  16. # 2011.12.23 - Started Script and Finished.
  17. #
  18. #==============================================================================
  19. # ▼ Introduction
  20. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  21. # This script changes the status screen completely to something the player can
  22. # interact with more and be able to view actor data with more clarity. The
  23. # player is able to view the general information for an actor (parameters and
  24. # experience), a parameters bar graph, the various hidden extra parameters
  25. # (named properties in the script), and a customizable biography for the actor.
  26. # Also with this script, biographies can be changed at any time using a script
  27. # call to add more of a personal touch to characters.
  28. #
  29. #==============================================================================
  30. # ▼ Instructions
  31. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  32. # To install this script, open up your script editor and copy/paste this script
  33. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  34. #
  35. # -----------------------------------------------------------------------------
  36. # Script Calls - These commands are used with script calls.
  37. # -----------------------------------------------------------------------------
  38. # $game_actors[x].description = string
  39. # Changes the biography description for actor x to that of the string. Use \n
  40. # to designate linebreaks in the string. If you wish to use text codes, write
  41. # them in the strings as \\n[2] or \\c[3] to make them work properly.
  42. #
  43. #==============================================================================
  44. # ▼ Compatibility
  45. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  46. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  47. # it will run with RPG Maker VX without adjusting.
  48. #
  49. #==============================================================================

  50. module YEA
  51.   module STATUS

  52.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  53.     # - Command Window Settings -
  54.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  55.     # This section adjusts the commands that appear in the command window used
  56.     # for the status screen. Rearrange the commands, add new ones, remove them
  57.     # as you see fit.
  58.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  59.     COMMANDS =[ # The order at which the menu items are shown.
  60.     # [    :command,    "Display"],
  61.       [    :general,    "信息"],
  62.       [ :parameters, "数据"],
  63.       [ :properties, "属性"],
  64.     # [    :custom1,     "Skills"],
  65.      #[    :custom2,  "Equipment"],
  66.      #[    :custom3,      "Class"],
  67.       [     :rename,     "Rename"],  # Requires YEA - Rename Actor
  68.       [    :retitle,    "Retitle"],  # Requires YEA - Rename Actor
  69.     ] # Do not remove this.

  70.     #--------------------------------------------------------------------------
  71.     # - Status Custom Commands -
  72.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  73.     # For those who use scripts to that may produce unique effects for the
  74.     # status menu, use this hash to manage the custom commands for the Status
  75.     # Command Window. You can disable certain commands or prevent them from
  76.     # appearing by using switches. If you don't wish to bind them to a switch,
  77.     # set the proper switch to 0 for it to have no impact.
  78.     #--------------------------------------------------------------------------
  79.     CUSTOM_STATUS_COMMANDS ={
  80.     # :command => [EnableSwitch, ShowSwitch, Handler Method, Window Draw],
  81.       :custom1 => [           0,          0, :command_name1, :draw_custom1],
  82.       :custom2 => [           0,          0, :command_name2, :draw_custom2],
  83.       :custom3 => [           0,          0, :command_name3, :draw_custom3],
  84.     } # Do not remove this.

  85.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  86.     # - General Window Settings -
  87.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  88.     # These settings adjust the way the general window visually appears.
  89.     # Not many changes need to be done here other than vocab changes.
  90.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  91.     PARAMETERS_VOCAB = "数据"         # Title used for Parameters.
  92.     EXPERIENCE_VOCAB = "经验值"         # Title used for Experience.
  93.     NEXT_TOTAL_VOCAB = "下次 %s 经验值总数"  # Label used for total experience.

  94.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  95.     # - Parameters Window Settings -
  96.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  97.     # These settings adjust the way the parameters window visually appears.
  98.     # Each of the stats have a non-window colour. Adjust them as you see fit.
  99.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  100.     PARAM_COLOUR ={
  101.     # ParamID => [:stat,       Colour1,                   Colour2          ],
  102.             2 => [ :atk, Color.new(225, 100, 100), Color.new(240, 150, 150)],
  103.             3 => [ :def, Color.new(250, 150,  30), Color.new(250, 180, 100)],
  104.             4 => [ :mat, Color.new( 70, 140, 200), Color.new(135, 180, 230)],
  105.             5 => [ :mdf, Color.new(135, 130, 190), Color.new(170, 160, 220)],
  106.             6 => [ :agi, Color.new( 60, 180,  80), Color.new(120, 200, 120)],
  107.             7 => [ :luk, Color.new(255, 240, 100), Color.new(255, 250, 200)],
  108.     } # Do not remove this.

  109.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  110.     # - Properties Window Settings -
  111.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  112.     # These settings adjust the way the properties window visually appears.
  113.     # The properties have abbreviations, but leaving them as such makes things
  114.     # confusing (as it's sometimes hard to figure out what the abbreviations
  115.     # mean). Change the way the appear, whether or not they appear, and what
  116.     # order they will appear in.
  117.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  118.     PROPERTIES_FONT_SIZE = 16        # Font size used for properties.

  119.     # These are the properties that appear in column 1.
  120.     PROPERTIES_COLUMN1 =[
  121.       [:hit, "命中"],
  122.       [:eva, "躲避"],
  123.       [:cri, "致命一击"],
  124.       [:cev, "致命闪避"],
  125.       [:mev, "魔法躲避"],
  126.       [:mrf, "魔法反射"],
  127.       [:cnt, "反击"],
  128.       [:tgr, "受敌攻击"],
  129.     ] # Do not remove this.

  130.     # These are the properties that appear in column 2.
  131.     PROPERTIES_COLUMN2 =[
  132.       [:hrg, "hp逐渐恢复"],
  133.       [:mrg, "mp逐渐恢复"],
  134.       [:trg, "SP逐渐恢复"],
  135.       [:rec, "魔法恢复"],
  136.       [:grd, "防御力"],
  137.       [:pha, "药品恢复"],
  138.       [:exr, "获得经验"],
  139.       [:tcr, "SP获得率"],
  140.     ] # Do not remove this.

  141.     # These are the properties that appear in column 3.
  142.     PROPERTIES_COLUMN3 =[
  143.       [:hcr, "SB伤害"],    # Requires YEA - Skill Cost Manager
  144.       [:mcr, "MF消耗"],
  145.       [:tcr, "SQ伤害"],    # Requires YEA - Skill Cost Manager
  146.       [:cdr, "直接伤害"],   # Requires YEA - Skill Restrictions
  147.       [:wur, "间接伤害"],     # Requires YEA - Skill Restrictions
  148.       [:pdr, "物理伤害"],
  149.       [:mdr, "魔法伤害"],
  150.       [:fdr, "基本伤害"],
  151.     ] # Do not remove this.

  152.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  153.     # - Biography Window Settings -
  154.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  155.     # These settings adjust the way the biography appears including the title
  156.     # used at the top, the font size, and whatnot.
  157.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  158.     BIOGRAPHY_NICKNAME_TEXT = "%s    %s"   # How the nickname will appear.
  159.     BIOGRAPHY_NICKNAME_SIZE = 32            # Size of the font used.



  160.   end # STATUS
  161. end # YEA

  162. #==============================================================================
  163. # ▼ Editting anything past this point may potentially result in causing
  164. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  165. # halitosis so edit at your own risk.
  166. #==============================================================================

  167. #==============================================================================
  168. # ■ Numeric
  169. #==============================================================================

  170. class Numeric

  171.   #--------------------------------------------------------------------------
  172.   # new method: group_digits
  173.   #--------------------------------------------------------------------------
  174.   unless $imported["YEA-CoreEngine"]
  175.   def group; return self.to_s; end
  176.   end # $imported["YEA-CoreEngine"]

  177. end # Numeric

  178. #==============================================================================
  179. # ■ Game_Temp
  180. #==============================================================================

  181. class Game_Temp

  182.   #--------------------------------------------------------------------------
  183.   # public instance variables
  184.   #--------------------------------------------------------------------------
  185.   attr_accessor :scene_status_index
  186.   attr_accessor :scene_status_oy

  187. end # Game_Temp

  188. #==============================================================================
  189. # ■ Game_Actor
  190. #==============================================================================

  191. class Game_Actor < Game_Battler

  192.   #--------------------------------------------------------------------------
  193.   # new method: description=
  194.   #--------------------------------------------------------------------------
  195.   def description=(text)
  196.     @description = text
  197.   end

  198.   #--------------------------------------------------------------------------
  199.   # overwrite method: description
  200.   #--------------------------------------------------------------------------
  201.   def description
  202.     return @description unless @description.nil?
  203.     return actor.description
  204.   end

  205. end # Game_Actor

  206. #==============================================================================
  207. # ■ Window_StatusCommand
  208. #==============================================================================

  209. class Window_StatusCommand < Window_Command

  210.   #--------------------------------------------------------------------------
  211.   # public instance variables
  212.   #--------------------------------------------------------------------------
  213.   attr_accessor :item_window

  214.   #--------------------------------------------------------------------------
  215.   # initialize
  216.   #--------------------------------------------------------------------------
  217.   def initialize(dx, dy)
  218.     super(dx, dy)
  219.     @actor = nil
  220.   end

  221.   #--------------------------------------------------------------------------
  222.   # window_width
  223.   #--------------------------------------------------------------------------
  224.   def window_width; return 160; end

  225.   #--------------------------------------------------------------------------
  226.   # actor=
  227.   #--------------------------------------------------------------------------
  228.   def actor=(actor)
  229.     return if @actor == actor
  230.     @actor = actor
  231.     refresh
  232.   end

  233.   #--------------------------------------------------------------------------
  234.   # visible_line_number
  235.   #--------------------------------------------------------------------------
  236.   def visible_line_number; return 4; end

  237.   #--------------------------------------------------------------------------
  238.   # ok_enabled?
  239.   #--------------------------------------------------------------------------
  240.   def ok_enabled?
  241.     return handle?(current_symbol)
  242.   end

  243.   #--------------------------------------------------------------------------
  244.   # make_command_list
  245.   #--------------------------------------------------------------------------
  246.   def make_command_list
  247.     return unless @actor
  248.     for command in YEA::STATUS::COMMANDS
  249.       case command[0]
  250.       #--- Default ---
  251.       when :general, :parameters, :properties, :biography
  252.         add_command(command[1], command[0])
  253.       #--- Yanfly Engine Ace ---
  254.       when :rename
  255.         next unless $imported["YEA-RenameActor"]
  256.         add_command(command[1], command[0], @actor.rename_allow?)
  257.       when :retitle
  258.         next unless $imported["YEA-RenameActor"]
  259.         add_command(command[1], command[0], @actor.retitle_allow?)
  260.       #--- Custom Commands ---
  261.       else
  262.         process_custom_command(command)
  263.       end
  264.     end
  265.     if !$game_temp.scene_status_index.nil?
  266.       select($game_temp.scene_status_index)
  267.       self.oy = $game_temp.scene_status_oy
  268.     end
  269.     $game_temp.scene_status_index = nil
  270.     $game_temp.scene_status_oy = nil
  271.   end

  272.   #--------------------------------------------------------------------------
  273.   # process_ok
  274.   #--------------------------------------------------------------------------
  275.   def process_ok
  276.     $game_temp.scene_status_index = index
  277.     $game_temp.scene_status_oy = self.oy
  278.     super
  279.   end

  280.   #--------------------------------------------------------------------------
  281.   # process_custom_command
  282.   #--------------------------------------------------------------------------
  283.   def process_custom_command(command)
  284.     return unless YEA::STATUS::CUSTOM_STATUS_COMMANDS.include?(command[0])
  285.     show = YEA::STATUS::CUSTOM_STATUS_COMMANDS[command[0]][1]
  286.     continue = show <= 0 ? true : $game_switches[show]
  287.     return unless continue
  288.     text = command[1]
  289.     switch = YEA::STATUS::CUSTOM_STATUS_COMMANDS[command[0]][0]
  290.     enabled = switch <= 0 ? true : $game_switches[switch]
  291.     add_command(text, command[0], enabled)
  292.   end

  293.   #--------------------------------------------------------------------------
  294.   # update
  295.   #--------------------------------------------------------------------------
  296.   def update
  297.     super
  298.     update_item_window
  299.   end

  300.   #--------------------------------------------------------------------------
  301.   # update_item_window
  302.   #--------------------------------------------------------------------------
  303.   def update_item_window
  304.     return if @item_window.nil?
  305.     return if @current_index == current_symbol
  306.     @current_index = current_symbol
  307.     @item_window.refresh
  308.   end

  309.   #--------------------------------------------------------------------------
  310.   # item_window=
  311.   #--------------------------------------------------------------------------
  312.   def item_window=(window)
  313.     @item_window = window
  314.     update
  315.   end

  316.   #--------------------------------------------------------------------------
  317.   # update_help
  318.   #--------------------------------------------------------------------------
  319.   def update_help
  320.     return if @actor.nil?
  321.     @help_window.set_text(@actor.actor.description)
  322.   end

  323. end # Window_StatusCommand

  324. #==============================================================================
  325. # ■ Window_StatusActor
  326. #==============================================================================

  327. class Window_StatusActor < Window_Base

  328.   #--------------------------------------------------------------------------
  329.   # initialize
  330.   #--------------------------------------------------------------------------
  331.   def initialize(dx, dy)
  332.     super(dx, dy, window_width, fitting_height(4))
  333.     @actor = nil
  334.   end

  335.   #--------------------------------------------------------------------------
  336.   # window_width
  337.   #--------------------------------------------------------------------------
  338.   def window_width; return Graphics.width - 160; end

  339.   #--------------------------------------------------------------------------
  340.   # actor=
  341.   #--------------------------------------------------------------------------
  342.   def actor=(actor)
  343.     return if @actor == actor
  344.     @actor = actor
  345.     refresh
  346.   end

  347.   #--------------------------------------------------------------------------
  348.   # refresh
  349.   #--------------------------------------------------------------------------
  350.   def refresh
  351.     contents.clear
  352.     return unless @actor
  353.     draw_actor_face(@actor, 0, 0)
  354.     draw_actor_simple_status(@actor, 108, line_height / 2)
  355.   end

  356. end # Window_StatusActor

  357. #==============================================================================
  358. # ■ Window_StatusItem
  359. #==============================================================================

  360. class Window_StatusItem < Window_Base

  361.   #--------------------------------------------------------------------------
  362.   # initialize
  363.   #--------------------------------------------------------------------------
  364.   def initialize(dx, dy, command_window)
  365.     super(dx, dy, Graphics.width, Graphics.height - dy)
  366.     @command_window = command_window
  367.     @actor = nil
  368.     refresh
  369.   end

  370.   #--------------------------------------------------------------------------
  371.   # actor=
  372.   #--------------------------------------------------------------------------
  373.   def actor=(actor)
  374.     return if @actor == actor
  375.     @actor = actor
  376.     refresh
  377.   end

  378.   #--------------------------------------------------------------------------
  379.   # refresh
  380.   #--------------------------------------------------------------------------
  381.   def refresh
  382.     contents.clear
  383.     reset_font_settings
  384.     return unless @actor
  385.     draw_window_contents
  386.   end

  387.   #--------------------------------------------------------------------------
  388.   # draw_window_contents
  389.   #--------------------------------------------------------------------------
  390.   def draw_window_contents
  391.     case @command_window.current_symbol
  392.     when :general
  393.       draw_actor_general
  394.     when :parameters
  395.       draw_parameter_graph
  396.     when :properties
  397.       draw_properties_list
  398.     when :biography, :rename, :retitle
  399.       draw_actor_biography
  400.     else
  401.       draw_custom
  402.     end
  403.   end

  404.   #--------------------------------------------------------------------------
  405.   # draw_actor_general
  406.   #--------------------------------------------------------------------------
  407.   def draw_actor_general
  408.     change_color(system_color)
  409.     text = YEA::STATUS::PARAMETERS_VOCAB
  410.     draw_text(0, 0, contents.width/2, line_height, text, 1)
  411.     text = YEA::STATUS::EXPERIENCE_VOCAB
  412.     draw_text(contents.width/2, 0, contents.width/2, line_height, text, 1)
  413.     draw_general_parameters
  414.     draw_general_experience
  415.   end

  416.   #--------------------------------------------------------------------------
  417.   # draw_general_parameters
  418.   #--------------------------------------------------------------------------
  419.   def draw_general_parameters
  420.     dx = 24
  421.     dy = line_height / 2
  422.     draw_actor_level(dx, line_height*1+dy, contents.width/2 - 24)
  423.     draw_actor_param(0, dx, line_height*2+dy, contents.width/2 - 24)
  424.     draw_actor_param(1, dx, line_height*3+dy, contents.width/2 - 24)
  425.     draw_actor_param(2, dx, line_height*4+dy, contents.width/4 - 12)
  426.     draw_actor_param(4, dx, line_height*5+dy, contents.width/4 - 12)
  427.     draw_actor_param(6, dx, line_height*6+dy, contents.width/4 - 12)
  428.     dx += contents.width/4 - 12
  429.     draw_actor_param(3, dx, line_height*4+dy, contents.width/4 - 12)
  430.     draw_actor_param(5, dx, line_height*5+dy, contents.width/4 - 12)
  431.     draw_actor_param(7, dx, line_height*6+dy, contents.width/4 - 12)
  432.   end

  433.   #--------------------------------------------------------------------------
  434.   # draw_actor_level
  435.   #--------------------------------------------------------------------------
  436.   def draw_actor_level(dx, dy, dw)
  437.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  438.     rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
  439.     contents.fill_rect(rect, colour)
  440.     change_color(system_color)
  441.     draw_text(dx+4, dy, dw-8, line_height, Vocab::level)
  442.     change_color(normal_color)
  443.     draw_text(dx+4, dy, dw-8, line_height, @actor.level.group, 2)
  444.   end

  445.   #--------------------------------------------------------------------------
  446.   # draw_actor_param
  447.   #--------------------------------------------------------------------------
  448.   def draw_actor_param(param_id, dx, dy, dw)
  449.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  450.     rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
  451.     contents.fill_rect(rect, colour)
  452.     change_color(system_color)
  453.     draw_text(dx+4, dy, dw-8, line_height, Vocab::param(param_id))
  454.     change_color(normal_color)
  455.     draw_text(dx+4, dy, dw-8, line_height, @actor.param(param_id).group, 2)
  456.   end

  457.   #--------------------------------------------------------------------------
  458.   # draw_general_experience
  459.   #--------------------------------------------------------------------------
  460.   def draw_general_experience
  461.     if @actor.max_level?
  462.       s1 = @actor.exp.group
  463.       s2 = "-------"
  464.       s3 = "-------"
  465.     else
  466.       s1 = @actor.exp.group
  467.       s2 = (@actor.next_level_exp - @actor.exp).group
  468.       s3 = @actor.next_level_exp.group
  469.     end
  470.     s_next = sprintf(Vocab::ExpNext, Vocab::level)
  471.     total_next_text = sprintf(YEA::STATUS::NEXT_TOTAL_VOCAB, Vocab::level)
  472.     change_color(system_color)
  473.     dx = contents.width/2 + 12
  474.     dy = line_height * 3 / 2
  475.     dw = contents.width/2 - 36
  476.     draw_text(dx, dy + line_height * 0, dw, line_height, Vocab::ExpTotal)
  477.     draw_text(dx, dy + line_height * 2, dw, line_height, s_next)
  478.     draw_text(dx, dy + line_height * 4, dw, line_height, total_next_text)
  479.     change_color(normal_color)
  480.     draw_text(dx, dy + line_height * 1, dw, line_height, s1, 2)
  481.     draw_text(dx, dy + line_height * 3, dw, line_height, s2, 2)
  482.     draw_text(dx, dy + line_height * 5, dw, line_height, s3, 2)
  483.   end

  484.   #--------------------------------------------------------------------------
  485.   # draw_parameter_graph
  486.   #--------------------------------------------------------------------------
  487.   def draw_parameter_graph
  488.     draw_parameter_title
  489.     dy = line_height * 3/2
  490.     maximum = 1
  491.     minimum = @actor.param_max(2)
  492.     for i in 2..7
  493.       maximum = [@actor.param(i), maximum].max
  494.       minimum = [@actor.param(i), minimum].min
  495.     end
  496.     maximum += minimum * 0.33 unless maximum == minimum
  497.     for i in 2..7
  498.       rate = calculate_rate(maximum, minimum, i)
  499.       dy = line_height * i - line_height/2
  500.       draw_param_gauge(i, dy, rate)
  501.       change_color(system_color)
  502.       draw_text(28, dy, contents.width - 56, line_height, Vocab::param(i))
  503.       dw = (contents.width - 48) * rate - 8
  504.       change_color(normal_color)
  505.       draw_text(28, dy, dw, line_height, @actor.param(i).group, 2)
  506.     end
  507.   end

  508.   #--------------------------------------------------------------------------
  509.   # calculate_rate
  510.   #--------------------------------------------------------------------------
  511.   def calculate_rate(maximum, minimum, param_id)
  512.     return 1.0 if maximum == minimum
  513.     rate = (@actor.param(param_id).to_f - minimum) / (maximum - minimum).to_f
  514.     rate *= 0.67
  515.     rate += 0.33
  516.     return rate
  517.   end

  518.   #--------------------------------------------------------------------------
  519.   # draw_param_gauge
  520.   #--------------------------------------------------------------------------
  521.   def draw_param_gauge(param_id, dy, rate)
  522.     dw = contents.width - 48
  523.     colour1 = param_gauge1(param_id)
  524.     colour2 = param_gauge2(param_id)
  525.     draw_gauge(24, dy, dw, rate, colour1, colour2)
  526.   end

  527.   #--------------------------------------------------------------------------
  528.   # param_gauge1
  529.   #--------------------------------------------------------------------------
  530.   def param_gauge1(param_id)
  531.     return YEA::STATUS::PARAM_COLOUR[param_id][1]
  532.   end

  533.   #--------------------------------------------------------------------------
  534.   # param_gauge2
  535.   #--------------------------------------------------------------------------
  536.   def param_gauge2(param_id)
  537.     return YEA::STATUS::PARAM_COLOUR[param_id][2]
  538.   end

  539.   #--------------------------------------------------------------------------
  540.   # draw_parameter_title
  541.   #--------------------------------------------------------------------------
  542.   def draw_parameter_title
  543.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  544.     rect = Rect.new(0, 0, contents.width, contents.height)
  545.     contents.fill_rect(rect, colour)
  546.     change_color(system_color)
  547.     text = YEA::STATUS::PARAMETERS_VOCAB
  548.     draw_text(0, line_height/3, contents.width, line_height, text, 1)
  549.   end

  550.   #--------------------------------------------------------------------------
  551.   # draw_properties_list
  552.   #--------------------------------------------------------------------------
  553.   def draw_properties_list
  554.     contents.font.size = YEA::STATUS::PROPERTIES_FONT_SIZE
  555.     draw_properties_column1
  556.     draw_properties_column2
  557.     draw_properties_column3
  558.     reset_font_settings
  559.   end

  560.   #--------------------------------------------------------------------------
  561.   # draw_properties_column1
  562.   #--------------------------------------------------------------------------
  563.   def draw_properties_column1
  564.     dx = 24
  565.     dw = (contents.width - 24) / 3 - 24
  566.     dy = 0
  567.     for property in YEA::STATUS::PROPERTIES_COLUMN1
  568.       dy = draw_property(property, dx, dy, dw)
  569.     end
  570.   end

  571.   #--------------------------------------------------------------------------
  572.   # draw_properties_column2
  573.   #--------------------------------------------------------------------------
  574.   def draw_properties_column2
  575.     dx = 24 + (contents.width - 24) / 3
  576.     dw = (contents.width - 24) / 3 - 24
  577.     dy = 0
  578.     for property in YEA::STATUS::PROPERTIES_COLUMN2
  579.       dy = draw_property(property, dx, dy, dw)
  580.     end
  581.   end

  582.   #--------------------------------------------------------------------------
  583.   # draw_properties_column3
  584.   #--------------------------------------------------------------------------
  585.   def draw_properties_column3
  586.     dx = 24 + (contents.width - 24) / 3 * 2
  587.     dw = (contents.width - 24) / 3 - 24
  588.     dy = 0
  589.     for property in YEA::STATUS::PROPERTIES_COLUMN3
  590.       dy = draw_property(property, dx, dy, dw)
  591.     end
  592.   end

  593.   #--------------------------------------------------------------------------
  594.   # draw_property
  595.   #--------------------------------------------------------------------------
  596.   def draw_property(property, dx, dy, dw)
  597.     case property[0]
  598.     #---
  599.     when :hit
  600.       fmt = "%1.2f%%"
  601.       value = sprintf(fmt, @actor.hit * 100)
  602.     when :eva
  603.       fmt = "%1.2f%%"
  604.       value = sprintf(fmt, @actor.eva * 100)
  605.     when :cri
  606.       fmt = "%1.2f%%"
  607.       value = sprintf(fmt, @actor.cri * 100)
  608.     when :cev
  609.       fmt = "%1.2f%%"
  610.       value = sprintf(fmt, @actor.cev * 100)
  611.     when :mev
  612.       fmt = "%1.2f%%"
  613.       value = sprintf(fmt, @actor.mev * 100)
  614.     when :mrf
  615.       fmt = "%1.2f%%"
  616.       value = sprintf(fmt, @actor.mrf * 100)
  617.     when :cnt
  618.       fmt = "%1.2f%%"
  619.       value = sprintf(fmt, @actor.cnt * 100)
  620.     when :hrg
  621.       fmt = "%1.2f%%"
  622.       value = sprintf(fmt, @actor.hrg * 100)
  623.     when :mrg
  624.       fmt = "%1.2f%%"
  625.       value = sprintf(fmt, @actor.mrg * 100)
  626.     when :trg
  627.       fmt = "%1.2f%%"
  628.       value = sprintf(fmt, @actor.trg * 100)
  629.     when :tgr
  630.       fmt = "%1.2f%%"
  631.       value = sprintf(fmt, @actor.tgr * 100)
  632.     when :grd
  633.       fmt = "%1.2f%%"
  634.       value = sprintf(fmt, @actor.grd * 100)
  635.     when :rec
  636.       fmt = "%1.2f%%"
  637.       value = sprintf(fmt, @actor.rec * 100)
  638.     when :pha
  639.       fmt = "%1.2f%%"
  640.       value = sprintf(fmt, @actor.pha * 100)
  641.     when :mcr
  642.       fmt = "%1.2f%%"
  643.       value = sprintf(fmt, @actor.mcr * 100)
  644.     when :tcr
  645.       fmt = "%1.2f%%"
  646.       value = sprintf(fmt, @actor.tcr * 100)
  647.     when :pdr
  648.       fmt = "%1.2f%%"
  649.       value = sprintf(fmt, @actor.pdr * 100)
  650.     when :mdr
  651.       fmt = "%1.2f%%"
  652.       value = sprintf(fmt, @actor.mdr * 100)
  653.     when :fdr
  654.       fmt = "%1.2f%%"
  655.       value = sprintf(fmt, @actor.fdr * 100)
  656.     when :exr
  657.       fmt = "%1.2f%%"
  658.       value = sprintf(fmt, @actor.exr * 100)
  659.     when :hcr
  660.       return dy unless $imported["YEA-SkillCostManager"]
  661.       fmt = "%1.2f%%"
  662.       value = sprintf(fmt, @actor.hcr * 100)
  663.     when :tcr
  664.       return dy unless $imported["YEA-SkillCostManager"]
  665.       fmt = "%1.2f%%"
  666.       value = sprintf(fmt, @actor.tcr * 100)
  667.     when :gcr
  668.       return dy unless $imported["YEA-SkillCostManager"]
  669.       fmt = "%1.2f%%"
  670.       value = sprintf(fmt, @actor.gcr * 100)
  671.     when :cdr
  672.       return dy unless $imported["YEA-SkillRestrictions"]
  673.       fmt = "%1.2f%%"
  674.       value = sprintf(fmt, @actor.cdr * 100)
  675.     when :wur
  676.       return dy unless $imported["YEA-SkillRestrictions"]
  677.       fmt = "%1.2f%%"
  678.       value = sprintf(fmt, @actor.wur * 100)
  679.     #---
  680.     else; return dy
  681.     end
  682.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  683.     rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
  684.     contents.fill_rect(rect, colour)
  685.     change_color(system_color)
  686.     draw_text(dx+4, dy, dw-8, line_height, property[1], 0)
  687.     change_color(normal_color)
  688.     draw_text(dx+4, dy, dw-8, line_height, value, 2)
  689.     return dy + line_height
  690.   end

  691.   #--------------------------------------------------------------------------
  692.   # draw_actor_biography
  693.   #--------------------------------------------------------------------------
  694.   def draw_actor_biography
  695.     fmt = YEA::STATUS::BIOGRAPHY_NICKNAME_TEXT
  696.     text = sprintf(fmt,@actor.nickname, @actor.name )
  697.     contents.font.size = YEA::STATUS::BIOGRAPHY_NICKNAME_SIZE
  698.     draw_text(0, 0, contents.width, line_height*2, text, 1)
  699.     reset_font_settings
  700.     draw_text_ex(24, line_height*2, @actor.description)
  701.   end

  702.   #--------------------------------------------------------------------------
  703.   # draw_custom
  704.   #--------------------------------------------------------------------------
  705.   def draw_custom
  706.     current_symbol = @command_window.current_symbol
  707.     return unless YEA::STATUS::CUSTOM_STATUS_COMMANDS.include?(current_symbol)
  708.     method(YEA::STATUS::CUSTOM_STATUS_COMMANDS[current_symbol][3]).call
  709.   end

  710.   #--------------------------------------------------------------------------
  711.   # draw_custom1
  712.   #--------------------------------------------------------------------------
  713.   def draw_custom1
  714.     dx = 0; dy = 0
  715.     for skill in @actor.skills
  716.       next if skill.nil?
  717.       next unless @actor.added_skill_types.include?(skill.stype_id)
  718.       draw_item_name(skill, dx, dy)
  719.       dx = dx == contents.width / 2 + 16 ? 0 : contents.width / 2 + 16
  720.       dy += line_height if dx == 0
  721.       return if dy + line_height > contents.height
  722.     end
  723.   end

  724.   #--------------------------------------------------------------------------
  725.   # draw_custom2
  726.   #--------------------------------------------------------------------------
  727.   def draw_custom2
  728.     dx = 4; dy = 0; slot_id = 0
  729.     for equip in @actor.equips
  730.       change_color(system_color)
  731.       text = Vocab.etype(@actor.equip_slots[slot_id])
  732.       draw_text(dx, dy, contents.width - dx, line_height, text)
  733.       reset_font_settings
  734.       draw_item_name(equip, dx+92, dy) unless equip.nil?
  735.       slot_id += 1
  736.       dy += line_height
  737.       break if dy + line_height > contents.height
  738.     end
  739.     dw = Graphics.width * 2 / 5 - 24
  740.     dx = contents.width - dw; dy = 0
  741.     param_id = 0
  742.     8.times do
  743.       colour = Color.new(0, 0, 0, translucent_alpha/2)
  744.       rect = Rect.new(dx+1, dy+1, dw - 2, line_height - 2)
  745.       contents.fill_rect(rect, colour)
  746.       size = $imported["YEA-AceEquipEngine"] ? YEA::EQUIP::STATUS_FONT_SIZE : 20
  747.       contents.font.size = size
  748.       change_color(system_color)
  749.       draw_text(dx+4, dy, dw, line_height, Vocab::param(param_id))
  750.       change_color(normal_color)
  751.       dwa = (Graphics.width * 2 / 5 - 2) / 2
  752.       draw_text(dx, dy, dwa, line_height, @actor.param(param_id).group, 2)
  753.       reset_font_settings
  754.       change_color(system_color)
  755.       draw_text(dx + dwa, dy, 22, line_height, "→", 1)
  756.       param_id += 1
  757.       dy += line_height
  758.       break if dy + line_height > contents.height
  759.     end
  760.   end

  761.   #--------------------------------------------------------------------------
  762.   # draw_custom3
  763.   #--------------------------------------------------------------------------
  764.   def draw_custom3
  765.     return unless $imported["YEA-ClassSystem"]
  766.     data = []
  767.     for class_id in YEA::CLASS_SYSTEM::CLASS_ORDER
  768.       next if $data_classes[class_id].nil?
  769.       item = $data_classes[class_id]
  770.       next unless @actor.unlocked_classes.include?(item.id) or
  771.         YEA::CLASS_SYSTEM::DEFAULT_UNLOCKS.include?(item.id)
  772.       data.push(item)
  773.     end
  774.     dx = 0; dy = 0; class_index = 0
  775.     for class_id in data
  776.       item = data[class_index]
  777.       reset_font_settings
  778.       if item == @actor.class
  779.         change_color(text_color(YEA::CLASS_SYSTEM::CURRENT_CLASS_COLOUR))
  780.       elsif item == @actor.subclass
  781.         change_color(text_color(YEA::CLASS_SYSTEM::SUBCLASS_COLOUR))
  782.       else
  783.         change_color(normal_color)
  784.       end
  785.       icon = item.icon_index
  786.       draw_icon(icon, dx, dy)
  787.       text = item.name
  788.       draw_text(24, dy, contents.width-24, line_height, text)
  789.       next if YEA::CLASS_SYSTEM::MAINTAIN_LEVELS
  790.       level = @actor.class_level(item.id)
  791.       contents.font.size = YEA::CLASS_SYSTEM::LEVEL_FONT_SIZE
  792.       text = sprintf(YEA::CLASS_SYSTEM::CLASS_LEVEL, level.group)
  793.       dwa = contents.width - (Graphics.width * 2 / 5 - 24) - 28
  794.       draw_text(dx, dy, dwa, line_height, text, 2)
  795.       class_index += 1
  796.       dy += line_height
  797.       break if dy + line_height > contents.height
  798.     end
  799.     dw = Graphics.width * 2 / 5 - 24
  800.     dx = contents.width - dw; dy = 0
  801.     param_id = 0
  802.     8.times do
  803.       colour = Color.new(0, 0, 0, translucent_alpha/2)
  804.       rect = Rect.new(dx+1, dy+1, dw - 2, line_height - 2)
  805.       contents.fill_rect(rect, colour)
  806.       contents.font.size = YEA::CLASS_SYSTEM::PARAM_FONT_SIZE
  807.       change_color(system_color)
  808.       draw_text(dx+4, dy, dw, line_height, Vocab::param(param_id))
  809.       change_color(normal_color)
  810.       dwa = (Graphics.width * 2 / 5 - 2) / 2
  811.       draw_text(dx, dy, dwa, line_height, @actor.param(param_id).group, 2)
  812.       reset_font_settings
  813.       change_color(system_color)
  814.       draw_text(dx + dwa, dy, 22, line_height, "→", 1)
  815.       param_id += 1
  816.       dy += line_height
  817.       break if dy + line_height > contents.height
  818.     end
  819.   end

  820. end # Window_StatusItem

  821. #==============================================================================
  822. # ■ Scene_Status
  823. #==============================================================================

  824. class Scene_Status < Scene_MenuBase

  825.   #--------------------------------------------------------------------------
  826.   # start
  827.   #--------------------------------------------------------------------------
  828.   def start
  829.     super

  830.     create_help_window
  831.     create_command_window
  832.     create_status_window
  833.     create_item_window
  834.     relocate_windows
  835.   end

  836.   #--------------------------------------------------------------------------
  837.   # create_command_window
  838.   #--------------------------------------------------------------------------
  839.   def create_command_window
  840.     wy = @help_window.height
  841.     @command_window = Window_StatusCommand.new(0, wy)
  842.     @command_window.viewport = @viewport
  843.     @command_window.actor = @actor
  844.     @command_window.help_window = @help_window
  845.     @command_window.set_handler(:cancel,   method(:return_scene))
  846.     @command_window.set_handler(:pagedown, method(:next_actor))
  847.     @command_window.set_handler(:pageup,   method(:prev_actor))
  848.     process_custom_status_commands
  849.   end

  850.   #--------------------------------------------------------------------------
  851.   # process_custom_status_commands
  852.   #--------------------------------------------------------------------------
  853.   def process_custom_status_commands
  854.     for command in YEA::STATUS::COMMANDS
  855.       next unless YEA::STATUS::CUSTOM_STATUS_COMMANDS.include?(command[0])
  856.       called_method = YEA::STATUS::CUSTOM_STATUS_COMMANDS[command[0]][2]
  857.       @command_window.set_handler(command[0], method(called_method))
  858.     end
  859.   end

  860.   #--------------------------------------------------------------------------
  861.   # create_status_window
  862.   #--------------------------------------------------------------------------
  863.   def create_status_window
  864.     wy = @help_window.height
  865.     @status_window = Window_StatusActor.new(@command_window.width, wy)
  866.     @status_window.viewport = @viewport
  867.     @status_window.actor = @actor
  868.   end

  869.   #--------------------------------------------------------------------------
  870.   # create_item_window
  871.   #--------------------------------------------------------------------------
  872.   def create_item_window
  873.     dy = @command_window.y + @command_window.height
  874.     @item_window = Window_StatusItem.new(0, dy, @command_window)
  875.     @item_window.viewport = @viewport
  876.     @item_window.actor = @actor
  877.     @command_window.item_window = @item_window
  878.   end

  879.   #--------------------------------------------------------------------------
  880.   # relocate_windows
  881.   #--------------------------------------------------------------------------
  882.   def relocate_windows
  883.     return unless $imported["YEA-AceMenuEngine"]
  884.     case Menu.help_window_location
  885.     when 0 # Top
  886.       @help_window.y = 0
  887.       @command_window.y = @help_window.height
  888.       @item_window.y = @command_window.y + @command_window.height
  889.     when 1 # Middle
  890.       @command_window.y = 0
  891.       @help_window.y = @command_window.height
  892.       @item_window.y = @help_window.y + @help_window.height
  893.     else # Bottom
  894.       @command_window.y = 0
  895.       @item_window.y = @command_window.height
  896.       @help_window.y = @item_window.y + @item_window.height
  897.     end
  898.     @status_window.y = @command_window.y
  899.   end

  900.   #--------------------------------------------------------------------------
  901.   # on_actor_change
  902.   #--------------------------------------------------------------------------
  903.   def on_actor_change
  904.     @command_window.actor = @actor
  905.     @status_window.actor = @actor
  906.     @item_window.actor = @actor
  907.     @command_window.activate
  908.   end

  909.   #--------------------------------------------------------------------------
  910.   # new method: command_name1
  911.   #--------------------------------------------------------------------------
  912.   def command_name1
  913.     SceneManager.call(Scene_Skill)
  914.   end

  915.   #--------------------------------------------------------------------------
  916.   # new method: command_name2
  917.   #--------------------------------------------------------------------------
  918.   def command_name2
  919.     SceneManager.call(Scene_Equip)
  920.   end

  921.   #--------------------------------------------------------------------------
  922.   # new method: command_name3
  923.   #--------------------------------------------------------------------------
  924.   def command_name3
  925.     unless $imported["YEA-ClassSystem"]
  926.       @command_window.activate
  927.       return
  928.     end
  929.     SceneManager.call(Scene_Class)
  930.   end

  931. end # Scene_Status

  932. #==============================================================================
  933. #
  934. # ▼ End of File
  935. #
  936. #==============================================================================
复制代码
[/fold]
3、地图左上角会显示一个坐标窗口。
[fold=显示坐标脚本]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #encoding:utf-8
  3. #------------------------------------------------------------------------
  4. #■ 地图上显示变量
  5. #   原作者:非法用户  lqn619修改并增加开关控制显示功能  脚本来自于66RPG
  6. #------------------------------------------------------------------------
  7.   # 使用者设定部分
  8.   $s_id3 = 45           #控制是否显示的开关ID,可以自己修改
  9. #------------------------------------------------------------------------

  10. class Window_Variables < Window_Base
  11.   def initialize
  12.     super(0,0,100,48)                    # 创建大小
  13.     @text = ""                              # 初始化内容
  14.     @variable = 0
  15.     refresh                                 #调用refresh方法(下文定义)
  16.   end
  17.   def refresh                               #定义refresh方法
  18.     if $game_switches[$s_id3] == false       #判断是否显示窗口
  19.        self.visible = false
  20.     else
  21.       self.visible = true
  22.     end
  23.     if @text != $text or @variable != $game_variables[$v_id]     #内容变化时
  24.       self.contents.clear                                        #清除窗口的位图
  25.       self.contents.draw_text(0,0,64,24,$text)                   #重绘
  26.       self.contents.draw_text(0,0,94,24,"坐标:" + $game_player.getX.to_s + "," + $game_player.getY.to_s,0)
  27.       @type = $type                                              # 代入当前内容
  28.       @owner = $owner
  29.     end   
  30.   end
  31. end


  32. class Scene_Map < Scene_Base
  33.   alias new_start start                     #生成窗体
  34.   def start
  35.     new_start
  36.     @varia_window = Window_Variables.new
  37.   end
  38.   alias new_update update                   #更新窗体
  39.   def update
  40.     new_update
  41.     @varia_window.refresh
  42.   end
  43.   alias new_terminate terminate             #消除窗体
  44.   def terminate
  45.     @varia_window.dispose
  46.     new_terminate
  47.   end
  48. end
复制代码
[/fold]
4、扩展攻击目标,技能可以攻击一组同种敌人。
[fold=种族灭绝者]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #在需要这个效果的技能的备注:<种族毁灭者>
  3. #然后效果范围要设置为【单个敌人】
  4. #==============================================================================
  5. # ■ 种族灭绝者 v1.0 魔族宝 2014.9.13
  6. #==============================================================================
  7. # ■ Game_Action
  8. #==============================================================================
  9. class Game_Action
  10.   #--------------------------------------------------------------------------
  11.   # ● 目标为敌人
  12.   alias targets_for_opponents1 targets_for_opponents
  13.   #--------------------------------------------------------------------------
  14.   def targets_for_opponents
  15.     return opponents_unit.semm_target(@target_index) if @subject.is_a?(Game_Actor) and item.note =~ /<种族灭绝者>/
  16.     targets_for_opponents1
  17.   end
  18. end
  19. #==============================================================================
  20. # ■ Game_Unit
  21. #==============================================================================
  22. class Game_Unit
  23.   def semm_target(index)
  24.     members.select {|member| member.enemy_id==members[index].enemy_id}
  25.   end
  26. end[/fold]
  27. [size=3][color=Blue][b]5、默认菜单左边空白处显示一些变量,比如:战斗次数、游戏时间、行走步数。还可以控制变量来显示时间24小时哦。[/b][/color][/size]
  28. [fold=菜单扩展脚本]#使用方法:打开脚本编辑器,将脚本插入到main上。
  29. #自己在游戏中设置事件添加变量就可以了,显示变量的ID可以自己在下面修改。
  30. #==============================================================================
  31. # ■ Game_Player
  32. #------------------------------------------------------------------------------
  33. #  处理玩家人物的类。拥有事件启动的判定、地图的卷动等功能。
  34. #   本类的实例请参考 $game_player 。
  35.     $v_id1 = 10          #显示变量的编号ID
  36.     $v_id2 = 11          #显示变量的编号ID
  37.     $v_id3 = 12          #显示变量的编号ID
  38.     $v_id4 = 13          #显示变量的编号ID
  39.     $v_id5 = 14          #显示变量的编号ID
  40. #==============================================================================

  41. class Game_Player < Game_Character
  42.   
  43.   def getX
  44.     @x
  45.   end
  46.   
  47.   def getY
  48.     @y
  49.   end
  50.   
  51. end

  52. #encoding:utf-8
  53. #==============================================================================
  54. # ■ Scene_Menu
  55. #------------------------------------------------------------------------------
  56. #  菜单画面
  57. #==============================================================================

  58. class Scene_Menu < Scene_MenuBase

  59.   #--------------------------------------------------------------------------
  60.   # ● 生成窗口
  61.   #--------------------------------------------------------------------------
  62.   def create_gold_window
  63.     @gold_window = Window_Gold.new
  64.     @gold_window.x = 0
  65.     @gold_window.y = Graphics.height - @gold_window.height
  66.     # 生成地图信息窗口
  67.     @mapinfos_window = Window_MapInfo.new
  68.     @mapinfos_window.x = 0
  69.     @mapinfos_window.y = 211
  70.    
  71.   end
  72.   
  73. end

  74. #==============================================================================
  75. # ■ Window_MapInfo
  76. #------------------------------------------------------------------------------
  77. #  显示当前信息的窗口。 By SkyZH
  78. #==============================================================================

  79. class Window_MapInfo < Window_Base
  80.   #--------------------------------------------------------------------------
  81.   # ● 初始化对像
  82.   #--------------------------------------------------------------------------
  83.   def initialize
  84.     super(0, 0, window_width, fitting_height(4))
  85.     refresh
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   # ● 获取窗口的宽度
  89.   #--------------------------------------------------------------------------
  90.   def window_width
  91.     return 160
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ● 刷新
  95.   #--------------------------------------------------------------------------
  96.   def refresh
  97.     self.contents.clear
  98.     self.contents.font.color = normal_color
  99.    
  100.     @a=$game_map.width
  101.     @b=$game_map.height
  102.     @BGMNAME=RPG::BGM.last.name
  103.    
  104.     draw_text(0, line_height*0, window_width-24, line_height,"时间: :" + $game_variables[$v_id1].to_s,0)
  105.     draw_text(0, line_height*0, window_width-24, line_height,"时间 " + $game_variables[$v_id2].to_s,0)
  106.     draw_text(0, line_height*1, window_width-24, line_height,"活跃:" + $game_variables[$v_id3].to_s,0)
  107.     draw_text(0, line_height*2, window_width-24, line_height,"荣誉:" + $game_variables[$v_id4].to_s,0)
  108.     draw_text(0, line_height*3, window_width-24, line_height,"强度:" + $game_variables[$v_id5].to_s,0)
  109.   end
  110. end
复制代码
[/fold]
6、修改过的显示敌人血槽状态脚本,敌人附加了什么状态都一目了然,我把血条显示去了,其实不显示敌人HP能让玩家感到更加的刺激。
[fold=敌人状態显示脚本]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #==============================================================================

  3. #  ■エネミーの状態を表示 for RGSS3 Ver0.80-α

  4. # □作成者 kure

  5. #==============================================================================

  6. $kure_base_script = {} if $kure_base_script == nil

  7. $kure_base_script[:InfoBar] = 100

  8. p "エネミーの情報表示"

  9. module KURE

  10.   module InfoBar

  11.     #初期設定(変更しない事)-----------------------------------------------------

  12.     COLOR = []

  13.    
  14.     #表示色(IDによって割り当てが決まっています。)

  15.       #バーの背景色(ID0)

  16.       COLOR[0] = Color.new(32 ,32, 64, 255)

  17.       

  18.       #HPバーの色(ID1,ID2)

  19.       COLOR[1] = Color.new(224 ,128, 64, 255)

  20.       COLOR[2] = Color.new(240 ,192, 64, 255)

  21.    
  22.   end

  23. end


  24. #==============================================================================

  25. # ■ RPG::Enemy(追加定義)

  26. #==============================================================================

  27. class RPG::Enemy < RPG::BaseItem

  28.   #--------------------------------------------------------------------------

  29.   # ☆ バーの表示幅の定義(追加定義)

  30.   #--------------------------------------------------------------------------  

  31.   def infobar_width

  32.     @note.match(/<情報表示幅\s?(\d+)\s?>/)

  33.     return 100 unless $1

  34.     return $1.to_i

  35.   end

  36.   #--------------------------------------------------------------------------

  37.   # ☆ バーの表示幅の定義(追加定義)

  38.   #--------------------------------------------------------------------------  

  39.   def infobar_visible?

  40.     return false if @note.include?("<情報非表示>")

  41.     return true

  42.   end

  43. end


  44. #==============================================================================

  45. # ■ Game_Enemy

  46. #==============================================================================

  47. class Game_Enemy < Game_Battler

  48.   #--------------------------------------------------------------------------

  49.   # ☆ バーの表示幅の定義(追加定義)

  50.   #--------------------------------------------------------------------------  

  51.   def infobar_width

  52.     return enemy.infobar_width

  53.   end

  54.   #--------------------------------------------------------------------------

  55.   # ☆ バーの表示幅の定義(追加定義)

  56.   #--------------------------------------------------------------------------  

  57.   def infobar_visible?

  58.     return enemy.infobar_visible?

  59.   end

  60. end


  61. #==============================================================================

  62. # ■ Spriteset_Battle

  63. #==============================================================================

  64. class Spriteset_Battle

  65.   #--------------------------------------------------------------------------

  66.   # ● 敵キャラスプライトの作成(エイリアス再定義)

  67.   #--------------------------------------------------------------------------

  68.   alias k_basescript_before_create_enemies create_enemies

  69.   def create_enemies

  70.     k_basescript_before_create_enemies

  71.     @enemy_info_bar = $game_troop.members.reverse.collect do |enemy|

  72.       Sprite_Infobar.new(@viewport1, enemy)

  73.     end

  74.   end

  75.   #--------------------------------------------------------------------------

  76.   # ● 敵キャラスプライトの更新(エイリアス再定義)

  77.   #--------------------------------------------------------------------------

  78.   alias k_basescript_before_update_enemies update_enemies

  79.   def update_enemies

  80.     k_basescript_before_update_enemies

  81.     @enemy_info_bar.each {|sprite| sprite.update }

  82.   end

  83.   #--------------------------------------------------------------------------

  84.   # ● 敵キャラスプライトの解放(エイリアス再定義)

  85.   #--------------------------------------------------------------------------

  86.   alias k_basescript_before_dispose_enemies dispose_enemies

  87.   def dispose_enemies

  88.     k_basescript_before_dispose_enemies

  89.     @enemy_info_bar.each {|sprite| sprite.dispose }

  90.   end

  91. end


  92. #==============================================================================

  93. # ■ Sprite_Infobar

  94. #==============================================================================

  95. class Sprite_Infobar < Sprite_Base

  96.   #--------------------------------------------------------------------------

  97.   # ● 公開インスタンス変数

  98.   #--------------------------------------------------------------------------

  99.   attr_accessor :battler

  100.   #--------------------------------------------------------------------------

  101.   # ● オブジェクト初期化

  102.   #--------------------------------------------------------------------------

  103.   def initialize(viewport, battler = nil)

  104.     super(viewport)

  105.     @battler = battler

  106.     @fill_w = nil

  107.     @bitmap_data = Cache.battler(battler.battler_name, battler.battler_hue)

  108.     @state = battler.states

  109.     @icon_set = Cache.system("Iconset")

  110.   end

  111.   #--------------------------------------------------------------------------

  112.   # ● フレーム更新

  113.   #--------------------------------------------------------------------------

  114.   def update

  115.     super

  116.     if @battler

  117.       @use_sprite = @battler.use_sprite?

  118.       if @use_sprite

  119.         update_bitmap

  120.         update_origin

  121.         update_position

  122.       end

  123.     else

  124.       self.bitmap = nil

  125.     end

  126.   end

  127.   #--------------------------------------------------------------------------

  128.   # ● 解放

  129.   #--------------------------------------------------------------------------

  130.   def dispose

  131.     bitmap.dispose if bitmap

  132.     super

  133.   end

  134.   #--------------------------------------------------------------------------

  135.   # ● 転送元ビットマップの更新

  136.   #--------------------------------------------------------------------------

  137.   def update_bitmap

  138.     fill_w = @battler.infobar_width * (@battler.hp.to_f / @battler.mhp)

  139.     state = battler.states

  140.     if @fill_w != fill_w or @state != state

  141.       @fill_w = fill_w

  142.       @state = state

  143.       

  144.       width = @battler.infobar_width + 4

  145.       

  146.       new_bitmap = Bitmap.new(width, 35)

  147.       @state.each_with_index {|state, index|

  148.         next if 24 * (index + 1) > new_bitmap.width

  149.         rect = Rect.new(state.icon_index % 16 * 24, state.icon_index / 16 * 24, 24, 24)

  150.         new_bitmap.blt(24 * index, 0, @icon_set, rect, 255)

  151.       }

  152.       #new_bitmap.fill_rect(0, 25, width, 10, color(0))

  153.       #new_bitmap.gradient_fill_rect(2, 27, fill_w, 6, color(1), color(2))

  154.    
  155.       self.bitmap = new_bitmap

  156.       init_visibility

  157.       

  158.       self.opacity = 0 unless @battler.infobar_visible?

  159.     end

  160.   end

  161.   #--------------------------------------------------------------------------

  162.   # ● 可視状態の初期化

  163.   #--------------------------------------------------------------------------

  164.   def init_visibility

  165.     @battler_visible = @battler.alive?

  166.     self.opacity = 0 unless @battler_visible

  167.   end

  168.   #--------------------------------------------------------------------------

  169.   # ● 文字色取得

  170.   #--------------------------------------------------------------------------

  171.   def color(num)

  172.     return KURE::InfoBar::COLOR[num]

  173.   end

  174.   #--------------------------------------------------------------------------

  175.   # ● 原点の更新

  176.   #--------------------------------------------------------------------------

  177.   def update_origin

  178.     if bitmap

  179.       self.ox = bitmap.width / 2

  180.       self.oy = bitmap.height

  181.     end

  182.   end

  183.   #--------------------------------------------------------------------------

  184.   # ● 位置の更新

  185.   #--------------------------------------------------------------------------

  186.   def update_position

  187.     self.x = @battler.screen_x

  188.     self.y = @battler.screen_y - @bitmap_data.height

  189.     self.z = @battler.screen_z + 10

  190.   end

  191. end
复制代码
[/fold]
7、如果想添加游戏难度,这个脚本一定少不了!玩家等级越高,敌人越强!这个脚本让我想起了fc金庸群侠传书剑江山里面的怪物,他们应该也是用了这个系统。
[fold=敌人等级跟随玩家脚本]
  1. # 使用方法:#使用方法:打开脚本编辑器,将脚本插入到main上。

  2. #在需要设定成长的敌人备注栏里填写<lv = leader>

  3. #设定跟随领队成长的敌人只需要在数据库里设定每级各属性成长率即可

  4. #比如1号敌人在备注栏里填写了<lv = leader>,

  5. #那么,如果他的物理伤害是5,领队等级10,战斗时,1号敌人的物理伤害就等于5*10=50

  6. #谨慎设置敌人属性!不然玩家不管升多少级都永远无法战胜敌人。
  7. =begin

  8. # 跟随主角成长的敌人,作者:66RPG的tan12345

  9. # 功能:敌人的属性、经验、金钱跟随队伍领队的等级成长

  10. =end

  11. module Tan_Enemy_lv_Set

  12.   #敌人的成长等级取决因素

  13.   #0 = 领队等级

  14.   #1 = 队伍平均等级

  15.   #2 = 队伍最高等级

  16.   ENEMY_LV = 1

  17. end

  18. class Game_Enemy < Game_Battler

  19.   attr_accessor :tan_enemy_rate                 # 属性、经验值、金钱比例

  20.   #--------------------------------------------------------------------------

  21.   # ● 初始化对象

  22.   #--------------------------------------------------------------------------

  23.   alias tan_enemy_lv_initialize initialize

  24.   def initialize(index, enemy_id)

  25.     tan_enemy_lv_initialize(index, enemy_id)

  26.     @tan_enemy_rate = 1

  27.     if enemy.note =~ /<lv = leader>/

  28.       case Tan_Enemy_lv_Set::ENEMY_LV

  29.       when 0

  30.         @tan_enemy_rate = $game_party.leader.level

  31.       when 1

  32.         @tan_enemy_rate = 0

  33.         $game_party.members.each {|actor|
  34.             @tan_enemy_rate += actor.level
  35.         }

  36.         @tan_enemy_rate /= $game_party.members.size if @tan_enemy_rate != 0

  37.       when 2

  38.         @tan_enemy_rate = $game_party.highest_level

  39.       else

  40.       end

  41.     end

  42.     @hp = mhp

  43.     @mp = mmp

  44.   end

  45.   #--------------------------------------------------------------------------

  46.   # ● 获取普通能力的基础值

  47.   #--------------------------------------------------------------------------

  48.   alias tan_enemy_lv_param_base param_base

  49.   def param_base(param_id)

  50.     v = tan_enemy_lv_param_base(param_id)

  51.     v *= @tan_enemy_rate.to_i

  52.     return v.to_i

  53.   end

  54.   #--------------------------------------------------------------------------

  55.   # ● 获取经验值

  56.   #--------------------------------------------------------------------------

  57.   alias tan_enemy_lv_exp exp

  58.   def exp

  59.     v = tan_enemy_lv_exp

  60.     v *= @tan_enemy_rate.to_i

  61.     return v.to_i

  62.   end

  63.   #--------------------------------------------------------------------------

  64.   # ● 获取金钱

  65.   #--------------------------------------------------------------------------

  66.   alias tan_enemy_lv_gold gold

  67.   def gold

  68.     v = tan_enemy_lv_gold

  69.     v *= @tan_enemy_rate.to_i

  70.     return v.to_i

  71.   end

  72. end
复制代码
[/fold]
8、在回合制游戏经常看得到的系统,例如梦幻西游里面的小怪头领,大家都知道名字后面有头领两个字的敌人会比较强一点,这个脚本就是这种效果。
[fold=精英敌人脚本]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. =begin
  3. # 精英敌人,作者:66RPG的tan12345
  4. # 功能:遇敌时,敌人有一定几率(可设定)变成精英,精英怪比普通怪属性有加成(可修改),
  5. #       当然了,精英怪的经验、金钱、掉落率也同样有加成。
  6. #       也可以设定指定的敌人不会变成精英(比如BOSS)
  7. #
  8. # 使用方法:将脚本插入到main上
  9. #
  10. =end

  11. module Tan_by_enemy_set
  12.   #精英怪出现几率,35代表35%
  13.   Tan_enemy_by = 35
  14.   #精英怪属性加成比例(同时也是经验、金钱、掉落率加成比例),1.1代表属性是普通怪的1.1倍
  15.   Tan_enemy_by_num = 1.1
  16.   #不会成为精英的敌人
  17.   NO_BY_ENEMY = [2,3]#表示2号ID和3号ID敌人不会变成精英,适合设定BOSS,
  18. end
  19. class Game_Enemy < Game_Battler
  20.   
  21.   attr_reader   :is_by  # 是否精英
  22.   
  23.   #--------------------------------------------------------------------------
  24.   # ● 精英初始化
  25.   #--------------------------------------------------------------------------
  26.   def init_by_enemy
  27.     @is_by = false
  28.     @is_by = true if rand(100) <= Tan_by_enemy_set::Tan_enemy_by && !Tan_by_enemy_set::NO_BY_ENEMY.include?(enemy_id)
  29.     @original_name = @original_name + "" if @is_by == true
  30.     @hp = mhp
  31.     @mp = mmp
  32.   end
  33.   #--------------------------------------------------------------------------
  34.   # ● 是否精英
  35.   #--------------------------------------------------------------------------
  36.   def is_by?
  37.     return true if @is_by
  38.     return false
  39.   end
  40.   
  41.   #--------------------------------------------------------------------------
  42.   # ● 初始化对象
  43.   #--------------------------------------------------------------------------
  44.   alias tan_by_enemy_initialize initialize
  45.   def initialize(index, enemy_id)
  46.     tan_by_enemy_initialize(index, enemy_id)
  47.     init_by_enemy
  48.   end
  49.   #--------------------------------------------------------------------------
  50.   # ● 获取普通能力的基础值
  51.   #--------------------------------------------------------------------------
  52.   alias tan_by_enemy_param_base param_base
  53.   def param_base(param_id)
  54.     v = tan_by_enemy_param_base(param_id)
  55.     v *= Tan_by_enemy_set::Tan_enemy_by_num if is_by?
  56.     return v.to_i
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   # ● 获取经验值
  60.   #--------------------------------------------------------------------------
  61.   alias tan_by_enemy_exp exp
  62.   def exp
  63.     v = tan_by_enemy_exp
  64.     v *= Tan_by_enemy_set::Tan_enemy_by_num if is_by?
  65.     return v.to_i
  66.   end
  67.   #--------------------------------------------------------------------------
  68.   # ● 获取金钱
  69.   #--------------------------------------------------------------------------
  70.   alias tan_by_enemy_gold gold
  71.   def gold
  72.     v = tan_by_enemy_gold
  73.     v *= Tan_by_enemy_set::Tan_enemy_by_num if is_by?
  74.     return v.to_i
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ● 获取物品掉率的倍率
  78.   #--------------------------------------------------------------------------
  79.   alias tan_by_enemy_drop_item_rate drop_item_rate
  80.   def drop_item_rate
  81.     v = tan_by_enemy_drop_item_rate
  82.     v *= Tan_by_enemy_set::Tan_enemy_by_num if is_by?
  83.     return v
  84.   end
  85. end
复制代码
[/fold]
9、附加状态效果可以重叠起来,适合集气技能使用,其实这个系统的原理就是把1号状态变成2号状态。
[fold=状态效果重叠]
  1. #使用方法:直接放进脚本编辑器,然后在下面自己设置。
  2. class Game_Battler

  3.   STATE_UPGRADE = {
  4.     50 => [51, 52, 53],  #51、52、53号状态为三个等级。通过添加50号状态来升级
  5.     60 => [61, 62],        #想添加更多可以自己尝试修改。
  6.   }

  7.   alias as_20141212 add_state
  8.   def add_state(id)
  9.     levels = STATE_UPGRADE[id]
  10.     return as_20141212(id) unless levels
  11.     index = levels.index { |state| state?(state) } # 当前等级
  12.     return as_20141212(id) unless index
  13.     return if index == levels.size - 1   # 已经达到最高等级
  14.     remove_state levels[index]
  15.     as_20141212 levels[index + 1]
  16.   end

  17. end
复制代码
[/fold]
10、甩不掉的诅咒,如果玩家想到死亡后那些附加在身上的状态就消失了,那么你错了!!。
[fold=状态残留脚本]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #在状态备注:<残留>
  3. #==============================================================================
  4. # ■ RGSS3 戦闘不能時残留ステート Ver1.01 by 星潟
  5. #------------------------------------------------------------------------------
  6. # 戦闘不能に陥った際、消去されないステートを作成します。
  7. # 用于那些全恢复时也不想要他消除的状态
  8. # 設定方法.
  9. # ステート欄に<残留>と記入する。
  10. #
  11. # Ver1.01
  12. # 全回復時・逃走の処理でも戦闘不能時残留ステートの効果が表れていた問題を修正。
  13. #==============================================================================
  14. module UnclearableState

  15.   #ステートのメモ欄に記入する為の設定用ワード
  16.   WORD = "<残留>"

  17. end
  18. #==============================================================================
  19. # ■ Game_BattlerBase
  20. #------------------------------------------------------------------------------
  21. #  バトラーを扱う基本のクラスです。主に能力値計算のメソッドを含んでいます。こ
  22. # のクラスは Game_Battler クラスのスーパークラスとして使用されます。
  23. #==============================================================================
  24. class Game_BattlerBase
  25.   #--------------------------------------------------------------------------
  26.   # ● オブジェクト初期化
  27.   #--------------------------------------------------------------------------
  28.   alias initialize_un_s initialize
  29.   def initialize
  30.     initialize_un_s
  31.     clear_states2
  32.   end
  33.   #--------------------------------------------------------------------------
  34.   # ● 全回復
  35.   #--------------------------------------------------------------------------
  36.   alias recover_all_un_s recover_all
  37.   def recover_all
  38.     recover_all_un_s
  39.     clear_states2
  40.   end
  41.   #--------------------------------------------------------------------------
  42.   # ● ステート情報をクリア
  43.   #--------------------------------------------------------------------------
  44.   def clear_states
  45.     @states = [] if @states == nil
  46.     stc = 0
  47.     stcl = []
  48.     stcl_turns = {}
  49.     stcl_steps = {}
  50.     for state in @states
  51.       if state != nil && $data_states[state].note.include?(UnclearableState::WORD)
  52.         stcl.push(@states[stc])
  53.         stcl_turns[state] = @state_turns[state]
  54.         stcl_steps[state] = @state_steps[state]
  55.       end
  56.       stc += 1
  57.     end
  58.     @states = stcl
  59.     @state_turns = stcl_turns
  60.     @state_steps = stcl_steps
  61.   end
  62.   #--------------------------------------------------------------------------
  63.   # ● ステート情報をクリア
  64.   #--------------------------------------------------------------------------
  65.   def clear_states2
  66.     @states = []
  67.     @state_turns = {}
  68.     @state_steps = {}
  69.   end
  70. end
  71. class Game_Battler < Game_BattlerBase
  72.   #--------------------------------------------------------------------------
  73.   # ● 逃げる
  74.   #--------------------------------------------------------------------------
  75.   alias escape_un_s escape
  76.   def escape
  77.     escape_un_s
  78.     clear_states2
  79.   end
  80. end
复制代码
[/fold]
11、当队伍要面临全灭时就会切换BGM来提示玩家,当解除危机时BGM就会恢复。
[fold=危急时切换BGM]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #50横的BGM=一定要打上自己有的BGM名字,不然当队伍要面临全灭时会报错。
  3. =begin

  4. ===============================================================================

  5.   危急时切换BGM By喵呜喵5

  6. ===============================================================================




  7. 【说明】




  8.   战斗中队伍总HP小于一定比率时自动切换战斗BGM




  9. =end

  10. $m5script = {} if $m5script.nil?

  11. $m5script["M5ChanBgm"] = true

  12. module M5ChanBgm

  13. #==============================================================================

  14. #  设定部分

  15. #==============================================================================

  16.   

  17.   DANGER = 20

  18.   

  19.   #这里设置HP的比率,当队伍的HP总百分比小于这个比率时切换BGM

  20.   

  21.   

  22.   BGM = "你有的音乐文件名字"

  23.   

  24.   #这里设置切换的BGM

  25.   

  26.   

  27. #==============================================================================

  28. #  设定结束

  29. #==============================================================================

  30. end

  31. class Game_Troop

  32.   def m5_20140320_change_bgm

  33.     hp = mhp = 0

  34.     @pos = 0 if !@pos

  35.     @danger = false if @danger == nil

  36.     $game_party.battle_members.each do |actor|

  37.       hp += actor.hp

  38.       mhp += actor.mhp

  39.     end

  40.     if hp.to_f / mhp < (M5ChanBgm::DANGER * 0.01)

  41.       if !@danger

  42.         @pos = Audio.bgm_pos

  43.         Audio.bgm_play("Audio/BGM/"+M5ChanBgm::BGM)

  44.         @danger = true

  45.       end

  46.     else

  47.       if @danger

  48.         $game_system.battle_bgm.play(@pos)

  49.         @danger = false

  50.       end

  51.     end

  52.   end

  53.   alias m5_20140320_setup_battle_event setup_battle_event

  54.   def setup_battle_event

  55.     m5_20140320_change_bgm

  56.     m5_20140320_setup_battle_event

  57.   end

  58.   def m5_20140320_end

  59.     @danger = false

  60.   end

  61. end

  62. class Scene_Battle

  63.   alias m5_20140320_pre_terminate pre_terminate

  64.   def pre_terminate

  65.     $game_troop.m5_20140320_end

  66.     m5_20140320_pre_terminate   

  67.   end

  68. end
复制代码
[/fold]
12、存档为空时显示提示文字。
[fold=空存档提示]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. =begin

  3. ===============================================================================

  4.   空存档提示 By喵呜喵5

  5. ===============================================================================




  6. 【说明】




  7.   存档为空时显示提示文字

  8.   

  9. =end




  10. $m5script = {} if $m5script.nil?

  11. $m5script["M5EmptyHint"] = true

  12. module M5EmptyHint

  13. #==============================================================================

  14. #  设定部分

  15. #==============================================================================




  16.   WORD = '\i[115]这个存档没有记录内容!'

  17.   #单引号中间设置提示的文字,支持符号、姓名等转义字符

  18.   

  19.   X_OFF = 140

  20.   #提示文字的X坐标

  21.   

  22.   Y_OFF = 20

  23.   #提示文字的Y坐标

  24.   

  25.   FONT = ["黑体"]

  26.   #提示文字所使用的字体

  27.   

  28.   SIZE = 20

  29.   #提示文字字体的大小

  30.   

  31.   COLOR = Color.new(255, 255, 255, 210)

  32.   #提示文字的颜色,四个数值分别是R、G、B以及透明度

  33.   

  34.   BOLD = false

  35.   #提示文字是否加粗

  36.   

  37.   ITALIC = false

  38.   #提示文字是否斜体

  39.   

  40.   SHADOW = false

  41.   #提示文字是否有阴影

  42.   

  43.   OUT = true

  44.   #提示文字是否加边框

  45.   

  46.   OUT_COLOR = Color.new(255, 255, 255, 100)

  47.   #提示文字边框的颜色,四个数值分别是R、G、B以及透明度

  48.   

  49. #==============================================================================

  50. #  设定结束

  51. #==============================================================================

  52. #==============================================================================

  53. #  脚本部分

  54. #==============================================================================

  55. end  

  56. class Window_SaveFile

  57.   alias m5_20140227_draw_party_characters draw_party_characters

  58.   def draw_party_characters(x, y)

  59.     header = DataManager.load_header(@file_index)

  60.     if header

  61.       m5_20140227_draw_party_characters(x, y)

  62.     else

  63.       wx = M5EmptyHint::X_OFF

  64.       wy = M5EmptyHint::Y_OFF

  65.       contents.font.name = M5EmptyHint::FONT

  66.       contents.font.size = M5EmptyHint::SIZE      

  67.       contents.font.bold = M5EmptyHint::BOLD

  68.       contents.font.italic = M5EmptyHint::ITALIC

  69.       contents.font.outline = M5EmptyHint::OUT

  70.       contents.font.shadow = M5EmptyHint::SHADOW

  71.       contents.font.color = M5EmptyHint::COLOR

  72.       contents.font.out_color = M5EmptyHint::OUT_COLOR

  73.       draw_text_ex_plus(wx, wy, M5EmptyHint::WORD)

  74.       reset_font_settings

  75.     end

  76.   end

  77.   def draw_text_ex_plus(x, y, text)

  78.     text = convert_escape_characters(text)

  79.     pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}

  80.     process_character(text.slice!(0, 1), text, pos) until text.empty?

  81.   end

  82. end
复制代码
[/fold]
13、多样化物品分类扩展脚本,适合养成小游戏。
[fold=物品分类扩展]
  1. #打开脚本编辑器,将脚本插入到main上。
  2. #==============================================================================
  3. # ■ 物品分类扩展
  4. # By :VIPArcher
  5. #  -- 本脚本来自 [url]https://rpg.blue[/url] 使用或转载请保留以上信息。
  6. #==============================================================================
  7. # 使用说明:
  8. #   在设定区设定好分类后在道具/武器/防具备注栏备注
  9. #   <分类:分类名称>
  10. #   即可把对应物品归到对应分类下,备注未填写分类的物品按默认分类归类
  11. #==============================================================================
  12. $VIPArcherScript ||= {};$VIPArcherScript[:item_category] = 20141017
  13. #==============================================================================
  14. # ● 设定区
  15. #==============================================================================
  16. module VIPArcher
  17.   ITEM_CATEGORY = { #  <- 别删
  18. #格式:分类标识符号 => "分类名称", 注:标识尽量独特不重复即可
  19.       :item       => "道具", #默认分类
  20.       :weapon     => "武器", #默认分类
  21.       :armor      => "防具", #默认分类
  22.       :key_item   => "特殊", #默认分类
  23.       :viparcher  => "食品",
  24.       :viparcher1  => "食材",
  25.       :viparcher2  => "材料",#不是默认的不想要可以自己在这里删掉。
  26.       #在这里继续添加...
  27.     } #  <- 别删
  28. end
  29. class Window_ItemList < Window_Selectable
  30.   #--------------------------------------------------------------------------
  31.   # ● 查询列表中是否含有此物品
  32.   #--------------------------------------------------------------------------
  33.   alias vip_include? include?
  34.   def include?(item)
  35.     if item && item.note =~ /<分类[:].*>/
  36.       note_include?(item)
  37.     else
  38.       vip_include?(item)
  39.     end
  40.   end
  41.   #--------------------------------------------------------------------------
  42.   # ● 检查备注分类
  43.   #--------------------------------------------------------------------------
  44.   def note_include?(item)
  45.     item.note =~ /<分类[:]\s*#{VIPArcher::ITEM_CATEGORY[@category]}>/
  46.   end
  47. end
  48. class Window_ItemCategory < Window_HorzCommand
  49.   #--------------------------------------------------------------------------
  50.   # ● 生成指令列表
  51.   #--------------------------------------------------------------------------
  52.   def make_command_list
  53.     VIPArcher::ITEM_CATEGORY.each{|key, value| add_command(value,key)}
  54.   end
  55. end
复制代码
[/fold]
14、更详细的描述物品效果,不管什么游戏都可必备。
[fold=物品属性介绍(加强)]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #encoding:utf-8
  3. #==============================================================================
  4. # ■ 技能物品说明增强 蓝本:wyongcan
  5. # 修改 :VIPArcher
  6. #
  7. # 改动说明:
  8. # 改用新的帮助窗口和新定义draw_text_vip方法来增强兼容性
  9. # 更改初始化数据时机以支持跳过标题
  10. # 追加对普通物品和技能的说明内容
  11. # 修改了对帮助窗口行数的计算以支持控制符
  12. # 加上了各种颜色的设置,具体更高级的玩法自己领悟吧
  13. # 改成光标不动一段时间后才会出现帮助窗口
  14. #
  15. #  -- 本脚本来自 [url]https://rpg.blue[/url] 使用或转载请保留以上信息。
  16. #==============================================================================
  17. $VIPArcherScript ||= {};$VIPArcherScript[:help_ex] = 20141007
  18. $VIPArcherScript[:equip_limit] = false #是否使用了后知后觉的装备能力限制
  19. class << DataManager
  20.   alias_method :vip_load_database, :load_database
  21.   #--------------------------------------------------------------------------
  22.   # ● 读取数据库
  23.   #--------------------------------------------------------------------------
  24.   def load_database
  25.     vip_load_database
  26.     VIPArcher::Equipplus.equiphelpready
  27.   end
  28. end
  29. module VIPArcher;end
  30. module VIPArcher::Equipplus
  31.   TIME = 30 #帮助窗口自动出现的时间(单位帧
  32.   Font_Name = Font.default_name # 推荐"微软雅黑"
  33.   Font_Size = 18                # "微软雅黑"的话就20号字体
  34.   UP   = 24 #能力值提升颜色编号
  35.   DOWN = 25 #能力值下降颜色编号
  36.   VIP  = 14 #特殊能力颜色编号
  37.   MP   = 23
  38.   TP   = 29
  39.   CODE ={
  40.     11 => "属性抗性",
  41.     12 => "弱化抗性",
  42.     13 => "状态抗性",
  43.     14 => "状态免疫",
  44.     21 => "普通能力",
  45.     22 => "添加能力",
  46.     23 => "特殊能力",
  47.     31 => "附带属性",
  48.     32 => "附带状态",
  49.     33 => "攻击速度",
  50.     34 => "添加攻击次数",
  51.     41 => "添加技能类型",
  52.     42 => "禁用技能类型",
  53.     43 => "添加技能",
  54.     44 => "禁用技能",
  55.     51 => "可用武器",
  56.     52 => "可用护甲",
  57.     53 => "固定装备",
  58.     54 => "禁用装备",
  59.     55 => "装备风格",
  60.     61 => "添加行动次数",
  61.     62 => "特殊标志",
  62.     63 => "消失效果",
  63.     64 => "队伍"}
  64.   #特殊标志
  65.   FLAG ={
  66.     0 => "自动战斗",
  67.     1 => "擅长防御",
  68.     2 => "保护弱者",
  69.     3 => "特技专注"}
  70.   #技能效果范围
  71.   SCOPE ={
  72.     0 => "无",
  73.     1 => "单个敌人",
  74.     2 => "全体敌人",
  75.     3 => "一个随机敌人",
  76.     4 => "两个随机敌人",
  77.     5 => "三个随机敌人",
  78.     6 => "四个随机敌人",
  79.     7 => "单个队友",
  80.     8 => "全体队友",
  81.     9 => "单个队友(战斗不能)",
  82.     10 => "全体队友(战斗不能)",
  83.     11 => "使用者" }
  84.   #技能命中类型
  85.   HIT ={
  86.     0 => "必定命中",
  87.     1 => "物理攻击",
  88.     2 => "魔法攻击"}
  89.   #使用限制
  90.   OCCASION ={
  91.     0 => "随时可用",
  92.     1 => "仅战斗中",
  93.     2 => "仅菜单中",
  94.     3 => "不能使用"}
  95.   #添加能力
  96.   XPARAM ={
  97.     0 => "物理命中几率:",
  98.     1 => "物理闪避几率:",
  99.     2 => "必杀几率:",
  100.     3 => "必杀闪避几率:",
  101.     4 => "魔法闪避几率:",
  102.     5 => "魔法反射几率:",
  103.     6 => "物理反击几率:",
  104.     7 => "HP逐渐恢复:",
  105.     8 => "MP逐渐恢复:",
  106.     9 => "SP逐渐增加:"}
  107.   #特殊能力
  108.   SPARAM ={
  109.     0 => "受到攻击的几率",
  110.     1 => "防御效果比率",
  111.     2 => "魔法恢复效果",
  112.     3 => "道具恢复效果",
  113.     4 => "MP消耗率",
  114.     5 => "SP获得率",
  115.     6 => "物理伤害加成",
  116.     7 => "魔法伤害加成",
  117.     8 => "地形伤害加成",
  118.     9 => "经验获得加成"}
  119.   #装备风格  require 装备风格扩展脚本
  120.   SLOT_TYPE ={
  121.     0 => "普通",
  122.     1 => "双持武器",
  123.     2 => "索爷三刀流",
  124.     3 => "NPC",
  125.     4 => "233",
  126.     5 => "论坛@的BUG好烦啊"}
  127.   #队伍能力
  128.   PARTY_ABILITY ={
  129.     0 => "遇敌几率减半",
  130.     1 => "随机遇敌无效",
  131.     2 => "敌人偷袭无效",
  132.     3 => "先制攻击提高",
  133.     4 => "获得金钱加倍",
  134.     5 => "掉落几率加倍"}
  135.   #伤害类型
  136.   DAMAGE_TYPE = {
  137.     0 => "无",
  138.     1 => "属性伤害",
  139.     2 => "属性伤害",
  140.     3 => "HP值恢复",
  141.     4 => "MP值恢复",
  142.     5 => "HP值吸收",
  143.     6 => "MP值吸收"}
  144.   #普通能力
  145.   #这只是个示范,你也可以依照个人喜好对这些用语添加颜色控制符
  146.   @params ={
  147.     0 => "\\c[17]最大HP",
  148.     1 => "\\c[16]最大MP",
  149.     2 => "\\c[20]物攻",
  150.     3 => "\\c[21]物防",
  151.     4 => "\\c[30]魔攻",
  152.     5 => "\\c[31]魔防",
  153.     6 => "\\c[14]敏捷",
  154.     7 => "\\c[17]幸运"}
  155.   #我举例技能类型的原因就是因为它 短
  156.   @skill_types = { # 这个和下面equiphelpready里注释掉的做的是一样的事
  157.                    # 只是下面是读取数据库添加用语,这里是手动枚举
  158.     1 => "\\c[1]特技",
  159.     2 => "\\c[2]魔法",
  160.     3 => "\\c[3]必杀",
  161.     4 => "\\c[5]卖萌"}
  162.   #初始化数据,当然如果你要用上面那样的控制符改变颜色的话
  163.   #欢迎枚举格式就是上面这样用Hash,用ID做键把用语对应起来
  164.   def self.equiphelpready
  165.     params = $data_system.terms.params
  166.     elements = $data_system.elements
  167.     weapon_types = $data_system.weapon_types
  168.     armor_types = $data_system.armor_types
  169.     etypes = $data_system.terms.etypes
  170.     skill_types = $data_system.skill_types
  171.     @states       ||= {}
  172.     @params       ||= {}
  173.     @weapon_types ||= {}
  174.     @armor_types  ||= {}
  175.     @etypes       ||= {}
  176.     @skill_types  ||= {}
  177.     @elements     ||= {}
  178.     skill_types.each_with_index{|x,y| @skill_types[y] = x if !x.nil?} if @skill_types == {}
  179.     $data_states.each{|x| @states[x.id] = x.name if !x.nil?} if @states == {}
  180.     elements.each_with_index{|x,y| @elements[y] = x if !x.nil?} if @elements == {}
  181.     weapon_types.each_with_index{|x,y| @weapon_types[y] = x if !x.nil?} if @weapon_types == {}
  182.     armor_types.each_with_index{|x,y| @armor_types[y] = x if !x.nil?} if @armor_types == {}
  183.     etypes.each_with_index{|x,y| @etypes[y] = x} if @etypes == {}
  184.     params.each_with_index{|x,y| @params[y] = x} if @params == {}
  185.   end
  186.   #获取装备帮助内容
  187.   def self.getequiphelp(equip)
  188.     help = ""
  189.     param = []
  190.     help += "\\c[16]装备位置:#{Vocab::etype(equip.etype_id)}\\c[0]\n"
  191.     if $VIPArcherScript[:equip_limit] #装备能力限制
  192.       help += "\\c[16]等级需求:#{equip.level_limit}\n" if equip.level_limit > 0
  193.       param_limit = []
  194.       for i in 0..7
  195.         if equip.params_limit(i) != 0
  196.           help += "\\c[16]#{@params[i]}需求:#{equip.params_limit(i)}\\c[0]\n"
  197.         end
  198.       end
  199.     end
  200.     equip.params.each_with_index{|x,y| param.push([@params[y],x])}
  201.     param = param.select{|x| x[1] != 0}
  202.     param.each{|x| help += "\\c[#{x[1]>0? UP : DOWN}]#{x[0]}:\\c[#{x[1]>0? UP : DOWN}]#{"﹢"if x[1]>0}#{x[1].to_int.to_s}\\c[0]\n"}
  203.     features = equip.features
  204.     featuresparam = []
  205.     featuresparam.push features.select{|x| x.code == 21}
  206.     featuresparam.push features.select{|x| x.code == 22}
  207.     featuresparam.push features.select{|x| x.code == 23}
  208.     featuresparam[0].each{|x| help += "\\c[#{x.value<0?DOWN: UP}]#{@params[x.data_id]}#{x.value<0?"﹣":" * "}#{(x.value.abs*100).to_i}%\n"}
  209.     featuresparam[1].each{|x| help += "\\c[#{x.value<0?DOWN: UP}]#{XPARAM[x.data_id]}#{x.value<0?"﹣":" * "}#{(x.value.abs*100).to_i}%\n"}
  210.     featuresparam[2].each{|x| help += "\\c[#{x.value<0?DOWN: UP}]#{SPARAM[x.data_id]}#{x.value<0?"﹣":" * "}#{(x.value.abs*100).to_i}%\n"}
  211.     if $VIPArcherScript[:slot_type]
  212.       help += "\\c[#{VIP}]#{CODE[55]}:#{SLOT_TYPE[$1.to_i]}\\c[0]\n" if equip.note =~ /<slot_type\s*[:](.*)>/i
  213.     else
  214.       features.select{|x| x.code == 55}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:双持武器\\c[0]\n"}
  215.     end
  216.     features.select{|x| x.code == 11}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@elements[x.data_id]}*#{(x.value*100).to_i}%\\c[0]\n"}
  217.     features.select{|x| x.code == 12}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@params[x.data_id]}*#{(x.value*100).to_i}%\\c[0]\n"}
  218.     features.select{|x| x.code == 13}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@states[x.data_id]}*#{(x.value*100).to_i}%\\c[0]\n"}
  219.     features.select{|x| x.code == 14}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:#{@states[x.data_id]}\\c[0]\n"}
  220.     features.select{|x| x.code == 31}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@elements[x.data_id]}\\c[0]\n"}
  221.     features.select{|x| x.code == 32}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@states[x.data_id]}#{(x.value*100).to_i}%\\c[0]\n"}
  222.     features.select{|x| x.code == 33}.each{|x| help += "\\c[#{x.value>0? UP : DOWN}]#{CODE[x.code]}:#{x.value}\\c[0]\n"}
  223.     features.select{|x| x.code == 34}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{x.value}\\c[0]\n"}
  224.     features.select{|x| x.code == 41}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@skill_types[x.data_id]}\\c[0]\n"}
  225.     features.select{|x| x.code == 42}.each{|x| help += "\\c[#{DOWN}]#{CODE[x.code]}:#{@skill_types[x.data_id]}\\c[0]\n"}
  226.     features.select{|x| x.code == 43}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{$data_skills[x.data_id].name}\\c[0]\n"}
  227.     features.select{|x| x.code == 44}.each{|x| help += "\\c[#{DOWN}]#{CODE[x.code]}:#{$data_skills[x.data_id].name}\\c[0]\n"}
  228.     features.select{|x| x.code == 51}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@weapon_types[x.data_id]}\\c[0]\n"}
  229.     features.select{|x| x.code == 52}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@armor_types[x.data_id]}\\c[0]\n"}
  230.     features.select{|x| x.code == 53}.each{|x| help += "\\c[#{DOWN}]#{CODE[x.code]}:#{@etypes[x.data_id]}\\c[0]\n"}
  231.     features.select{|x| x.code == 54}.each{|x| help += "\\c[#{DOWN}]#{CODE[x.code]}:#{@etypes[x.data_id]}\\c[0]\n"}
  232.     features.select{|x| x.code == 61}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:#{x.value}\\c[0]\n"}
  233.     features.select{|x| x.code == 62}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:#{FLAG[x.data_id]}\\c[0]\n"}
  234.     features.select{|x| x.code == 64}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:#{PARTY_ABILITY[x.data_id]}\\c[0]\n"}
  235.     help
  236.   end
  237.   #获取技能帮助内容
  238.   def self.getskillhelp(skill)
  239.     help = ""
  240.     effects = skill.effects
  241.     damage  = skill.damage
  242.     r = [skill.required_wtype_id1,skill.required_wtype_id2]
  243.     help += "\\c[16]消耗:\\c[#{MP}]MP:#{skill.mp_cost.to_s} \\c[#{TP}]SP:#{skill.tp_cost.to_s}\\c[0]\n" if skill.mp_cost > 0 && skill.tp_cost > 0
  244.     help += "\\c[16]消耗:\\c[#{MP}]MP:#{skill.mp_cost.to_s}\\c[0]\n" if skill.mp_cost > 0 && skill.tp_cost <= 0
  245.     help += "\\c[16]消耗:\\c[#{TP}]SP:#{skill.tp_cost.to_s}\\c[0]\n" if skill.tp_cost > 0 && skill.mp_cost <= 0
  246.     help += "\\c[#{skill.speed<0?DOWN: UP}]速度修正:#{skill.speed}\\c[0]\n" if skill.speed != 0
  247.     help += "\\c[#{DOWN}]成功率:#{skill.success_rate}%\\c[0]\n" if skill.success_rate != 100
  248.     help += "\\c[16]类型:#{HIT[skill.hit_type]}\\c[0]\n"
  249.     help += "\\c[16]效果:#{@elements[damage.element_id]}#{DAMAGE_TYPE[damage.type]}\\c[0]\n" if damage.type != 0
  250.     effects.select{|x| x.code == 31}.each{|x| help += "\\c[#{UP}]强化:#{@params[x.data_id]} #{x.value1.to_i}回合\\c[0]\n"}
  251.     effects.select{|x| x.code == 32}.each{|x| help += "\\c[#{UP}]弱化:#{@params[x.data_id]} #{x.value1.to_i}回合\\c[0]\n"}
  252.     effects.select{|x| x.code == 33}.each{|x| help += "\\c[#{UP}]解除:强化#{@params[x.data_id]}\n"}
  253.     effects.select{|x| x.code == 34}.each{|x| help += "\\c[#{UP}]解除:弱化#{@params[x.data_id]}\n"}
  254.     effects.select{|x| x.code == 22}.each{|x| help += "\\c[#{UP}]解除:#{@states[x.data_id]} #{(x.value1*100).to_i}%\\c[0]\n"}
  255.     effects.select{|x| x.code == 41}.each{|x| help += "\\c[#{VIP}]特殊效果:撤退\n"}
  256.     effects.select{|x| x.code == 42}.each{|x| help += "\\c[#{UP}]提升:#{@params[x.data_id]}#{x.value1.to_i}点\\c[0]\n"}
  257.     effects.select{|x| x.code == 43}.each{|x| help += "\\c[#{VIP}]学会:#{$data_skills[x.data_id].name}\\c[0]\n"}
  258.     help += "\\c[16]场合:#{OCCASION[skill.occasion]}\n"
  259.     help += "\\c[#{DOWN}]限制:#{$data_system.weapon_types[r[0]] if r[0] != 0} #{$data_system.weapon_types[r[1]] if r[1] != 0}\\c[0]\n" if r != [0,0]
  260.     help
  261.   end
  262.   #获取道具帮助内容
  263.   def self.getitemhelp(item)
  264.     help = ""
  265.     effects = item.effects
  266.     damage  = item.damage
  267.     help += "\\c[16]类型:\\c[#{VIP}]#{"贵重物品  "if item.itype_id != 1}\\c[#{DOWN}]#{item.consumable ? "消耗品":"非消耗品"}\\c[0]\n"
  268.     help += "\\c[16]效果:#{@elements[damage.element_id]}#{DAMAGE_TYPE[damage.type]}\\c[0]\n" if damage.type != 0
  269.     effects.select{|x| x.code == 31}.each{|x| help += "\\c[#{UP}]强化:#{@params[x.data_id]} #{x.value1.to_i}回合\\c[0]\n"}
  270.     effects.select{|x| x.code == 32}.each{|x| help += "\\c[#{UP}]弱化:#{@params[x.data_id]} #{x.value1.to_i}回合\\c[0]\n"}
  271.     effects.select{|x| x.code == 33}.each{|x| help += "\\c[#{UP}]解除:强化#{@params[x.data_id]}\\c[0]\n"}
  272.     effects.select{|x| x.code == 34}.each{|x| help += "\\c[#{UP}]解除:弱化#{@params[x.data_id]}\\c[0]\n"}
  273.     effects.select{|x| x.code == 22}.each{|x| help += "\\c[#{UP}]解除:#{@states[x.data_id]} #{(x.value1*100).to_i}%\\c[0]\n"}
  274.     effects.select{|x| x.code == 41}.each{|x| help += "\\c[#{VIP}]特殊效果:撤退\n"}
  275.     effects.select{|x| x.code == 42}.each{|x| help += "\\c[#{VIP}]提升:#{@params[x.data_id]}#{x.value1.to_i}点\\c[0]\n"}
  276.     effects.select{|x| x.code == 43}.each{|x| help += "\\c[#{VIP}]学会:#{$data_skills[x.data_id].name}\\c[0]\n"}
  277.     help += "\\c[16]场合:#{OCCASION[item.occasion]}\\c[0]\n"
  278.     help
  279.   end
  280.   #计算行数(有些字体的汉字和[字母,数字,符号]的宽度不同,
  281.   #有可能会照成行数计算不对,尽量用宽度相同的字体吧)
  282.   def self.getline(text,maxtext)
  283.     text_new = ""
  284.     xtext = []
  285.     line = 0
  286.     text.each_line{|x| text_new += x.gsub(/\\\S\[\d+\]/i){}} #去掉控制符
  287.     text_new.each_line{|x| xtext.push x.gsub(/\n/){}}        #去掉换行符
  288.     xtext.each{|x| line += (x.size / (maxtext.to_f + 1).to_i) + 1}
  289.     line
  290.   end
  291. end
  292. #==============================================================================
  293. # ■ Window_Help_Ex
  294. #------------------------------------------------------------------------------
  295. #  加强显示特技和物品等的说明
  296. #==============================================================================

  297. class Window_Help_Ex < Window_Base
  298.   include VIPArcher::Equipplus
  299.   #--------------------------------------------------------------------------
  300.   # ● 初始化对象
  301.   #--------------------------------------------------------------------------
  302.   def initialize(line_number = 0)
  303.     super(0, 0, 210, 0)
  304.     self.z = 150
  305.     contents.font.size = 14
  306.     @time = 0
  307.   end
  308.   #--------------------------------------------------------------------------
  309.   # ● 设置内容
  310.   #--------------------------------------------------------------------------
  311.   def set_text(text)
  312.     @text = text
  313.     refresh
  314.   end
  315.   #--------------------------------------------------------------------------
  316.   # ● 清除
  317.   #--------------------------------------------------------------------------
  318.   def clear
  319.     set_text("")
  320.   end
  321.   #--------------------------------------------------------------------------
  322.   # ● 更新帮助位置
  323.   #--------------------------------------------------------------------------
  324.   def uppos(index,rect,window)
  325.     self.height = fitting_height_vip(VIPArcher::Equipplus.getline(@xtext,13))
  326.     create_contents
  327.     contents.font.name = Font_Name
  328.     contents.font.size = Font_Size
  329.     rect.x -= window.ox
  330.     rect.y -= window.oy
  331.     ax = rect.x + rect.width + 10
  332.     ax = rect.x - self.width + 10 if ax + self.width > window.width + 10
  333.     ax += window.x
  334.     ax = 0 if ax < 0
  335.     ay = rect.y + rect.height
  336.     ay = rect.y - self.height if ay + self.height > window.height
  337.     ay += window.y
  338.     ay = 0 if ay < 0
  339.     self.x = ax
  340.     self.y = ay + 12
  341.     set_text(@xtext)
  342.     @time = TIME
  343.     self.show
  344.     self.openness = 0
  345.   end
  346.   #--------------------------------------------------------------------------
  347.   # ● 设置物品
  348.   #     item : 技能、物品等
  349.   #--------------------------------------------------------------------------
  350.   def set_item(item)
  351.     if item == nil
  352.       set_text("")
  353.       return
  354.     end
  355.     @xtext = ""
  356.     if $VIPArcherScript[:itemcolor] # require 物品描绘颜色脚本
  357.       @xtext = "\\c[16]名称:\\c[#{VIPArcher::ItemColor::Color_Lv[item.color]}]" +
  358.       "#{item.name}  #{item.color if item.color != 0}#{"★" if item.color != 0}\\c[0]\n"
  359.     else
  360.       @xtext = "\\c[16]名称:\\c[0]#{item.name}\n"
  361.     end
  362.     if $VIPArcherScript[:load]      # require 队伍负重脚本
  363.       @xtext += "\\c[16]售价:#{item.price} 重量:#{item.load}\\c[0]\n"
  364.     else
  365.       @xtext += item.price == 0 ? "\\c[16]售价:\\c[14]无法出售\\c[0]\n":"\\c[16]售价:#{item.price}\\c[0]\n"
  366.     end if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Item)
  367.     @xtext += VIPArcher::Equipplus.getequiphelp(item) if item.is_a?(RPG::EquipItem)
  368.     @xtext += VIPArcher::Equipplus.getskillhelp(item) if item.is_a?(RPG::Skill)
  369.     @xtext += VIPArcher::Equipplus.getitemhelp(item) if item.is_a?(RPG::Item)
  370.     if $VIPArcherScript[:exdrop_rate]   # require 队伍掉率扩展
  371.       @xtext += "\\c[#{$2.to_i > 0 ? UP : DOWN}]#{$1}掉率: #{$2}%\\c[0]\n" if
  372.       item.note =~ /<(\W+)掉率:\s*([0-9+.-]+)%>/i
  373.     end if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Skill)
  374.     @xtext = @xtext[0,@text.size - 2] if @xtext[@xtext.size - 2,2] == "\n"
  375.   end
  376.   #--------------------------------------------------------------------------
  377.   # ● 刷新
  378.   #--------------------------------------------------------------------------
  379.   def refresh
  380.     contents.clear
  381.     self.hide if @text == ""
  382.     draw_text_vip(4, 0, @text,width,40,false)
  383.   end
  384.   #--------------------------------------------------------------------------
  385.   # ● 更新画面
  386.   #--------------------------------------------------------------------------
  387.   def update
  388.     super
  389.     @time -= 1 if @time > 0
  390.     self.open if @time == 0
  391.   end
  392. end
  393. class Window_Base < Window
  394.   #--------------------------------------------------------------------------
  395.   # ● 计算窗口显示指定行数时的应用高度2*************************
  396.   #--------------------------------------------------------------------------
  397.   def fitting_height_vip(line_number)
  398.     line_number * contents.font.size + standard_padding * 2
  399.   end
  400.   # draw_text_ex的增强,使其可以自动换行  原作者:叶子 修改:wyongcan
  401.   #--------------------------------------------------------------------------
  402.   # ● 绘制带有控制符的文本内容
  403.   #   如果传递了width参数的话,会自动换行
  404.   #--------------------------------------------------------------------------
  405.   def draw_text_vip(x, y, text, width = nil,textwidth = nil,normalfont = true)
  406.     reset_font_settings if normalfont == true
  407.     text = convert_escape_characters(text)
  408.     pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  409.     if width != nil
  410.       pos[:height] = contents.font.size
  411.       pos[:width] = width
  412.       pos[:textwidth] = textwidth
  413.     end
  414.     process_character(text.slice!(0, 1), text, pos) until text.empty?
  415.   end
  416.   #--------------------------------------------------------------------------
  417.   # ● 文字的处理
  418.   #     c    : 文字
  419.   #     text : 绘制处理中的字符串缓存(字符串可能会被修改)
  420.   #     pos  : 绘制位置 {:x, :y, :new_x, :height}
  421.   #--------------------------------------------------------------------------
  422.   def process_character(c, text, pos)
  423.     case c
  424.     when "\r"   # 回车
  425.       return
  426.     when "\n"   # 换行
  427.       process_new_line(text, pos)
  428.     when "\f"   # 翻页
  429.       process_new_page(text, pos)
  430.     when "\e"   # 控制符
  431.       process_escape_character(obtain_escape_code(text), text, pos)
  432.     else        # 普通文字
  433.       pos[:textwidth] == nil ? text_width = text_size(c).width : text_width = pos[:textwidth]
  434.       if pos[:width] != nil && pos[:x] - pos[:new_x] + text_width > pos[:width]
  435.         process_new_line(text, pos)
  436.       end
  437.       process_normal_character(c, pos)
  438.     end
  439.   end
  440.   #--------------------------------------------------------------------------
  441.   # ● 处理换行文字
  442.   #--------------------------------------------------------------------------
  443.   alias vip_20141007_process_new_line process_new_line
  444.   def process_new_line(text, pos)
  445.     vip_20141007_process_new_line(text, pos)
  446.     pos[:height] = contents.font.size if pos[:width] != nil
  447.   end
  448. end

  449. #==============================================================================
  450. # ■ 设置帮助增强窗口
  451. #==============================================================================
  452. class Window_Selectable < Window_Base
  453.   attr_reader   :help_ex_window
  454.   #--------------------------------------------------------------------------
  455.   # ● 调用帮助窗口的更新方法
  456.   #--------------------------------------------------------------------------
  457.   alias help_ex_call_update_help call_update_help
  458.   def call_update_help
  459.     help_ex_call_update_help
  460.     update_ex_help if active && @help_ex_window
  461.   end
  462.   #--------------------------------------------------------------------------
  463.   # ● 更新帮助内容
  464.   #--------------------------------------------------------------------------
  465.   def update_ex_help
  466.     @help_ex_window.set_item(item) if @help_ex_window
  467.     if index != -1 && item != nil
  468.       @help_ex_window.uppos(index,item_rect(index),self)
  469.     end
  470.   end
  471.   #--------------------------------------------------------------------------
  472.   # ● 设置帮助增强窗口
  473.   #--------------------------------------------------------------------------
  474.   def help_ex_window=(help_ex_window)
  475.     @help_ex_window = help_ex_window
  476.   end
  477. end
  478. #==============================================================================
  479. # ■ 在各场景处理帮助窗口
  480. #==============================================================================
  481. class Scene_Base
  482.   #--------------------------------------------------------------------------
  483.   # ● 生成帮助增强窗口
  484.   #--------------------------------------------------------------------------
  485.   def create_help_ex
  486.     @help_ex_window  = Window_Help_Ex.new
  487.     @help_ex_window .viewport = @viewport
  488.     @item_window.help_ex_window  = @help_ex_window if @item_window
  489.     @slot_window.help_ex_window  = @help_ex_window if @slot_window
  490.     @skill_window.help_ex_window = @help_ex_window if @skill_window
  491.     @buy_window.help_ex_window   = @help_ex_window if @buy_window
  492.     @sell_window.help_ex_window  = @help_ex_window if @sell_window
  493.   end
  494. end
  495. #道具栏
  496. class Scene_Item < Scene_ItemBase
  497.   #--------------------------------------------------------------------------
  498.   # ● 开始处理
  499.   #--------------------------------------------------------------------------
  500.   alias help_ex_start start
  501.   def start
  502.     help_ex_start
  503.     create_help_ex
  504.   end
  505.   #--------------------------------------------------------------------------
  506.   # ● 物品“取消”
  507.   #--------------------------------------------------------------------------
  508.   alias help_ex_on_item_cancel on_item_cancel
  509.   def on_item_cancel
  510.     help_ex_on_item_cancel
  511.     @help_ex_window.hide
  512.   end
  513. end
  514. #装备栏
  515. class Scene_Equip < Scene_MenuBase
  516.   #--------------------------------------------------------------------------
  517.   # ● 开始处理
  518.   #--------------------------------------------------------------------------
  519.   alias help_ex_start start
  520.   def start
  521.     help_ex_start
  522.     create_help_ex
  523.   end
  524.   #--------------------------------------------------------------------------
  525.   # ● 装备栏“取消”
  526.   #--------------------------------------------------------------------------
  527.   alias help_ex_on_slot_cancel on_slot_cancel
  528.   def on_slot_cancel
  529.     help_ex_on_slot_cancel
  530.     @help_ex_window.hide
  531.   end
  532. end
  533. #技能栏
  534. class Scene_Skill < Scene_ItemBase
  535.   #--------------------------------------------------------------------------
  536.   # ● 开始处理
  537.   #--------------------------------------------------------------------------
  538.   alias help_ex_start start
  539.   def start
  540.     help_ex_start
  541.     create_help_ex
  542.   end
  543.   #--------------------------------------------------------------------------
  544.   # ● 物品“确定”
  545.   #--------------------------------------------------------------------------
  546.   alias help_ex_on_item_ok on_item_ok
  547.   def on_item_ok
  548.     help_ex_on_item_ok
  549.     @help_ex_window.hide
  550.   end
  551.   #--------------------------------------------------------------------------
  552.   # ● 物品“取消”
  553.   #--------------------------------------------------------------------------
  554.   alias help_ex_on_item_cancel on_item_cancel
  555.   def on_item_cancel
  556.     help_ex_on_item_cancel
  557.     @help_ex_window.hide
  558.   end
  559. end
  560. #战斗界面
  561. class Scene_Battle < Scene_Base
  562.   #--------------------------------------------------------------------------
  563.   # ● 开始处理
  564.   #--------------------------------------------------------------------------
  565.   alias help_ex_start start
  566.   def start
  567.     help_ex_start
  568.     create_help_ex
  569.   end
  570.   #--------------------------------------------------------------------------
  571.   # ● 技能“确定”
  572.   #--------------------------------------------------------------------------
  573.   alias help_ex_on_skill_ok on_skill_ok
  574.   def on_skill_ok
  575.     help_ex_on_skill_ok
  576.     @help_ex_window.hide
  577.   end
  578.   #--------------------------------------------------------------------------
  579.   # ● 技能“取消”
  580.   #--------------------------------------------------------------------------
  581.   alias help_ex_on_skill_cancel on_skill_cancel
  582.   def on_skill_cancel
  583.     help_ex_on_skill_cancel
  584.     @help_ex_window.hide
  585.   end
  586.   #--------------------------------------------------------------------------
  587.   # ● 物品“确定”
  588.   #--------------------------------------------------------------------------
  589.   alias help_ex_on_item_ok on_item_ok
  590.   def on_item_ok
  591.     help_ex_on_item_ok
  592.     @help_ex_window.hide
  593.   end
  594.   #--------------------------------------------------------------------------
  595.   # ● 物品“取消”
  596.   #--------------------------------------------------------------------------
  597.   alias help_ex_on_item_cancel on_item_cancel
  598.   def on_item_cancel
  599.     help_ex_on_item_cancel
  600.     @help_ex_window.hide
  601.   end
  602. end
  603. #商店界面
  604. class Scene_Shop < Scene_MenuBase
  605.   #--------------------------------------------------------------------------
  606.   # ● 开始处理
  607.   #--------------------------------------------------------------------------
  608.   alias help_ex_start start
  609.   def start
  610.     help_ex_start
  611.     create_help_ex
  612.   end
  613.   #--------------------------------------------------------------------------
  614.   # ● 买入“确定”
  615.   #--------------------------------------------------------------------------
  616.   alias help_ex_on_buy_ok on_buy_ok
  617.   def on_buy_ok
  618.     help_ex_on_buy_ok
  619.     @help_ex_window.hide
  620.   end
  621.   #--------------------------------------------------------------------------
  622.   # ● 买入“取消”
  623.   #--------------------------------------------------------------------------
  624.   alias help_ex_on_buy_cancel on_buy_cancel
  625.   def on_buy_cancel
  626.     help_ex_on_buy_cancel
  627.     @help_ex_window.hide
  628.   end
  629.   #--------------------------------------------------------------------------
  630.   # ● 卖出“确定”
  631.   #--------------------------------------------------------------------------
  632.   alias help_ex_on_sell_ok on_sell_ok
  633.   def on_sell_ok
  634.     help_ex_on_sell_ok
  635.     @help_ex_window.hide
  636.   end
  637.   #--------------------------------------------------------------------------
  638.   # ● 卖出“取消”
  639.   #--------------------------------------------------------------------------
  640.   alias help_ex_on_sell_cancel on_sell_cancel
  641.   def on_sell_cancel
  642.     help_ex_on_sell_cancel
  643.     @help_ex_window.hide
  644.   end
  645. end
复制代码
[/fold]
15、这是根据DQ打造的脚本,能让游戏更具有探索性。
[fold=隐藏地图]
  1. #打开脚本编辑器,将脚本插入到main上。
  2. #==============================================================================
  3. # ■ 隐藏房间黑块
  4. #  by:VIPArcher [email: VIPArcher@sina.com]
  5. #  -- 本脚本来自 https://rpg.blue 使用或转载请保留以上信息。
  6. #==============================================================================
  7. # 使用说明:
  8. #  · 在需要用黑块遮罩的地图上建一个事件,事件名为 "Black_Room"并且在该事件里注释上
  9. #  需要遮罩的范围矩形,例如 <6,4,10,17> 就为从地图坐标(6,4)开始到坐标(10,17)的矩形
  10. #  区域填充上黑色块遮罩掉,当玩家踏入这个矩形时遮罩块消失。查看坐标可以看地图编辑器
  11. #  右下角,把要遮罩的区域的左上角的坐标和右下角的坐标带入即可。
  12. #  · 指定遮罩块颜色可在设置的第一行注释上<color=Color.new(R,G,B)>
  13. #  · 每个遮罩可以指定角色踏入的矩形,规则同上,注释方法为在对应的矩形后面同一行注释
  14. #  例如<6,4,10,17>,[6,4,10,18],未指定踏入区域时默认原矩形为踏入区域
  15. #  · 如需注释多个黑块房间请注意换行。
  16. #  · 需要用图片做为遮罩块,就像这样备注 <name=文件名 x:5 y:5>,[5,5,10,10]
  17. #   使用图片做为遮罩块必须设置踏入的矩形。文件放在"\Graphics\Parallaxes"文件夹下
  18. #==============================================================================
  19. $VIPArcherScript ||= {};$VIPArcherScript[:black_room] = 20150211
  20. #-------------------------------------------------------------------------------
  21. module VIPArcher end
  22. #==============================================================================
  23. # ★ 设定部分 ★
  24. #==============================================================================
  25. module VIPArcher::BlackRoom
  26.   Z = 999                        # 遮罩块的Z值
  27.   SW = 1                         # 该开关开启时遮罩块不可见
  28.   Edge = 0                      # 遮罩块边距留空的距离
  29.   Room_Color = Color.new(0,0,0)  # 默认遮罩块填充的颜色
  30.   Event_Name = 'Black_Room'      # 设置遮罩块的事件名
  31.   Opacity_Speed = 17             # 透明度变化的速度
  32. end
  33. #==============================================================================
  34. # ☆ 设定结束 ☆
  35. #==============================================================================
  36. class Sprite_BlackRoom < Sprite
  37.   include VIPArcher::BlackRoom
  38.   #--------------------------------------------------------------------------
  39.   # ● 初始化对象
  40.   #--------------------------------------------------------------------------
  41.   def initialize(rect,check_rect,color,viewport)
  42.     super(viewport)
  43.     @check_rect, @color = check_rect,color
  44.     if rect.is_a?(Rect)
  45.       self.x, self.y, self.z = rect.x * 32, rect.y * 32, Z
  46.       width, height = rect.width - rect.x + 1,rect.height - rect.y + 1
  47.       set_bitmap(width * 32,height * 32)
  48.     elsif rect.is_a?(Array)
  49.       self.x, self.y, self.z = rect[1] * 32, rect[2] * 32, Z
  50.       set_bitmap(rect[0])
  51.     end
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # ● 设置Bitmap
  55.   #--------------------------------------------------------------------------
  56.   def set_bitmap(*args)
  57.     case args.size
  58.     when 1
  59.       self.bitmap = Cache.parallax(args[0])
  60.     when 2
  61.       self.bitmap = Bitmap.new(args[0], args[1])
  62.       rect = Rect.new(Edge, Edge, args[0] - Edge * 2, args[1] - Edge * 2)
  63.       self.bitmap.fill_rect(rect, @color)
  64.     end
  65.   end
  66.   #--------------------------------------------------------------------------
  67.   # ● 释放
  68.   #--------------------------------------------------------------------------
  69.   def dispose
  70.     super
  71.     self.bitmap.dispose
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # ● 位置判定
  75.   #--------------------------------------------------------------------------
  76.   def character_pos?
  77.     $game_player.x > @check_rect.width  || $game_player.x <  @check_rect.x ||
  78.     $game_player.y > @check_rect.height || $game_player.y <  @check_rect.y
  79.   end
  80.   #--------------------------------------------------------------------------
  81.   # ● 更新透明度
  82.   #--------------------------------------------------------------------------
  83.   def update_opacity
  84.     self.opacity += character_pos? ? Opacity_Speed : - Opacity_Speed
  85.     self.opacity = 0 if $game_switches[SW]
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   # ● 更新位置
  89.   #--------------------------------------------------------------------------
  90.   def update_position
  91.     self.ox = $game_map.display_x * 32
  92.     self.oy = $game_map.display_y * 32
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # ● 更新画面
  96.   #--------------------------------------------------------------------------
  97.   def update
  98.     super
  99.     update_opacity
  100.     update_position
  101.   end
  102. end
  103. #-------------------------------------------------------------------------------
  104. class Spriteset_Map
  105.   include VIPArcher::BlackRoom
  106.   #--------------------------------------------------------------------------
  107.   # ● 生成黑色遮罩块
  108.   #--------------------------------------------------------------------------
  109.   alias black_room_create_characters create_characters
  110.   def create_characters
  111.     black_room_create_characters
  112.     room_sprite_dispose if @black_room_sprites
  113.     @black_room_sprites = []
  114.     $game_map.events.values.each do |event|
  115.       if event.instance_variable_get(:@event).name =~ /#{Event_Name}/i
  116.         return if event.list.nil?
  117.         event.list.each { |command| get_setup(command) }
  118.       end
  119.     end
  120.   end
  121.   #--------------------------------------------------------------------------
  122.   # ● 获取遮罩块设置
  123.   #--------------------------------------------------------------------------
  124.   def get_setup(command)
  125.     return unless command.code == 108 or 408
  126.     command.parameters.each {|line|get_rect_setup(line);get_bitmap_setup(line)}
  127.   end
  128.   #--------------------------------------------------------------------------
  129.   # ● 备注文件名的设置
  130.   #--------------------------------------------------------------------------
  131.   def get_bitmap_setup(line)
  132.     if line =~ /<name\s*=\s*(\S+?)\s*x:\s*(\d+?)\s*y:\s*(\d+)>/i
  133.       rect = [$1,$2.to_i,$3.to_i]
  134.       if line =~ /\[(\d+.*?)\]/; x = $1.split(',')
  135.         check_rect = Rect.new(x[0].to_i,x[1].to_i,x[2].to_i,x[3].to_i)
  136.       end
  137.       sprite = Sprite_BlackRoom.new(rect,check_rect,@color,@viewport1)
  138.       sprite.opacity = 0 unless sprite.character_pos?
  139.       @black_room_sprites.push(sprite)
  140.     end
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # ● 备注矩形的设置
  144.   #--------------------------------------------------------------------------
  145.   def get_rect_setup(line)
  146.     @color = eval($1) if line =~ /<color\s*=\s*(.*?)\s*>/i
  147.     @color ||= Room_Color
  148.     if line =~ /<(\d+.*?)>/; x = $1.split(',')
  149.       check_rect = rect = Rect.new(x[0].to_i,x[1].to_i,x[2].to_i,x[3].to_i)
  150.       if line =~ /\[(\d+.*?)\]/; x = $1.split(',')
  151.         check_rect = Rect.new(x[0].to_i,x[1].to_i,x[2].to_i,x[3].to_i)
  152.       end
  153.       sprite = Sprite_BlackRoom.new(rect,check_rect,@color,@viewport1)
  154.       sprite.opacity = 0 unless sprite.character_pos?
  155.       @black_room_sprites.push(sprite)
  156.     end
  157.   end
  158.   #--------------------------------------------------------------------------
  159.   # ● 释放
  160.   #--------------------------------------------------------------------------
  161.   alias black_room_dispose dispose
  162.   def dispose
  163.     black_room_dispose
  164.     room_sprite_dispose
  165.   end
  166.   #--------------------------------------------------------------------------
  167.   # ● 释放遮罩块
  168.   #--------------------------------------------------------------------------
  169.   def room_sprite_dispose
  170.     @black_room_sprites.each {|sprite| sprite.dispose }
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # ● 更新画面
  174.   #--------------------------------------------------------------------------
  175.   alias black_room_update update
  176.   def update
  177.     black_room_update
  178.     @black_room_sprites.each {|sprite| sprite.update }
  179.   end
  180. end
复制代码
[/fold]
16、在战斗中菜单加入一个“队伍”(名字可以在脚本改)选项,战斗中可以不限制的切换没有出来参战的同伴出来战斗。
[fold=战斗支援脚本1]
  1. #使用方法:打开脚本编辑器,将“战斗支援脚本1”“战斗支援脚本2"脚本插入到main上。
  2. # ===========================================================================

  3. # ◆ A1 Scripts ◆

  4. #    A1バトル共通スクリプト(RGSS3)

  5. #

  6. # バージョン   : 1.23 (2012/01/27)

  7. # 作者         : A1

  8. # URL     : http://a1tktk.web.fc2.com/

  9. # ---------------------------------------------------------------------------

  10. # 更新履歴   :2012/01/18 Ver1.00 リリース

  11. #                2012/01/21 Ver1.10 装備拡張対応

  12. #                2012/01/21 Ver1.10 メンバー加入時の不具合を修正

  13. #                2012/01/21 Ver1.10 メンバー加入時に既にパーティに居るさい何もしないように修正

  14. #                2012/01/24 Ver1.20 スキル拡張対応

  15. #                2012/01/24 Ver1.21 Window_BattleActorの不具合を修正

  16. #                2012/01/26 Ver1.22 Window_BattleSkillの不具合を修正

  17. #                2012/01/27 Ver1.23 戦闘行動がない際の不具合を修正

  18. # ---------------------------------------------------------------------------

  19. # 設置場所      

  20. #  A1共通スクリプトより下

  21. #    一部再定義メソッドがあるため、なるべく上の方

  22. #

  23. # 必要スクリプト

  24. #    A1共通スクリプトVer4.30以上

  25. #==============================================================================

  26. $imported = {} if $imported == nil

  27. if $imported["A1_Common_Script"]

  28. $imported["A1_BattleCommonScript"] = true

  29. old_common_script("A1バトル共通スクリプト", "4.30") if common_version < 4.30

  30. #==============================================================================

  31. # ■ Window_Base

  32. #------------------------------------------------------------------------------

  33. #  ゲーム中の全てのウィンドウのスーパークラスです。

  34. #==============================================================================


  35. class Window_Base < Window

  36.   #--------------------------------------------------------------------------

  37.   # ○ メソッドの定義

  38.   #--------------------------------------------------------------------------

  39.   def define_method(method, symbol)

  40.     @method ||= {}

  41.     @method[symbol] = method

  42.   end

  43.   #--------------------------------------------------------------------------

  44.   # ○ メソッドのコール

  45.   #--------------------------------------------------------------------------

  46.   def call_method(symbol, *args)

  47.     @method ||= {}

  48.     @method[symbol].call(*args) if @method[symbol]

  49.   end

  50.   #--------------------------------------------------------------------------

  51.   # ○ 顔グラフィックの描画(解放なし)

  52.   #--------------------------------------------------------------------------

  53.   def draw_face_no_dispose(face_name, face_index, x, y, enabled = true)

  54.     bitmap = Cache.face(face_name)

  55.     rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 96)

  56.     contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)

  57.   end

  58.   #--------------------------------------------------------------------------

  59.   # ○ 背景の描画

  60.   #--------------------------------------------------------------------------

  61.   def draw_background(rect)

  62.     temp_rect = rect.clone

  63.     temp_rect.width /= 2

  64.     contents.gradient_fill_rect(temp_rect, back_color2, back_color1)

  65.     temp_rect.x = temp_rect.width

  66.     contents.gradient_fill_rect(temp_rect, back_color1, back_color2)

  67.   end

  68.   #--------------------------------------------------------------------------

  69.   # ○ 背景色 1 の取得

  70.   #--------------------------------------------------------------------------

  71.   def back_color1

  72.     Color.new(0, 0, 0, 192)

  73.   end

  74.   #--------------------------------------------------------------------------

  75.   # ○ 背景色 2 の取得

  76.   #--------------------------------------------------------------------------

  77.   def back_color2

  78.     Color.new(0, 0, 0, 0)

  79.   end

  80. end

  81. #==============================================================================

  82. # ■ Window_Help

  83. #------------------------------------------------------------------------------

  84. #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。

  85. #==============================================================================


  86. class Window_Help < Window_Base

  87.   #--------------------------------------------------------------------------

  88.   # ○ センターにテキストを描画

  89.   #--------------------------------------------------------------------------

  90.   def draw_center_text(text)

  91.     contents.clear

  92.     draw_text(0, 0, contents.width, line_height, text, 1)

  93.   end

  94. end

  95. #==============================================================================

  96. # ■ Window_BattleActor

  97. #------------------------------------------------------------------------------

  98. #  バトル画面で、行動対象のアクターを選択するウィンドウです。

  99. #==============================================================================


  100. class Window_BattleActor < Window_BattleStatus

  101.   #--------------------------------------------------------------------------

  102.   # ★ ウィンドウの表示

  103.   #--------------------------------------------------------------------------

  104.   def show

  105.     setup_remain if @info_viewport

  106.     self.visible = true

  107.     refresh

  108.     open

  109.     self

  110.   end

  111.   #--------------------------------------------------------------------------

  112.   # ★ ウィンドウの非表示

  113.   #--------------------------------------------------------------------------

  114.   def hide

  115.     close

  116.     @info_viewport.rect.width = Graphics.width if @info_viewport

  117.     call_method(:select_actor_end)

  118.   end

  119.   #--------------------------------------------------------------------------

  120.   # ○ フレーム更新

  121.   #--------------------------------------------------------------------------

  122.   def update

  123.     return update_basic unless self.visible

  124.     super

  125.     self.visible = false if self.openness == 0

  126.   end

  127.   #--------------------------------------------------------------------------

  128.   # ○ フレーム更新(基本)

  129.   #--------------------------------------------------------------------------

  130.   def update_basic

  131.     process_cursor_move

  132.     process_handling

  133.   end

  134.   #--------------------------------------------------------------------------

  135.   # ○ 項目の選択

  136.   #--------------------------------------------------------------------------

  137.   def select(index)

  138.     super

  139.     call_method(:select_actor, index)

  140.   end

  141.   #--------------------------------------------------------------------------

  142.   # ○ ウィンドウの調整

  143.   #--------------------------------------------------------------------------

  144.   def setup_remain

  145.     width_remain = Graphics.width - width

  146.     self.x = width_remain

  147.     @info_viewport.rect.width = width_remain

  148.     select(0)

  149.   end

  150. end

  151. #==============================================================================

  152. # ■ Window_BattleEnemy

  153. #------------------------------------------------------------------------------

  154. #  バトル画面で、行動対象の敵キャラを選択するウィンドウです。

  155. #==============================================================================


  156. class Window_BattleEnemy < Window_Selectable

  157.   #--------------------------------------------------------------------------

  158.   # ★ ウィンドウの表示

  159.   #--------------------------------------------------------------------------

  160.   def show

  161.     setup_remain if @info_viewport

  162.     self.visible = true

  163.     open

  164.     self

  165.   end

  166.   #--------------------------------------------------------------------------

  167.   # ★ ウィンドウの非表示

  168.   #--------------------------------------------------------------------------

  169.   def hide

  170.     close

  171.     @info_viewport.rect.width = Graphics.width if @info_viewport

  172.     call_method(:select_enemy_end)

  173.   end

  174.   #--------------------------------------------------------------------------

  175.   # ○ フレーム更新

  176.   #--------------------------------------------------------------------------

  177.   def update

  178.     return update_basic unless self.visible

  179.     super

  180.     self.visible = false if self.openness == 0

  181.   end

  182.   #--------------------------------------------------------------------------

  183.   # ○ フレーム更新(基本)

  184.   #--------------------------------------------------------------------------

  185.   def update_basic

  186.     process_cursor_move

  187.     process_handling

  188.   end

  189.   #--------------------------------------------------------------------------

  190.   # ○ 項目の選択

  191.   #--------------------------------------------------------------------------

  192.   def select(index)

  193.     super

  194.     call_method(:select_enemy, index)

  195.   end

  196.   #--------------------------------------------------------------------------

  197.   # ○ ウィンドウの調整

  198.   #--------------------------------------------------------------------------

  199.   def setup_remain

  200.     width_remain = Graphics.width - width

  201.     self.x = width_remain

  202.     @info_viewport.rect.width = width_remain

  203.     select(0)

  204.   end

  205. end

  206. #==============================================================================

  207. # ■ Window_BattleSkill

  208. #------------------------------------------------------------------------------

  209. #  バトル画面で、使用するスキルを選択するウィンドウです。

  210. #==============================================================================


  211. class Window_BattleSkill < Window_SkillList

  212.   #--------------------------------------------------------------------------

  213.   # ☆ オブジェクト初期化

  214.   #     info_viewport : 情報表示用ビューポート

  215.   #--------------------------------------------------------------------------

  216.   alias a1_psw_wbs_initialize initialize

  217.   def initialize(help_window, info_viewport)

  218.     a1_psw_wbs_initialize(help_window, info_viewport)

  219.     self.openness = 0

  220.     self.visible  = true

  221.     @help_window.openness = 0

  222.     @help_window.visible = true

  223.   end

  224.   #--------------------------------------------------------------------------

  225.   # ○ 高さを変える

  226.   #--------------------------------------------------------------------------

  227.   def resize_height(base_y)

  228.     self.height = base_y - self.y

  229.     create_contents

  230.   end

  231.   #--------------------------------------------------------------------------

  232.   # ★ ウィンドウの表示

  233.   #--------------------------------------------------------------------------

  234.   def show

  235.     self.visible = true

  236.     @help_window.visible = true

  237.     select_last

  238.     open

  239.     @help_window.open

  240.     self

  241.   end

  242.   #--------------------------------------------------------------------------

  243.   # ★ ウィンドウの非表示

  244.   #--------------------------------------------------------------------------

  245.   def hide

  246.     close

  247.     @help_window.close

  248.     @info_viewport.rect.width = Graphics.width if @info_viewport

  249.     call_method(:skill_item_window_hide)

  250.   end

  251.   #--------------------------------------------------------------------------

  252.   # ○ オープン

  253.   #--------------------------------------------------------------------------

  254.   def open

  255.     self.visible = true

  256.     call_method(:skill_item_window_show)

  257.     super

  258.   end

  259.   #--------------------------------------------------------------------------

  260.   # ○ アクティブ化

  261.   #--------------------------------------------------------------------------

  262.   def activate

  263.     open

  264.     @help_window.open

  265.     super

  266.   end

  267. end

  268. #==============================================================================

  269. # ■ Window_BattleItem

  270. #------------------------------------------------------------------------------

  271. #  バトル画面で、使用するアイテムを選択するウィンドウです。

  272. #==============================================================================


  273. class Window_BattleItem < Window_ItemList

  274.   #--------------------------------------------------------------------------

  275.   # ☆ オブジェクト初期化

  276.   #     info_viewport : 情報表示用ビューポート

  277.   #--------------------------------------------------------------------------

  278.   alias a1_battle_common_wbi_initialize initialize

  279.   def initialize(help_window, info_viewport)

  280.     a1_battle_common_wbi_initialize(help_window, info_viewport)

  281.     self.openness = 0

  282.     self.visible  = true

  283.     @help_window.openness = 0

  284.     @help_window.visible = true

  285.   end

  286.   #--------------------------------------------------------------------------

  287.   # ○ 高さを変える

  288.   #--------------------------------------------------------------------------

  289.   def resize_height(base_y)

  290.     self.height = base_y - self.y

  291.     create_contents

  292.   end

  293.   #--------------------------------------------------------------------------

  294.   # ★ ウィンドウの表示

  295.   #--------------------------------------------------------------------------

  296.   def show

  297.     self.visible = true

  298.     @help_window.visible = true

  299.     select_last

  300.     open

  301.     @help_window.open

  302.     self

  303.   end

  304.   #--------------------------------------------------------------------------

  305.   # ★ ウィンドウの非表示

  306.   #--------------------------------------------------------------------------

  307.   def hide

  308.     close

  309.     @help_window.close

  310.     call_method(:skill_item_window_hide)

  311.   end

  312.   #--------------------------------------------------------------------------

  313.   # ○ オープン

  314.   #--------------------------------------------------------------------------

  315.   def open

  316.     self.visible = true

  317.     call_method(:skill_item_window_show)

  318.     super

  319.   end

  320.   #--------------------------------------------------------------------------

  321.   # ○ アクティブ化

  322.   #--------------------------------------------------------------------------

  323.   def activate

  324.     open

  325.     @help_window.open

  326.     super

  327.   end

  328.   #--------------------------------------------------------------------------

  329.   # ○ フレーム更新

  330.   #--------------------------------------------------------------------------

  331.   def update

  332.     return unless self.visible

  333.     super

  334.     self.visible = false if self.openness == 0

  335.   end

  336. end

  337. #==============================================================================

  338. # ■ Window_ActorCommand

  339. #------------------------------------------------------------------------------

  340. #  バトル画面で、アクターの行動を選択するウィンドウです。

  341. #==============================================================================


  342. class Window_ActorCommand < Window_Command

  343.   #--------------------------------------------------------------------------

  344.   # ☆ セットアップ

  345.   #--------------------------------------------------------------------------

  346.   alias a1_battle_common_wac_setup setup

  347.   def setup(actor)

  348.     call_method(:actor_command_setup, actor)

  349.     a1_battle_common_wac_setup(actor)

  350.   end

  351.   #--------------------------------------------------------------------------

  352.   # ○ ウィンドウのアクティブ化

  353.   #--------------------------------------------------------------------------

  354.   def activate

  355.     open

  356.     super

  357.   end

  358.   #--------------------------------------------------------------------------

  359.   # ○ オープン

  360.   #--------------------------------------------------------------------------

  361.   def open

  362.     call_method(:actor_command_open)

  363.     super

  364.   end

  365.   #--------------------------------------------------------------------------

  366.   # ○ クローズ

  367.   #--------------------------------------------------------------------------

  368.   def close

  369.     call_method(:actor_command_close)

  370.     super

  371.   end

  372. end

  373. #==============================================================================

  374. # ■ Window_BattleStatus

  375. #------------------------------------------------------------------------------

  376. #  バトル画面で、パーティメンバーのステータスを表示するウィンドウです。

  377. #==============================================================================


  378. class Window_BattleStatus < Window_Selectable

  379.   #--------------------------------------------------------------------------

  380.   # ☆ リフレッシュ

  381.   #--------------------------------------------------------------------------

  382.   alias a1_battle_common_wbs_refresh refresh

  383.   def refresh

  384.     call_method(:refresh_statsu_window)

  385.     return unless self.visible

  386.     a1_battle_common_wbs_refresh

  387.   end

  388.   #--------------------------------------------------------------------------

  389.   # ○ ウィンドウを開く

  390.   #--------------------------------------------------------------------------

  391.   def open

  392.     super

  393.     call_method(:open_status_window)

  394.   end

  395.   #--------------------------------------------------------------------------

  396.   # ○ ウィンドウを閉じる

  397.   #--------------------------------------------------------------------------

  398.   def close

  399.     super

  400.     call_method(:close_status_window)

  401.   end

  402.   #--------------------------------------------------------------------------

  403.   # ○ 項目の選択

  404.   #--------------------------------------------------------------------------

  405.   def select(index)

  406.     super

  407.     call_method(:select_status_window, index)

  408.   end

  409.   #--------------------------------------------------------------------------

  410.   # ○ フレーム更新

  411.   #--------------------------------------------------------------------------

  412.   def update

  413.     call_method(:update_status_window)

  414.     return unless self.visible

  415.     super

  416.   end

  417.   #--------------------------------------------------------------------------

  418.   # ○ 解放

  419.   #--------------------------------------------------------------------------

  420.   def dispose

  421.     super

  422.     call_method(:dispose_status_window)

  423.   end

  424. end

  425. #==============================================================================

  426. # ■ Window_PersonalStatus

  427. #==============================================================================


  428. class Window_PersonalStatus < Window_Base

  429.   #--------------------------------------------------------------------------

  430.   # ○ オブジェクト初期化

  431.   #--------------------------------------------------------------------------

  432.   def initialize(x, y, opacity = 0)

  433.     super(x, y, Graphics.width / 2, 120)

  434.     self.opacity  = opacity

  435.     self.openness = 0

  436.     @actor = nil

  437.   end

  438.   #--------------------------------------------------------------------------

  439.   # ○ アクターの設定

  440.   #--------------------------------------------------------------------------

  441.   def actor=(actor)

  442.     @actor = actor

  443.     refresh

  444.   end

  445.   #--------------------------------------------------------------------------

  446.   # ○ リフレッシュ

  447.   #--------------------------------------------------------------------------

  448.   def refresh

  449.     contents.clear

  450.     draw_face(@actor.face_name, @actor.face_index, 0, 0)

  451.     draw_text(116, line_height * 0, contents.width, line_height, @actor.name)

  452.     draw_actor_level(@actor, 116, 0 + line_height * 1)

  453.     draw_actor_icons(@actor, 180, 0 + line_height * 1)

  454.     draw_actor_hp(@actor, 116, 0 + line_height * 2, 128)

  455.     draw_actor_mp(@actor, 116, 0 + line_height * 3, 60)

  456.     draw_actor_tp(@actor, 184, 0 + line_height * 3, 60) if $data_system.opt_display_tp

  457.   end

  458.   #--------------------------------------------------------------------------

  459.   # ○ フレーム更新

  460.   #--------------------------------------------------------------------------

  461.   def update

  462.     return unless self.visible

  463.     super

  464.     self.visible = false if self.openness == 0

  465.   end

  466.   #--------------------------------------------------------------------------

  467.   # ○ オープン

  468.   #--------------------------------------------------------------------------

  469.   def open

  470.     self.visible = true

  471.     super

  472.   end

  473.   #--------------------------------------------------------------------------

  474.   # ○ 顔グラフィックの描画

  475.   #--------------------------------------------------------------------------

  476.   def draw_face(face_name, face_index, x, y, enabled = true)

  477.     draw_face_no_dispose(face_name, face_index, x, y, enabled)

  478.   end

  479. end

  480. #==============================================================================

  481. # ■ RPG::Enemy

  482. #==============================================================================


  483. class RPG::Enemy < RPG::BaseItem

  484.   #--------------------------------------------------------------------------

  485.   # ○ 初期装備

  486.   #--------------------------------------------------------------------------

  487.   def equips

  488.     @equips ||= [0,0,0,0,0]

  489.     @equips[0] ||= $a1_common.note_data_one(self.note, "エネミー武器", 0)

  490.     return @equips

  491.   end

  492. end

  493. #==============================================================================

  494. # ■ Game_Enemy

  495. #------------------------------------------------------------------------------

  496. #  敵キャラを扱うクラスです。このクラスは Game_Troop クラス($game_troop)の

  497. # 内部で使用されます。

  498. #==============================================================================


  499. class Game_Enemy < Game_Battler

  500.   #--------------------------------------------------------------------------

  501.   # ☆ オブジェクト初期化

  502.   #--------------------------------------------------------------------------

  503.   alias a1_battle_common_ge_initialize initialize

  504.   def initialize(index, enemy_id)

  505.     @equips = []

  506.     a1_battle_common_ge_initialize(index, enemy_id)

  507.     init_equips(enemy.equips)

  508.   end

  509. end

  510. #==============================================================================

  511. # ■ Game_Actor

  512. #------------------------------------------------------------------------------

  513. #  アクターを扱うクラスです。このクラスは Game_Actors クラス($game_actors)

  514. # の内部で使用され、Game_Party クラス($game_party)からも参照されます。

  515. #==============================================================================


  516. class Game_Actor < Game_Battler

  517.   #--------------------------------------------------------------------------

  518.   # ★ 装備品の初期化

  519.   #     equips : 初期装備の配列

  520.   #--------------------------------------------------------------------------

  521.   def init_equips(equips)

  522.     super

  523.   end

  524.   #--------------------------------------------------------------------------

  525.   # ★ 装備タイプからスロット ID に変換(空きを優先)

  526.   #--------------------------------------------------------------------------

  527.   def empty_slot(etype_id)

  528.     super

  529.   end

  530.   #--------------------------------------------------------------------------

  531.   # ★ 装備タイプからスロット ID のリストに変換

  532.   #--------------------------------------------------------------------------

  533.   def slot_list(etype_id)

  534.     super

  535.   end

  536.   #--------------------------------------------------------------------------

  537.   # ★ エディタで設定されたインデックスを装備タイプ ID に変換

  538.   #--------------------------------------------------------------------------

  539.   def index_to_etype_id(index)

  540.     super

  541.   end

  542.   #--------------------------------------------------------------------------

  543.   # ★ 装備スロットの配列を取得

  544.   #--------------------------------------------------------------------------

  545.   def equip_slots

  546.     super

  547.   end

  548.   #--------------------------------------------------------------------------

  549.   # ★ 装備品オブジェクトの配列取得

  550.   #--------------------------------------------------------------------------

  551.   def equips

  552.     super

  553.   end

  554.   #--------------------------------------------------------------------------

  555.   # ★ 武器オブジェクトの配列取得

  556.   #--------------------------------------------------------------------------

  557.   def weapons

  558.     super

  559.   end

  560.   #--------------------------------------------------------------------------

  561.   # ★ 通常能力値の加算値取得

  562.   #--------------------------------------------------------------------------

  563.   def param_plus(param_id)

  564.     super

  565.   end

  566.   #--------------------------------------------------------------------------

  567.   # ☆ 通常攻撃 アニメーション ID の取得

  568.   #--------------------------------------------------------------------------

  569.   alias a1_battle_common_ga_atk_animation_id1 atk_animation_id1

  570.   def atk_animation_id1

  571.     return a1_battle_common_ga_atk_animation_id1 if !@current_weapon || @current_weapon.is_a?(Array)

  572.     @current_weapon.animation_id

  573.   end

  574.   #--------------------------------------------------------------------------

  575.   # ☆ 通常攻撃 アニメーション ID の取得(二刀流:武器2)

  576.   #--------------------------------------------------------------------------

  577.   alias a1_battle_common_ga_atk_animation_id2 atk_animation_id2

  578.   def atk_animation_id2

  579.     return a1_battle_common_ga_atk_animation_id2 if !@current_weapon || @current_weapon.is_a?(Array)

  580.     @current_weapon.animation_id

  581.   end

  582.   #--------------------------------------------------------------------------

  583.   # ○ 装備タイプ名を取得

  584.   #--------------------------------------------------------------------------

  585.   def e_type_name(item)

  586.     return $data_system.weapon_types[item.wtype_id] if item.is_a?(RPG::Weapon)

  587.     return $data_system.armor_types[item.atype_id] if item.is_a?(RPG::Armor)

  588.   end

  589. end

  590. #==============================================================================

  591. # ■ Game_BattlerBase

  592. #------------------------------------------------------------------------------

  593. #  バトラーを扱う基本のクラスです。主に能力値計算のメソッドを含んでいます。こ

  594. # のクラスは Game_Battler クラスのスーパークラスとして使用されます。

  595. #==============================================================================


  596. class Game_BattlerBase

  597.   #--------------------------------------------------------------------------

  598.   # ○ 二刀流?

  599.   #--------------------------------------------------------------------------

  600.   def two_sword_style?

  601.     weapons[0] && weapons[1]

  602.   end

  603.   #--------------------------------------------------------------------------

  604.   # ○ バトラーオブジェクト取得

  605.   #--------------------------------------------------------------------------

  606.   def battler

  607.     return actor if self.actor?

  608.     return enemy

  609.   end

  610. end

  611. #==============================================================================

  612. # ■ Game_Battler

  613. #------------------------------------------------------------------------------

  614. #  スプライトや行動に関するメソッドを追加したバトラーのクラスです。このクラス

  615. # は Game_Actor クラスと Game_Enemy クラスのスーパークラスとして使用されます。

  616. #==============================================================================


  617. class Game_Battler < Game_BattlerBase

  618.   #--------------------------------------------------------------------------

  619.   # ○ 公開インスタンス変数

  620.   #--------------------------------------------------------------------------

  621.   attr_accessor :current_weapon

  622.   attr_accessor :current_main

  623.   #--------------------------------------------------------------------------

  624.   # ○ 装備品の初期化

  625.   #     equips : 初期装備の配列

  626.   #--------------------------------------------------------------------------

  627.   def init_equips(equips)

  628.     @equips = Array.new(equip_slots.size) { Game_BaseItem.new }

  629.     equips.each_with_index do |item_id, i|

  630.       etype_id = index_to_etype_id(i)

  631.       slot_id = empty_slot(etype_id)

  632.       @equips[slot_id].set_equip(etype_id == 0, item_id) if slot_id

  633.     end

  634.     refresh

  635.   end

  636.   #--------------------------------------------------------------------------

  637.   # ○ 装備タイプからスロット ID に変換(空きを優先)

  638.   #--------------------------------------------------------------------------

  639.   def empty_slot(etype_id)

  640.     list = slot_list(etype_id)

  641.     list.find {|i| @equips[i].is_nil? } || list[0]

  642.   end

  643.   #--------------------------------------------------------------------------

  644.   # ○ 装備タイプからスロット ID のリストに変換

  645.   #--------------------------------------------------------------------------

  646.   def slot_list(etype_id)

  647.     result = []

  648.     equip_slots.each_with_index {|e, i| result.push(i) if e == etype_id }

  649.     result

  650.   end

  651.   #--------------------------------------------------------------------------

  652.   # ○ エディタで設定されたインデックスを装備タイプ ID に変換

  653.   #--------------------------------------------------------------------------

  654.   def index_to_etype_id(index)

  655.     index == 1 && dual_wield? ? 0 : index

  656.   end

  657.   #--------------------------------------------------------------------------

  658.   # ○ 装備スロットの配列を取得

  659.   #--------------------------------------------------------------------------

  660.   def equip_slots

  661.     return [0,0,2,3,4] if dual_wield?       # 二刀流

  662.     return [0,1,2,3,4]                      # 通常

  663.   end

  664.   #--------------------------------------------------------------------------

  665.   # ○ 装備品オブジェクトの配列取得

  666.   #--------------------------------------------------------------------------

  667.   def equips

  668.     @equips.collect {|item| item.object }

  669.   end

  670.   #--------------------------------------------------------------------------

  671.   # ○ 武器オブジェクトの配列取得

  672.   #--------------------------------------------------------------------------

  673.   def weapons

  674.     @equips.select {|item| item.is_weapon? }.collect {|item| item.object }

  675.   end

  676.   #--------------------------------------------------------------------------

  677.   # ○ 通常能力値の加算値取得

  678.   #--------------------------------------------------------------------------

  679.   def param_plus(param_id)

  680.     equips.compact.inject(super) {|r, item| r += item.params[param_id] + ex_item_params(item, param_id) }

  681.   end

  682.   #--------------------------------------------------------------------------

  683.   # ○ アイテムにかける追加要素

  684.   #--------------------------------------------------------------------------

  685.   def ex_item_params(item, param_id)

  686.     return 0

  687.   end

  688.   #--------------------------------------------------------------------------

  689.   # ○ スキルを取得

  690.   #--------------------------------------------------------------------------

  691.   def skill(skill_id)

  692.     $data_skills[skill_id]

  693.   end

  694. end

  695. #==============================================================================

  696. # ■ Game_Party

  697. #------------------------------------------------------------------------------

  698. #  パーティを扱うクラスです。所持金やアイテムなどの情報が含まれます。このクラ

  699. # スのインスタンスは $game_party で参照されます。

  700. #==============================================================================


  701. class Game_Party < Game_Unit

  702.   #--------------------------------------------------------------------------

  703.   # ☆ アクターを加える

  704.   #--------------------------------------------------------------------------

  705.   alias a1_battle_common_gp_add_actor add_actor

  706.   def add_actor(actor_id)

  707.     return a1_battle_common_gp_add_actor(actor_id) unless in_battle

  708.     return if @actors.include?(actor_id)

  709.     prev_add_actor(battle_members)

  710.     insert_actor(actor_id)

  711.     post_add_actor($game_actors[actor_id])

  712.   end

  713.   #--------------------------------------------------------------------------

  714.   # ○ アクターを加える

  715.   #--------------------------------------------------------------------------

  716.   def insert_actor(actor_id)

  717.     @new_index = @remove_member_index ? @remove_member_index[0] : @actors.size

  718.     @actors.insert(@new_index, actor_id) unless @actors.include?(actor_id)

  719.     $game_player.refresh

  720.     $game_map.need_refresh = true

  721.     return unless @remove_member_index

  722.     @remove_member_index.delete_at(0)

  723.     @remove_member_index = nil if @remove_member_index.empty?

  724.   end

  725.   #--------------------------------------------------------------------------

  726.   # ○ アクターを加えたIndexを取得

  727.   #--------------------------------------------------------------------------

  728.   def new_index

  729.     @new_index

  730.   end

  731.   #--------------------------------------------------------------------------

  732.   # ○ アクターを加える前処理

  733.   #--------------------------------------------------------------------------

  734.   def prev_add_actor(members)

  735.     BattleManager.call_method(:prev_add_battler, members)

  736.   end

  737.   #--------------------------------------------------------------------------

  738.   # ○ アクターを加えた後処理

  739.   #--------------------------------------------------------------------------

  740.   def post_add_actor(member)

  741.     BattleManager.call_method(:post_add_battler, member)

  742.   end

  743.   #--------------------------------------------------------------------------

  744.   # ☆ アクターを外す

  745.   #--------------------------------------------------------------------------

  746.   alias a1_battle_common_gp_remove_actor remove_actor

  747.   def remove_actor(actor_id)

  748.     prev_remove_actor($game_actors[actor_id]) if in_battle

  749.     a1_battle_common_gp_remove_actor(actor_id)

  750.     post_remove_actor if in_battle

  751.   end

  752.   #--------------------------------------------------------------------------

  753.   # ○ アクターを外す前処理

  754.   #--------------------------------------------------------------------------

  755.   def prev_remove_actor(member)

  756.     @remove_member_index ||= []

  757.     @remove_member_index.push(member.index)

  758.     BattleManager.call_method(:prev_remove_battler, member)

  759.   end

  760.   #--------------------------------------------------------------------------

  761.   # ○ アクターを外した後処理

  762.   #--------------------------------------------------------------------------

  763.   def post_remove_actor

  764.     BattleManager.call_method(:post_remove_battler)

  765.   end

  766. end

  767. #==============================================================================

  768. # ■ BattleManager

  769. #------------------------------------------------------------------------------

  770. #  戦闘の進行を管理するモジュールです。

  771. #==============================================================================


  772. module BattleManager

  773.   #--------------------------------------------------------------------------

  774.   # ○ エイリアス用特異メソッド

  775.   #--------------------------------------------------------------------------

  776.   class << self

  777.     alias :a1_battle_common_bm_turn_end :turn_end

  778.     alias :a1_battle_common_bm_turn_start :turn_start

  779.     alias :a1_battle_common_bm_battle_end :battle_end

  780.   end

  781.   #--------------------------------------------------------------------------

  782.   # ☆ ターン開始

  783.   #--------------------------------------------------------------------------

  784.   def self.turn_start

  785.     @turn_end_wait = 0

  786.     a1_battle_common_bm_turn_start

  787.   end

  788.   #--------------------------------------------------------------------------

  789.   # ☆ ターン終了

  790.   #--------------------------------------------------------------------------

  791.   def self.turn_end

  792.     call_method(:wait, @turn_end_wait) if @turn_end_wait > 0

  793.     @turn_end_wait = 0

  794.     a1_battle_common_bm_turn_end

  795.   end

  796.   #--------------------------------------------------------------------------

  797.   # ○ メソッドの設定

  798.   #--------------------------------------------------------------------------

  799.   def self.define_method(method, symbol)

  800.     @method ||= {}

  801.     @method[symbol] = method

  802.   end

  803.   #--------------------------------------------------------------------------

  804.   # ○ メソッドのコール

  805.   #--------------------------------------------------------------------------

  806.   def self.call_method(symbol, *args)

  807.     @method[symbol].call(*args) if @method[symbol]

  808.   end

  809.   #--------------------------------------------------------------------------

  810.   # ○ ターン終了後ウェイト設定

  811.   #--------------------------------------------------------------------------

  812.   def self.turn_end_wait=(flame)

  813.     @turn_end_wait = flame if @turn_end_wait < flame || flame == 0

  814.   end

  815.   #--------------------------------------------------------------------------

  816.   # ☆ 戦闘終了

  817.   #     result : 結果(0:勝利 1:逃走 2:敗北)

  818.   #--------------------------------------------------------------------------

  819.   def self.battle_end(result)

  820.     call_method(:battle_end, result)

  821.     a1_battle_common_bm_battle_end(result)

  822.   end

  823. end

  824. #==============================================================================

  825. # ■ Game_Action

  826. #------------------------------------------------------------------------------

  827. #  戦闘行動を扱うクラスです。このクラスは Game_Battler クラスの内部で使用され

  828. # ます。

  829. #==============================================================================


  830. class Game_Action

  831.   #--------------------------------------------------------------------------

  832.   # ☆ ターゲットの配列作成

  833.   #--------------------------------------------------------------------------

  834.   alias a1_battle_common_gac_make_targets make_targets

  835.   def make_targets

  836.     @targets ||= pre_make_targets

  837.     return @targets

  838.   end

  839.   #--------------------------------------------------------------------------

  840.   # ○ ターゲットの配列先行作成

  841.   #--------------------------------------------------------------------------

  842.   def pre_make_targets

  843.     @targets = a1_battle_common_gac_make_targets

  844.   end

  845.   #--------------------------------------------------------------------------

  846.   # ○ ターゲットの配列を取得

  847.   #--------------------------------------------------------------------------

  848.   def targets

  849.     @targets.compact

  850.   end

  851.   #--------------------------------------------------------------------------

  852.   # ○ ターゲットの配列をクリア

  853.   #--------------------------------------------------------------------------

  854.   def clear_targets

  855.     @targets = nil

  856.   end

  857. end

  858. #==============================================================================

  859. # ■ Scene_Battle

  860. #------------------------------------------------------------------------------

  861. #  バトル画面の処理を行うクラスです。

  862. #==============================================================================


  863. class Scene_Battle < Scene_Base

  864.   #--------------------------------------------------------------------------

  865.   # ☆ 開始処理

  866.   #--------------------------------------------------------------------------

  867.   alias a1_battle_common_sb_start start

  868.   def start

  869.     a1_battle_common_sb_start

  870.     define_battle_manager_method

  871.   end

  872.   #--------------------------------------------------------------------------

  873.   # ○ バトルマネージャメソッドの定義

  874.   #--------------------------------------------------------------------------

  875.   def define_battle_manager_method

  876.     BattleManager.define_method(method(:wait), :wait)

  877.     BattleManager.define_method(method(:post_add_battler),       :post_add_battler)

  878.     BattleManager.define_method(method(:post_remove_battler),    :post_remove_battler)

  879.     BattleManager.define_method(method(:prev_remove_battler),    :prev_remove_battler)

  880.     BattleManager.define_method(method(:prev_add_battler),       :prev_add_battler)

  881.     BattleManager.define_method(method(:process_victory),        :process_victory)

  882.     BattleManager.define_method(method(:battle_end),             :battle_end)

  883.   end

  884.   #--------------------------------------------------------------------------

  885.   # ☆ ステータスウィンドウの作成

  886.   #--------------------------------------------------------------------------

  887.   alias a1_battle_common_sb_create_status_window create_status_window

  888.   def create_status_window

  889.     a1_battle_common_sb_create_status_window

  890.     post_create_status_window

  891.     define_status_window_method

  892.   end

  893.   #--------------------------------------------------------------------------

  894.   # ○ ステータスウィンドウ作成の後処理

  895.   #--------------------------------------------------------------------------

  896.   def post_create_status_window

  897.   end

  898.   #--------------------------------------------------------------------------

  899.   # ○ ステータスウィンドウメソッドの定義

  900.   #--------------------------------------------------------------------------

  901.   def define_status_window_method

  902.     @status_window.define_method(method(:refresh_statsu_window), :refresh_statsu_window)

  903.     @status_window.define_method(method(:close_status_window),   :close_status_window)

  904.     @status_window.define_method(method(:open_status_window),    :open_status_window)

  905.     @status_window.define_method(method(:select_status_window),  :select_status_window)

  906.     @status_window.define_method(method(:update_status_window),  :update_status_window)

  907.     @status_window.define_method(method(:dispose_status_window), :dispose_status_window)

  908.   end

  909.   #--------------------------------------------------------------------------

  910.   # ○ ステータスウィンドウがリフレッシュされた時の処理

  911.   #--------------------------------------------------------------------------

  912.   def refresh_statsu_window

  913.   end

  914.   #--------------------------------------------------------------------------

  915.   # ○ ステータスウィンドウがクローズされた時の処理

  916.   #--------------------------------------------------------------------------

  917.   def close_status_window

  918.   end

  919.   #--------------------------------------------------------------------------

  920.   # ○ ステータスウィンドウがオープンされた時の処理

  921.   #--------------------------------------------------------------------------

  922.   def open_status_window

  923.   end

  924.   #--------------------------------------------------------------------------

  925.   # ○ ステータスウィンドウがセレクトされた時の処理

  926.   #--------------------------------------------------------------------------

  927.   def select_status_window(index)

  928.   end

  929.   #--------------------------------------------------------------------------

  930.   # ○ ステータスウィンドウが更新された時の処理

  931.   #--------------------------------------------------------------------------

  932.   def update_status_window

  933.   end

  934.   #--------------------------------------------------------------------------

  935.   # ○ ステータスウィンドウが解放された時の処理

  936.   #--------------------------------------------------------------------------

  937.   def dispose_status_window

  938.   end

  939.   #--------------------------------------------------------------------------

  940.   # ☆ 情報表示ビューポートの作成

  941.   #--------------------------------------------------------------------------

  942.   alias a1_battle_common_sb_create_info_viewport create_info_viewport

  943.   def create_info_viewport

  944.     a1_battle_common_sb_create_info_viewport

  945.     post_create_info_viewport

  946.   end

  947.   #--------------------------------------------------------------------------

  948.   # ○ 情報表示ビューポート作成の後処理

  949.   #--------------------------------------------------------------------------

  950.   def post_create_info_viewport

  951.   end

  952.   #--------------------------------------------------------------------------

  953.   # ☆ スキルウィンドウの作成

  954.   #--------------------------------------------------------------------------

  955.   alias a1_battle_common_sb_create_skill_window create_skill_window

  956.   def create_skill_window

  957.     a1_battle_common_sb_create_skill_window

  958.     post_create_skill_window

  959.     define_skill_window_method

  960.   end

  961.   #--------------------------------------------------------------------------

  962.   # ○ スキルウィンドウ作成の後処理

  963.   #--------------------------------------------------------------------------

  964.   def post_create_skill_window

  965.   end

  966.   #--------------------------------------------------------------------------

  967.   # ○ スキルウィンドウメソッドの定義

  968.   #--------------------------------------------------------------------------

  969.   def define_skill_window_method

  970.     @skill_window.define_method(method(:skill_item_window_show), :skill_item_window_show)

  971.     @skill_window.define_method(method(:skill_item_window_hide), :skill_item_window_hide)

  972.   end

  973.   #--------------------------------------------------------------------------

  974.   # ☆ アイテムウィンドウの作成

  975.   #--------------------------------------------------------------------------

  976.   alias a1_battle_common_sb_create_item_window create_item_window

  977.   def create_item_window

  978.     a1_battle_common_sb_create_item_window

  979.     post_create_item_window

  980.     define_item_window_method

  981.   end

  982.   #--------------------------------------------------------------------------

  983.   # ○ アイテムウィンドウ作成の後処理

  984.   #--------------------------------------------------------------------------

  985.   def post_create_item_window

  986.   end

  987.   #--------------------------------------------------------------------------

  988.   # ○ アイテムウィンドウメソッドの定義

  989.   #--------------------------------------------------------------------------

  990.   def define_item_window_method

  991.     @item_window.define_method(method(:skill_item_window_show), :skill_item_window_show)

  992.     @item_window.define_method(method(:skill_item_window_hide), :skill_item_window_hide)

  993.   end

  994.   #--------------------------------------------------------------------------

  995.   # ○ スキル/アイテムウィンドウが表示された時の処理

  996.   #--------------------------------------------------------------------------

  997.   def skill_item_window_show

  998.   end

  999.   #--------------------------------------------------------------------------

  1000.   # ○ スキル/アイテムウィンドウが非表示になった時の処理

  1001.   #--------------------------------------------------------------------------

  1002.   def skill_item_window_hide

  1003.   end

  1004.   #--------------------------------------------------------------------------

  1005.   # ☆ パーティコマンドウィンドウの作成

  1006.   #--------------------------------------------------------------------------

  1007.   alias a1_battle_common_sb_create_party_command_window create_party_command_window

  1008.   def create_party_command_window

  1009.     a1_battle_common_sb_create_party_command_window

  1010.     post_create_party_command_window

  1011.     define_party_command_window_method

  1012.     define_party_command_window_handle

  1013.   end

  1014.   #--------------------------------------------------------------------------

  1015.   # ○ パーティコマンドウィンドウ作成の後処理

  1016.   #--------------------------------------------------------------------------

  1017.   def post_create_party_command_window

  1018.   end

  1019.   #--------------------------------------------------------------------------

  1020.   # ○ パーティコマンドウィンドウメソッドの定義

  1021.   #--------------------------------------------------------------------------

  1022.   def define_party_command_window_method

  1023.   end

  1024.   #--------------------------------------------------------------------------

  1025.   # ○ パーティコマンドウィンドウハンドルの定義

  1026.   #--------------------------------------------------------------------------

  1027.   def define_party_command_window_handle

  1028.   end

  1029.   #--------------------------------------------------------------------------

  1030.   # ☆ アクターウィンドウの作成

  1031.   #--------------------------------------------------------------------------

  1032.   alias a1_battle_common_sb_create_actor_window create_actor_window

  1033.   def create_actor_window

  1034.     a1_battle_common_sb_create_actor_window

  1035.     post_create_actor_window

  1036.     define_actor_window_method

  1037.   end

  1038.   #--------------------------------------------------------------------------

  1039.   # ○ アクターウィンドウ作成の後処理

  1040.   #--------------------------------------------------------------------------

  1041.   def post_create_actor_window

  1042.   end

  1043.   #--------------------------------------------------------------------------

  1044.   # ○ アクターウィンドウメソッドの定義

  1045.   #--------------------------------------------------------------------------

  1046.   def define_actor_window_method

  1047.     @actor_window.define_method(method(:select_actor),     :select_actor)

  1048.     @actor_window.define_method(method(:select_actor_end), :select_actor_end)

  1049.   end

  1050.   #--------------------------------------------------------------------------

  1051.   # ○ アクターウィンドウをセレクトした時の処理

  1052.   #--------------------------------------------------------------------------

  1053.   def select_actor(index)

  1054.   end

  1055.   #--------------------------------------------------------------------------

  1056.   # ○ アクターウィンドウをセレクト終了した時の処理

  1057.   #--------------------------------------------------------------------------

  1058.   def select_actor_end

  1059.   end

  1060.   #--------------------------------------------------------------------------

  1061.   # ☆ 敵キャラウィンドウの作成

  1062.   #--------------------------------------------------------------------------

  1063.   alias a1_battle_common_sb_create_enemy_window create_enemy_window

  1064.   def create_enemy_window

  1065.     a1_battle_common_sb_create_enemy_window

  1066.     post_create_enemy_window

  1067.     define_enemy_window_method

  1068.   end

  1069.   #--------------------------------------------------------------------------

  1070.   # ○ 敵キャラウィンドウ作成の後処理

  1071.   #--------------------------------------------------------------------------

  1072.   def post_create_enemy_window

  1073.   end

  1074.   #--------------------------------------------------------------------------

  1075.   # ○ 敵キャラウィンドウメソッドの定義

  1076.   #--------------------------------------------------------------------------

  1077.   def define_enemy_window_method

  1078.     @enemy_window.define_method(method(:select_enemy),     :select_enemy)

  1079.     @enemy_window.define_method(method(:select_enemy_end) ,:select_enemy_end)

  1080.   end

  1081.   #--------------------------------------------------------------------------

  1082.   # ○ 敵キャラウィンドウをセレクトした時の処理

  1083.   #--------------------------------------------------------------------------

  1084.   def select_enemy(index)

  1085.   end

  1086.   #--------------------------------------------------------------------------

  1087.   # ○ 敵キャラウィンドウをセレクト終了した時の処理

  1088.   #--------------------------------------------------------------------------

  1089.   def select_enemy_end

  1090.   end

  1091.   #--------------------------------------------------------------------------

  1092.   # ☆ アクターコマンドウィンドウの作成

  1093.   #--------------------------------------------------------------------------

  1094.   alias a1_battle_common_sb_start_create_actor_command_window create_actor_command_window

  1095.   def create_actor_command_window

  1096.     a1_battle_common_sb_start_create_actor_command_window

  1097.     post_create_actor_command_window

  1098.     define_actor_command_handle

  1099.     define_actor_command_window

  1100.   end

  1101.   #--------------------------------------------------------------------------

  1102.   # ○ アクターコマンドウィンドウ作成の後処理

  1103.   #--------------------------------------------------------------------------

  1104.   def post_create_actor_command_window

  1105.   end

  1106.   #--------------------------------------------------------------------------

  1107.   # ○ アクターコマンドウィンドウメソッドの定義

  1108.   #--------------------------------------------------------------------------

  1109.   def define_actor_command_window

  1110.     @actor_command_window.define_method(method(:actor_command_open),  :actor_command_open)

  1111.     @actor_command_window.define_method(method(:actor_command_close), :actor_command_close)

  1112.     @actor_command_window.define_method(method(:actor_command_setup), :actor_command_setup)

  1113.   end

  1114.   #--------------------------------------------------------------------------

  1115.   # ○ アクターコマンドウィンドウハンドルの定義

  1116.   #--------------------------------------------------------------------------

  1117.   def define_actor_command_handle

  1118.   end

  1119.   #--------------------------------------------------------------------------

  1120.   # ○ アクターコマンドウィンドウがオープンした時の処理

  1121.   #--------------------------------------------------------------------------

  1122.   def actor_command_open

  1123.   end

  1124.   #--------------------------------------------------------------------------

  1125.   # ○ アクターコマンドウィンドウがクローズした時の処理

  1126.   #--------------------------------------------------------------------------

  1127.   def actor_command_close

  1128.   end

  1129.   #--------------------------------------------------------------------------

  1130.   # ○ アクターコマンドウィンドウのセットアップ時の処理

  1131.   #--------------------------------------------------------------------------

  1132.   def actor_command_setup(actor)

  1133.   end

  1134.   #--------------------------------------------------------------------------

  1135.   # ☆ パーティコマンド選択の開始

  1136.   #--------------------------------------------------------------------------

  1137.   alias a1_battle_common_sb_start_party_command_selection start_party_command_selection

  1138.   def start_party_command_selection

  1139.     prev_start_party_command_selection

  1140.     a1_battle_common_sb_start_party_command_selection

  1141.     post_start_party_command_selection

  1142.   end

  1143.   #--------------------------------------------------------------------------

  1144.   # ○ パーティコマンド選択の開始の前処理

  1145.   #--------------------------------------------------------------------------

  1146.   def prev_start_party_command_selection

  1147.   end

  1148.   #--------------------------------------------------------------------------

  1149.   # ○ パーティコマンド選択の開始の後処理

  1150.   #--------------------------------------------------------------------------

  1151.   def post_start_party_command_selection

  1152.   end

  1153.   #--------------------------------------------------------------------------

  1154.   # ☆ 次のコマンド入力へ

  1155.   #--------------------------------------------------------------------------

  1156.   alias a1_battle_common_sb_next_command next_command

  1157.   def next_command

  1158.     prev_next_command

  1159.     a1_battle_common_sb_next_command

  1160.     post_next_command

  1161.   end

  1162.   #--------------------------------------------------------------------------

  1163.   # ○ 次のコマンド入力への前処理

  1164.   #--------------------------------------------------------------------------

  1165.   def prev_next_command

  1166.   end

  1167.   #--------------------------------------------------------------------------

  1168.   # ○ 次のコマンド入力への後処理

  1169.   #--------------------------------------------------------------------------

  1170.   def post_next_command

  1171.   end

  1172.   #--------------------------------------------------------------------------

  1173.   # ☆ 前のコマンド入力へ

  1174.   #--------------------------------------------------------------------------

  1175.   alias a1_battle_common_sb_prior_command prior_command

  1176.   def prior_command

  1177.     prev_prior_command

  1178.     a1_battle_common_sb_prior_command

  1179.     post_prior_command

  1180.   end

  1181.   #--------------------------------------------------------------------------

  1182.   # ○ 前のコマンド入力への前処理

  1183.   #--------------------------------------------------------------------------

  1184.   def prev_prior_command

  1185.   end

  1186.   #--------------------------------------------------------------------------

  1187.   # ○ 前のコマンド入力への後処理

  1188.   #--------------------------------------------------------------------------

  1189.   def post_prior_command

  1190.   end

  1191.   #--------------------------------------------------------------------------

  1192.   # ☆ ターン開始

  1193.   #--------------------------------------------------------------------------

  1194.   alias a1_battle_common_sb_turn_start turn_start

  1195.   def turn_start

  1196.     prev_turn_start

  1197.     a1_battle_common_sb_turn_start

  1198.     post_turn_start

  1199.   end

  1200.   #--------------------------------------------------------------------------

  1201.   # ○ ターン開始の前処理

  1202.   #--------------------------------------------------------------------------

  1203.   def prev_turn_start

  1204.   end

  1205.   #--------------------------------------------------------------------------

  1206.   # ○ ターン開始の後処理

  1207.   #--------------------------------------------------------------------------

  1208.   def post_turn_start

  1209.   end

  1210.   #--------------------------------------------------------------------------

  1211.   # ☆ ターン終了

  1212.   #--------------------------------------------------------------------------

  1213.   alias a1_battle_common_sb_turn_end turn_end

  1214.   def turn_end

  1215.     prev_turn_end

  1216.     a1_battle_common_sb_turn_end

  1217.     post_turn_end

  1218.   end

  1219.   #--------------------------------------------------------------------------

  1220.   # ○ ターン終了の前処理

  1221.   #--------------------------------------------------------------------------

  1222.   def prev_turn_end

  1223.   end

  1224.   #--------------------------------------------------------------------------

  1225.   # ○ ターン終了の後処理

  1226.   #--------------------------------------------------------------------------

  1227.   def post_turn_end

  1228.   end

  1229.   #--------------------------------------------------------------------------

  1230.   # ○ ウィンドウが閉じるまでウェイト

  1231.   #--------------------------------------------------------------------------

  1232.   def wait_fot_window_close(window)

  1233.     update_basic while window.close?

  1234.   end

  1235.   #--------------------------------------------------------------------------

  1236.   # ○ アクターのバトルメンバー取得

  1237.   #--------------------------------------------------------------------------

  1238.   def battle_members

  1239.     @party_battle_members ||= $game_party.battle_members

  1240.     return @party_battle_members

  1241.   end

  1242.   #--------------------------------------------------------------------------

  1243.   # ○ バトルメンバーの追加の前処理

  1244.   #--------------------------------------------------------------------------

  1245.   def prev_add_battler(members)

  1246.   end

  1247.   #--------------------------------------------------------------------------

  1248.   # ○ バトルメンバーの追加後の処理

  1249.   #--------------------------------------------------------------------------

  1250.   def post_add_battler(member)

  1251.     @party_battle_members = $game_party.battle_members

  1252.   end

  1253.   #--------------------------------------------------------------------------

  1254.   # ○ バトルメンバー削除の前処理

  1255.   #--------------------------------------------------------------------------

  1256.   def prev_remove_battler(member)

  1257.   end

  1258.   #--------------------------------------------------------------------------

  1259.   # ○ バトルメンバーの削除後の処理

  1260.   #--------------------------------------------------------------------------

  1261.   def post_remove_battler

  1262.     @party_battle_members = $game_party.battle_members

  1263.   end

  1264.   #--------------------------------------------------------------------------

  1265.   # ☆ 戦闘行動の実行

  1266.   #--------------------------------------------------------------------------

  1267.   alias a1_battle_common_sb_execute_action execute_action

  1268.   def execute_action

  1269.     prev_execute_action

  1270.     a1_battle_common_sb_execute_action

  1271.     post_execute_action

  1272.   end

  1273.   #--------------------------------------------------------------------------

  1274.   # ○ 戦闘行動の実行の前処理

  1275.   #--------------------------------------------------------------------------

  1276.   def prev_execute_action

  1277.     @subject.current_action.pre_make_targets

  1278.   end

  1279.   #--------------------------------------------------------------------------

  1280.   # ○ 戦闘行動の実行の後処理

  1281.   #--------------------------------------------------------------------------

  1282.   def post_execute_action

  1283.     @subject.current_action.clear_targets if @subject.current_action

  1284.   end

  1285.   #--------------------------------------------------------------------------

  1286.   # ☆ スキル/アイテムの使用

  1287.   #--------------------------------------------------------------------------

  1288.   alias a1_battle_common_sb_use_item use_item

  1289.   def use_item

  1290.     prev_use_item

  1291.     a1_battle_common_sb_use_item

  1292.     post_use_item

  1293.   end

  1294.   #--------------------------------------------------------------------------

  1295.   # ○ スキル/アイテムの使用の前処理

  1296.   #--------------------------------------------------------------------------

  1297.   def prev_use_item

  1298.   end

  1299.   #--------------------------------------------------------------------------

  1300.   # ○ スキル/アイテムの使用の後処理

  1301.   #--------------------------------------------------------------------------

  1302.   def post_use_item

  1303.   end

  1304.   #--------------------------------------------------------------------------

  1305.   # ○ 勝利の処理

  1306.   #--------------------------------------------------------------------------

  1307.   def process_victory

  1308.   end

  1309.   #--------------------------------------------------------------------------

  1310.   # ○ 戦闘終了

  1311.   #--------------------------------------------------------------------------

  1312.   def battle_end(result)

  1313.     $game_party.all_members.each {|member| init_member_battle_end(member) }

  1314.   end

  1315.   #--------------------------------------------------------------------------

  1316.   # ○ 戦闘終了時のメンバー初期化

  1317.   #--------------------------------------------------------------------------

  1318.   def init_member_battle_end(member)

  1319.     member.current_weapon = nil

  1320.     member.current_main   = nil

  1321.   end

  1322. end

  1323. end
复制代码
[/fold]
[fold=战斗支援脚本2]
  1. #===========================================================================

  2. # ◆ A1 Scripts ◆

  3. #    戦闘中入れ替え(RGSS3)

  4. #

  5. # バージョン   : 1.00 (2012/01/18)

  6. # 作者         : A1

  7. # URL     : http://a1tktk.web.fc2.com/

  8. #---------------------------------------------------------------------------

  9. # 機能:

  10. # ・戦闘中にメンバーを入れ替えます

  11. #---------------------------------------------------------------------------

  12. # 更新履歴   :2012/01/18 Ver1.00 リリース

  13. #---------------------------------------------------------------------------

  14. # 設置場所      

  15. #    A1バトル共通スクリプト以下

  16. #

  17. # 必要スクリプト

  18. #    A1バトル共通スクリプト

  19. #---------------------------------------------------------------------------

  20. # 使い方

  21. #   導入することで適用されます

  22. #==============================================================================

  23. $imported ||= {}

  24. if $imported["A1_BattleCommonScript"]

  25. $imported["A1_ChangeMember"] = true

  26. old_common_script("戦闘中入れ替え", "3.90") if common_version < 3.90

  27. #==============================================================================

  28. # ■ Window_PartyCommand

  29. #==============================================================================


  30. class Window_MemberChange < Window_Selectable

  31.   #--------------------------------------------------------------------------

  32.   # ○ オブジェクト初期化

  33.   #--------------------------------------------------------------------------

  34.   def initialize

  35.     @form_actor_window = Window_PersonalStatus.new(0, Graphics.height - 120, 255)

  36.     @to_actor_window   = Window_PersonalStatus.new(Graphics.width / 2, Graphics.height - 120, 255)

  37.     setup_members

  38.     width              = @battle_members.size * 48 + standard_padding * 2

  39.     height             = (@all_members.size / @battle_members.size.to_f).ceil * 48 + standard_padding * 2 + 36

  40.     super((Graphics.width - width) / 2, (Graphics.height - height) / 2, width, height)

  41.     self.y = Graphics.height - @form_actor_window.height - height if self.y + height > Graphics.height - @form_actor_window.height

  42.     self.index = 0

  43.     @from_actor = -1

  44.     self.openness = 0

  45.   end

  46.   #--------------------------------------------------------------------------

  47.   # ○ アクティブ化

  48.   #--------------------------------------------------------------------------

  49.   def activate

  50.     super

  51.     refresh

  52.     @form_actor_window.actor = @all_members[self.index]

  53.   end

  54.   #--------------------------------------------------------------------------

  55.   # ○ メンバーのセットアップ

  56.   #--------------------------------------------------------------------------

  57.   def setup_members

  58.     @all_members    = $game_party.all_members

  59.     @battle_members = $game_party.battle_members

  60.   end

  61.   #--------------------------------------------------------------------------

  62.   # ○ 項目の選択

  63.   #--------------------------------------------------------------------------

  64.   def select(index)

  65.     super

  66.     @form_actor_window.actor = @all_members[self.index] if @from_actor == -1

  67.     @to_actor_window.actor   = @all_members[self.index] if @from_actor >= 0

  68.   end

  69.   #--------------------------------------------------------------------------

  70.   # ○ 項目数の取得

  71.   #--------------------------------------------------------------------------

  72.   def item_max

  73.     @all_members.size

  74.   end

  75.   #--------------------------------------------------------------------------

  76.   # ○ 桁数の取得

  77.   #--------------------------------------------------------------------------

  78.   def col_max

  79.     @battle_members.size

  80.   end

  81.   #--------------------------------------------------------------------------

  82.   # ○ リフレッシュ

  83.   #--------------------------------------------------------------------------

  84.   def refresh

  85.     super

  86.     draw_horz_line(52)

  87.   end

  88.   #--------------------------------------------------------------------------

  89.   # ○ 水平線の描画

  90.   #--------------------------------------------------------------------------

  91.   def draw_horz_line(y)

  92.     line_y = y + line_height / 2 - 1

  93.     contents.fill_rect(0, line_y, contents_width, 2, line_color)

  94.   end

  95.   #--------------------------------------------------------------------------

  96.   # ○ 水平線の色を取得

  97.   #--------------------------------------------------------------------------

  98.   def line_color

  99.     color = normal_color

  100.     color.alpha = 128

  101.     color

  102.   end

  103.   #--------------------------------------------------------------------------

  104.   # ○ 項目の描画

  105.   #--------------------------------------------------------------------------

  106.   def draw_item(index)

  107.     c_name  = member(index).character_name

  108.     c_index = member(index).character_index

  109.     rect    = item_rect(index)

  110.     draw_character(c_name, c_index, rect.x + 24, rect.y + 40)

  111.   end

  112.   #--------------------------------------------------------------------------

  113.   # ○ 項目を描画する矩形の取得

  114.   #--------------------------------------------------------------------------

  115.   def item_rect(index)

  116.     rect = Rect.new

  117.     rect.width = item_width

  118.     rect.height = item_height

  119.     rect.x = index % col_max * item_width

  120.     rect.y = index / col_max * item_height

  121.     rect.y += 24 if index > @battle_members.size - 1

  122.     rect

  123.   end

  124.   #--------------------------------------------------------------------------

  125.   # ○ 項目の幅を取得

  126.   #--------------------------------------------------------------------------

  127.   def item_width

  128.     return 48

  129.   end

  130.   #--------------------------------------------------------------------------

  131.   # ○ 項目の高さを取得

  132.   #--------------------------------------------------------------------------

  133.   def item_height

  134.     return 48

  135.   end

  136.   #--------------------------------------------------------------------------

  137.   # ○ ウィンドウ内容の高さを計算

  138.   #--------------------------------------------------------------------------

  139.   def contents_height

  140.     row_max * item_height + 24

  141.   end

  142.   #--------------------------------------------------------------------------

  143.   # ○ 下端パディングの更新

  144.   #--------------------------------------------------------------------------

  145.   def update_padding_bottom

  146.     surplus = (height - standard_padding * 2) % item_height - 24

  147.     self.padding_bottom = padding + surplus

  148.   end

  149.   #--------------------------------------------------------------------------

  150.   # ○ メンバーの取得

  151.   #--------------------------------------------------------------------------

  152.   def member(index)

  153.     @all_members[index]

  154.   end

  155.   #--------------------------------------------------------------------------

  156.   # ○ 決定処理の有効状態を取得

  157.   #--------------------------------------------------------------------------

  158.   def ok_enabled?

  159.     return true

  160.   end

  161.   #--------------------------------------------------------------------------

  162.   # ○ 決定ボタンが押されたときの処理

  163.   #--------------------------------------------------------------------------

  164.   def process_ok

  165.     Sound.play_ok

  166.     Input.update

  167.     return select_start_to_actor if @from_actor == -1

  168.     return call_cancel_handler if @from_actor == self.index

  169.     change_member if @from_actor >= 0

  170.     post_change_member

  171.   end

  172.   #--------------------------------------------------------------------------

  173.   # ○ メンバー入れ替え

  174.   #--------------------------------------------------------------------------

  175.   def change_member

  176.     $game_party.swap_order(@from_actor, self.index)

  177.   end

  178.   #--------------------------------------------------------------------------

  179.   # ○ メンバー入れ替え後の処理

  180.   #--------------------------------------------------------------------------

  181.   def post_change_member

  182.     setup_members

  183.     self.index  = @from_actor

  184.     @form_actor_window.actor = @all_members[self.index]

  185.     @from_actor = -1

  186.     @to_actor_window.close

  187.     refresh

  188.   end

  189.   #--------------------------------------------------------------------------

  190.   # ○ 入れ替え先のアクター選択開始

  191.   #--------------------------------------------------------------------------

  192.   def select_start_to_actor

  193.     @from_actor = self.index

  194.     @to_actor_window.open

  195.     self.index = self.index < @battle_members.size ? @battle_members.size : 0

  196.     @to_actor_window.actor = @all_members[self.index]

  197.   end

  198.   #--------------------------------------------------------------------------

  199.   # ○ 入れ替え元のアクター

  200.   #--------------------------------------------------------------------------

  201.   def from_actor

  202.     @from_actor

  203.   end

  204.   #--------------------------------------------------------------------------

  205.   # ○ オープン

  206.   #--------------------------------------------------------------------------

  207.   def open

  208.     super

  209.     @form_actor_window.open

  210.   end

  211.   #--------------------------------------------------------------------------

  212.   # ○ キャンセルハンドラの呼び出し

  213.   #--------------------------------------------------------------------------

  214.   def call_cancel_handler

  215.     super if @from_actor == -1

  216.     @from_actor = -1

  217.     @to_actor_window.close

  218.     @form_actor_window.actor = @all_members[self.index]

  219.     activate

  220.   end

  221.   #--------------------------------------------------------------------------

  222.   # ○ クローズ

  223.   #--------------------------------------------------------------------------

  224.   def close

  225.     super

  226.     @form_actor_window.close

  227.     @to_actor_window.close

  228.   end

  229.   #--------------------------------------------------------------------------

  230.   # ○ フレーム更新

  231.   #--------------------------------------------------------------------------

  232.   def update

  233.     super

  234.     @form_actor_window.update

  235.     @to_actor_window.update

  236.   end

  237.   #--------------------------------------------------------------------------

  238.   # ○ 解放

  239.   #--------------------------------------------------------------------------

  240.   def dispose

  241.     super

  242.     @form_actor_window.dispose

  243.     @to_actor_window.dispose

  244.   end

  245. end

  246. #==============================================================================

  247. # ■ Window_PartyCommand

  248. #------------------------------------------------------------------------------

  249. #  バトル画面で、戦うか逃げるかを選択するウィンドウです。

  250. #==============================================================================


  251. class Window_PartyCommand < Window_Command

  252.   #--------------------------------------------------------------------------

  253.   # ☆ コマンドリストの作成

  254.   #--------------------------------------------------------------------------

  255.   alias a1_cbm_wpc_make_command_list make_command_list

  256.   def make_command_list

  257.     a1_cbm_wpc_make_command_list

  258.     add_command("同伴", :member_change, $game_party.all_members.size > $game_party.max_battle_members)

  259.   end

  260. end

  261. #==============================================================================

  262. # ■ Scene_Battle

  263. #------------------------------------------------------------------------------

  264. #  バトル画面の処理を行うクラスです。

  265. #==============================================================================


  266. class Scene_Battle < Scene_Base

  267.   #--------------------------------------------------------------------------

  268.   # ☆ 全ウィンドウの作成

  269.   #--------------------------------------------------------------------------

  270.   alias a1_cbm_wpc_create_all_windows create_all_windows

  271.   def create_all_windows

  272.     a1_cbm_wpc_create_all_windows

  273.     create_member_change_window

  274.   end

  275.   #--------------------------------------------------------------------------

  276.   # ○ 入れ替えウィンドウの作成

  277.   #--------------------------------------------------------------------------

  278.   def create_member_change_window

  279.     @window_member_change = Window_MemberChange.new

  280.     @window_member_change.set_handler(:cancel, method(:on_member_change_cancel))

  281.   end

  282.   #--------------------------------------------------------------------------

  283.   # ☆ パーティコマンドウィンドウハンドルの定義

  284.   #--------------------------------------------------------------------------

  285.   alias a1_cbm_sb_define_party_command_window_handle define_party_command_window_handle

  286.   def define_party_command_window_handle

  287.     a1_cbm_sb_define_party_command_window_handle

  288.     @party_command_window.set_handler(:member_change,  method(:command_member_change))

  289.   end

  290.   #--------------------------------------------------------------------------

  291.   # ○ 入れ替え

  292.   #--------------------------------------------------------------------------

  293.   def command_member_change

  294.     @prev_battle_members = $game_party.battle_members

  295.     @status_window.close

  296.     @party_command_window.close

  297.     @window_member_change.open

  298.     @window_member_change.activate

  299.   end

  300.   #--------------------------------------------------------------------------

  301.   # ○ 変更したメンバーを取得

  302.   #--------------------------------------------------------------------------

  303.   def change_diss_members(ret = [])

  304.     $game_party.battle_members.each_with_index {|member, i| ret.push(member) if member != @prev_battle_members[i] }

  305.     return ret

  306.   end

  307.   #--------------------------------------------------------------------------

  308.   # ○ メンバーチェンジ[キャンセル]

  309.   #--------------------------------------------------------------------------

  310.   def on_member_change_cancel

  311.     @party_command_window.activate

  312.     @status_window.refresh

  313.     @status_window.open

  314.     @party_command_window.open

  315.     @window_member_change.close

  316.     change_diss_members.each {|member| member.make_actions }

  317.     @party_battle_members = $game_party.battle_members

  318.   end

  319. end

  320. end
复制代码
[/fold]
18、当战斗小队全灭时后备队员惨战。
[fold=全灭后待机成员参战 v1.2]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. $imported = {} if $imported.nil?

  3. $imported["Sub_Party"] = true

  4. #==============================================================================

  5. # 全灭后待机成员参战 v1.2

  6. #------------------------------------------------------------------------------

  7. #    2015.05.31 by 企鹅达达

  8. #    2015.06.03 修正事件扣血时不更换队员的bug

  9. #    2015.06.04 防止整队类脚本对为加入队伍的成员调用draw_actor_simple_status等出错

  10. #==============================================================================

  11. #       如题,这个脚本的功能就是让非战斗人员按照序号编成小队,全灭后一个小队一个

  12. #   小队上场战斗。嗯,感觉不是很好用,反正是自用的╮(╯_╰)╭

  13. #       用这个脚本建议把濒死设置成战斗后解除,这样可以避免某些小队战斗

  14. #   时空了一些死掉的队员。

  15. #       顺带一提这脚本和战斗中整队、战斗中添加成员(比如召唤)类型的脚本天生不对头,

  16. #   如果因为这些原因报错,本人也无能为力了 ← ←

  17. #==============================================================================


  18. #参战时显示的信息,可以使用转义符,%s取代角色名。

  19. #    JION_MESSAGE = "\ec[6]%s\ec[0] 参战!"


  20. #如果不想要这个信息,可以设置为 nil

  21. #    JION_MESSAGE = nil


  22. JION_MESSAGE = "%s 参战!"


  23. # 在菜单里显示的名字,SUB_PARTY_NAME里没有的话会用下面的SUB_PARTY_DEFAULT_NAME


  24. SUB_PARTY_SHOW_IN_MENU = true


  25. SUB_PARTY_NAME = [" "," ",]


  26. SUB_PARTY_DEFAULT_NAME = "候补小队"



  27. #==============================================================================

  28. # ■ Game_Battler

  29. #------------------------------------------------------------------------------

  30. #  处理战斗者的类。Game_Actor 和 Game_Enemy 类的父类。

  31. #==============================================================================


  32. class Game_Battler < Game_BattlerBase

  33.   attr_accessor :battle_formation_order          #队伍顺序标记

  34.   #--------------------------------------------------------------------------

  35.   # ● 保存队伍顺序

  36.   #--------------------------------------------------------------------------

  37.   def save_battle_formation_order

  38.     @battle_formation_order = index

  39.   end

  40.   #--------------------------------------------------------------------------

  41.   # ● 行动结束

  42.   #--------------------------------------------------------------------------

  43.   alias sub_party_on_action_end on_action_end

  44.   def on_action_end

  45.     sub_party_on_action_end

  46.     while $game_party.all_dead?

  47.       break if $game_party.sub_party_now >= $game_party.sub_party_max

  48.       $game_party.sub_party_jion_battle

  49.     end

  50.   end

  51. end

  52. #==============================================================================

  53. # ■ Game_Party

  54. #------------------------------------------------------------------------------

  55. #  管理队伍的类。保存有金钱及物品的信息。本类的实例请参考 $game_party 。

  56. #==============================================================================

  57. class Game_Party < Game_Unit

  58.   attr_accessor :sub_party_now          #参战分队编号

  59.   attr_accessor :sub_party_max          #参战分队最大编号

  60.   #--------------------------------------------------------------------------

  61.   # ● 战斗开始处理

  62.   #--------------------------------------------------------------------------

  63.   def sub_party_jion_battle

  64.     @sub_party_now += 1

  65.     max_battle_members.times do |i|

  66.       next if all_members[ max_battle_members * @sub_party_now + i ].nil?

  67.       next if all_members[ max_battle_members * @sub_party_now + i ].dead?

  68.       swap_order( i, max_battle_members * @sub_party_now + i)

  69.       if JION_MESSAGE

  70. #       BattleManager.log_window.add_text(sprintf(JION_MESSAGE, $game_party.all_members[i].name))

  71. #       BattleManager.log_window.abs_wait(90)

  72.         $game_message.add(sprintf(JION_MESSAGE, $game_party.all_members[i].name))

  73.         BattleManager.wait_for_message

  74.       end

  75.     end

  76.   end

  77.   #--------------------------------------------------------------------------

  78.   # ● 队伍顺序恢复

  79.   #--------------------------------------------------------------------------

  80.   def sub_party_reset_order

  81.     @actors.sort! {|a, b|$game_actors[a].battle_formation_order <=> $game_actors[b].battle_formation_order }
  82.   end

  83.   #--------------------------------------------------------------------------

  84.   # ● 保存队伍顺序

  85.   #--------------------------------------------------------------------------

  86.   def sub_party_save_order

  87.     all_members.each do |member|

  88.       member.save_battle_formation_order

  89.     end

  90.   end

  91.   #--------------------------------------------------------------------------

  92.   # ● 初始化参战分队信息,顺带让第一个有成活队员的分队上阵。

  93.   #--------------------------------------------------------------------------

  94.   def make_sub_party

  95.     @sub_party_now = 0

  96.     @sub_party_max = all_members.size / max_battle_members
  97.     @sub_party_max -= 1 if all_members.size == max_battle_members * @sub_party_max

  98.     while battle_members.select {|member|member.alive?}.empty?

  99.       break if @sub_party_now >= @sub_party_max

  100.       sub_party_jion_battle

  101.     end

  102.   end

  103.   #--------------------------------------------------------------------------

  104.   # ● 战斗开始处理

  105.   #--------------------------------------------------------------------------

  106.   alias sub_party_on_battle_start on_battle_start

  107.   def on_battle_start

  108.     sub_party_save_order

  109.     make_sub_party

  110.     sub_party_on_battle_start

  111.   end

  112.   #--------------------------------------------------------------------------

  113.   # ● 战斗结束处理

  114.   #--------------------------------------------------------------------------

  115.   alias sub_party_on_battle_end on_battle_end

  116.   def on_battle_end

  117.     sub_party_reset_order

  118.     sub_party_on_battle_end

  119.   end

  120. end

  121. #==============================================================================

  122. # ■ Game_Interpreter

  123. #------------------------------------------------------------------------------

  124. #  事件指令的解释器。

  125. #   本类在 Game_Map、Game_Troop、Game_Event 类的内部使用。

  126. #==============================================================================


  127. class Game_Interpreter

  128.   #--------------------------------------------------------------------------

  129.   # ● 增减 HP                   v 1.1更新

  130.   #--------------------------------------------------------------------------

  131.   def command_311

  132.     value = operate_value(@params[2], @params[3], @params[4])

  133.     iterate_actor_var(@params[0], @params[1]) do |actor|

  134.       next if actor.dead?

  135.       actor.change_hp(value, @params[5])

  136.       actor.perform_collapse_effect if actor.dead?

  137.     end

  138.     ##############################################

  139.     if SceneManager.scene_is?(Scene_Battle)

  140.       while $game_party.all_dead?

  141.         break if $game_party.sub_party_now >= $game_party.sub_party_max

  142.         $game_party.sub_party_jion_battle

  143.       end

  144.     end

  145.     ##############################################

  146.     SceneManager.goto(Scene_Gameover) if $game_party.all_dead?

  147.   end

  148.   #--------------------------------------------------------------------------

  149.   # ● 更改状态                   v 1.1更新

  150.   #--------------------------------------------------------------------------

  151.   alias sub_party_command_313 command_313

  152.   def command_313

  153.    sub_party_command_313

  154.     ##############################################

  155.     if SceneManager.scene_is?(Scene_Battle)

  156.       while $game_party.all_dead?

  157.         break if $game_party.sub_party_now >= $game_party.sub_party_max

  158.         $game_party.sub_party_jion_battle

  159.       end

  160.     end

  161.     ##############################################

  162.   end

  163. end

  164. if SUB_PARTY_SHOW_IN_MENU

  165. #==============================================================================

  166. # ■ Window_Base

  167. #------------------------------------------------------------------------------

  168. #  游戏中所有窗口的父类

  169. #==============================================================================

  170. class Window_Base < Window

  171.   #--------------------------------------------------------------------------

  172.   # ● 绘制分队名

  173.   #--------------------------------------------------------------------------

  174.   def draw_actor_sub_party(actor, x, y, width = 112)

  175.     return if actor.index.nil?                           #   v1.2修改

  176.     change_color(system_color)

  177.     sub_party_index = actor.index / $game_party.max_battle_members

  178.     text = SUB_PARTY_NAME[sub_party_index].nil? ? SUB_PARTY_DEFAULT_NAME : SUB_PARTY_NAME[sub_party_index]

  179.     draw_text(x, y, width, line_height, text)

  180.     change_color(normal_color)

  181.   end

  182.   #--------------------------------------------------------------------------

  183.   # ● 绘制简单的状态

  184.   #--------------------------------------------------------------------------

  185.   alias sub_party_draw_actor_simple_status draw_actor_simple_status

  186.   def draw_actor_simple_status(actor, x, y)

  187.     sub_party_draw_actor_simple_status(actor, x, y)

  188.     draw_actor_sub_party(actor, x-108, y+56)

  189.   end

  190. end


  191. #encoding:utf-8

  192. #==============================================================================

  193. # ■ Window_Status

  194. #------------------------------------------------------------------------------

  195. #  显示队伍成员状态的窗口

  196. #==============================================================================


  197. class Window_Status < Window_Selectable

  198.   #--------------------------------------------------------------------------

  199.   # ● 绘制基本区域

  200.   #--------------------------------------------------------------------------

  201.   alias sub_party_draw_basic_info draw_basic_info

  202.   def draw_basic_info(x, y)

  203.     sub_party_draw_basic_info(x, y)

  204.     draw_actor_sub_party(@actor, x -132, y+72, 100)

  205.   end

  206. end


  207. end # if SUB_PARTY_SHOW_IN_MENU
复制代码
[/fold]
19、破解系统默认事件选择贵重物品处理脚本,应该很少人会使用到。
[fold=物品选择处理扩张]
  1. 打开脚本编辑器,将脚本插入到main上。
  2. #==============================================================================
  3. # ■ 物品选择处理扩张
  4. #  作者:影月千秋
  5. #------------------------------------------------------------------------------
  6. # ● 简介
  7. #  使事件中物品选择处理允许选择武器、防具、普通物品
  8. #------------------------------------------------------------------------------
  9. # ● 使用方法
  10. #  安装此脚本后,在事件中物品选择处理之前加上一句脚本:
  11. #    mca_change(symbol)
  12. #  其中symbol是【:item】【:armor】【:weapon】之一,分别对应物品、防具、武器
  13. #  这样的话,这一个物品选择处理就会处理对应项目
  14. #  但是注意!!该脚本的作用域只有一个物品选择处理
  15. #  如果连续使用两个物品选择处理,第一个会是对应项目,第二个则会是关键物品
  16. #------------------------------------------------------------------------------
  17. # ● 声明
  18. #   本脚本来自【影月千秋】,使用、修改和转载请保留此信息
  19. #==============================================================================
  20. module MoVar;@ckiaddition = :key_item;end
  21. class Game_Interpreter;def mca_change(symbol)
  22.   MoVar.instance_variable_set("@ckiaddition", symbol)
  23. end;end
  24. class Window_KeyItem
  25.   def enable?(item);true;end
  26.   def category=(category)
  27.     @category = MoVar.instance_variable_get("@ckiaddition") rescue category
  28.     MoVar.instance_variable_set("@ckiaddition", category)
  29.     refresh
  30.     self.oy = 0
  31.   end
  32. end
  33. #==============================================================================#
  34. #=====                        =================================================#
  35.            "■ 脚 本 尾"
  36. #=====                        =================================================#
  37. #==============================================================================#
复制代码
[/fold]
20、目前我还没有使用过,不知道小伙伴们用不用得上。
[fold=等级属性限制]
  1. #打开脚本编辑器,将脚本插入到main上。
  2. #==============================================================================
  3. # ■ 装备等级、属性限制 作者:后知后觉 2012-7-25 Ver:1.2
  4. #--------------------------------------------------------------------------
  5. #    本脚本来自 www.66rpg.com 使用或转载请保留此信息。
  6. #--------------------------------------------------------------------------
  7. #~   说明:
  8. #~     限制的属性只会计算人物当前的基础属性.装备、状态增加的属性不会计算在内
  9. #~     默认给武器、护甲增加一行说明.说明内容是需要的各种限制信息
  10. #~     但默认帮助窗口一共只能显示2行内容.
  11. #~     因此你在数据库设置武器、护甲说明的时候
  12. #~     如果设置了2行内容.那么这新增加的第3行将无法显示出来.
  13. #~   设置:
  14. #~     在武器、护甲的备注里写入下面格式的内容表示要做要求.
  15. #~       <lv 数值>    等级限制
  16. #~       <mhp 数值>   最大HP限制
  17. #~       <mmp 数值>   最大MP限制
  18. #~       <atk 数值>   物理攻击限制
  19. #~       <pdf 数值>   物理防御限制
  20. #~       <mat 数值>   魔法攻击限制
  21. #~       <mdf 数值>   魔法防御限制
  22. #~       <agi 数值>   敏捷限制
  23. #~       <luk 数值>   幸运限制
  24. #==============================================================================
  25. #==============================================================================
  26. # ■ RPG::EquipItem
  27. #==============================================================================

  28. class RPG::EquipItem < RPG::BaseItem
  29.   ParamName = ["mhp","mmp","atk","pdf","mat","mdf","agi","luk"]
  30.   def level_limit
  31.     if /<lv (\d+?)>/i =~ @note
  32.       return $1.to_i
  33.     else
  34.       return 0
  35.     end
  36.   end
  37.   def params_limit(param_id)
  38.     if /<#{ParamName[param_id]} (\d+?)>/i =~ @note
  39.       return $1.to_i
  40.     else
  41.       return 0
  42.     end
  43.   end
  44. end
  45. #==============================================================================
  46. # ■ Game_BattlerBase
  47. #==============================================================================

  48. class Game_BattlerBase
  49.   #--------------------------------------------------------------------------
  50.   # ● 判定物品是否可以装备
  51.   #--------------------------------------------------------------------------
  52.   alias original_equippable? equippable?
  53.   def equippable?(item)
  54.     original_equippable?(item) && equip_params_ok?(item)
  55.   end
  56.   #--------------------------------------------------------------------------
  57.   # ● 判定物品是否可以装备
  58.   #--------------------------------------------------------------------------
  59.   def equip_params_ok?(item)
  60.     return true if enemy?
  61.     return false if item.level_limit > level
  62.     for param_id in 0..7
  63.       value = param_base(param_id) + @param_plus[param_id]
  64.       value = [[value, param_max(param_id)].min, param_min(param_id)].max.to_i
  65.       return false if item.params_limit(param_id) > value
  66.     end
  67.     return true
  68.   end
  69. end
  70. #==============================================================================
  71. # ■ Game_Actor
  72. #==============================================================================

  73. class Game_Actor < Game_Battler
  74.   #--------------------------------------------------------------------------
  75.   # ● 强制更换装备
  76.   #--------------------------------------------------------------------------
  77.   def hzhj_force_change_equip(slot_id, item)
  78.     @equips[slot_id].object = item if original_equippable?(item) || !item
  79.   end
  80. end
  81. #==============================================================================
  82. # ■ Window_EquipItem
  83. #==============================================================================

  84. class Window_EquipItem < Window_ItemList
  85.   #--------------------------------------------------------------------------
  86.   # ● 查询使用列表中是否含有此物品
  87.   #--------------------------------------------------------------------------
  88.   def include?(item)
  89.     return true if item == nil
  90.     return false unless item.is_a?(RPG::EquipItem)
  91.     return false if @slot_id < 0
  92.     return false if item.etype_id != @actor.equip_slots[@slot_id]
  93.     return @actor.original_equippable?(item)
  94.   end
  95.   #--------------------------------------------------------------------------
  96.   # ● 查询此文件是否可以装备
  97.   #--------------------------------------------------------------------------
  98.   def enable?(item)
  99.     return true unless item
  100.     return @actor.equippable?(item)
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # ● 更新帮助内容
  104.   #--------------------------------------------------------------------------
  105.   def update_help
  106.     super
  107.     if @actor && @status_window
  108.       temp_actor = Marshal.load(Marshal.dump(@actor))
  109.       temp_actor.hzhj_force_change_equip(@slot_id, item)
  110.       @status_window.set_temp_actor(temp_actor)
  111.     end
  112.   end
  113. end


  114. #==============================================================================
  115. # ■ Window_ShopStatus
  116. #==============================================================================




  117. class Window_ShopStatus < Window_Base
  118.   #--------------------------------------------------------------------------
  119.   # ● 绘制角色的装备信息
  120.   #--------------------------------------------------------------------------
  121.   def draw_actor_equip_info(x, y, actor)
  122.     enabled = actor.equippable?(@item)
  123.     change_color(normal_color, enabled)
  124.     draw_text(x, y, 112, line_height, actor.name)
  125.     item1 = current_equipped_item(actor, @item.etype_id)
  126.     draw_actor_param_change(x, y, actor, item1) if actor.original_equippable?(@item)
  127.     draw_item_name(item1, x, y + line_height, enabled)
  128.     contents.font.size = 14   
  129.   end
  130. end
复制代码
[/fold]
21、进入战斗就会自动附加状态,战斗结束就解除,非常适合战斗类型游戏。
[fold=战斗附加状态]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. # 随便写的,没有详细测试过。用法是在角色|职业|装备|敌人的备注栏
  3. # 备注<被动状态:状态ID> 例如<被动状态:18> 那么就会在战斗开始前
  4. # 会为该角色附加18号状态,战斗结束时移除这个状态。同时装备2个以
  5. # 上的有被动状态的装备亦可叠加,都会附加上对应的状态。
  6. class Game_Battler < Game_BattlerBase
  7.   #--------------------------------------------------------------------------
  8.   # ● 战斗开始处理
  9.   #--------------------------------------------------------------------------
  10.   alias state_battle_start on_battle_start
  11.   def on_battle_start
  12.     state_battle_start
  13.     self.feature_objects.each {|obj|
  14.     self.add_state($1.to_i) if obj.note =~ /<被动状态:\s*(\d+)>/}
  15.   end
  16. end
复制代码
[/fold]
22、一个简洁没有分类的怪物图鉴系统,但怪物描述可以做得非常详细。
[fold=怪物图鉴1]
  1. #使用方法:打开脚本编辑器,将“怪物图鉴1”“怪物图鉴2”“怪物图鉴3”脚本插入到main上。
  2. #在敌人备注:<图鉴技能:火球>
  3. #                     <图鉴说明:王城周边的流浪魔法师。>
  4. #==============================================================================
  5. # ■ RGSS3 魔物図鑑 ver 1.00 初期設定
  6. #------------------------------------------------------------------------------
  7. #  配布元:
  8. #     白の魔 [url]http://izumiwhite.web.fc2.com/[/url]
  9. #
  10. #  利用規約:
  11. #     RPGツクールVXの正規の登録者のみご利用になれます。
  12. #     利用報告・著作権表示とかは必要ありません。
  13. #     改造もご自由にどうぞ。
  14. #     何か問題が発生しても責任は持ちません。
  15. #==============================================================================

  16. #-------------------------------------------------------------------------------
  17. # ★ 初期設定。
  18. #-------------------------------------------------------------------------------
  19. module WD_monsterdictionary_layout

  20. #=== 各項目のレイアウト設定項目 ================================================
  21. #
  22. #   *_***_display       : trueで表示。falseで非表示。
  23. #   *_***_display_x     : 表示位置のx座標
  24. #   *_***_display_y     : 表示位置のy座標
  25. #   *_***_display_width : 表示テキストの幅
  26. #   *_***_display_text* : 表示テキスト
  27. #
  28. #===============================================================================

  29. #===全図鑑共通設定==============================================================

  30.   #図鑑完成度にどの段階で繁栄するか
  31.   Perfection_timing = 1 #1⇒遭遇時、2⇒撃破時

  32.   #フォントサイズ
  33.   C_font_size = 18

  34. #===魔物図鑑設定================================================================

  35.   #番号の表示
  36.   M_id_display            = true
  37.   M_id_display_x          = 0
  38.   M_id_display_y          = 0
  39.   M_id_display_width      = 60
  40.   M_id_display_digit      = 3 #桁数

  41.   #名前の表示
  42.   M_name_display          = true
  43.   M_name_display_x        = 84
  44.   M_name_display_y        = 0
  45.   M_name_display_width    = 172

  46.   #画像の表示
  47.   M_pic_display           = true
  48.   M_pic_display_x         = 140
  49.   M_pic_display_y         = 380
  50.   M_pic_display_opacity   = 255 #画像の不透明度

  51.   #最大HPの表示
  52.   M_mhp_display           = true
  53.   M_mhp_display_x         = 0
  54.   M_mhp_display_y         = 33
  55.   M_mhp_display_width     = 136

  56.   #最大MPの表示
  57.   M_mmp_display           = true
  58.   M_mmp_display_x         = 150
  59.   M_mmp_display_y         = 33
  60.   M_mmp_display_width     = 136

  61.   #攻撃力の表示
  62.   M_atk_display           = true
  63.   M_atk_display_x         = 0
  64.   M_atk_display_y         = 51
  65.   M_atk_display_width     = 136

  66.   #防御力の表示
  67.   M_def_display           = true
  68.   M_def_display_x         = 150
  69.   M_def_display_y         = 51
  70.   M_def_display_width     = 136

  71.   #魔法力の表示
  72.   M_mat_display           = true
  73.   M_mat_display_x         = 0
  74.   M_mat_display_y         = 69
  75.   M_mat_display_width     = 136

  76.   #魔法防御の表示
  77.   M_mdf_display           = true
  78.   M_mdf_display_x         = 150
  79.   M_mdf_display_y         = 69
  80.   M_mdf_display_width     = 136

  81.   #敏捷性の表示
  82.   M_agi_display           = true
  83.   M_agi_display_x         = 0
  84.   M_agi_display_y         = 87
  85.   M_agi_display_width     = 136

  86.   #特徴の表示
  87.   M_feature_display       = true
  88.   M_feature_display_x     = 0
  89.   M_feature_display_y     = 114
  90.   M_feature_display_width = 286
  91.   M_feature_display_text1 = "技能"
  92.   M_feature_display_text2 = "无"

  93.   #経験値の表示
  94.   M_exp_display           = true
  95.   M_exp_display_x         = 0
  96.   M_exp_display_y         = 213
  97.   M_exp_display_width     = 136
  98.   M_exp_display_text1     = "经验值"

  99.   #お金の表示
  100.   M_gold_display          = true
  101.   M_gold_display_x        = 150
  102.   M_gold_display_y        = 213
  103.   M_gold_display_width    = 136
  104.   M_gold_display_text1    = "金钱"

  105.   #ドロップアイテムの表示
  106.   M_drop_display          = true
  107.   M_drop_display_x        = 0
  108.   M_drop_display_y        = 240
  109.   M_drop_display_width    = 286
  110.   M_drop_display_text1    = "掉落物品"
  111.   M_drop_display_text2    = "无"

  112.   #説明の表示
  113.   M_help_display          = true
  114.   M_help_display_x        = 0
  115.   M_help_display_y        = 321
  116.   M_help_display_width    = 286
  117.   M_help_display_text1    = " "
  118.   M_help_display_text2    = " "

  119.   #撃破数の表示
  120.   M_geno_display          = true
  121.   M_geno_display_x        = 320
  122.   M_geno_display_y        = 321
  123.   M_geno_display_width    = 100
  124.   M_geno_display_text1    = "战胜"

  125. end
  126. #-------------------------------------------------------------------------------
  127. # ★ 初期設定おわり
  128. #-------------------------------------------------------------------------------
复制代码
[/fold]
[fold=怪物图鉴2]
  1. #==============================================================================
  2. # ■ RGSS3 魔物図鑑 ver 1.00 本体プログラム
  3. #------------------------------------------------------------------------------
  4. #  配布元:
  5. #     白の魔 [url]http://izumiwhite.web.fc2.com/[/url]
  6. #
  7. #  利用規約:
  8. #     RPGツクールVXの正規の登録者のみご利用になれます。
  9. #     利用報告・著作権表示とかは必要ありません。
  10. #     改造もご自由にどうぞ。
  11. #     何か問題が発生しても責任は持ちません。
  12. #==============================================================================

  13. #==============================================================================
  14. # ■ WD_monsterdictionary
  15. #------------------------------------------------------------------------------
  16. #  魔物図鑑用の共通メソッドです。
  17. #==============================================================================

  18. module WD_monsterdictionary



  19.   def m_dictionary_encount_switch_on(id)
  20.     $game_system.m_dic_encount_sw = [] if $game_system.m_dic_encount_sw == nil
  21.     $game_system.m_dic_encount_sw[id] = false if $game_system.m_dic_encount_sw[id] == nil
  22.     $game_system.m_dic_encount_sw[id] = true
  23.   end
  24.   def m_dictionary_encount_switch_off(id)
  25.     $game_system.m_dic_encount_sw = [] if $game_system.m_dic_encount_sw == nil
  26.     $game_system.m_dic_encount_sw[id] = false if $game_system.m_dic_encount_sw[id] == nil
  27.     $game_system.m_dic_encount_sw[id] = false
  28.   end
  29.   def m_dictionary_encount_switch_on?(id)
  30.     $game_system.m_dic_encount_sw = [] if $game_system.m_dic_encount_sw == nil
  31.     $game_system.m_dic_encount_sw[id] = false if $game_system.m_dic_encount_sw[id] == nil
  32.     return $game_system.m_dic_encount_sw[id]
  33.   end
  34.   def m_dictionary_victory_switch_on(id)
  35.     $game_system.m_dic_victory_sw = [] if $game_system.m_dic_victory_sw == nil
  36.     $game_system.m_dic_victory_sw[id] = false if $game_system.m_dic_victory_sw[id] == nil
  37.     $game_system.m_dic_victory_sw[id] = true
  38.   end
  39.   def m_dictionary_victory_switch_off(id)
  40.     $game_system.m_dic_victory_sw = [] if $game_system.m_dic_victory_sw == nil
  41.     $game_system.m_dic_victory_sw[id] = false if $game_system.m_dic_victory_sw[id] == nil
  42.     $game_system.m_dic_victory_sw[id] = false
  43.   end
  44.   def m_dictionary_victory_switch_on?(id)
  45.     $game_system.m_dic_victory_sw = [] if $game_system.m_dic_victory_sw == nil
  46.     $game_system.m_dic_victory_sw[id] = false if $game_system.m_dic_victory_sw[id] == nil
  47.     return $game_system.m_dic_victory_sw[id]
  48.   end
  49.   def m_dictionary_drop_switch_on(id, n)
  50.     $game_system.m_dic_drop_sw = [] if $game_system.m_dic_drop_sw == nil
  51.     $game_system.m_dic_drop_sw[id] = [] if $game_system.m_dic_drop_sw[id] == nil
  52.     $game_system.m_dic_drop_sw[id][n] = false if $game_system.m_dic_drop_sw[id][n] == nil
  53.     $game_system.m_dic_drop_sw[id][n] = true
  54.   end
  55.   def m_dictionary_drop_switch_off(id, n)
  56.     $game_system.m_dic_drop_sw = [] if $game_system.m_dic_drop_sw == nil
  57.     $game_system.m_dic_drop_sw[id] = [] if $game_system.m_dic_drop_sw[id] == nil
  58.     $game_system.m_dic_drop_sw[id][n] = false if $game_system.m_dic_drop_sw[id][n] == nil
  59.     $game_system.m_dic_drop_sw[id][n] = false
  60.   end
  61.   def m_dictionary_drop_switch_on?(id, n)
  62.     $game_system.m_dic_drop_sw = [] if $game_system.m_dic_drop_sw == nil
  63.     $game_system.m_dic_drop_sw[id] = [] if $game_system.m_dic_drop_sw[id] == nil
  64.     $game_system.m_dic_drop_sw[id][n] = false if $game_system.m_dic_drop_sw[id][n] == nil
  65.     return $game_system.m_dic_drop_sw[id][n]
  66.   end
  67.   def m_dictionary_genoside_number_add(id, n)
  68.     $game_system.m_dic_genoside_num = [] if $game_system.m_dic_genoside_num == nil
  69.     $game_system.m_dic_genoside_num[id] = 0 if $game_system.m_dic_genoside_num[id] == nil
  70.     $game_system.m_dic_genoside_num[id] += n
  71.   end
  72.   def m_dictionary_genoside_number(id)
  73.     $game_system.m_dic_genoside_num = [] if $game_system.m_dic_genoside_num == nil
  74.     $game_system.m_dic_genoside_num[id] = 0 if $game_system.m_dic_genoside_num[id] == nil
  75.     return $game_system.m_dic_genoside_num[id]
  76.   end

  77.   def print_dictionary?(enemy)
  78.     if enemy != nil
  79.       if enemy.name.size > 0
  80.         hantei = /<图鉴无效>/ =~ enemy.note
  81.         if hantei == nil
  82.           return true
  83.         end
  84.       end
  85.     end
  86.     return false
  87.   end
  88.   def monster_dictionary_perfection
  89.     dic_max = 0
  90.     dic_num = 0
  91.     $data_enemies.each do |enemy|
  92.       if print_dictionary?(enemy)
  93.         dic_max += 1
  94.         if WD_monsterdictionary_layout::Perfection_timing == 1
  95.           if m_dictionary_encount_switch_on?(enemy.id) == true
  96.             dic_num += 1
  97.           end
  98.         elsif WD_monsterdictionary_layout::Perfection_timing == 2
  99.           if m_dictionary_victory_switch_on?(enemy.id) == true
  100.             dic_num += 1
  101.           end
  102.         end
  103.       end
  104.     end
  105.     return (100*dic_num)/dic_max
  106.   end
  107. end

  108. class Game_Interpreter
  109.   include WD_monsterdictionary
  110. end

  111. class Game_System
  112.   #--------------------------------------------------------------------------
  113.   # ● 公開インスタンス変数
  114.   #--------------------------------------------------------------------------
  115.   attr_accessor :m_dic_encount_sw
  116.   attr_accessor :m_dic_victory_sw
  117.   attr_accessor :m_dic_drop_sw
  118.   attr_accessor :m_dic_genoside_num
  119.   #--------------------------------------------------------------------------
  120.   # ● オブジェクト初期化
  121.   #--------------------------------------------------------------------------
  122.   alias wd_orig_initialize002 initialize
  123.   def initialize
  124.     wd_orig_initialize002
  125.     @m_dic_encount_sw = []
  126.     @m_dic_victory_sw = []
  127.     @m_dic_drop_sw = []
  128.     @m_dic_genoside_num = []
  129.   end
  130. end

  131. class Game_Troop < Game_Unit
  132.   include WD_monsterdictionary
  133.   #--------------------------------------------------------------------------
  134.   # ● 図鑑への登録(遭遇済み判定)
  135.   #--------------------------------------------------------------------------
  136.   def dictionary1
  137.     for enemy in members
  138.       m_dictionary_encount_switch_on(enemy.enemy_id) unless enemy.hidden? #遭遇済み図鑑登録
  139.     end
  140.   end
  141.   #--------------------------------------------------------------------------
  142.   # ● 図鑑への登録(撃破済み判定)
  143.   #--------------------------------------------------------------------------
  144.   def dictionary2
  145.     for enemy in dead_members
  146.       m_dictionary_victory_switch_on(enemy.enemy_id) unless enemy.hidden? #撃破済み図鑑登録
  147.       m_dictionary_genoside_number_add(enemy.enemy_id, 1) unless enemy.hidden? #撃破数カウント
  148.     end
  149.   end
  150. end

  151. class << BattleManager
  152.   #--------------------------------------------------------------------------
  153.   # ● 戦闘開始
  154.   #--------------------------------------------------------------------------
  155.   alias wd_orig_battle_start002 battle_start
  156.   def battle_start
  157.     wd_orig_battle_start002
  158.     $game_troop.dictionary1 #図鑑への登録(遭遇済み判定)
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   # ● 勝利の処理
  162.   #--------------------------------------------------------------------------
  163.   alias wd_orig_process_victory002 process_victory
  164.   def process_victory
  165.     $game_troop.dictionary2 #図鑑への登録(撃破済み判定)
  166.     wd_orig_process_victory002
  167.   end
  168. end

  169. class Game_Interpreter
  170.   #--------------------------------------------------------------------------
  171.   # ● 敵キャラの出現
  172.   #--------------------------------------------------------------------------
  173.   alias wd_orig_command_335_002 command_335
  174.   def command_335
  175.     wd_orig_command_335_002
  176.     $game_troop.dictionary1 #図鑑への登録(遭遇済み判定)
  177.   end
  178. end

  179. class Game_Enemy < Game_Battler
  180.   include WD_monsterdictionary
  181.   #--------------------------------------------------------------------------
  182.   # ● ドロップアイテムの配列作成(再定義)
  183.   #--------------------------------------------------------------------------
  184.   def make_drop_items
  185.     n = -1
  186.     enemy.drop_items.inject([]) do |r, di|
  187.       n += 1
  188.       if di.kind > 0 && rand * di.denominator < drop_item_rate
  189.         m_dictionary_drop_switch_on(@enemy_id, n)
  190.         r.push(item_object(di.kind, di.data_id))
  191.       else
  192.         r
  193.       end
  194.     end
  195.   end
  196. end

  197. #==============================================================================
  198. # ■ Scene_MonsterDictionary
  199. #------------------------------------------------------------------------------
  200. #  魔物図鑑画面の処理を行うクラスです。
  201. #==============================================================================

  202. class Scene_MonsterDictionary < Scene_ItemBase
  203.   #--------------------------------------------------------------------------
  204.   # ● 開始処理
  205.   #--------------------------------------------------------------------------
  206.   def start
  207.     super

  208.     create_status_window
  209.     create_item_window
  210.     create_perfection_window
  211.   end
  212.   #--------------------------------------------------------------------------
  213.   # ● アイテムウィンドウの作成
  214.   #--------------------------------------------------------------------------
  215.   def create_item_window
  216.     wy = 0
  217.     wh = Graphics.height - 48
  218.     @item_window = Window_MonsterDictionaryList.new(Graphics.width-172-48, wy, 172+48, wh)
  219.     @item_window.viewport = @viewport
  220.     @item_window.status_window = @status_window
  221.     @item_window.set_handler(:cancel, method(:return_scene))
  222.     @item_window.update_help
  223.   end

  224.   def return_scene
  225.     $game_map.autoplay
  226.     SceneManager.return
  227.   end

  228.   #--------------------------------------------------------------------------
  229.   # ● アイテムステータスウィンドウの作成
  230.   #--------------------------------------------------------------------------
  231.   def create_status_window
  232.     wy = 0
  233.     wh = Graphics.height
  234.     @status_window = Window_MonsterDictionaryStatus.new(0, wy, Graphics.width-172-48, wh)
  235.     @status_window.viewport = @viewport
  236.   end
  237.   #--------------------------------------------------------------------------
  238.   # ● 図鑑完成度ウィンドウの作成
  239.   #--------------------------------------------------------------------------
  240.   def create_perfection_window
  241.     wy = @item_window.y + @item_window.height
  242.     wh = 48
  243.     @perfection_window = Window_MonsterDictionaryPerfection.new(Graphics.width-172-48, wy, 172+48, wh)
  244.     @perfection_window.viewport = @viewport
  245.   end
  246. end


  247. #==============================================================================
  248. # ■ Window_MonsterDictionaryList
  249. #------------------------------------------------------------------------------
  250. #  魔物図鑑画面で、魔物の一覧を表示するウィンドウです。
  251. #==============================================================================

  252. class Window_MonsterDictionaryList < Window_Selectable
  253.   include WD_monsterdictionary
  254.   #--------------------------------------------------------------------------
  255.   # ● オブジェクト初期化
  256.   #--------------------------------------------------------------------------
  257.   def initialize(x, y, width, height)
  258.     super
  259.     @data = []
  260.     refresh
  261.     activate
  262.     select(0)
  263.   end
  264.   #--------------------------------------------------------------------------
  265.   # ● 桁数の取得
  266.   #--------------------------------------------------------------------------
  267.   def col_max
  268.     return 1
  269.   end
  270.   #--------------------------------------------------------------------------
  271.   # ● 項目数の取得
  272.   #--------------------------------------------------------------------------
  273.   def item_max
  274.     @data ? @data.size : 1
  275.   end
  276.   #--------------------------------------------------------------------------
  277.   # ● アイテムの取得
  278.   #--------------------------------------------------------------------------
  279.   def enemy
  280.     @data && index >= 0 ? @data[index] : nil
  281.   end
  282.   #--------------------------------------------------------------------------
  283.   # ● アイテムリストの作成
  284.   #--------------------------------------------------------------------------
  285.   def make_item_list
  286.     @data = []
  287.     $data_enemies.each do |enemy|
  288.       if print_dictionary?(enemy)
  289.         @data.push(enemy)
  290.       end
  291.     end
  292.   end
  293.   #--------------------------------------------------------------------------
  294.   # ● 項目の描画
  295.   #--------------------------------------------------------------------------
  296.   def draw_item(index)
  297.     enemy = @data[index]
  298.     if enemy
  299.       rect = item_rect(index)
  300.       rect.width -= 4
  301.       if m_dictionary_encount_switch_on?(enemy.id)
  302.         change_color(normal_color, true)
  303.         draw_text(rect.x, rect.y, 172, line_height, enemy.name)
  304.       else
  305.         change_color(normal_color, false)
  306.         draw_text(rect.x, rect.y, 172, line_height, "无数据")
  307.       end
  308.     end
  309.   end
  310.   #--------------------------------------------------------------------------
  311.   # ● ヘルプウィンドウ更新メソッドの呼び出し
  312.   #--------------------------------------------------------------------------
  313.   def call_update_help
  314.     update_help if active
  315.   end
  316.   #--------------------------------------------------------------------------
  317.   # ● ヘルプテキスト更新
  318.   #--------------------------------------------------------------------------
  319.   def update_help
  320.     if @status_window
  321.       if m_dictionary_encount_switch_on?(enemy.id)
  322.         @status_window.set_item(enemy, @index, true)
  323.       else
  324.         @status_window.set_item(enemy, @index, false)
  325.       end
  326.     end
  327.   end
  328.   #--------------------------------------------------------------------------
  329.   # ● リフレッシュ
  330.   #--------------------------------------------------------------------------
  331.   def refresh
  332.     make_item_list
  333.     create_contents
  334.     draw_all_items
  335.   end
  336.   #--------------------------------------------------------------------------
  337.   # ● ステータスウィンドウの設定
  338.   #--------------------------------------------------------------------------
  339.   def status_window=(status_window)
  340.     @status_window = status_window
  341.   end
  342. end

  343. #==============================================================================
  344. # ■ Window_MonsterDictionaryPerfection
  345. #------------------------------------------------------------------------------
  346. #  魔物図鑑画面で、図鑑の完成度を表示するウィンドウです。
  347. #==============================================================================

  348. class Window_MonsterDictionaryPerfection < Window_Selectable
  349.   include WD_monsterdictionary
  350.   #--------------------------------------------------------------------------
  351.   # ● オブジェクト初期化
  352.   #--------------------------------------------------------------------------
  353.   def initialize(x, y, width, height)
  354.     super
  355.     refresh(width)
  356.   end
  357.   #--------------------------------------------------------------------------
  358.   # ● リフレッシュ
  359.   #--------------------------------------------------------------------------
  360.   def refresh(width)
  361.     contents.clear
  362.     draw_text(0, 0, width-24, line_height, "图鉴进度: #{monster_dictionary_perfection} %", 1)
  363.   end
  364. end


  365. #==============================================================================
  366. # ■ Window_MonsterDictionaryStatus
  367. #------------------------------------------------------------------------------
  368. #  魔物図鑑画面で、エネミーの詳細を表示するウィンドウです。
  369. #==============================================================================

  370. class Window_MonsterDictionaryStatus < Window_Selectable
  371.   include WD_monsterdictionary
  372.   #--------------------------------------------------------------------------
  373.   # ● オブジェクト初期化
  374.   #--------------------------------------------------------------------------
  375.   def initialize(x, y, width, height)
  376.     super
  377.     @enemy = nil
  378.     refresh
  379.   end
  380.   #--------------------------------------------------------------------------
  381.   # ● アイテムの設定
  382.   #--------------------------------------------------------------------------
  383.   def set_item(enemy, index=-1, print=false)
  384.     return if ((@enemy == enemy) and (@index == index))
  385.     @enemy = enemy
  386.     @index = index
  387.     @print = print
  388.     refresh
  389.   end
  390.   #--------------------------------------------------------------------------
  391.   # ● アイテムオブジェクトの取得,掉落物取得
  392.   #--------------------------------------------------------------------------
  393.   def item_object(kind, data_id)
  394.     return $data_items  [data_id] if kind == 1
  395.     return $data_weapons[data_id] if kind == 2
  396.     return $data_armors [data_id] if kind == 3
  397.     return nil
  398.   end
  399.   #--------------------------------------------------------------------------
  400.   # ● リフレッシュ
  401.   #--------------------------------------------------------------------------
  402.   def refresh
  403.     contents.clear
  404.     contents.font.size = 24

  405.     if @print

  406.       if WD_monsterdictionary_layout::M_id_display
  407.         text1  = sprintf("%0#{WD_monsterdictionary_layout::M_id_display_digit}d",@index+1)
  408.         x      = WD_monsterdictionary_layout::M_id_display_x
  409.         y      = WD_monsterdictionary_layout::M_id_display_y
  410.         width  = WD_monsterdictionary_layout::M_id_display_width
  411.         height = line_height
  412.         draw_text(x, y, width, height, text1, 0)
  413.       end
  414.       if WD_monsterdictionary_layout::M_name_display
  415.         text1  = @enemy.name
  416.         x      = WD_monsterdictionary_layout::M_name_display_x
  417.         y      = WD_monsterdictionary_layout::M_name_display_y
  418.         width  = WD_monsterdictionary_layout::M_name_display_width
  419.         height = line_height
  420.         draw_text(x, y, width, height, text1, 0)
  421.       end
  422.       if WD_monsterdictionary_layout::M_pic_display
  423.         pic_name = @enemy.battler_name
  424.         pic_hue  = @enemy.battler_hue
  425.         x      = WD_monsterdictionary_layout::M_pic_display_x
  426.         y      = WD_monsterdictionary_layout::M_pic_display_y
  427.         opacity= WD_monsterdictionary_layout::M_pic_display_opacity
  428.         bitmap = Cache.battler(pic_name, pic_hue)
  429.         rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  430.         contents.blt(x - rect.width/2, y - rect.height, bitmap, rect, opacity)
  431.       end

  432.       font_size = WD_monsterdictionary_layout::C_font_size
  433.       contents.font.size = font_size
  434.       if WD_monsterdictionary_layout::M_mhp_display
  435.         text1  = Vocab::param(0)
  436.         text2  = "?"
  437.         text2  = @enemy.params[0] if m_dictionary_victory_switch_on?(@enemy.id)
  438.         x      = WD_monsterdictionary_layout::M_mhp_display_x
  439.         y      = WD_monsterdictionary_layout::M_mhp_display_y
  440.         width  = WD_monsterdictionary_layout::M_mhp_display_width
  441.         change_color(system_color)
  442.         draw_text(x, y, width, font_size, text1, 0)
  443.         change_color(normal_color)
  444.         draw_text(x, y, width, font_size, text2, 2)
  445.       end
  446.       if WD_monsterdictionary_layout::M_mmp_display
  447.         text1  = Vocab::param(1)
  448.         text2  = "?"
  449.         text2  = @enemy.params[1] if m_dictionary_victory_switch_on?(@enemy.id)
  450.         x      = WD_monsterdictionary_layout::M_mmp_display_x
  451.         y      = WD_monsterdictionary_layout::M_mmp_display_y
  452.         width  = WD_monsterdictionary_layout::M_mmp_display_width
  453.         change_color(system_color)
  454.         draw_text(x, y, width, font_size, text1, 0)
  455.         change_color(normal_color)
  456.         draw_text(x, y, width, font_size, text2, 2)
  457.       end
  458.       if WD_monsterdictionary_layout::M_atk_display
  459.         text1  = Vocab::param(2)
  460.         text2  = "?"
  461.         text2  = @enemy.params[2] if m_dictionary_victory_switch_on?(@enemy.id)
  462.         x      = WD_monsterdictionary_layout::M_atk_display_x
  463.         y      = WD_monsterdictionary_layout::M_atk_display_y
  464.         width  = WD_monsterdictionary_layout::M_atk_display_width
  465.         change_color(system_color)
  466.         draw_text(x, y, width, font_size, text1, 0)
  467.         change_color(normal_color)
  468.         draw_text(x, y, width, font_size, text2, 2)
  469.       end
  470.       if WD_monsterdictionary_layout::M_def_display
  471.         text1  = Vocab::param(3)
  472.         text2  = "?"
  473.         text2  = @enemy.params[3] if m_dictionary_victory_switch_on?(@enemy.id)
  474.         x      = WD_monsterdictionary_layout::M_def_display_x
  475.         y      = WD_monsterdictionary_layout::M_def_display_y
  476.         width  = WD_monsterdictionary_layout::M_def_display_width
  477.         change_color(system_color)
  478.         draw_text(x, y, width, font_size, text1, 0)
  479.         change_color(normal_color)
  480.         draw_text(x, y, width, font_size, text2, 2)
  481.       end
  482.       if WD_monsterdictionary_layout::M_mat_display
  483.         text1  = Vocab::param(4)
  484.         text2  = "?"
  485.         text2  = @enemy.params[4] if m_dictionary_victory_switch_on?(@enemy.id)
  486.         x      = WD_monsterdictionary_layout::M_mat_display_x
  487.         y      = WD_monsterdictionary_layout::M_mat_display_y
  488.         width  = WD_monsterdictionary_layout::M_mat_display_width
  489.         change_color(system_color)
  490.         draw_text(x, y, width, font_size, text1, 0)
  491.         change_color(normal_color)
  492.         draw_text(x, y, width, font_size, text2, 2)
  493.       end
  494.       if WD_monsterdictionary_layout::M_mdf_display
  495.         text1  = Vocab::param(5)
  496.         text2  = "?"
  497.         text2  = @enemy.params[5] if m_dictionary_victory_switch_on?(@enemy.id)
  498.         x      = WD_monsterdictionary_layout::M_mdf_display_x
  499.         y      = WD_monsterdictionary_layout::M_mdf_display_y
  500.         width  = WD_monsterdictionary_layout::M_mdf_display_width
  501.         change_color(system_color)
  502.         draw_text(x, y, width, font_size, text1, 0)
  503.         change_color(normal_color)
  504.         draw_text(x, y, width, font_size, text2, 2)
  505.       end
  506.       if WD_monsterdictionary_layout::M_agi_display
  507.         text1  = Vocab::param(6)
  508.         text2  = "?"
  509.         text2  = @enemy.params[6] if m_dictionary_victory_switch_on?(@enemy.id)
  510.         x      = WD_monsterdictionary_layout::M_agi_display_x
  511.         y      = WD_monsterdictionary_layout::M_agi_display_y
  512.         width  = WD_monsterdictionary_layout::M_agi_display_width
  513.         change_color(system_color)
  514.         draw_text(x, y, width, font_size, text1, 0)
  515.         change_color(normal_color)
  516.         draw_text(x, y, width, font_size, text2, 2)
  517.       end
  518.       if WD_monsterdictionary_layout::M_feature_display
  519.         text1  = WD_monsterdictionary_layout::M_feature_display_text1
  520.         text2  = "?"
  521.         text2  = WD_monsterdictionary_layout::M_feature_display_text2 if m_dictionary_victory_switch_on?(@enemy.id)
  522.         x      = WD_monsterdictionary_layout::M_feature_display_x
  523.         y      = WD_monsterdictionary_layout::M_feature_display_y
  524.         width  = WD_monsterdictionary_layout::M_feature_display_width
  525.         change_color(system_color)
  526.         draw_text(x, y, width, font_size, text1, 0)
  527.         change_color(normal_color)
  528.         i = 0
  529.         if m_dictionary_victory_switch_on?(@enemy.id)
  530.           @enemy.note.scan(/<图鉴技能:(.*)>/){|matched|
  531.             i += 1
  532.             self.contents.draw_text(x + font_size, y + font_size * i, width - font_size, font_size, matched[0], 0)
  533.           }
  534.         end
  535.         if i == 0
  536.           self.contents.draw_text(x + font_size, y + font_size, width - font_size, font_size, text2, 0)
  537.         end
  538.       end
  539.       if WD_monsterdictionary_layout::M_exp_display
  540.         text1  = WD_monsterdictionary_layout::M_exp_display_text1
  541.         text2  = "?"
  542.         text2  = @enemy.exp if m_dictionary_victory_switch_on?(@enemy.id)
  543.         x      = WD_monsterdictionary_layout::M_exp_display_x
  544.         y      = WD_monsterdictionary_layout::M_exp_display_y
  545.         width  = WD_monsterdictionary_layout::M_exp_display_width
  546.         change_color(system_color)
  547.         draw_text(x, y, width, font_size, text1, 0)
  548.         change_color(normal_color)
  549.         draw_text(x, y, width, font_size, text2, 2)
  550.       end
  551.       if WD_monsterdictionary_layout::M_gold_display
  552.         text1  = WD_monsterdictionary_layout::M_gold_display_text1
  553.         text2  = "?"
  554.         text2  = @enemy.gold if m_dictionary_victory_switch_on?(@enemy.id)
  555.         text3  = Vocab::currency_unit
  556.         x      = WD_monsterdictionary_layout::M_gold_display_x
  557.         y      = WD_monsterdictionary_layout::M_gold_display_y
  558.         width  = WD_monsterdictionary_layout::M_gold_display_width
  559.         change_color(system_color)
  560.         draw_text(x, y, width, font_size, text1, 0)
  561.         cx = text_size(Vocab::currency_unit).width
  562.         change_color(normal_color)
  563.         draw_text(x, y, width - cx - 2, font_size, text2, 2)
  564.         change_color(system_color)
  565.         draw_text(x, y, width, font_size, text3, 2)
  566.         change_color(normal_color)
  567.       end
  568.       if WD_monsterdictionary_layout::M_drop_display
  569.         text1  = WD_monsterdictionary_layout::M_drop_display_text1
  570.         text2  = WD_monsterdictionary_layout::M_drop_display_text2 if m_dictionary_victory_switch_on?(@enemy.id)
  571.         x      = WD_monsterdictionary_layout::M_drop_display_x
  572.         y      = WD_monsterdictionary_layout::M_drop_display_y
  573.         width  = WD_monsterdictionary_layout::M_drop_display_width
  574.         change_color(system_color)
  575.         draw_text(x, y, width, font_size, text1, 0)
  576.         change_color(normal_color)
  577.         i = 0
  578.         @enemy.drop_items.each do |di|
  579.           if di.kind > 0
  580.             i += 1
  581.             item = item_object(di.kind, di.data_id)
  582.             n = i -1
  583.             if m_dictionary_drop_switch_on?(@enemy.id, n)
  584.               text2 = item.name
  585.               text3 = "1/#{di.denominator}"
  586.             else
  587.               text2  = "未知"
  588.               text3  = ""
  589.             end
  590.             self.contents.draw_text(x + font_size, y + font_size * i, width - font_size, font_size, text2, 0)
  591.             self.contents.draw_text(x + font_size, y + font_size * i, width - font_size, font_size, text3, 2)
  592.           end
  593.         end
  594.         if i == 0
  595.           self.contents.draw_text(x + font_size, y + font_size, width - font_size, font_size, text2, 0)
  596.         end
  597.       end
  598.       if WD_monsterdictionary_layout::M_help_display
  599.         text1  = WD_monsterdictionary_layout::M_help_display_text1
  600.         text2  = "?"
  601.         text2  = WD_monsterdictionary_layout::M_help_display_text2 if m_dictionary_victory_switch_on?(@enemy.id)
  602.         x      = WD_monsterdictionary_layout::M_help_display_x
  603.         y      = WD_monsterdictionary_layout::M_help_display_y
  604.         width  = WD_monsterdictionary_layout::M_help_display_width
  605.         change_color(system_color)
  606.         draw_text(x, y, width, font_size, text1, 0)
  607.         change_color(normal_color)
  608.         i = 0
  609.         if m_dictionary_victory_switch_on?(@enemy.id)
  610.           @enemy.note.scan(/<图鉴说明:(.*)>/){|matched|
  611.             i += 1
  612.             self.contents.draw_text(x + font_size, y + font_size * i, width - font_size, font_size, matched[0], 0)
  613.           }
  614.         end
  615.         if i == 0
  616.           self.contents.draw_text(x + font_size, y + font_size, width - font_size, font_size, text2, 0)
  617.         end
  618.       end
  619.       if WD_monsterdictionary_layout::M_geno_display
  620.         text1  = WD_monsterdictionary_layout::M_geno_display_text1
  621.         text2  = "#{m_dictionary_genoside_number(@enemy.id)}"
  622.         x      = WD_monsterdictionary_layout::M_geno_display_x
  623.         y      = WD_monsterdictionary_layout::M_geno_display_y
  624.         width  = WD_monsterdictionary_layout::M_geno_display_width
  625.         change_color(system_color)
  626.         draw_text(x, y, width, font_size, text1, 0)
  627.         change_color(normal_color)
  628.         draw_text(x, y, width, font_size, text2, 2)
  629.       end

  630.     elsif @enemy != nil

  631.       if WD_monsterdictionary_layout::M_id_display
  632.         text1  = sprintf("%0#{WD_monsterdictionary_layout::M_id_display_digit}d",@index+1)
  633.         x      = WD_monsterdictionary_layout::M_id_display_x
  634.         y      = WD_monsterdictionary_layout::M_id_display_y
  635.         width  = WD_monsterdictionary_layout::M_id_display_width
  636.         height = line_height
  637.         draw_text(x, y, width, height, text1, 0)
  638.       end
  639.       if WD_monsterdictionary_layout::M_name_display
  640.         text1  = "- ???? -"
  641.         x      = WD_monsterdictionary_layout::M_name_display_x
  642.         y      = WD_monsterdictionary_layout::M_name_display_y
  643.         width  = WD_monsterdictionary_layout::M_name_display_width
  644.         height = line_height
  645.         draw_text(x, y, width, height, text1, 0)
  646.       end

  647.     end
  648.   end
  649. end
复制代码
[/fold]
[fold=怪物图鉴3]
  1. #==============================================================================
  2. #  菜单画面
  3. #==============================================================================
  4. class Scene_Menu < Scene_MenuBase
  5.   #--------------------------------------------------------------------------
  6.   # alias 给 create_command_window 方法取个别名 尽量命名独特不容易重名
  7.   #--------------------------------------------------------------------------
  8.   alias miao_20150812_create_1 create_command_window
  9.   #--------------------------------------------------------------------------
  10.   # ● 生成指令窗口
  11.   #--------------------------------------------------------------------------
  12.   def create_command_window
  13.     miao_20150812_create_1
  14.     @command_window.set_handler(:neko_commands1,    method(:command_neko1))
  15.   end
  16.   #--------------------------------------------------------------------------
  17.   # ● 按钮所执行的内容方法名与上面的 method() 里的符号对应
  18.   #--------------------------------------------------------------------------
  19.   def command_neko1
  20.     #通常指令内容是呼出场景
  21.     SceneManager.call(Scene_MonsterDictionary)
  22.     #但是按钮按下去的效果不一定局限于切换场景
  23.   end
  24. end
  25. #==============================================================================
  26. #  菜单画面中显示指令的窗口
  27. #==============================================================================
  28. class Window_MenuCommand < Window_Command
  29.   alias miao_20150812_aoc add_original_commands
  30.   #--------------------------------------------------------------------------
  31.   # ● 独自添加指令用
  32.   #--------------------------------------------------------------------------
  33.   def add_original_commands
  34.     miao_20150812_aoc
  35.     add_command("图鉴", :neko_commands1, main_commands_enabled)#添加按钮
  36.             
  37. =begin
  38.     add_command()里的3个参数依次为:
  39.                   ● name:选项的名称,在描绘选项时使用
  40.                   ● symbol:选项的符号,这是一个标志与上面set_handler里对应
  41.                   ● enabled:有效状态,当值为 false 时选项无效且用半透明绘制
  42. =end
  43.   end
  44. end
复制代码
[/fold]
23、在特殊战斗中可以使用到的雾景。
[fold=战斗中雾效果]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #战斗中的雾效果是默认开启的,不想显示效果就打开指定ID开关,请看28横代码说明。
  3. #==============================================================================
  4. # ★ RGSS3_バトルミスト Ver1.0
  5. #==============================================================================
  6. =begin

  7. 作者:tomoaky
  8. webサイト:ひきも記 (http://hikimoki.sakura.ne.jp/)

  9. 戦闘シーンの背景に霧を表示します。

  10. 動作に必要な画像
  11.   Graphics/System/mist.png
  12.   
  13. 使用するゲームスイッチ(初期設定)
  14.   0001

  15. 2011.12.15  Ver1.0
  16.   公開

  17. =end

  18. #==============================================================================
  19. # □ 設定項目
  20. #==============================================================================
  21. module TMBMIST
  22.   SW_NOUSE   = 100        # 100开关开启无雾效果
  23.   BLEND_TYPE = 1        # 霧画像の合成方法(0=通常 / 1=加算 / 2=減算)
  24.   MIST_NUM   = 10       # 霧の量
  25. end

  26. #==============================================================================
  27. # □ Sprite_Mist
  28. #==============================================================================
  29. class Sprite_Mist < Sprite
  30.   #--------------------------------------------------------------------------
  31.   # ● オブジェクト初期化
  32.   #--------------------------------------------------------------------------
  33.   def initialize(viewport)
  34.     super(viewport)
  35.     self.bitmap = Cache.system("mist")
  36.     self.blend_type = TMBMIST::BLEND_TYPE
  37.     self.ox = self.bitmap.width / 2
  38.     self.oy = self.bitmap.height / 2
  39.     setup
  40.     self.z += rand(570)
  41.     update_position
  42.   end
  43.   #--------------------------------------------------------------------------
  44.   # ○ セットアップ
  45.   #--------------------------------------------------------------------------
  46.   def setup
  47.     @base_x = rand(Graphics.width / 2) + Graphics.width / 4
  48.     self.z = 20
  49.     self.mirror = (rand(3) == 0)
  50.     update_position
  51.   end
  52.   #--------------------------------------------------------------------------
  53.   # ○ 座標の更新
  54.   #--------------------------------------------------------------------------
  55.   def update_position
  56.     self.x = (@base_x - (Graphics.width / 2)) * self.z / 128 + @base_x
  57.     self.y = self.z / 4 + 160
  58.     self.zoom_x = self.z * 0.003 + 0.25
  59.     self.zoom_y = self.zoom_x
  60.     self.opacity = (self.z >= 536 ? (600 - self.z) * 4 : self.z)
  61.   end
  62.   #--------------------------------------------------------------------------
  63.   # ● 更新
  64.   #--------------------------------------------------------------------------
  65.   def update
  66.     super
  67.     self.z += 1
  68.     self.z >= 600 ? setup : update_position
  69.   end
  70. end

  71. #==============================================================================
  72. # ■ Spriteset_Battle
  73. #==============================================================================
  74. class Spriteset_Battle
  75.   #--------------------------------------------------------------------------
  76.   # ● 戦闘背景(床)スプライトの作成
  77.   #--------------------------------------------------------------------------
  78.   alias tmbmist_spriteset_battle_create_battleback1 create_battleback1
  79.   def create_battleback1
  80.     tmbmist_spriteset_battle_create_battleback1
  81.     @mist_sprites = []
  82.     unless $game_switches[TMBMIST::SW_NOUSE]
  83.       @mist_sprites = Array.new(TMBMIST::MIST_NUM) { Sprite_Mist.new(@viewport1) }
  84.     end
  85.   end
  86.   #--------------------------------------------------------------------------
  87.   # ● 戦闘背景(床)スプライトの解放
  88.   #--------------------------------------------------------------------------
  89.   alias tmbmist_spriteset_battle_dispose_battleback1 dispose_battleback1
  90.   def dispose_battleback1
  91.     tmbmist_spriteset_battle_dispose_battleback1
  92.     @mist_sprites.each {|sprite| sprite.dispose }
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # ● 戦闘背景(床)スプライトの更新
  96.   #--------------------------------------------------------------------------
  97.   alias tmbmist_spriteset_battle_update_battleback1 update_battleback1
  98.   def update_battleback1
  99.     tmbmist_spriteset_battle_update_battleback1
  100.     @mist_sprites.each {|sprite| sprite.update }
  101.   end
  102. end
复制代码
[/fold]
24、遇敌时碎屏画面进入战斗特效。
附件
[fold=碎屏特效1]
  1. #使用方法:打开脚本编辑器,将“碎屏特效1”“碎屏特效2”脚本插入到main上。
  2. #将附件下载解压sptx.png到Graphics/system文件夹里面。
  3. #===================================================
  4. # Broken_Screen
  5. #----------------------------------------------------
  6. # ■ 碎屏特效
  7. #===================================================



  8. =begin
  9. 名称:碎屏转场特效
  10. 版本:1.01
  11. 效果:场景更换时,产生屏幕碎开的效果。

  12. 使用说明:
  13. 你可以修改Graphics/system/sptx.png文件,改成自己想要的碎片效果。
  14. 在转场前的场景,如地图到战斗
  15. 则在地图的  切换战斗画面前的处理 方法 内添加
  16. $swtf = Broken_Screen.new(文件名,可省略)
  17. 此时可定格画面(其实是把当前画面制作成碎片)
  18. 然后在需要碎开的地方添加
  19.    if $swtf != nil
  20.       $swtf.get_bomb
  21.       $swtf=nil
  22.     end
  23.     即可实现碎开。
  24.    
  25. 由于脚本的优化,所以有时候会出现实际碎片与碎片图有差别,不过这影响不大
  26. 如果必要的话,可以适当减少 @step_w @step_h的值(步长)即可
  27. 但会增加计算量,也许很大。
  28. =end


  29. class Broken_Screen
  30.   #--------------------------------------------------------------------------
  31.   # ● 初始化对象
  32.   #--------------------------------------------------------------------------

  33.   def initialize(filename="Graphics/system/sptx.png")
  34.     @width = Graphics.width  #获取宽高
  35.     @height = Graphics.height
  36.     #===========================
  37.     @step_w = @width/2  #★★★★★★★★★★★#★★★★★★★★★★★
  38.     @step_h = @height/2 #★★★★★★★★★★★#★★★★★★★★★★★
  39.     #可以设置这两项数据,以减少可能会出现的误差,
  40.     #因为脚本并不会检查所有的像素,所以有时候会出现误差,减少
  41.     #步长可以减少出现误差的可能,但会增加计算量。
  42.     #===========================
  43.     @picture = Graphics.snap_to_bitmap #获取当前的图像
  44.     @borken_pic = Bitmap.new(filename)#获取破碎辅助图
  45. #~     pic = Sprite.new
  46. #~     pic.bitmap = Bitmap.new(544,416)
  47. #~     pic.bitmap.blt(20,20,@picture,Rect.new(20,20,100,100))
  48. #~     pic.x+= 200
  49. #   return
  50.     @shards = {} #碎片的数组
  51.     start #开始绘图
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # ● 开始绘图
  55.   #--------------------------------------------------------------------------
  56.   def start
  57.     y0=0
  58.     loop do
  59.       x0 = 0
  60.       loop do
  61.         area = x0,y0,[@width-x0,@step_w].min,[@height-y0,@step_h].min
  62.         part_pic(area)
  63.         x0+=@step_w
  64.         break if x0>=@width
  65.       end
  66.       y0+=@step_h
  67.       break if y0>=@height
  68.     end
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ● 开始炸开
  72.   #--------------------------------------------------------------------------
  73.   def get_bomb
  74.     Audio.se_play("Audio/SE/battle1")
  75.     temp = [] #将哈希表转换为数组
  76.     @shards.each_value{|shard|
  77.     temp.push shard
  78.     }
  79.     @shards = temp
  80.     shards_v = []
  81.    
  82.     for i in 0..@shards.size-1
  83.       #               对象         中心位置                            转速
  84.     #  @shards[i].angle=rand(2)*45
  85.       shards_v.push [@shards[i],rand(@shards[i].x)+20-rand(40),@shards[i].y-208,rand(2)]
  86.     end
  87.     for t in 0..89
  88.       for sha in shards_v
  89.         sha[0].x+= sha[1]/10
  90.         sha[0].y+= sha[2]/20
  91. #~         msgbox sha[0].x
  92.         sha[2]+=10
  93. #~          sha[0].angle+=sha[3]
  94.         if sha[3] == 0
  95.           sha[0].zoom_x -= 0.01
  96.          
  97.         else
  98.           sha[0].zoom_y -= 0.01
  99.          
  100.         end
  101.          
  102.       end
  103.       Graphics.update

  104.     end
  105.     for sha in shards_v
  106.       sha[0].dispose
  107.     end
  108.     @picture.dispose
  109.     @borken_pic.dispose
  110.   end
  111.   
  112.   #--------------------------------------------------------------------------
  113.   # ●         拆分图块 若颜色不单一,继续四分图块
  114.   # 递归算法 area 被拆分的范围
  115.   #--------------------------------------------------------------------------
  116.   def part_pic(area)
  117.     x,y,w,h = *area
  118.     if w>=1 and h>=1 and w+h>2 #如果长宽大于1,并且长宽之和大于2
  119.       #四分区域
  120.       areas = []
  121.       areas[0] = [x,y,w/2,h/2]
  122.       areas[1] = [x+w/2,y,w-w/2,h/2]
  123.       areas[2] = [x,y+h/2,w/2,h-h/2]
  124.       areas[3] = [x+w/2,y+h/2,w-w/2,h-h/2]
  125.       for area in areas
  126.         test = area_test(area)
  127.         if test[0]
  128.           make_shard(area,test[1]) #绘图
  129.         else
  130.           part_pic(area) #递归
  131.         end
  132.         
  133.       end
  134.     else#if w>1 and h>1
  135.       if w*h == 0
  136.         return #如果长宽其中之一为0,则忽略
  137.       else #这里表示只有一格的情况
  138.         make_shard(area,area_test(area)[1])#绘图
  139.       end
  140.       
  141.     end#if w>1 and h>1
  142.    
  143.   end
  144.   
  145.   #--------------------------------------------------------------------------
  146.   # ● 区块检测
  147.   #  检测区块颜色是否单一 area 检测的范围
  148.   #--------------------------------------------------------------------------
  149.   def area_test(area)
  150.     x,y,w,h = *area #获取位置,长宽
  151.     color = @borken_pic.get_pixel(x, y) #获取左上角像素的颜色
  152.     if @borken_pic.get_pixel(x+w-1, y) != color #依次检测剩下三个点是否和单一
  153.       return [false]
  154.     end
  155.     if @borken_pic.get_pixel(x, y+h-1) != color
  156.       return [false]
  157.     end
  158.     if @borken_pic.get_pixel(x+w-1, y+h-1) != color
  159.       return [false]
  160.     end
  161.     return [true,color.red]
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ● 制作碎片
  165.   # area,可以被绘图的区域,color该区域的颜色(这里的颜色是只辅助图内的颜色)
  166.   #--------------------------------------------------------------------------
  167.   def make_shard(area,color)
  168.     unless @shards.include?(color) #如果没有该颜色的记录
  169.       spr = Sprite.new
  170.       spr.z = 100
  171.       spr.bitmap = Bitmap.new(@width,@height)
  172.      # spr.x,spr.y,spr.bitmap.width,spr.bitmap.height = *area#获得长宽
  173.      spr.ox=(area[0]+area[2])/2
  174.      spr.oy=(area[1]+area[3])/2
  175.      spr.x=(area[0]+area[2])/2
  176.      spr.y=(area[1]+area[3])/2
  177.       @shards[color] = spr
  178.       
  179.     end
  180.    
  181.     #----------------------绘图----------------------
  182. #   @shards[color].bitmap.fill_rect(*area,Color.new(125,125,125,255))
  183.      @shards[color].bitmap.blt(area[0], area[1], @picture, Rect.new(*area))
  184. #~     @shards[color].ox = (x+xt)/2
  185. #~     @shards[color].x = (x+xt)/2
  186. #~     @shards[color].oy = (y+yt)/2
  187. #~     @shards[color].y = (y+yt)/2
  188.    
  189.   end
  190.   
  191. end
  192. #============================================================
  193. # 本脚本由九夜神尊制作
  194. # 欢迎任意转载修改,但请保留作者名。
  195. #===========================================================
复制代码
[/fold]
[fold=碎屏特效2]
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ Scene_Map
  4. #------------------------------------------------------------------------------
  5. #  地图画面
  6. #==============================================================================

  7. class Scene_Map < Scene_Base
  8.   #--------------------------------------------------------------------------
  9.   # ● 执行战斗前的渐变
  10.   #--------------------------------------------------------------------------
  11.   def perform_battle_transition
  12. #~     Graphics.transition(60, "Graphics/System/BattleStart", 100)
  13. #~     Graphics.freeze
  14.   end

  15.   #--------------------------------------------------------------------------
  16.   # ● 切换战斗画面前的处理
  17.   #--------------------------------------------------------------------------
  18.   def pre_battle_scene
  19.     Graphics.update
  20.     Graphics.freeze
  21.     @spriteset.dispose_characters
  22.     BattleManager.save_bgm_and_bgs
  23.     BattleManager.play_battle_bgm
  24.     Sound.play_battle_start
  25.     $swtf = Broken_Screen.new if $swtf==nil #★★★★★★★★★★★★★★★★★

  26.   end
  27. end
  28. #encoding:utf-8
  29. #==============================================================================
  30. # ■ Scene_Battle
  31. #------------------------------------------------------------------------------
  32. #  战斗画面
  33. #==============================================================================

  34. class Scene_Battle < Scene_Base
  35.   #--------------------------------------------------------------------------
  36.   # ● 执行渐变
  37.   #--------------------------------------------------------------------------
  38.   def perform_transition
  39.     super
  40.     Graphics.transition(transition_speed)
  41.     if $swtf != nil
  42.       $swtf.get_bomb
  43.       $swtf=nil
  44.     end
  45.   end
  46. end
复制代码
[/fold]
25、战斗菜单添加一个新选项,选项效果是自己设定的公共事件。
[fold=新战斗选项]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #11横改选项名字 31横改执第几个行公共事件ID
  3. class Window_PartyCommand

  4. alias shijian_make_command_list make_command_list

  5.   def make_command_list

  6.     shijian_make_command_list

  7.     add_command("作战", :shijian)

  8.   end

  9. end

  10. class Scene_Battle

  11. alias shijian_create_party_command_window create_party_command_window

  12.   def create_party_command_window

  13.     shijian_create_party_command_window

  14.     @party_command_window.set_handler(:shijian,  method(:command_shijian))

  15.   end

  16.   def command_shijian

  17.     $game_temp.reserve_common_event(19)

  18.     process_event

  19.     start_party_command_selection

  20.   end

  21. end
复制代码
[/fold]
26、突破装备能力值表示没用过,太强大了!喜欢的可以试试超神的感觉。
[fold=装备属性突破]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #==============================================================================
  3. #    ☆VXAce RGSS3 「装備能力限界突破」☆
  4. #      EnDlEss DREamER
  5. #     URL:[url]http://mitsu-evo.6.ql.bz/[/url]
  6. #     製作者 mitsu-evo
  7. #     Last:2012/1/25
  8. #   武器防具の能力上限「500」を超えて設定する。
  9. #     ▼ 「▼ 素材」に近い位置に挿入。
  10. #==============================================================================
  11. =begin

  12. 1/25:設定能力値が最大HPにしか反映されない現象を修正。


  13. ☆☆☆☆☆☆ 挿入位置 ☆☆☆☆☆☆

  14.   素材の最上部に挿入してください。
  15.   個別武器コマンドや装備拡張:武器拡張追加などのスクリプトよりも上。
  16.   
  17.   
  18. ☆☆☆☆☆☆ 機能説明 ☆☆☆☆☆☆
  19.  
  20.   武器和防具的备注栏
  21.     <物理攻击 9999>  <物理防御 9999>  <魔法攻击 9999>  <魔法防御 9999>
  22.     <敏 捷 值 9999>  <幸 运 值 9999>  <体力上限 9999>  <魔力上限 9999>
  23.   <ATK 9999> <DEF 9999> <MAT 9999> <MDF 9999>
  24.   <AGI 9999> <LUC 9999> <MHP 9999> <MMP 9999>
  25.     等の記述を入れると設定した数値の攻撃力となります。
  26.    
  27.     データベース設定での500上限が物足りないという人用の素材です。
  28.    
  29. =end
  30. $ed_rgss3 = {} if $ed_rgss3 == nil
  31. $ed_rgss3["ed_equip_over_param"] = true
  32.   # メモ欄取得用定数

  33.   EQUIP_MHP_PARAM = /<(?:MHP|体力上限)\s*(\d+)>/i
  34.   EQUIP_MMP_PARAM = /<(?:MMP|魔力上限)\s*(\d+)>/i
  35.   EQUIP_ATK_PARAM = /<(?:ATK|物理攻击)\s*(\d+)>/i
  36.   EQUIP_DEF_PARAM = /<(?:DEF|物理防御)\s*(\d+)>/i
  37.   EQUIP_MAT_PARAM = /<(?:MAT|魔法攻击)\s*(\d+)>/i
  38.   EQUIP_MDF_PARAM = /<(?:MDF|魔法防御)\s*(\d+)>/i
  39.   EQUIP_AGI_PARAM = /<(?:AGI|敏 捷 值)\s*(\d+)>/i
  40.   EQUIP_LUK_PARAM = /<(?:LUC|幸 运 值)\s*(\d+)>/i

  41. module RPG
  42.   class EquipItem < BaseItem
  43.     #--------------------------------------------------------------------------
  44.     # ● パラメータの取得
  45.     #--------------------------------------------------------------------------
  46.     def params
  47.       @params.each_index{|index|
  48.       case index
  49.       when 0
  50.         self.note.each_line { |line|
  51.         @params[0] = $1.to_i if line =~ EQUIP_MHP_PARAM}
  52.       when 1
  53.         self.note.each_line { |line|
  54.         @params[1] = $1.to_i if line =~ EQUIP_MMP_PARAM}
  55.       when 2
  56.         self.note.each_line { |line|
  57.         @params[2] = $1.to_i if line =~ EQUIP_ATK_PARAM}
  58.       when 3
  59.         self.note.each_line { |line|
  60.         @params[3] = $1.to_i if line =~ EQUIP_DEF_PARAM}
  61.       when 4
  62.         self.note.each_line { |line|
  63.         @params[4] = $1.to_i if line =~ EQUIP_MAT_PARAM}
  64.       when 5
  65.         self.note.each_line { |line|
  66.         @params[5] = $1.to_i if line =~ EQUIP_MDF_PARAM}
  67.       when 6
  68.         self.note.each_line { |line|
  69.         @params[6] = $1.to_i if line =~ EQUIP_AGI_PARAM}
  70.       when 7
  71.         self.note.each_line { |line|
  72.         @params[7] = $1.to_i if line =~ EQUIP_LUK_PARAM}
  73.       end
  74.       }
  75.       return @params
  76.     end
  77.   end
  78. end
复制代码
[/fold]
27、有的物品不想要怎么办?那就选择丢弃吧!这个脚本也算是拟补了VA一项必备功能。
[fold=丢弃物品]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #按C键可以选择丢弃物品,不能丢弃贵重物品,按键可以在19横改“R”默认。
  3. #==============================================================================
  4. # ■ VXAce-RGSS3-2 アイテム捨てる [Ver.1.0.0]         by Claimh
  5. #------------------------------------------------------------------------------
  6. #  アイテム画面上でXボタンを押すと、アイテムを捨てることができます。
  7. #==============================================================================


  8. #==============================================================================
  9. # ■ Window_ItemList
  10. #==============================================================================
  11. class Window_ItemList < Window_Selectable
  12.   #--------------------------------------------------------------------------
  13.   # ● 決定やキャンセルなどのハンドリング処理
  14.   #--------------------------------------------------------------------------
  15.   def process_handling
  16.     return unless open? && active
  17.     return call_handler(:append_R)   if handle?(:append_R) && Input.trigger?(:R)
  18.     super
  19.   end
  20. end

  21. #==============================================================================
  22. # ■ Window_ItemNumber
  23. #==============================================================================
  24. class Window_ItemNumber < Window_ShopNumber
  25.   #--------------------------------------------------------------------------
  26.   # ● 公開インスタンス変数
  27.   #--------------------------------------------------------------------------
  28.   attr_reader   :number                   # 入力された個数
  29.   #--------------------------------------------------------------------------
  30.   # ● オブジェクト初期化
  31.   #--------------------------------------------------------------------------
  32.   def initialize
  33.     x = (Graphics.width - window_width) / 2
  34.     super(x, 200, line_height*2 + 32)
  35.     @item = nil
  36.     @max = 1
  37.     @number = 1
  38.   end
  39.   #--------------------------------------------------------------------------
  40.   # ● アイテム、最大個数の設定
  41.   #--------------------------------------------------------------------------
  42.   def set(item, max)
  43.     @item = item
  44.     @max = max
  45.     @number = 1
  46.     refresh
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # ● リフレッシュ
  50.   #--------------------------------------------------------------------------
  51.   def refresh
  52.     contents.clear
  53.     contents.draw_text(0, 0, 200, line_height, "丢弃数:")
  54.     draw_item_name(@item, 4, line_height)
  55.     draw_number
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   # ● アイテム名表示行の Y 座標
  59.   #--------------------------------------------------------------------------
  60.   def item_y
  61.     line_height
  62.   end
  63. end


  64. #==============================================================================
  65. # ■ Scene_Item
  66. #==============================================================================
  67. class Scene_Item < Scene_ItemBase
  68.   #--------------------------------------------------------------------------
  69.   # ● 開始処理
  70.   #--------------------------------------------------------------------------
  71.   alias start_dump start
  72.   def start
  73.     start_dump
  74.     create_item_dump_window
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ● アイテムウィンドウの作成
  78.   #--------------------------------------------------------------------------
  79.   alias create_item_window_dump create_item_window
  80.   def create_item_window
  81.     create_item_window_dump
  82.     @item_window.set_handler(:append_R, method(:on_item_dump))
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # ● アイテム数選択ウィンドウの作成
  86.   #--------------------------------------------------------------------------
  87.   def create_item_dump_window
  88.     @number_window = Window_ItemNumber.new
  89.     @number_window.viewport = @viewport
  90.     @number_window.hide
  91.     @number_window.set_handler(:ok,     method(:on_number_ok))
  92.     @number_window.set_handler(:cancel, method(:on_number_cancel))
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # ● アイテム[捨てる]
  96.   #--------------------------------------------------------------------------
  97.   def on_item_dump
  98.     if item_dumpable?
  99.       Sound.play_ok
  100.       @number_window.set(item, max_item)
  101.       @number_window.show.activate
  102.       @item_window.deactivate
  103.     else
  104.       Sound.play_buzzer
  105.     end
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # ● 個数入力[決定]
  109.   #--------------------------------------------------------------------------
  110.   def on_number_ok
  111.     Sound.play_ok
  112.     do_item_dump(@number_window.number)
  113.     @number_window.hide
  114.     activate_item_window
  115.   end
  116.   #--------------------------------------------------------------------------
  117.   # ● 個数入力[キャンセル]
  118.   #--------------------------------------------------------------------------
  119.   def on_number_cancel
  120.     Sound.play_cancel
  121.     @number_window.hide
  122.     activate_item_window
  123.   end
  124.   #--------------------------------------------------------------------------
  125.   # ● 捨てるの実行
  126.   #--------------------------------------------------------------------------
  127.   def do_item_dump(number)
  128.     $game_party.lose_item(item, number)
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # ● アイテムを捨てる判定
  132.   #--------------------------------------------------------------------------
  133.   def item_dumpable?
  134.     item.is_a?(RPG::Item) ? !item.key_item? : (!item.nil?)
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ● 所持数の取得
  138.   #--------------------------------------------------------------------------
  139.   def max_item
  140.     $game_party.item_number(item)
  141.   end
  142. end
复制代码
[/fold]
28、事件或者角色显示影子,当然!某些事件想不显示影子也可以。
附件
[fold=影子脚本]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #下载附件解压出shadow01.png放到Graphics/Characters文件夹。
  3. #不想显示影子的事件有两种方法:1、事件优先等级在人物下方。2、行走图文件名后面加上(shadow)
  4. =begin
  5. ===============================================================================
  6.   影子 By喵呜喵5
  7. ===============================================================================


  8. 【说明】


  9.   在人物、事件的脚底显示影子
  10.   
  11.   影子的素材直接使用了飞行船的素材
  12.   
  13.   如果不希望某个角色显示影子的话,在行走图文件名里写上(shadow)即可
  14.   
  15. =end
  16. $m5script ||= {};$m5script[:M5Shadow20141206] = 20141206
  17. module M5Shadow20141206
  18. #==============================================================================
  19. #  设定部分
  20. #==============================================================================
  21.   
  22.   X = 0
  23.   
  24.   # 影子的X位置(相对角色)  


  25.   Y = 5
  26.   
  27.   # 影子的Y位置(相对角色)
  28.   
  29.   OPACITY = -20
  30.   
  31.   # 影子的透明度(相对角色)


  32. #==============================================================================
  33. #  设定结束
  34. #==============================================================================
  35. class Sprite_Shadow < Sprite
  36.   def initialize(viewport, character = nil)
  37.     super(viewport)
  38.     @character = character
  39.     set_character_bitmap
  40.     update
  41.   end
  42.   def set_character_bitmap
  43.     self.bitmap = Cache.system("Shadow")
  44.     self.ox = self.bitmap.width / 2
  45.     self.oy = self.bitmap.height   
  46.   end
  47.   def update
  48.     super
  49.     update_visible
  50.     return unless self.visible
  51.     update_position
  52.     update_other
  53.   end
  54.   def update_visible
  55.     self.visible = judge_name
  56.     self.visible = !@character.transparent if self.visible
  57.   end
  58.   def judge_name
  59.     return false if @character.character_name == ""
  60.     return false if @character.character_name =~ /(shadow)/
  61.     true
  62.   end
  63.   def update_position
  64.     self.x = @character.screen_x + X
  65.     self.y = @character.screen_y + Y
  66.     self.z = @character.screen_z - 1
  67.   end
  68.   def update_other
  69.     self.opacity = @character.opacity + OPACITY
  70.     self.blend_type = @character.blend_type
  71.     self.bush_depth = @character.bush_depth
  72.   end
  73. end
  74. end # module M5Shadow20141206
  75. class Spriteset_Map
  76.   alias m5_20141206_create_characters create_characters
  77.   def create_characters
  78.     m5_20141206_create_characters
  79.     @m5_20141206_character_shadow_sprites = []
  80.     array = @m5_20141206_character_shadow_sprites   
  81.     $game_map.events.values.each do |event|
  82.       array.push M5Shadow20141206::Sprite_Shadow.new(@viewport1, event)
  83.     end   
  84.     $game_player.followers.reverse_each do |follower|
  85.       array.push M5Shadow20141206::Sprite_Shadow.new(@viewport1, follower)
  86.     end   
  87.     array.push M5Shadow20141206::Sprite_Shadow.new(@viewport1, $game_player)
  88.   end
  89.   alias m5_20141206_update_characters update_characters
  90.   def update_characters
  91.     m5_20141206_update_characters
  92.     @m5_20141206_character_shadow_sprites.each {|sprite| sprite.update }
  93.   end
  94.   alias m5_20141206_dispose_characters dispose_characters
  95.   def dispose_characters
  96.     m5_20141206_dispose_characters
  97.     @m5_20141206_character_shadow_sprites.each {|sprite| sprite.dispose }
  98.   end  
  99. end
复制代码
[/fold]
29、装备,技能,角色,职业,敌人都更改普通攻击技能ID,比如:装备魔法杖,魔法师的普通攻击变成火球攻击。或者魔法师默认普通攻击就是火球。
[fold=更改普通攻击ID]
  1. #打开脚本编辑器,将脚本插入到main上。
  2. #--------------------------------------------------------------------------
  3. # ● require Taroxd基础设置
  4. #    更改角色/敌人普通攻击/防御的技能ID
  5. #
  6. #    使用方法:
  7. #      在装备/技能/角色/职业/敌人上备注 <attackskill x> / <guardskill x>
  8. #      建议与“战斗指令优化”配合使用。
  9. #--------------------------------------------------------------------------

  10. Taroxd::AttackSkill = true

  11. class RPG::BaseItem
  12.   note_i :attack_skill, false
  13.   note_i :guard_skill,  false
  14. end

  15. class Game_BattlerBase

  16.   def_chain :attack_skill_id do |old|
  17.     note_objects { |item| return item.attack_skill if item.attack_skill }
  18.     old.call
  19.   end

  20.   def_chain :guard_skill_id do |old|
  21.     note_objects { |item| return item.guard_skill if item.guard_skill }
  22.     old.call
  23.   end
  24. end
复制代码
[/fold]
30、菜单添加一个新选项,选项效果是自己设定的公共事件(和第25个脚本差不多一样的效果)。
[fold=新增菜单选项]
  1. #打开脚本编辑器,将脚本插入到main上。
  2. =begin
  3. ===============================================================================
  4.   物品添加到菜单选项中 By喵呜喵5
  5. ===============================================================================

  6. 【说明】

  7.   在菜单选项中添加指定选项,选择该选项即可使用特定的物品
  8.   配合物品使用效果中的“公共事件”以及其他脚本,
  9.   可以很简单的实现添加可执行公共事件的菜单选项的效果

  10. =end
  11. $m5script ||= {};$m5script[:M5IM20150215] = 20150406
  12. module M5IM20150215; LIST = [
  13. #==============================================================================
  14. # 设定部分
  15. #==============================================================================

  16.     ["帐篷", 5, false],         #这里可以修改选项名字,5是使用物品的ID

  17.     # 设置添加的选项,设置的格式为:

  18.     #   [选项的名称, 选择该选项后使用的物品ID, 未持有该物品时的选项状态],

  19.     # 选项的名称前后要加上英文引号
  20.     # 未持有物品时选项状态设置为 true 时,即使未持有特定物品也显示该物品的选项
  21.     # 未持有物品时选项状态设置为 false 时,不显示未持有物品对应的选项
  22.     # 各个设置之间以及每条设置内容之间需要加上英文逗号分隔

  23. #==============================================================================
  24. # 设定结束
  25. #==============================================================================
  26.   ]
  27.   class Scene_ItemTarget < Scene_ItemBase
  28.     attr_reader :actor_window
  29.     attr_writer :item_id
  30.     def initialize(scene)
  31.       super
  32.       @viewport = Viewport.new
  33.       @item_window = scene.instance_variable_get(:@command_window)
  34.       @status_window = scene.instance_variable_get(:@status_window)
  35.     end
  36.     def item; $data_items[@item_id]; end
  37.     def cursor_left?; true; end
  38.     def play_se_for_item; Sound.play_use_item; end
  39.     def show_sub_window(window)
  40.       super(window)
  41.       @status_window.hide if @status_window
  42.     end
  43.     def hide_sub_window(window)
  44.       super(window)
  45.       @item_window.height = @item_window.window_height
  46.       @item_window.create_contents
  47.       @item_window.refresh
  48.       @status_window.show.refresh if @status_window
  49.     end
  50.     def use_item
  51.       super
  52.       on_actor_cancel
  53.     end
  54.   end
  55. end
  56. class Window_MenuCommand
  57.   alias m5_20150215_add_original_commands add_original_commands
  58.   def add_original_commands
  59.     m5_20150215_add_original_commands
  60.     M5IM20150215::LIST.each do |item|
  61.       name = "m520150215im#{item[1]}".to_sym
  62.       has = $game_party.has_item?($data_items[item[1]])
  63.       if item[2] then add_command(item[0], name, has)
  64.       else add_command(item[0], name) if has
  65.       end
  66.     end
  67.   end
  68. end
  69. class Scene_Menu
  70.   alias m5_20150215_start start
  71.   def start
  72.     m5_20150215_start
  73.     @m520150215SA = M5IM20150215::Scene_ItemTarget.new(self)
  74.     @m520150215SA.create_actor_window
  75.     @m520150215SA.actor_window.hide.deactivate   
  76.     M5IM20150215::LIST.each do |item|
  77.       name = "m520150215im#{item[1]}".to_sym
  78.       proc = Proc.new {
  79.         @m520150215SA.item_id = item[1]
  80.         @m520150215SA.determine_item
  81.       }
  82.       @command_window.set_handler(name, proc)
  83.     end
  84.   end
  85.   alias m5_20150215_update update
  86.   def update
  87.     m5_20150215_update
  88.     @m520150215SA.actor_window.update
  89.   end
  90.   alias m5_20150215_terminate terminate
  91.   def terminate
  92.     m5_20150215_terminate   
  93.     @m520150215SA.actor_window.dispose
  94.     @m520150215SA.dispose_main_viewport
  95.   end
  96. end
复制代码
[/fold]
31、这个脚本涉及到的东西很广,自己灵活运用。
[fold=隐藏物品/装备/技能]
  1. #打开脚本编辑器,将脚本插入到main上。
  2. =begin
  3. ===============================================================================
  4.   隐藏物品/装备/技能 By 喵呜喵5
  5. ===============================================================================

  6. 【说明】

  7.   在物品/装备/技能的数据库备注栏中输入“<hide>”(不包括双引号)
  8.   
  9.   实际游戏时即使玩家获得了这个物品/装备/技能玩家也无法在游戏中看到

  10. =end
  11. #==============================================================================
  12. #  脚本部分
  13. #==============================================================================
  14. $m5script ||= {};raise("需要喵呜喵5基础脚本的支持") unless $m5script[:M5Base]
  15. $m5script[:M5HI20150131] = 20150131;M5script.version(20150129)
  16. class Window_ItemList
  17.   alias m5_20150131_include? include?
  18.   def include?(item)
  19.     return false if item && item.m5note("hide",false,false)
  20.     return m5_20150131_include?(item)
  21.   end
  22. end
  23. class Window_SkillList
  24.   alias m5_20150131_include? include?
  25.   def include?(item)
  26.     return false if item && item.m5note("hide",false,false)
  27.     return m5_20150131_include?(item)
  28.   end
  29. end
  30. class Window_EquipItem
  31.   alias m5_20150131_include? include?
  32.   def include?(item)
  33.     return false if item && item.m5note("hide",false,false)
  34.     return m5_20150131_include?(item)
  35.   end
  36. end
  37. class Window_BattleItem
  38.   alias m5_20150131_include? include?
  39.   def include?(item)
  40.     return false if item && item.m5note("hide",false,false)
  41.     return m5_20150131_include?(item)
  42.   end
  43. end
复制代码
[/fold]
32、得失物品自动提示功能很多人会用到。
[fold=得失物品自动提示]
  1. #打开脚本编辑器,将脚本插入到main上。
  2. #==============================================================================
  3. # 本腳本來自www.66RPG.com,使用和轉載請保留此信息
  4. #==============================================================================

  5. # 注意!!!在對話後得到物品,請在對話後先用事件等待3幀,否則對話框來不及消失。

  6. # 開關定義:

  7. $noshowgold = 41                        # 不显示金钱得失

  8. $noshowitem = 42                        # 不显示物品得失

  9. $noshowweapon = 43                      # 不显示武器得失

  10. $noshowarmor = 44                       # 不显示防具得失
  11. # 以上開關,當打開的時候,獲得物品將不會提示,比如默認打開41號開關,獲得金錢不再提示

  12. # 不想提示等级升降时,就在事件命令直接选择是否显示就行了。

  13. #——聲效,可以自己改
  14. folder = "Audio/SE/"
  15. $gain_gold_se   = folder +"Shop"      # 获得金钱声效
  16. $loss_gold_se   = folder +"Blow2"     # 失去金钱声效

  17. $gain_item_se   = folder +"Item1"     # 获得物品声效
  18. $loss_item_se   = folder +"Blow2"     # 失去物品声效

  19. $gain_weapon_se = folder +"Item1"     # 获得武器声效
  20. $loss_weapon_se = folder +"Blow2"     # 失去武器声效

  21. $gain_armor_se  = folder +"Item1"     # 获得防具声效
  22. $loss_armor_se  = folder +"Blow2"     # 失去防具声效

  23. $gain_lv_se     = folder +"Item1"     # 提升等级声效
  24. $loss_lv_se     = folder +"Blow2"     # 降低等级声效

  25. # ————————————————————————————————————

  26. class Game_Interpreter
  27.   #--------------------------------------------------------------------------
  28.   # ● 增減金錢
  29.   #--------------------------------------------------------------------------
  30.   def command_125
  31.     value = operate_value(@params[0], @params[1], @params[2])
  32.     $game_party.gain_gold(value)
  33.     if $game_switches[$noshowgold]==false
  34.       show_gain_window(0, value)
  35.     end
  36.     return true
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ● 增減物品
  40.   #--------------------------------------------------------------------------
  41.   def command_126
  42.     value = operate_value(@params[1], @params[2], @params[3])
  43.     $game_party.gain_item($data_items[@params[0]], value)
  44.     if $game_switches[$noshowitem]==false
  45.       show_gain_window(1, value)
  46.     end
  47.     $game_map.need_refresh = true
  48.     return true
  49.   end
  50.   #--------------------------------------------------------------------------
  51.   # ● 增減武器
  52.   #--------------------------------------------------------------------------
  53.   def command_127
  54.     value = operate_value(@params[1], @params[2], @params[3])
  55.     $game_party.gain_item($data_weapons[@params[0]], value, @params[4])
  56.     if $game_switches[$noshowweapon]==false
  57.       show_gain_window(2, value)
  58.     end
  59.     return true
  60.   end
  61.   #--------------------------------------------------------------------------
  62.   # ● 增減防具
  63.   #--------------------------------------------------------------------------
  64.   def command_128
  65.     value = operate_value(@params[1], @params[2], @params[3])
  66.     $game_party.gain_item($data_armors[@params[0]], value, @params[4])
  67.     if $game_switches[$noshowarmor]==false
  68.       show_gain_window(3, value)
  69.     end
  70.     return true
  71.   end
  72.   def show_gain_window(type, value)
  73.     snstar2006_66rpg_item = $data_armors[@params[0]]
  74.     snstar2006_66rpg = Window_Base.new((640-300)/2,128,200,100)
  75.     snstar2006_66rpg.contents = Bitmap.new(snstar2006_66rpg.width - 32, snstar2006_66rpg.height - 32)
  76.     if value >= 0
  77.       gain_text = "获得"   
  78.     else
  79.       gain_text = "失去"
  80.     end
  81.    
  82.     case type
  83.     when 0
  84.       gain_type = "金钱"
  85.       if value >=0
  86.         Audio.se_play($gain_gold_se,80,100)
  87.       else
  88.         Audio.se_play("Audio/SE/"+"Item1",80,100)
  89.       end
  90.     when 1
  91.       gain_type = "物品"
  92.       string = $data_items[@params[0]]
  93.       if value >=0
  94.         Audio.se_play($gain_item_se,80,100)
  95.       else
  96.         Audio.se_play($loss_item_se,80,100)
  97.       end
  98.     when 2
  99.       gain_type = "武器"
  100.       string = $data_weapons[@params[0]]
  101.       if value >=0
  102.         Audio.se_play($gain_weapon_se,80,100)
  103.       else
  104.         Audio.se_play($loss_weapon_se,80,100)
  105.       end
  106.     when 3
  107.       gain_type = "防具"
  108.       string = $data_armors[@params[0]]
  109.       if value >=0
  110.         Audio.se_play($gain_armor_se,80,100)
  111.       else
  112.         Audio.se_play($loss_armor_se,80,100)
  113.       end
  114.     end
  115.    
  116.     snstar2006_66rpg.contents.draw_text(0,0,160,30,gain_text+gain_type+":")
  117.    
  118.     unless type == 0
  119.       snstar2006_66rpg.draw_item_name(string, 0, 30, true)
  120.       snstar2006_66rpg.contents.draw_text(0, 30, 160, 30, "×"+value.abs.to_s, 2)
  121.     else
  122.       snstar2006_66rpg.contents.draw_text(0,30,165,30,value.abs.to_s + "  "+ Vocab.currency_unit, 2)
  123.     end
  124.    
  125.     snstar2006_66rpg.opacity = 160
  126.    
  127.     for i in 0..50
  128.       Graphics.update
  129.     end
  130.    
  131.     for i in 0..10
  132.       snstar2006_66rpg.opacity -= 10
  133.       snstar2006_66rpg.contents_opacity -= 10
  134.       Graphics.update
  135.     end
  136.    
  137.     snstar2006_66rpg.dispose
  138.    
  139.   end

  140.   def show_gain_level_window(actor,value)
  141.     lvstring = Vocab::level
  142.         
  143.     snstar2006_66rpg = Window_Base.new((640-300)/2,128,200,100)
  144.     snstar2006_66rpg.contents = Bitmap.new(snstar2006_66rpg.width - 30, snstar2006_66rpg.height - 30)
  145.    
  146.     if value >= 0
  147.       gain_text = "提升"
  148.       Audio.se_play($gain_lv_se,80,100)
  149.     else
  150.       gain_text = "降低"
  151.       Audio.se_play($loss_lv_se,80,100)
  152.     end
  153.    
  154.     snstar2006_66rpg.contents.draw_text(0, 0, 110, 30, actor.name)
  155.     string = lvstring+gain_text+value.abs.to_s+"级"
  156.     snstar2006_66rpg.contents.draw_text(0,30,160,30,string, 2)

  157.     snstar2006_66rpg.opacity = 160
  158.    
  159.     for i in 0..50
  160.       Graphics.update
  161.     end
  162.    
  163.     for i in 0..10
  164.       snstar2006_66rpg.opacity -= 10
  165.       snstar2006_66rpg.contents_opacity -= 10
  166.       Graphics.update
  167.     end
  168.    
  169.     snstar2006_66rpg.dispose

  170.   end
  171. end


  172. #==============================================================================
  173. # 本腳本來自www.66RPG.com,使用和轉載請保留此信息
  174. #==============================================================================
复制代码
[/fold]
33、消耗变量购买物品,可配合第二货币脚本使用。
[fold=变量商店]
  1. #打开脚本编辑器,将脚本插入到main上。
  2. =begin
  3. ===============================================================================
  4.   变量商店 By喵呜喵5
  5. ===============================================================================

  6. 【说明】

  7.   可以使用变量在商店进行购物

  8.   首先先在事件中使用脚本命令输入

  9.   m5_20160528_shop(变量的ID,"变量的名称")

  10.   例如:m5_20160528_shop(1,"节操")

  11.   若事件指令中下一条指令为商店处理,则进入商店时购买物品消耗的是对应的变量

  12. =end
  13. $m5script ||= {}; $m5script[:M5VS20160528] = 20160528
  14. module M5VS20160528
  15. #==============================================================================
  16. #  设定部分
  17. #==============================================================================

  18.   EQUAL = false

  19.   # 设置为 true 时,变量商店物品的出售价格为【数据库中】物品售价的一半
  20.   # 设置为 false 时,变量商店物品的出售价格为【该商店】物品售价的一半
  21.   # (一般来说,个人建议将变量商店请设置为只允许购买)

  22. #==============================================================================
  23. #  设定结束
  24. #==============================================================================
  25.   def self.init; set(0, nil); end
  26.   def self.gold; @data[0]; end
  27.   def self.unit; @data[1]; end
  28.   def self.set(gold, unit); @data = [gold, unit]; end
  29.   def self.work(&block)
  30.     origin_gold = $game_party.gold
  31.     $game_party.m5_20160528_set_gold($game_variables[gold]) if unit
  32.     block.call
  33.     return unless unit
  34.     $game_variables[gold] = $game_party.gold
  35.     $game_party.m5_20160528_set_gold(origin_gold)
  36.   end
  37. end
  38. M5VS20160528.init
  39. class Game_Interpreter
  40.   def m5_20160528_shop(gold, unit)
  41.     return unless next_event_code == 302
  42.     M5VS20160528.set(gold, unit)
  43.     @index += 1
  44.     execute_command
  45.     M5VS20160528.init
  46.   end
  47. end
  48. class Window_Gold
  49.   alias m5_20160528_value value
  50.   def value
  51.     M5VS20160528.unit ? $game_variables[M5VS20160528.gold] : m5_20160528_value
  52.   end
  53.   alias m5_20160528_unit currency_unit
  54.   def currency_unit; M5VS20160528.unit || m5_20160528_unit; end
  55. end
  56. class Game_Party; def m5_20160528_set_gold(gold); @gold = gold; end; end
  57. class Scene_Shop
  58.   alias m5_20140318_do_buy do_buy
  59.   def do_buy(number); M5VS20160528.work{ m5_20140318_do_buy(number) }; end
  60.   alias m5_20140318_do_sell do_sell
  61.   def do_sell(number); M5VS20160528.work{ m5_20140318_do_sell(number) }; end
  62.   alias m5_20140318_selling_price selling_price
  63.   def selling_price
  64.     return m5_20140318_selling_price unless M5VS20160528.unit
  65.     return m5_20140318_selling_price if M5VS20160528::EQUAL
  66.     p = buying_price || 0
  67.     p / 2
  68.   end
  69. end
复制代码
[/fold]
34、新货币,显示的是某项变量,也可以不当货币看待。
[fold=第二货币]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #41横可以修改显示变量的ID,44横可修改货币名字。
  3. #=============================================================================

  4. #  第二货币   by 子弹君

  5. #=============================================================================

  6. #=============================================================================

  7. #说明:

  8. #在菜单里显示一个第二货币的窗口。

  9. #=============================================================================

  10. $BombScript ||= {};$BombScript["第二货币"] = "第二货币20140919"

  11. #=============================================================================

  12. #  设定部分

  13. #=============================================================================

  14. module BOMB

  15.   module DEHB

  16.   BOMB_X = 0

  17. # 调整窗口的X坐标

  18.   BOMB_Y = 325

  19. # 调整窗口的X坐标

  20.   BOMB_VAL = 14

  21. # 设置一个变量,等于货币的数量

  22.   BOMB_STH = 5

  23. # 设置一个开关,开启时第二货币窗口打开,关闭时关闭。
  24.   BOMB_CU = "G"

  25. # 这里设置货币的单位

  26.   end

  27. end

  28. class BOMB_Gold < Window_Base

  29.   #--------------------------------------------------------------------------

  30.   # ● 初始化对象

  31.   #--------------------------------------------------------------------------

  32.   def initialize

  33.     super(0, 0, window_width, fitting_height(1))

  34.     refresh

  35.   end

  36.   #--------------------------------------------------------------------------

  37.   # ● 获取窗口的宽度

  38.   #--------------------------------------------------------------------------

  39.   def window_width

  40.     return 160

  41.   end

  42.   #--------------------------------------------------------------------------

  43.   # ● 刷新

  44.   #--------------------------------------------------------------------------

  45.   def refresh

  46.     contents.clear
  47.     draw_icon(3782,0,0)
  48.     draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)

  49.   end

  50.   #--------------------------------------------------------------------------

  51.   # ● 获取货币单位

  52.   #--------------------------------------------------------------------------

  53.   def currency_unit

  54.     return BOMB::DEHB::BOMB_CU

  55.   end
  56. #--------------------------------------------------------------------------

  57.   # ● 获取持有金钱

  58.   #--------------------------------------------------------------------------

  59.   def value

  60.     $game_variables[BOMB::DEHB::BOMB_VAL]

  61.   end
  62.   #--------------------------------------------------------------------------

  63.   # ● 打开窗口

  64.   #--------------------------------------------------------------------------

  65.   def open

  66.     refresh

  67.     super

  68.   end

  69. end

  70. class Scene_Menu < Scene_MenuBase

  71.   #--------------------------------------------------------------------------

  72.   # ● 生成金钱窗口

  73.   #--------------------------------------------------------------------------

  74. alias bomb2014919start start

  75.   def start

  76.     bomb2014919start

  77.     create_bomb_window if
  78.     $game_switches[BOMB::DEHB::BOMB_STH] == true

  79.   end

  80.   def create_bomb_window

  81.     @bomb_window = BOMB_Gold.new

  82.     @bomb_window.x = BOMB::DEHB::BOMB_X

  83.     @bomb_window.y = BOMB::DEHB::BOMB_Y

  84.   end

  85. end
复制代码
[/fold]
35、在默认战斗界面中显示角色的脸图,虽然不是显示全脸,但也足够了。
[fold=战斗显示脸图]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #==============================================================================
  3. # F03 - 战斗显示脸图 - By芙蕾娅
  4. #------------------------------------------------------------------------------
  5. #  ★ - 新增  ☆ - 修改  ■ - 删除 ● - 无变更
  6. #==============================================================================
  7. # ■ Window_BattleStatus
  8. #------------------------------------------------------------------------------
  9. #  战斗画面中,显示“队伍成员状态”的窗口。
  10. #==============================================================================
  11. class Window_BattleStatus < Window_Selectable
  12.   #--------------------------------------------------------------------------
  13.   # ☆ 绘制角色战斗用肖像图
  14.   #     enabled : 有效的标志。false 的时候使用半透明效果绘制
  15.   #--------------------------------------------------------------------------
  16.   def draw_face(face_name, face_index, x, y, enabled = true)
  17.     bitmap = Cache.face(face_name)
  18.     rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96 + 32, 96, 22)
  19.     contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  20.     bitmap.dispose
  21.   end
  22.   #--------------------------------------------------------------------------
  23.   # ☆ 绘制基本区域
  24.   #--------------------------------------------------------------------------
  25.   def draw_basic_area(rect, actor)
  26.     draw_actor_face(actor, rect.x, rect.y + 1)
  27.     contents.font.size = 16
  28.     draw_actor_name(actor, rect.x, rect.y + 4, 100)
  29.     contents.font.size = Font.default_size
  30.     draw_actor_icons(actor, rect.x + 104, rect.y, rect.width - 104)
  31.   end
  32. end
复制代码
[/fold]
36、战斗菜单添加一个查看状态的选项。
[fold=战斗中查看状态]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #==============================================================================
  3. # ■ RGSS3 状況確認コマンド Ver1.05 by 星潟
  4. #------------------------------------------------------------------------------
  5. # RPGツクールVXAceでは、現在のステートや強化/弱体の表示数が
  6. # 著しく制限されており、非常に確認し辛いです。
  7. #
  8. # しかし、状況確認コマンドではステートを22個、強化/弱体も全て表示されます。
  9. #
  10. # パーティコマンドに、敵味方の現在能力値やステート/強化/弱体の状態を
  11. # 確認する為の新規コマンドを追加します。
  12. # 最初はアクターを表示し、LボタンかRボタンを押すことで
  13. # エネミーに表示を切り替えます。
  14. # アクターかエネミーを指定して決定キーを押すことで詳細表示を行います。
  15. # 詳細表示中に更に決定キーを押すと、属性耐性とステート耐性が表示されます。
  16. #
  17. # エネミーを表示しない機能や、詳細を表示せず
  18. # ステート/強化/弱体の確認に留めさせる設定も可能です。
  19. #
  20. # テストモードでの利用に限定する事も可能です。
  21. #------------------------------------------------------------------------------
  22. # Ver1.01 %表示に関する設定や、属性/ステート耐性の表示機能が追加されました。
  23. # Ver1.02 操作性を向上させました。
  24. # Ver1.03 隠れている敵を表示しないようにする機能を追加しました。
  25. # Ver1.04 詳細モードで敵のHPが表示限界でも見えてしまう不具合を修正しました。
  26. #         また、表示限界の適用を敵のみにする機能を追加しました。
  27. # Ver1.05 システム側のTP表示設定が無効化されていてもTPが表示される不具合を修正。
  28. #==============================================================================
  29. module B_CONFIRM

  30.   #テストモード限定化するか否かを設定します。
  31.   #(trueで限定化/falseで常時使用可)

  32.   TONLY = false

  33.   #状況確認コマンドの名称を取得します。

  34.   WORD1 = "状态"

  35.   #ステート表示用の項目名を取得します。

  36.   WORD2 = "状态"

  37.   #強化/弱体表示用の項目名を取得します。

  38.   WORD3 = ""

  39.   #背景透過度を設定します。

  40.   BOPAC = 255

  41.   #控えメンバーも表示するかどうかを設定します。
  42.   #(trueで表示/falseで非表示)

  43.   PTMT = true

  44.   #メンバーの詳細情報を表示するかどうかを設定します。
  45.   #(trueで表示/falseで非表示)

  46.   PTDT = true

  47.   #ページ切り替えで敵も表示するかどうかを設定します。
  48.   #(trueで表示/falseで非表示)

  49.   TROK = true

  50.   #敵の詳細情報を表示するかどうかを設定します。
  51.   #(trueで表示/falseで非表示)

  52.   TRDT = true

  53.   #隠れている敵も表示するかどうかを指定します。

  54.   HIDE = false

  55.   #HP/MP/TPの表示限界値を設定します。
  56.   #この値を以上の値となった時はTEXTの文字列を表示します。

  57.   OVER = 10000

  58.   #HP/MP/TPが表示限界値に達した際に、代わりに表示する文字列を設定します。

  59.   TEXT = "?????"

  60.   #表示限界に達した際に代わりに表示するのは敵のみにするかを設定します。
  61.   #trueで敵のみ、falseで双方となります。

  62.   EN_O = true

  63.   #2ページ目を有効にするか否かを設定します。
  64.   #(trueで有効/falseで無効)

  65.   P2   = true

  66.   #詳細情報での追加能力値の表示設定を行います。
  67.   #[追加能力値ID(0~9の数字), 追加能力値名称(文字列), 敵も表示するか否か(true/false)]で
  68.   #1セットとなっています。

  69.   XPRM = [
  70.   [0, "命中率", true],
  71.   [1, "物理回避", true],
  72.   [2, "必杀率", true],
  73.   [3, "暴击回避", true],
  74.   [4, "魔法回避", true],
  75.   [5, "魔法反射", true],
  76.   [6, "反击率", true],
  77.   [7, "HP再生率", true],
  78.   [8, "MP再生率", true],
  79.   [9, "TP再生率", true]
  80.   ]

  81.   #追加能力値の後に%の文字を付けるか否かを設定します。
  82.   #(trueで有効/falseで無効)

  83.   ADP  = false

  84.   #詳細情報での特殊能力値の表示設定を行います。
  85.   #[特殊能力値ID(0~9の数字), 特殊能力値名称(文字列), 敵も表示するか否か(true/false)]で
  86.   #1セットとなっています。

  87.   SPRM = [
  88.   [0, "敌人目标", false],
  89.   [1, "防御効果", false],
  90.   [2, "回復効果", false],
  91.   [3, "药的知识", false],
  92.   [4, "MP消耗率", false],
  93.   [5, "TP补充率", false],
  94.   [6, "物攻抗性", false],
  95.   [7, "魔法抗性", false],
  96.   [9, "经验加成", false]
  97.   ]

  98.   #特殊能力値の後に%の文字を付けるか否かを設定します。
  99.   #(trueで有効/falseで無効)

  100.   SPP  = false

  101.   #詳細情報での属性有効度の表示設定を行います。
  102.   #[属性ID, 属性名の後に付ける文字(文字列),
  103.   #敵も表示するか否か(true/false),
  104.   #100から該当の値を引いた数で表示するかを否か,
  105.   #数字の後に付ける文字(文字列)]で
  106.   #1セットとなっています。

  107.   ELEM = [
  108.   [3, "抗性", true, true],
  109.   [4, "抗性", true, true],
  110.   [5, "抗性", true, true],
  111.   [6, "抗性", true, true],
  112.   [7, "抗性", true, true],
  113.   [8, "抗性", true, true],
  114.   [9, "抗性", true, true],
  115.   [10, "抗性", true, true],
  116.   ]

  117.   #属性有効度の後に%の文字を付けるか否かを設定します。
  118.   #(trueで有効/falseで無効)

  119.   ELP  = false

  120.   #1行目に表示するステートの最大数を指定します。
  121.   #(2行目までしか想定していません)

  122.   MAX  = 11

  123.   #詳細情報でのステート有効度の表示設定を行います。
  124.   #[ステートID(0~-7で指定した場合は、絶対数の値の弱体有効度ID),
  125.   #ステート名の後に付ける文字(文字列), 敵も表示するか否か(true/false),
  126.   #100から該当の値を引いた数で表示するかを否か]で
  127.   #1セットとなっています。

  128.   STAT = [
  129.   [1, "抗性", true, true],
  130.   [2, "抗性", true, true],
  131.   [3, "抗性", true, true],
  132.   [4, "抗性", true, true],
  133.   [5, "抗性", true, true],
  134.   [6, "抗性", true, true],
  135.   [7, "抗性", true, true],
  136.   [8, "抗性", true, true],
  137.   ]

  138.   #ステート有効度の後に%の文字を付けるか否かを設定します。
  139.   #(trueで有効/falseで無効)

  140.   STP  = false

  141. end

  142. #テストモード限定化されており、なおかつテストモードの場合か
  143. #テストモード限定化されていない場合は処理を行う。

  144. if (B_CONFIRM::TONLY && ($TEST or $BTEST)) or !B_CONFIRM::TONLY

  145. class Game_Troop < Game_Unit
  146.   def unhidden_members
  147.     B_CONFIRM::HIDE ? members : members.select {|e| !e.hidden?}
  148.   end
  149. end
  150. class Game_Temp
  151.   attr_accessor :b_confirm_limit_flag
  152. end
  153. class Window_Base < Window
  154.   alias draw_current_and_max_values_overnumber draw_current_and_max_values
  155.   def draw_current_and_max_values(x, y, width, current, max, color1, color2)

  156.     #状況確認ウィンドウである場合のみ
  157.     #現在値と最大値を必要に応じて読み替える。

  158.     if (self.is_a?(Window_B_Confirm) or self.is_a?(Window_B_Confirm_Detail)) && $game_temp.b_confirm_limit_flag
  159.       current = B_CONFIRM::TEXT if current >= B_CONFIRM::OVER
  160.       max = B_CONFIRM::TEXT if max >= B_CONFIRM::OVER
  161.     end

  162.     #本来の処理を実行する。

  163.     draw_current_and_max_values_overnumber(x, y, width, current, max, color1, color2)
  164.   end
  165. end
  166. class Window_PartyCommand < Window_Command
  167.   #--------------------------------------------------------------------------
  168.   # コマンドリストの作成
  169.   #--------------------------------------------------------------------------
  170.   alias make_command_list_b_confirm make_command_list
  171.   def make_command_list

  172.     #本来の処理を実行する。

  173.     make_command_list_b_confirm

  174.     #状況確認コマンドを追加する。

  175.     add_command(B_CONFIRM::WORD1,  :b_confirm)
  176.   end
  177. end
  178. class Window_B_Confirm < Window_Selectable
  179.   attr_accessor :end_flag
  180.   attr_accessor :display_mode
  181.   attr_accessor :last_actor
  182.   def initialize(x, y, type, actor = nil)

  183.     #各種データを取得する。

  184.     @display_mode = type
  185.     @last_actor = actor
  186.     @end_flag = false

  187.     #ウィンドウを作成する。

  188.     super(x, y, window_width, window_height)

  189.     #背景透過度を設定する。

  190.     self.back_opacity = B_CONFIRM::BOPAC

  191.     activate

  192.     self.index = 0

  193.     #描写を行う。

  194.     refresh

  195.   end
  196.   #--------------------------------------------------------------------------
  197.   # フレーム更新
  198.   #--------------------------------------------------------------------------
  199.   def update

  200.     #ウィンドウを閉じている最中は何もしない。

  201.     return if @end_flag

  202.     super

  203.     return if !self.active

  204.     if Input.trigger?(:B)#キャンセルキーを押した場合

  205.       #キャンセルのSEを鳴らす。

  206.       Sound.play_cancel

  207.       @end_flag = true
  208.       @last_actor = nil
  209.       @display_mode = 2

  210.     elsif Input.trigger?(:C)#決定キーを押した場合

  211.       #バトラーが指定されていない場合はウィンドウを閉じる。
  212.       #バトラーが指定されている場合はウィンドウを切り替える。
  213.       case @display_mode
  214.       when 0
  215.         actor = B_CONFIRM::PTMT ? $game_party.all_members[index] : $game_party.members[index]
  216.       when 1
  217.         actor = $game_troop.unhidden_members[index]
  218.       end

  219.       #バトラーがアクターであり、なおかつアクターの詳細表示が可能な場合
  220.       #あるいはバトラーがエネミーであり、なおかつエネミーの詳細表示が可能な場合続行。

  221.       return if actor.actor? && !B_CONFIRM::PTDT
  222.       return if !actor.actor? && !B_CONFIRM::TRDT

  223.       #OKのSEを鳴らす。

  224.       Sound.play_ok

  225.       @end_flag = true
  226.       @last_actor = actor

  227.     elsif (Input.trigger?(:L) or Input.trigger?(:R)) && B_CONFIRM::TROK

  228.       #カーソルのSEを鳴らす。

  229.       Sound.play_cursor

  230.       #ウィンドウを作り直す準備を行う。

  231.       @end_flag = true
  232.       @last_actor = nil
  233.       @display_mode = @display_mode == 0 ? 1 : 0

  234.     end
  235.   end
  236.   #--------------------------------------------------------------------------
  237.   # ウィンドウ幅の取得
  238.   #--------------------------------------------------------------------------
  239.   def window_width
  240.     Graphics.width
  241.   end
  242.   #--------------------------------------------------------------------------
  243.   # ウィンドウ高さの取得
  244.   #--------------------------------------------------------------------------
  245.   def window_height
  246.     Graphics.height
  247.   end
  248.   #--------------------------------------------------------------------------
  249.   # 項目数の取得
  250.   #--------------------------------------------------------------------------
  251.   def item_max

  252.     #バトラーが指定されていない場合は項目数は1個にする。

  253.     return 1 if @last_actor != nil

  254.     #アクターかエネミーのどちらを表示するかで処理を分岐し
  255.     #それぞれ設定に適した値を返す。

  256.     case @display_mode
  257.     when 0
  258.       B_CONFIRM::PTMT ? $game_party.all_members.size : $game_party.members.size
  259.     when 1
  260.       $game_troop.unhidden_members.size
  261.     end
  262.   end
  263.   #--------------------------------------------------------------------------
  264.   # 項目の高さを取得
  265.   #--------------------------------------------------------------------------
  266.   def item_height
  267.     (height - standard_padding * 2) / 4
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # 項目の描画
  271.   #--------------------------------------------------------------------------
  272.   def draw_item(index)

  273.     #バトラーが指定されているか否かで処理を分岐。

  274.     if @last_actor == nil

  275.       #アクターかエネミーのどちらを表示するかで設定に応じて処理を分岐。

  276.       case @display_mode
  277.       when 0
  278.         actor = B_CONFIRM::PTMT ? $game_party.all_members[index] : $game_party.members[index]
  279.       when 1
  280.         actor = $game_troop.unhidden_members[index]
  281.       end

  282.       #項目の矩形を取得。

  283.       rect = item_rect(index)

  284.       #項目内のデータを描写していく。

  285.       $game_temp.b_confirm_limit_flag = (!B_CONFIRM::EN_O or (B_CONFIRM::EN_O && @display_mode == 1))
  286.       draw_actor_name(actor, rect.x, rect.y)
  287.       draw_actor_hp(actor, rect.x + 4, rect.y + line_height * 1)
  288.       draw_actor_mp(actor, rect.x + 4, rect.y + line_height * 2)
  289.       draw_actor_tp(actor, rect.x + 4, rect.y + line_height * 3) if $data_system.opt_display_tp
  290.       self.contents.font.color = system_color
  291.       draw_text(rect.x + 150, rect.y + line_height * 1, 96, line_height, B_CONFIRM::WORD2)
  292.       draw_text(rect.x + 150, rect.y + line_height * 3, 96, line_height, B_CONFIRM::WORD3)
  293.       self.contents.font.color = normal_color
  294.       icons_width = (rect.width - rect.x - 150 - 96) / 24
  295.       icons = (actor.state_icons)[0, icons_width]
  296.       icons.each_with_index {|n, i| draw_icon(n, rect.x + 246 + 24 * i, rect.y + line_height * 1) }
  297.       icons = (actor.state_icons)[icons_width, icons_width * 2]
  298.       icons.each_with_index {|n, i| draw_icon(n, rect.x + 246 + 24 * i, rect.y + line_height * 2) } if icons != nil
  299.       icons = (actor.buff_icons)[0, icons_width]
  300.       icons.each_with_index {|n, i| draw_icon(n, rect.x + 246 + 24 * i, rect.y + line_height * 3) }

  301.     end
  302.   end
  303.   #--------------------------------------------------------------------------
  304.   # 決定ボタンが押されたときの処理(邪魔なので消す)
  305.   #--------------------------------------------------------------------------
  306.   def process_ok
  307.   end
  308.   #--------------------------------------------------------------------------
  309.   # キャンセルボタンが押されたときの処理(邪魔なので消す)
  310.   #--------------------------------------------------------------------------
  311.   def process_cancel
  312.   end
  313.   #--------------------------------------------------------------------------
  314.   # Lボタンが押されたときの処理(邪魔なので消す)
  315.   #--------------------------------------------------------------------------
  316.   def process_pageup
  317.   end
  318.   #--------------------------------------------------------------------------
  319.   # Rボタンが押されたときの処理(邪魔なので消す)
  320.   #--------------------------------------------------------------------------
  321.   def process_pagedown
  322.   end
  323. end

  324. class Window_B_Confirm_Detail < Window_Base
  325.   attr_accessor :window_b_confirm
  326.   attr_accessor :end_flag
  327.   #--------------------------------------------------------------------------
  328.   # 初期化
  329.   #--------------------------------------------------------------------------
  330.   def initialize(window_b_confirm)
  331.     @page_data = 0
  332.     @window_b_confirm = window_b_confirm
  333.     @end_flag = false
  334.     super(0, 0, window_width, window_height)

  335.     #背景透過度を設定する。

  336.     self.back_opacity = B_CONFIRM::BOPAC

  337.     refresh
  338.   end
  339.   #--------------------------------------------------------------------------
  340.   # ウィンドウ幅の取得
  341.   #--------------------------------------------------------------------------
  342.   def window_width
  343.     Graphics.width
  344.   end
  345.   #--------------------------------------------------------------------------
  346.   # ウィンドウ高さの取得
  347.   #--------------------------------------------------------------------------
  348.   def window_height
  349.     Graphics.height
  350.   end
  351.   #--------------------------------------------------------------------------
  352.   # フレーム更新
  353.   #--------------------------------------------------------------------------
  354.   def update
  355.     super
  356.     if Input.trigger?(:B)#キャンセルキーを押した場合

  357.       #キャンセルのSEを鳴らす。

  358.       Sound.play_cancel
  359.       @end_flag = true

  360.     elsif page_change?   #決定キー、左右キー、LRボタンを押した場合

  361.       Sound.play_cursor
  362.       @page_data = @page_data == 0 ? 1 : 0
  363.       contents.clear
  364.       refresh

  365.     end
  366.   end
  367.   #--------------------------------------------------------------------------
  368.   # ページ切り替えを行うか?
  369.   #--------------------------------------------------------------------------
  370.   def page_change?
  371.     flag = false
  372.     [:C, :L, :R, :LEFT, :RIGHT].each {|k|flag = true if Input.trigger?(k)}
  373.     flag
  374.   end
  375.   #--------------------------------------------------------------------------
  376.   # リフレッシュ
  377.   #--------------------------------------------------------------------------
  378.   def refresh
  379.     #バトラーを取得。

  380.     actor = @window_b_confirm.last_actor

  381.     #項目内のデータを描写していく。

  382.     draw_actor_name(actor, x, y)
  383.     $game_temp.b_confirm_limit_flag = (!B_CONFIRM::EN_O or (B_CONFIRM::EN_O && !actor.actor?))
  384.     draw_actor_hp(actor, x + 4, y + line_height * 1)
  385.     draw_actor_mp(actor, x + 4, y + line_height * 2)
  386.     draw_actor_tp(actor, x + 4, y + line_height * 3) if $data_system.opt_display_tp
  387.     self.contents.font.color = system_color
  388.     draw_text(x + 150, y + line_height * 1, 96, line_height, B_CONFIRM::WORD2)
  389.     draw_text(x + 150, y + line_height * 3, 96, line_height, B_CONFIRM::WORD3)
  390.     self.contents.font.color = normal_color
  391.     icons_width = (width - x - 162 - 96) / 24
  392.     icons = (actor.state_icons)[0, icons_width]
  393.     icons.each_with_index {|n, i| draw_icon(n, x + 246 + 24 * i, y + line_height * 1) }
  394.     icons = (actor.state_icons)[icons_width, icons_width * 2]
  395.     icons.each_with_index {|n, i| draw_icon(n, x + 246 + 24 * i, y + line_height * 2) } if icons != nil
  396.     icons = (actor.buff_icons)[0, icons_width]
  397.     icons.each_with_index {|n, i| draw_icon(n, x + 246 + 24 * i, y + line_height * 3) }
  398.     draw_horz_line(line_height * 4)

  399.     if @page_data == 0

  400.       6.times {|i|draw_actor_param(actor, x, y + line_height * (5 + i), (i + 2))}
  401.       ex_xprms_draw(actor, x, y)
  402.       ex_sprms_draw(actor, x, y)

  403.     else

  404.       ex_elem_draw(actor, x, y)
  405.       ex_state_draw(actor, x, y)

  406.     end
  407.   end
  408.   #--------------------------------------------------------------------------
  409.   # 水平線の色を取得(Window_Statusからそのままコピー)
  410.   #--------------------------------------------------------------------------
  411.   def line_color
  412.     color = normal_color
  413.     color.alpha = 48
  414.     color
  415.   end
  416.   #--------------------------------------------------------------------------
  417.   # 水平線の描画(Window_Statusからそのままコピー)
  418.   #--------------------------------------------------------------------------
  419.   def draw_horz_line(y)
  420.     line_y = y + line_height / 2 - 1
  421.     contents.fill_rect(0, line_y, contents_width, 2, line_color)
  422.   end
  423.   #--------------------------------------------------------------------------
  424.   # 追加能力値
  425.   #--------------------------------------------------------------------------
  426.   def ex_xprms_draw(actor, x, y)

  427.     #追加能力値の描写対象がない場合は飛ばす。

  428.     return if B_CONFIRM::XPRM.empty?

  429.     #追加能力値を描写する。

  430.     B_CONFIRM::XPRM.each_with_index do |xp, i|
  431.       next if !actor.actor? && !xp[2]
  432.       change_color(system_color)
  433.       draw_text(x + 170, y + line_height * (5 + i), 120, line_height, xp[1])
  434.       change_color(normal_color)
  435.       draw_text(x + 280, y + line_height * (5 + i), 56, line_height, (actor.xparam(xp[0]) * 100).to_i.to_s + (B_CONFIRM::ADP ? "%" : ""), 2)
  436.     end
  437.   end
  438.   #--------------------------------------------------------------------------
  439.   # 特殊能力値
  440.   #--------------------------------------------------------------------------
  441.   def ex_sprms_draw(actor, x, y)

  442.     #特殊能力値の描写対象がない場合は飛ばす。

  443.     return if B_CONFIRM::SPRM.empty?

  444.     #特殊能力値を描写する。

  445.     B_CONFIRM::SPRM.each_with_index do |sp, i|
  446.       next if !actor.actor? && !sp[2]
  447.       change_color(system_color)
  448.       draw_text(x + 344, y + line_height * (5 + i), 120, line_height, sp[1])
  449.       change_color(normal_color)
  450.       draw_text(x + 454, y + line_height * (5 + i), 56, line_height, (actor.sparam(sp[0]) * 100).to_i.to_s + (B_CONFIRM::SPP ? "%" : ""), 2)
  451.     end
  452.   end
  453.   #--------------------------------------------------------------------------
  454.   # 属性有効度
  455.   #--------------------------------------------------------------------------
  456.   def ex_elem_draw(actor, x, y)

  457.     #属性有効度の描写対象がない場合は飛ばす。

  458.     return if B_CONFIRM::ELEM.empty?

  459.     #属性有効度を描写する。

  460.     B_CONFIRM::ELEM.each_with_index do |elem, i|
  461.       next if !actor.actor? && !elem[2]
  462.       change_color(system_color)
  463.       name = $data_system.elements[elem[0]]
  464.       data = (actor.element_rate(elem[0]) * 100).to_i
  465.       data = (elem[3] ? (100 - data) : data).to_s
  466.       draw_text(x, y + line_height * (5 + i), 120, line_height, name + elem[1])
  467.       change_color(normal_color)
  468.       draw_text(x + 110, y + line_height * (5 + i), 56, line_height, data + (B_CONFIRM::ELP ? "%" : ""), 2)
  469.     end
  470.   end
  471.   #--------------------------------------------------------------------------
  472.   # ステート有効度
  473.   #--------------------------------------------------------------------------
  474.   def ex_state_draw(actor, x, y)

  475.     #ステート有効度の描写対象がない場合は飛ばす。

  476.     return if B_CONFIRM::STAT.empty?

  477.     #ステート有効度を描写する。

  478.     B_CONFIRM::STAT.each_with_index do |state, i|
  479.       next if !actor.actor? && !state[2]
  480.       change_color(system_color)
  481.       x_data = i < B_CONFIRM::MAX ? 170 : 344
  482.       if state[0] > 0
  483.         name = $data_states[state[0]].name
  484.         data = (actor.state_rate(state[0]) * 100).to_i
  485.         data = (state[3] ? (100 - data) : data).to_s
  486.       else
  487.         state_id = state[0].abs
  488.         name = Vocab.param(state_id)
  489.         data = (actor.debuff_rate(state_id) * 100).to_i
  490.         data = (state[3] ? (100 - data) : data).to_s
  491.       end
  492.       draw_text(x + x_data, y + line_height * (5 + i - (i < B_CONFIRM::MAX ? 0 : B_CONFIRM::MAX)), 120, line_height, name + state[1])
  493.       change_color(normal_color)
  494.       draw_text(x + x_data + 110, y + line_height * (5 + i - (i < B_CONFIRM::MAX ? 0 : B_CONFIRM::MAX)), 56, line_height, data + (B_CONFIRM::STP ? "%" : ""), 2)
  495.     end
  496.   end
  497. end
  498. class Scene_Battle < Scene_Base
  499.   #--------------------------------------------------------------------------
  500.   # パーティコマンドウィンドウの作成
  501.   #--------------------------------------------------------------------------
  502.   alias create_party_command_window_b_confirm create_party_command_window
  503.   def create_party_command_window

  504.     #本来の処理を実行。

  505.     create_party_command_window_b_confirm

  506.     #状況確認コマンド用のハンドラを追加。

  507.     @party_command_window.set_handler(:b_confirm,  method(:command_b_confirm))
  508.   end
  509.   #--------------------------------------------------------------------------
  510.   # コマンド[状況確認]
  511.   #--------------------------------------------------------------------------
  512.   def command_b_confirm

  513.     #状況確認コマンドの処理内容を実行。

  514.     b_confirm_execute
  515.   end
  516.   #--------------------------------------------------------------------------
  517.   # 状況確認開始
  518.   #--------------------------------------------------------------------------
  519.   def b_confirm_execute

  520.     #状況確認ウィンドウを作成。

  521.     @b_confirm_window = Window_B_Confirm.new(0, 0, 0)

  522.     #処理をループで処理。

  523.     loop do

  524.       #とりあえずアップデートは行う。

  525.       update

  526.       #状況確認ウィンドウがアクティブであり
  527.       #なおかつ操作終了フラグが有効な場合は分岐。

  528.       if @b_confirm_window.active && @b_confirm_window.end_flag

  529.         #表示モードが2の時、ループを終了する。

  530.         break if @b_confirm_window.display_mode == 2

  531.         #操作終了フラグをfalseにする。

  532.         @b_confirm_window.end_flag = false

  533.         #最後にキャラクターを選択している場合

  534.         if @b_confirm_window.last_actor != nil

  535.           #状況確認ウィンドウのアクティブ状態を解除し
  536.           #詳細ウィンドウを作成する。

  537.           @b_confirm_window.deactivate
  538.           @b_confirm_detail_window = Window_B_Confirm_Detail.new(@b_confirm_window)

  539.         #最後にキャラクターを選択していない場合

  540.         else

  541.           #状況確認ウィンドウを解放する。

  542.           @b_confirm_window.dispose

  543.           #状況確認ウィンドウを作り直す。

  544.           @b_confirm_window = Window_B_Confirm.new(0, 0, (@b_confirm_window.display_mode == 0 ? 0 : 1))

  545.         end

  546.       #詳細ウィンドウが存在し、なおかつ終了フラグが有効な場合。

  547.       elsif @b_confirm_detail_window != nil && @b_confirm_detail_window.end_flag

  548.         #詳細ウィンドウを解放し、nil扱いとする。

  549.         @b_confirm_detail_window.dispose
  550.         @b_confirm_detail_window = nil

  551.         #最後に選択したアクターをnilとする。

  552.         @b_confirm_window.last_actor = nil

  553.         #状況確認ウィンドウをアクティブ化する。

  554.         @b_confirm_window.activate
  555.       end
  556.     end

  557.     #状況確認ウィンドウを解放する。

  558.     @b_confirm_window.dispose

  559.     #パーティコマンドウィンドウをアクティブにする。

  560.     @party_command_window.activate
  561.   end
  562. end
  563. end
复制代码
[/fold]
37、战斗菜单添加一个更换装备选项。
[fold=战斗中更换装备]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #在角色备注:<戦闘中装備変更>
  3. #还可以禁止装备某个装备 备注:<戦闘中装備変更禁止:4>
  4. # 0 => 武器 1 => 盾 2=> 兜 3=> 鎧 4=> 装飾品
  5. #==============================================================================
  6. # ■ RGSS3 戦闘中装備変更 Ver1.00 by 星潟
  7. #------------------------------------------------------------------------------
  8. # パーティコマンド、もしくはアクターコマンドに装備変更コマンドを追加します。
  9. # パーティコマンドの場合は全体、アクターコマンドの場合は個別です。
  10. #------------------------------------------------------------------------------
  11. # ★設定例(特徴を有する項目のメモ欄を使用します)
  12. #------------------------------------------------------------------------------
  13. # <戦闘中装備変更>
  14. #
  15. # このアクターのアクターコマンドに装備変更を追加します。
  16. # TYPEが0の場合は意味がありません。
  17. #------------------------------------------------------------------------------
  18. # <戦闘中装備変更禁止:4>
  19. #
  20. # このアクターの装備部位4を戦闘中のみ変更できなくします。
  21. # 装備部位の対応は以下の通りです。(デフォルトの場合です)
  22. # 0 => 武器 1 => 盾 2=> 兜 3=> 鎧 4=> 装飾品
  23. #==============================================================================
  24. module BATTLE_EQUIP_CHANGE

  25.   #戦闘中の装備変更コマンドのコマンド名を指定します。

  26.   WORD1 = "装备"

  27.   #指定した装備の種類を戦闘中装備変更不可能にします。
  28.   #装備部位の対応は以下の通りです。(デフォルトの場合です)
  29.   #0 => 武器 1 => 盾 2=> 兜 3=> 鎧 4=> 装飾品
  30.   #それぞれ、数字を「,」で区切って指定して下さい。
  31.   #例.[2,3]

  32.   SEAL = []

  33.   #戦闘中の装備変更タイプを指定します。
  34.   #0の場合 パーティコマンドに無条件に追加されます。(アクターの切り替えはL・Rボタン)
  35.   #1の場合 アクターコマンドに無条件に追加されます。(アクターの切り替え不可)
  36.   #2の場合 戦闘中装備変更特徴があるアクターのみ
  37.   #        アクターコマンドに追加されます。(アクターの切り替え不可)

  38.   TYPE = 2

  39.   #戦闘中の装備変更を可能とする特徴を作成する為の指定用キーワードを指定します。
  40.   #TYPEが1か2の時しか意味はありません。

  41.   WORD2 = "戦闘中装備変更"

  42.   #部位別に戦闘中の装備変更を禁止する特徴を作成する為の
  43.   #指定用キーワードを指定します。
  44.   #装備変更画面以外の、イベントコマンド等での装備変更は有効です。

  45.   WORD3 = "戦闘中装備変更禁止"

  46. end
  47. class Game_Temp
  48.   attr_accessor :battle_equip
  49.   #--------------------------------------------------------------------------
  50.   # オブジェクト初期化
  51.   #--------------------------------------------------------------------------
  52.   alias initialize_battle_equip initialize
  53.   def initialize

  54.     #本来の処理を実行。

  55.     initialize_battle_equip

  56.     #装備変更関連を初期化。

  57.     @battle_equip = false

  58.   end
  59. end
  60. class Game_Actor < Game_Battler
  61.   #--------------------------------------------------------------------------
  62.   # 装備変更コマンドの追加可否
  63.   #--------------------------------------------------------------------------
  64.   def equip_command_usable

  65.     #特徴の中に装備変更コマンド追加特徴があればtrueを返す。

  66.     feature_objects.each {|f| return true if f.equip_command_usable}

  67.     #falseを返す。

  68.     false

  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # 装備変更コマンドの追加可否
  72.   #--------------------------------------------------------------------------
  73.   def equip_command_seal

  74.     #空の配列を作成。

  75.     array = []

  76.     #特徴で戦闘中の装備変更禁止箇所が指定されている場合
  77.     #その箇所の値を配列に加える。

  78.     feature_objects.each {|f| array += f.equip_command_seal}

  79.     #配列を返す。

  80.     array

  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # 装備変更の可能判定
  84.   #     slot_id : 装備スロット ID
  85.   #--------------------------------------------------------------------------
  86.   alias equip_change_ok_battle_equip? equip_change_ok?
  87.   def equip_change_ok?(slot_id)

  88.     #戦闘中の装備変更であり戦闘中の装備変更禁止箇所に含まれている場合はfalseを返す。

  89.     return false if battle_equip_seal.include?(equip_slots[slot_id]) if $game_temp.battle_equip

  90.     #本来の処理を実行する。

  91.     equip_change_ok_battle_equip?(slot_id)

  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # 戦闘中の装備変更禁止箇所
  95.   #--------------------------------------------------------------------------
  96.   def battle_equip_seal

  97.     #設定で指定した装備禁止箇所と
  98.     #アクター個別に設定された装備箇所を合わせ
  99.     #重複分を削除して返す。

  100.     (BATTLE_EQUIP_CHANGE::SEAL + equip_command_seal).uniq

  101.   end
  102. end
  103. class RPG::BaseItem
  104.   #--------------------------------------------------------------------------
  105.   # 装備変更コマンドの追加可否
  106.   #--------------------------------------------------------------------------
  107.   def equip_command_usable

  108.     #キャッシュが存在する場合はキャッシュを返す。

  109.     return @equip_command_usable if @equip_command_usable != nil

  110.     #メモ欄からデータを取得。

  111.     @equip_command_usable = self.note.include?("<" + BATTLE_EQUIP_CHANGE::WORD2 + ">")

  112.     #データを返す。

  113.     @equip_command_usable

  114.   end
  115.   #--------------------------------------------------------------------------
  116.   # 装備変更コマンド封印判定
  117.   #--------------------------------------------------------------------------
  118.   def equip_command_seal

  119.     #キャッシュが存在する場合はキャッシュを返す。

  120.     return @equip_command_seal if @equip_command_seal != nil

  121.     #空の配列を作成。

  122.     @equip_command_seal = []

  123.     #メモ欄からデータを取得。

  124.     memo = self.note.scan(/<#{BATTLE_EQUIP_CHANGE::WORD3}[::](\S+)>/).flatten
  125.     if memo != nil && !memo.empty?
  126.       memo = memo[0].split(/\s*,\s*/)
  127.       memo.each {|i| @equip_command_seal.push(i.to_i)}
  128.     end

  129.     #データを返す。

  130.     @equip_command_seal

  131.   end
  132. end

  133. #タイプ別に処理を分ける。

  134. case BATTLE_EQUIP_CHANGE::TYPE

  135. #パーティコマンドに追加する場合

  136. when 0
  137. class Scene_Battle < Scene_Base
  138.   #--------------------------------------------------------------------------
  139.   # 戦闘開始
  140.   #--------------------------------------------------------------------------
  141.   alias battle_start_equip battle_start
  142.   def battle_start

  143.     #装備変更から戻ってきた場合は行動を作成し直し
  144.     #パーティコマンドの選択から開始する。
  145.     #そうでない場合は、通常の処理を行う。

  146.     if $game_temp.battle_equip
  147.       $game_party.make_actions
  148.       start_party_command_selection
  149.     else
  150.       battle_start_equip
  151.     end

  152.     #戦闘中装備変更フラグを初期化する。

  153.     $game_temp.battle_equip = false

  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # パーティコマンドウィンドウの作成
  157.   #--------------------------------------------------------------------------
  158.   alias create_party_command_window_equip create_party_command_window
  159.   def create_party_command_window

  160.     #本来の処理を実行。

  161.     create_party_command_window_equip

  162.     #装備変更コマンド用と命令を関連付ける。

  163.     @party_command_window.set_handler(:equip_change,  method(:command_equip_change))

  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # コマンド[装備変更]
  167.   #--------------------------------------------------------------------------
  168.   def command_equip_change

  169.     #戦闘中装備変更フラグを立てる。

  170.     $game_temp.battle_equip = true

  171.     #Scene_Equipを呼び出す。

  172.     SceneManager.call(Scene_Equip)

  173.   end
  174. end
  175. class Window_PartyCommand < Window_Command
  176.   #--------------------------------------------------------------------------
  177.   # コマンドリストの作成
  178.   #--------------------------------------------------------------------------
  179.   alias make_command_list_equip make_command_list
  180.   def make_command_list

  181.     #本来の処理を実行。

  182.     make_command_list_equip

  183.     #装備変更コマンドを追加する。

  184.     add_command(BATTLE_EQUIP_CHANGE::WORD1,  :equip_change)

  185.   end
  186. end

  187. #アクターコマンドに追加する場合

  188. when 1..2
  189. class Game_BattlerBase
  190.   def equip_command_usable

  191.     #戦闘中装備変更特徴の有無をチェックする。

  192.     feature_objects.each {|f| return true if f.equip_command_usable}

  193.     false

  194.   end
  195. end
  196. class Scene_Equip < Scene_MenuBase
  197.   #--------------------------------------------------------------------------
  198.   # コマンドウィンドウの作成
  199.   #--------------------------------------------------------------------------
  200.   alias create_command_window_equip create_command_window
  201.   def create_command_window

  202.     #本来の処理を実行。

  203.     create_command_window_equip

  204.     #戦闘中装備変更の場合、装備コマンドウィンドウから
  205.     #アクター切り替えの機能を削除する。

  206.     @command_window.battle_command_seal if $game_temp.battle_equip

  207.   end
  208. end
  209. class Scene_Battle < Scene_Base
  210.   #--------------------------------------------------------------------------
  211.   # 戦闘開始
  212.   #--------------------------------------------------------------------------
  213.   alias battle_start_equip battle_start
  214.   def battle_start

  215.     #戦闘中装備変更から戻った場合ではない場合

  216.     if !$game_temp.battle_equip

  217.       #本来の処理を実行。

  218.       battle_start_equip
  219.     else

  220.       #そうでない場合は、ステータスをリフレッシュし
  221.       #ステータスウィンドウを開く。

  222.       refresh_status
  223.       @status_window.unselect
  224.       @status_window.open

  225.       #アクターが操作不能に陥っている場合は、行動内容を作成して
  226.       #次のアクターにコマンド選択を移す。

  227.       if BattleManager.actor && !BattleManager.actor.inputable?
  228.         BattleManager.actor.make_auto_battle_actions
  229.         BattleManager.next_command
  230.       end

  231.       #アクターコマンドの選択を開始する。

  232.       BattleManager.actor ? start_actor_command_selection : next_command

  233.     end

  234.     #戦闘中装備変更フラグを初期化する。

  235.     $game_temp.battle_equip = false
  236.   end
  237.   #--------------------------------------------------------------------------
  238.   # アクターコマンドウィンドウの作成
  239.   #--------------------------------------------------------------------------
  240.   alias create_actor_command_window_equip create_actor_command_window
  241.   def create_actor_command_window

  242.     #本来の処理を実行。

  243.     create_actor_command_window_equip

  244.     #装備変更コマンド用と命令を関連付ける。

  245.     @actor_command_window.set_handler(:equip_change, method(:command_equip_change))
  246.   end
  247.   #--------------------------------------------------------------------------
  248.   # コマンド[装備変更]
  249.   #--------------------------------------------------------------------------
  250.   def command_equip_change

  251.     #戦闘中装備変更フラグを立てる。

  252.     $game_temp.battle_equip = true

  253.     #メニューアクターを行動選択中のアクターにする。

  254.     $game_party.menu_actor = BattleManager.actor

  255.     #装備画面を開く。

  256.     SceneManager.call(Scene_Equip)
  257.   end
  258. end
  259. class Window_ActorCommand < Window_Command
  260.   #--------------------------------------------------------------------------
  261.   # コマンドリストの作成
  262.   #--------------------------------------------------------------------------
  263.   alias make_command_list_equip make_command_list
  264.   def make_command_list

  265.     #本来の処理を実行。

  266.     make_command_list_equip

  267.     #アクターが存在しない場合は処理を飛ばす。

  268.     return unless @actor

  269.     #タイプ1の場合は無条件で追加する。
  270.     #タイプ2の場合は戦闘中装備変更特徴がある場合に追加する。

  271.     add_command(BATTLE_EQUIP_CHANGE::WORD1,:equip_change) if BATTLE_EQUIP_CHANGE::TYPE == 1 or @actor.equip_command_usable

  272.   end
  273. end
  274. class Window_EquipCommand < Window_HorzCommand
  275.   def battle_command_seal

  276.     #アクター切り替えの機能を削除する。

  277.     @handler.delete(:pageup)
  278.     @handler.delete(:pagedown)

  279.   end
  280. end
  281. end
复制代码
[/fold]
38、一个改了很久才完成的饥饿值系统,每个角色头像下面都有自己的变量显示槽,由于打开默认状态显示会乱坐标,要配合第二个详细状态脚本使用。
[fold=饥饿值显示]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #==============================================================================
  3. # *饥饿变量显示槽 *   
  4. #==============================================================================
  5. module Freya
  6.   QWE = Color.new(192,128,255)
  7.   QWE = Color.new(-255,255,-255)
  8. end
  9. #==============================================================================
  10. # ■ Window_Base
  11. #------------------------------------------------------------------------------
  12. #  游戏中所有窗口的父类
  13. #==============================================================================
  14. class Window_Base < Window
  15.   #--------------------------------------------------------------------------
  16.   # ● 绘制饥饿
  17.   #--------------------------------------------------------------------------
  18.   def draw_actor_level(actor, x, y)
  19.     a = 100     #显示每个角色最大变量数值
  20.     b = b = a-$game_variables[actor.id+20]  #显示角色附加变量ID(角色1id+28=29)
  21.     rate = 1 - (b.to_f / a)
  22.     draw_gauge(x  - 106, y + 40, 94, rate,Freya::QWE, Freya::QWE)
  23.     change_color(system_color)
  24.     draw_text(x - 106, y + 36, 26, line_height, "")
  25.     change_color(normal_color)
  26.     draw_text(x + 22, y, 24, line_height, actor.level, 2)
  27.     draw_icon(10, x  - 110, y + 42, true) #10是显示10号图标
  28.   end
  29. end
复制代码
[/fold]
39、一个不错的技能,魔法师可以牺牲MP来抵挡伤害。
[fold=魔法盾]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. class Game_Battler < Game_BattlerBase
  3.   
  4.   STATE_ID = 25   #魔法盾状态的id号
  5.   MP_RATE  = 1  #魔法盾吸收伤害的比率0.4就是10点伤害hp6点mp4点
  6.   
  7.   #--------------------------------------------------------------------------
  8.   # ● 计算伤害
  9.   #--------------------------------------------------------------------------
  10.   def make_damage_value(user, item)
  11.     value = item.damage.eval(user, self, $game_variables)
  12.     value *= item_element_rate(user, item)
  13.     value *= pdr if item.physical?
  14.     value *= mdr if item.magical?
  15.     value *= rec if item.damage.recover?
  16.     value = apply_critical(value) if @result.critical
  17.     value = apply_variance(value, item.damage.variance)
  18.     value = apply_guard(value)
  19.     if item.damage.to_hp? and self.state?(STATE_ID)
  20.       mp_value = [(value * MP_RATE).to_i  , self.mp].min
  21.       value -= mp_value
  22.       self.mp -= mp_value
  23.     end
  24.     @result.make_damage(value.to_i, item)
  25.   end
  26. end
复制代码
[/fold]
40、失去一件装备换取一次重生,建议这件装备是饰品。
[fold=生命石]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #脚本默认100护甲ID,可自行在下面修改。
  3. class Game_Actor
  4.   def add_state(state_id)
  5.     item = $data_armors[100] # 100 为护甲ID
  6.     if state_id == death_state_id && armors.include?(item)
  7.       discard_equip(item)
  8.       recover_all
  9.     else
  10.       super
  11.     end
  12.   end
  13. end
复制代码
[/fold]
41、装备界面添加几项能力显示。
[fold=装备界面扩展]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #encoding:utf-8
  3. #==============================================================================
  4. # ■ Window_EquipStatus
  5. #------------------------------------------------------------------------------
  6. #  装备画面中,显示角色能力值变化的窗口。
  7. #==============================================================================

  8. class Window_EquipStatus < Window_Base
  9.   #  0 最大HP          Maximum Hit Point
  10.   #  1 最大MP          Maximum Magic Point
  11.   #  2 物理攻击        ATtacK power
  12.   #  3 物理防御        DEFense power
  13.   #  4 魔法攻击        Magic ATtack power
  14.   #  5 魔法防御        Magic DeFense power
  15.   #  6 敏 捷 值        AGIlity
  16.   #  7 幸 运 值        LUcK
  17.   # x0 成功几率        HIT rate
  18.   # x1 闪避几率        EVAsion rate
  19.   # x2 必杀几率        CRItical rate
  20.   # x3 闪避必杀几率    Critical EVasion rate
  21.   # x4 闪避魔法几率    Magic EVasion rate
  22.   # x5 反射魔法几率    Magic ReFlection rate
  23.   # x6 反击几率        CouNTer attack rate
  24.   # x7 HP再生速度      Hp ReGeneration rate
  25.   # x8 MP再生速度      Mp ReGeneration rate
  26.   # x9 TP再生速度      Tp ReGeneration rate
  27.   # s0 受到攻击的几率  TarGet Rate
  28.   # s1 防御效果比率    GuaRD effect rate
  29.   # s2 恢复效果比率    RECovery effect rate
  30.   # s3 药理知识        PHArmacology
  31.   # s4 MP消费率        Mp Cost Rate
  32.   # s5 TP消耗率        Tp Charge Rate
  33.   # s6 物理伤害加成    Physical Damage Rate
  34.   # s7 魔法伤害加成    Magical Damage Rate
  35.   # s8 地形伤害加成    Floor Damage Rate
  36.   # s9 经验获得加成    EXperience Rate
  37.   Params = [
  38.             ["力量", "actor.param(2)"],
  39.             ["防御", "actor.param(3)"],
  40.             ["智慧", "actor.param(4)"],
  41.             ["精神", "actor.param(5)"],
  42.             ["速度", "actor.param(6)"],
  43.             ["幸运", "actor.param(7)"],
  44.             ["命中", "actor.xparam(0) * 100"],
  45.             ["物避", "actor.xparam(1) * 100"],
  46.             ["魔避", "actor.xparam(4) * 100"],
  47.             ["恢复", "actor.sparam(3) * 100"],
  48.             ["必杀", "actor.xparam(3) * -100"],
  49.             ["反击", "actor.xparam(6) * 100"],
  50.             ["反射", "actor.xparam(5) * 100"],
  51.             ["伤害", "(actor.sparam(6) + actor.sparam(7) + actor.sparam(8)) / 3.0 * 100"],
  52.             ["受敌", "actor.sparam(0) * 100"],
  53.            ]
  54.   #--------------------------------------------------------------------------
  55.   # ● 初始化对象
  56.   #--------------------------------------------------------------------------
  57.   def initialize(x, y, height)
  58.     super(x, y, window_width, height)
  59.     @actor = nil
  60.     @temp_actor = nil
  61.     refresh
  62.   end
  63.   #--------------------------------------------------------------------------
  64.   # ● 获取显示行数
  65.   #--------------------------------------------------------------------------
  66.   def visible_line_number
  67.     return Params.size
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # ● 获取行高
  71.   #--------------------------------------------------------------------------
  72.   def line_height
  73.     return contents.font.size
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● 刷新
  77.   #--------------------------------------------------------------------------
  78.   def refresh
  79.     y = 0
  80.     contents.clear
  81.     contents.font.size = 24
  82.     if @actor
  83.       draw_actor_name(@actor, 4, 0)
  84.       y += line_height
  85.     end
  86.     contents.font.size = 20 #字体大小
  87.     Params.each {|i| draw_item(0, y, i); y += line_height }
  88.   end
  89.   #--------------------------------------------------------------------------
  90.   # ● 绘制能力值的名字
  91.   #--------------------------------------------------------------------------
  92.   def draw_param_name(x, y, param_name)
  93.     change_color(system_color)
  94.     draw_text(x, y, 80, line_height, param_name)
  95.   end
  96.   #--------------------------------------------------------------------------
  97.   # ● 计算能力值 by orzFly
  98.   #--------------------------------------------------------------------------
  99.   def calc_param(actor, param_formal)
  100.     Kernel.eval(param_formal).to_i rescue 0
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # ● 绘制当前能力值
  104.   #--------------------------------------------------------------------------
  105.   def draw_current_param(x, y, param_id)
  106.     change_color(normal_color)
  107.     draw_text(x, y, 32, line_height, calc_param(@actor, param_id), 2)
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ● 绘制更换装备后的能力值
  111.   #--------------------------------------------------------------------------
  112.   def draw_new_param(x, y, param_id)
  113.     new_value = calc_param(@temp_actor, param_id)
  114.     change_color(param_change_color(new_value - calc_param(@actor, param_id)))
  115.     draw_text(x, y, 32, line_height, new_value, 2)
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   # ● 绘制项目
  119.   #--------------------------------------------------------------------------
  120.   def draw_item(x, y, param)
  121.     draw_param_name(x + 4, y, param[0])
  122.     draw_current_param(x + 94, y, param[1]) if @actor
  123.     draw_right_arrow(x + 126, y)
  124.     draw_new_param(x + 150, y, param[1]) if @temp_actor
  125.   end
  126. end

  127. #==============================================================================
  128. # ■ Window_EquipItem
  129. #------------------------------------------------------------------------------
  130. #  装备画面中,显示可替换装备的窗口。
  131. #==============================================================================

  132. class Window_EquipItem < Window_ItemList
  133.   def col_max
  134.     return 1
  135.   end
  136. end

  137. #==============================================================================
  138. # ■ Scene_Equip
  139. #------------------------------------------------------------------------------
  140. #  装备画面
  141. #==============================================================================

  142. class Scene_Equip < Scene_MenuBase
  143.   #--------------------------------------------------------------------------
  144.   # ● 生成状态窗口
  145.   #--------------------------------------------------------------------------
  146.   def create_status_window
  147.     @status_window = Window_EquipStatus.new(0, @help_window.height,
  148.                                        Graphics.height - @help_window.height)
  149.     @status_window.viewport = @viewport
  150.     @status_window.actor = @actor
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # ● 生成物品窗口
  154.   #--------------------------------------------------------------------------
  155.   def create_item_window
  156.     wx = @status_window.width
  157.     wy = @slot_window.y + @slot_window.height
  158.     ww = Graphics.width - @status_window.width
  159.     wh = Graphics.height - wy
  160.     @item_window = Window_EquipItem.new(wx, wy, ww, wh)
  161.     @item_window.viewport = @viewport
  162.     @item_window.help_window = @help_window
  163.     @item_window.status_window = @status_window
  164.     @item_window.actor = @actor
  165.     @item_window.set_handler(:ok,     method(:on_item_ok))
  166.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  167.     @slot_window.item_window = @item_window
  168.   end
  169. end
复制代码
[/fold]
42、动态敌人,虽然看起来很变扭!但的确动了。
[fold=动态敌人]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #==============================================================================
  3. # ★ RGSS3_バトラー表示拡張 Ver1.02
  4. #==============================================================================
  5. =begin

  6. 作者:tomoaky
  7. webサイト:ひきも記 ([url]http://hikimoki.sakura.ne.jp/[/url])

  8. 戦闘シーンにおいてエネミーのスプライトに以下の効果を適用します。
  9.   ・ランダムに左右反転
  10.   ・Y座標を元に拡大縮小をおこない遠近感を演出
  11.   ・一定間隔で拡大縮小をおこない息遣いを演出
  12.   
  13. 行動不可状態のエネミーは息遣いが自動的に一時停止します

  14. 2012.04.05  Ver1.02
  15.  ・アクターグラフィックに効果を適用しないように修正
  16.     デフォルトの戦闘シーンでは特に意味はありません

  17. 2011.12.20  Ver1.01
  18.   ・解像度に合わせて遠近効果の基準となるY座標を自動計算するように修正

  19. 2011.12.15  Ver1.0
  20.   公開

  21. =end

  22. #==============================================================================
  23. # □ 設定項目
  24. #==============================================================================
  25. module TMBSPREX
  26.   # 不适用镜像翻转的小队IDで指定
  27.   NO_MIRROR_TROOP = []

  28.   # 不适用镜像翻转的敌人IDで指定
  29.   NO_MIRROR_ENEMY = []

  30.   # 遠近効果不适用的小队をIDで指定
  31.   NO_ZOOM_TROOP = []

  32.   # 遠近効果不适用的敌人をIDで指定
  33.   NO_ZOOM_ENEMY = []

  34.   # 呼吸效果不适用的小队をIDで指定
  35.   NO_BREATH_TROOP = []

  36.   # 呼吸效果不适用的敌人をIDで指定
  37.   NO_BREATH_ENEMY = []
  38. end
  39. # 【目前1/3的几率镜像翻转】
  40. #==============================================================================
  41. # ■ Sprite_Battler
  42. #==============================================================================
  43. class Sprite_Battler < Sprite_Base
  44.   #--------------------------------------------------------------------------
  45.   # ● オブジェクト初期化
  46.   #--------------------------------------------------------------------------
  47.   alias tmbsprex_sprite_battler_initialize initialize
  48.   def initialize(viewport, battler = nil)
  49.     tmbsprex_sprite_battler_initialize(viewport, battler)
  50.     if battler && !battler.actor?
  51.       unless TMBSPREX::NO_MIRROR_TROOP.include?($game_troop.troop.id)
  52.         unless TMBSPREX::NO_MIRROR_ENEMY.include?(battler.enemy.id)
  53.           self.mirror = (rand(0) == 0)      # 1/3的几率镜像翻转
  54.         end
  55.       end
  56.       unless TMBSPREX::NO_ZOOM_TROOP.include?($game_troop.troop.id)
  57.         unless TMBSPREX::NO_ZOOM_ENEMY.include?(battler.enemy.id)
  58.           border_y = Graphics.height * 65 / 100
  59.           self.zoom_x = (battler.screen_y - border_y) * 0.005 + 1.0
  60.         end
  61.       end
  62.       unless TMBSPREX::NO_BREATH_TROOP.include?($game_troop.troop.id)
  63.         unless TMBSPREX::NO_BREATH_ENEMY.include?(battler.enemy.id)
  64.           @zoom_max = rand(30) + 150
  65.           @zoom_count = rand(@zoom_max)
  66.         end
  67.       end
  68.       @use_tmbsprex = true
  69.     end
  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # ● フレーム更新
  73.   #--------------------------------------------------------------------------
  74.   alias tmbsprex_sprite_battler_update update
  75.   def update
  76.     tmbsprex_sprite_battler_update
  77.     if @use_tmbsprex
  78.       self.zoom_y = self.zoom_x
  79.       self.z = 50 + self.y
  80.       if @zoom_max && @battler.movable?
  81.         @zoom_count += 1
  82.         @zoom_count = 0 if @zoom_count == @zoom_max
  83.         f = Math.sin(Math::PI * @zoom_count / (@zoom_max / 2))
  84.         self.zoom_y += f * 0.015 + 0.015
  85.       end
  86.     end
  87.   end
  88. end
复制代码
[/fold]
43、简单易懂的物品制造系统,但不能制造装备。
[fold=物品制造1]
  1. #打开脚本编辑器,将“物品制造1”“物品制造2”脚本插入到main上。
  2. #encoding:utf-8
  3. #==============================================================================
  4. # 本腳本來自www.66RPG.com,使用和轉載請保留此信息
  5. #==============================================================================
  6. #==============================================================================
  7. #使用说明:
  8. #每添加一个制造的类型,最上面的类别菜单就会多一项。
  9. #
  10. #添加类型的方法是运行:
  11. #$game_party.add_cook_type("合成","合成药品", true)
  12. #$game_party.add_cook_type("烹饪","烹饪食物", true)
  13. #
  14. #添加配方的方法:
  15. #$game_party.add_cookbook(配方名称, 配方介绍, 配方类别名称,材料的二维数组,产出物的二维数组,配方状态)
  16. #
  17. #举例:
  18. #$game_party.add_cookbook("初级补血药水", "制作初级补血药水", "制药",[[18,2]],[[1,1]],true)
  19. #
  20. #调用窗口的方法:SceneManager.call(Scene_Cook)
  21. #
  22. #
  23. #==============================================================================

  24. #==============================================================================
  25. # ■ Cookbook_Type
  26. #------------------------------------------------------------------------------
  27. #  食谱类型类。
  28. #==============================================================================

  29. class Cookbook_Type
  30.   attr_reader :index
  31.   attr_reader :name
  32.   attr_reader :description
  33.   attr_reader :enabled
  34.   #--------------------------------------------------------------------------
  35.   # ● 初始化对象
  36.   #--------------------------------------------------------------------------
  37.   def initialize(index, name, description, enabled = false)
  38.     @index = index
  39.     @name = name
  40.     @description = description
  41.     @enabled = enabled
  42.   end
  43.   
  44.   def enable(en)
  45.     @enabled = en
  46.   end
  47. end

  48. #==============================================================================
  49. # ■ Cookbook
  50. #------------------------------------------------------------------------------
  51. #  食谱类。本类在 Game_Task 类的内部使用。
  52. #   食谱属性:食谱序号,食谱名称,食谱类型,食谱介绍,原料,成品
  53. #==============================================================================

  54. class Cookbook
  55.   attr_reader :index
  56.   attr_reader :name
  57.   attr_reader :description
  58.   attr_reader :type
  59.   attr_reader :input
  60.   attr_reader :output
  61.   attr_reader :enabled
  62.   #--------------------------------------------------------------------------
  63.   # ● 初始化对象
  64.   #--------------------------------------------------------------------------
  65.   def initialize(index, name, description, type, input, output, enabled = true)
  66.     @index = index
  67.     @name = name
  68.     @description = description
  69.     @type = type
  70.     @input = input
  71.     @output = output
  72.     @enabled = enabled
  73.   end
  74.   
  75.   def enable(en)
  76.     @enabled = en
  77.   end
  78.   
  79.   #--------------------------------------------------------------------------
  80.   # ● 查询列表中的物品
  81.   #--------------------------------------------------------------------------
  82.   def in_list?(item, list)
  83.     list.each do |arr|
  84.       return true if arr[0] == item.id
  85.     end
  86.     return false
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ● 查询是否是材料列表中的物品
  90.   #--------------------------------------------------------------------------
  91.   def resource?(item)
  92.     in_list?(item, @input)
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # ● 查询是否是产出列表中的物品
  96.   #--------------------------------------------------------------------------
  97.   def output?(item)
  98.     in_list?(item, @output)
  99.   end
  100.   #--------------------------------------------------------------------------
  101.   # ● 查询材料需求量
  102.   #--------------------------------------------------------------------------
  103.   def amount(item, i)
  104.     if i == 0
  105.       @input.each do |arr|
  106.         return arr[1] if arr[0] == item.id
  107.       end
  108.     else
  109.       @output.each do |arr|
  110.         return arr[1] if arr[0] == item.id
  111.       end
  112.     end
  113.     return 0
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   # ● 查询材料是否足够
  117.   #--------------------------------------------------------------------------
  118.   def enough?
  119.     input.each do |arr|
  120.       return false if $data_items[arr[0]] && arr[1] > $game_party.item_number($data_items[arr[0]])
  121.     end
  122.     return true
  123.   end
  124.   #--------------------------------------------------------------------------
  125.   # ● 查询某件材料是否足够
  126.   #--------------------------------------------------------------------------
  127.   def item_enough?(item)
  128.     input.each do |arr|
  129.       return false if arr[0] == item.id && arr[1] > $game_party.item_number(item)
  130.     end
  131.     return true
  132.   end
  133. end

  134. #==============================================================================
  135. # ■ Game_Party
  136. #==============================================================================

  137. class Game_Party < Game_Unit
  138.   #--------------------------------------------------------------------------
  139.   # ● 初始化对象
  140.   #--------------------------------------------------------------------------
  141.   alias old_init initialize
  142.   def initialize
  143.     old_init
  144.     @cook_types = []
  145.     @cookbooks = []
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # ● 添加新的制造类型
  149.   #--------------------------------------------------------------------------
  150.   def add_cook_type(n, d, en)
  151.     @cook_types.push(Cookbook_Type.new(@cook_types.size, n, d, en)) if !have_cook_type?(n)
  152.   end
  153.   #--------------------------------------------------------------------------
  154.   # ● 添加新的食谱
  155.   #--------------------------------------------------------------------------
  156.   def add_cookbook(n, d, type, input, output, en)
  157.     if !have_cookbook?(n) && have_cook_type?(type)
  158.       @cookbooks.push(Cookbook.new(@cookbooks.size, n, d, type, input, output, en))
  159.     end
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # ● 判断名称为n的制造类型是否存在
  163.   #--------------------------------------------------------------------------
  164.   def have_cook_type?(n)
  165.     @cook_types.each do |x|
  166.       return true if x.name == n
  167.     end
  168.     return false
  169.   end
  170.   #--------------------------------------------------------------------------
  171.   # ● 判断名称为n的食谱是否存在
  172.   #--------------------------------------------------------------------------
  173.   def have_cookbook?(n)
  174.     @cookbooks.each do |x|
  175.       return true if x.name == n
  176.     end
  177.     return false
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● 返回制造类型列表
  181.   #--------------------------------------------------------------------------
  182.   def cook_types
  183.     return @cook_types
  184.   end
  185.   #--------------------------------------------------------------------------
  186.   # ● 返回食谱列表
  187.   #--------------------------------------------------------------------------
  188.   def cookbooks(type = nil)
  189.     return @cookbooks if type == nil
  190.     arr = []
  191.     @cookbooks.each do |x|
  192.       arr.push(x) if x.type == type
  193.     end
  194.     return arr
  195.   end
  196.   #--------------------------------------------------------------------------
  197.   # ● 更改序号为i的制造类型的使用状态
  198.   #--------------------------------------------------------------------------
  199.   def set_cook_type(i, en)
  200.     @cook_types[i].enable(en)
  201.   end
  202.   #--------------------------------------------------------------------------
  203.   # ● 更改序号为i的食谱的使用状态
  204.   #--------------------------------------------------------------------------
  205.   def set_cookbook(i, en)
  206.     @cookbooks[i].enable(en)
  207.   end
  208.   #--------------------------------------------------------------------------
  209.   # ● 返回制造类型数目
  210.   #--------------------------------------------------------------------------
  211.   def cook_types_size
  212.     return @cook_types.size
  213.   end
  214.   #--------------------------------------------------------------------------
  215.   # ● 查询名称为n的制造类型的描述
  216.   #--------------------------------------------------------------------------
  217.   def cook_type_description(n)
  218.     @cook_types.each do |x|
  219.       return x.description if x.name == n
  220.     end
  221.     return ""
  222.   end
  223. end

  224. #==============================================================================
  225. # ■ Scene_Cook
  226. #------------------------------------------------------------------------------
  227. #  制造画面
  228. #==============================================================================

  229. class Scene_Cook < Scene_ItemBase
  230.   #--------------------------------------------------------------------------
  231.   # ● 开始处理
  232.   #--------------------------------------------------------------------------
  233.   def start
  234.     super
  235.     create_category_window
  236.     create_cookbook_window
  237.     create_description_window
  238.     create_needs_window
  239.   end
  240.   #--------------------------------------------------------------------------
  241.   # ● 生成分类窗口
  242.   #--------------------------------------------------------------------------
  243.   def create_category_window
  244.     @category_window = Window_CookCategory.new
  245.     @category_window.viewport = @viewport
  246.     @category_window.y = 0
  247.     @category_window.set_handler(:ok,     method(:on_category_ok))
  248.     @category_window.set_handler(:cancel, method(:return_scene))
  249.   end
  250.   #--------------------------------------------------------------------------
  251.   # ● 生成食谱窗口
  252.   #--------------------------------------------------------------------------
  253.   def create_cookbook_window
  254.     wy = @category_window.height
  255.     wh = Graphics.height - wy
  256.     @item_window = Window_CookList.new(0, wy, Graphics.width*0.5 , wh)
  257.     @item_window.viewport = @viewport
  258.     @item_window.set_handler(:ok,     method(:on_item_ok))
  259.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  260.     @category_window.item_window = @item_window
  261.   end
  262.   #--------------------------------------------------------------------------
  263.   # ● 生成描述窗口
  264.   #--------------------------------------------------------------------------
  265.   def create_description_window
  266.     wy = @category_window.height
  267.     @help_window = Window_Description.new(Graphics.width*0.5, wy)
  268.     @help_window.viewport = @viewport
  269.     @item_window.help_window = @help_window
  270.     @category_window.help_window = @help_window
  271.   end
  272.     #--------------------------------------------------------------------------
  273.   # ● 生成材料窗口
  274.   #--------------------------------------------------------------------------
  275.   def create_needs_window
  276.     wy = @category_window.height + @help_window.height
  277.     wh = Graphics.height - wy
  278.     @needs_window = Window_NeedsList.new(Graphics.width*0.5, wy, Graphics.width*0.5 , wh)
  279.     #@item_window.viewport = @viewport
  280.     @item_window.needs_window = @needs_window
  281.    
  282.   end
  283.   #--------------------------------------------------------------------------
  284.   # ● 分类“确定”
  285.   #--------------------------------------------------------------------------
  286.   def on_category_ok
  287.     @item_window.activate
  288.     @item_window.select_last
  289.   end
  290.   #--------------------------------------------------------------------------
  291.   # ● 食谱“确定”
  292.   #--------------------------------------------------------------------------
  293.   def on_item_ok
  294.     #$game_party.last_item.object = item
  295.     cook
  296.   end
  297.   #--------------------------------------------------------------------------
  298.   # ● 食谱“取消”
  299.   #--------------------------------------------------------------------------
  300.   def on_item_cancel
  301.     @item_window.unselect
  302.     @category_window.activate
  303.   end
  304.   #--------------------------------------------------------------------------
  305.   # ● 制造
  306.   #--------------------------------------------------------------------------
  307.   def cook
  308.     if item.enough?
  309.       play_se_for_item
  310.       use_item
  311.       @needs_window.refresh
  312.       @item_window.refresh
  313.       activate_item_window
  314.     end
  315.   end
  316.   #--------------------------------------------------------------------------
  317.   # ● 播放制作声效
  318.   #--------------------------------------------------------------------------
  319.   def play_se_for_item
  320.     Sound.play_recovery
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # ● 使用食谱
  324.   #--------------------------------------------------------------------------
  325.   def use_item
  326.     #super
  327.     #@item_window.redraw_current_item
  328.     $data_items.each do |it|
  329.       if it && !it.name.empty?
  330.         $game_party.gain_item(it,-item.amount(it,0)) if item.resource?(it)
  331.         $game_party.gain_item(it,item.amount(it,1)) if item.output?(it)
  332.       end
  333.     end
  334.   end
  335. end


  336. #==============================================================================
  337. # ■ Window_CookCategory
  338. #------------------------------------------------------------------------------
  339. #  制造画面中,显示制造类型的窗口。
  340. #==============================================================================

  341. class Window_CookCategory < Window_HorzCommand
  342.   #--------------------------------------------------------------------------
  343.   # ● 定义实例变量
  344.   #--------------------------------------------------------------------------
  345.   attr_reader   :item_window
  346.   #--------------------------------------------------------------------------
  347.   # ● 初始化对象
  348.   #--------------------------------------------------------------------------
  349.   def initialize
  350.     super(0, 0)
  351.   end
  352.   #--------------------------------------------------------------------------
  353.   # ● 获取窗口的宽度
  354.   #--------------------------------------------------------------------------
  355.   def window_width
  356.     Graphics.width
  357.   end
  358.   #--------------------------------------------------------------------------
  359.   # ● 获取列数
  360.   #--------------------------------------------------------------------------
  361.   def col_max
  362.     return $game_party.cook_types_size
  363.   end
  364.   #--------------------------------------------------------------------------
  365.   # ● 更新画面
  366.   #--------------------------------------------------------------------------
  367.   def update
  368.     super
  369.     #@item_window.category = current_symbol if @item_window
  370.     @item_window.category = current_data[:name] if @item_window
  371.   end
  372.   #--------------------------------------------------------------------------
  373.   # ● 生成制造列表
  374.   #--------------------------------------------------------------------------
  375.   def make_command_list
  376.     $game_party.cook_types.each do |t|
  377.       add_command(t.name, t.index, t.enabled)
  378.     end
  379.   end
  380.   #--------------------------------------------------------------------------
  381.   # ● 设置制造列表窗口
  382.   #--------------------------------------------------------------------------
  383.   def item_window=(item_window)
  384.     @item_window = item_window
  385.     update
  386.   end
  387.   #--------------------------------------------------------------------------
  388.   # ● 更新帮助内容
  389.   #--------------------------------------------------------------------------
  390.   def update_help
  391.     @help_window.set_text($game_party.cook_type_description(current_data[:name]))
  392.   end
  393. end

  394. #==============================================================================
  395. # ■ Window_CookList
  396. #------------------------------------------------------------------------------
  397. #  任务画面中,显示已获得任务的窗口。
  398. #==============================================================================

  399. class Window_CookList < Window_Selectable
  400.   #--------------------------------------------------------------------------
  401.   # ● 定义实例变量
  402.   #--------------------------------------------------------------------------
  403.   attr_reader   :needs_window
  404.   #--------------------------------------------------------------------------
  405.   # ● 初始化对象
  406.   #--------------------------------------------------------------------------
  407.   def initialize(x, y, width, height)
  408.     super
  409.     @data = []
  410.     @category = $game_party.cook_types_size > 0 ? $game_party.cook_types[0].name : nil
  411.     refresh
  412.   end
  413.   #--------------------------------------------------------------------------
  414.   # ● 设置分类
  415.   #--------------------------------------------------------------------------
  416.   def category=(category)
  417.     return if @category == category
  418.     @category = category
  419.     refresh
  420.     self.oy = 0
  421.   end
  422.   #--------------------------------------------------------------------------
  423.   # ● 设置材料窗口
  424.   #--------------------------------------------------------------------------
  425.   def needs_window=(needs_window)
  426.     @needs_window = needs_window
  427.     update
  428.   end
  429.   #--------------------------------------------------------------------------
  430.   # ● 获取列数
  431.   #--------------------------------------------------------------------------
  432.   def col_max
  433.     return 1
  434.   end
  435.   #--------------------------------------------------------------------------
  436.   # ● 获取项目数
  437.   #--------------------------------------------------------------------------
  438.   def item_max
  439.     @data ? @data.size : 1
  440.   end
  441.   #--------------------------------------------------------------------------
  442.   # ● 获取食谱
  443.   #--------------------------------------------------------------------------
  444.   def item
  445.     @data && index >= 0 ? @data[index] : nil
  446.   end
  447.   #--------------------------------------------------------------------------
  448.   # ● 获取选择食谱的有效状态
  449.   #--------------------------------------------------------------------------
  450.   def current_item_enabled?
  451.     enable?(@data[index])
  452.   end
  453.   #--------------------------------------------------------------------------
  454.   # ● 查询此食谱是否可用
  455.   #--------------------------------------------------------------------------
  456.   def enable?(item)
  457.     item.enabled && item.enough?
  458.   end
  459.   #--------------------------------------------------------------------------
  460.   # ● 生成食谱列表
  461.   #--------------------------------------------------------------------------
  462.   def make_item_list
  463.     @data = $game_party.cookbooks(@category)
  464.   end
  465.   #--------------------------------------------------------------------------
  466.   # ● 返回上一个选择的位置
  467.   #--------------------------------------------------------------------------
  468.   def select_last
  469.     select(0)
  470.   end
  471.   #--------------------------------------------------------------------------
  472.   # ● 绘制项目
  473.   #--------------------------------------------------------------------------
  474.   def draw_item(index)
  475.     item = @data[index]
  476.     if item
  477.       rect = item_rect(index)
  478.       rect.width -= 4
  479.       draw_item_name(item, rect.x, rect.y, enable?(item))
  480.     end
  481.   end
  482.   #--------------------------------------------------------------------------
  483.   # ● 绘制名称
  484.   #     enabled : 有效的标志。false 的时候使用半透明效果绘制
  485.   #--------------------------------------------------------------------------
  486.   def draw_item_name(item, x, y, enabled = true, width = 300)
  487.     return unless item
  488.     text = item.name
  489.     text += "[材料不足]" if !item.enough?
  490.     change_color(normal_color, enabled)
  491.     draw_text(x, y, width, line_height, text)
  492.   end
  493.   #--------------------------------------------------------------------------
  494.   # ● 更新帮助内容
  495.   #--------------------------------------------------------------------------
  496.   def update_help
  497.     @help_window.set_item(item)
  498.   end
  499.    #--------------------------------------------------------------------------
  500.   # ● 更新食谱清单
  501.   #--------------------------------------------------------------------------
  502.   def update_needslist
  503.     @needs_window.set_item(item)
  504.   end
  505.   #--------------------------------------------------------------------------
  506.   # ● 调用帮助窗口的更新方法
  507.   #--------------------------------------------------------------------------
  508.   def call_update_help
  509.     update_help if @help_window
  510.     update_needslist if @needs_window
  511.   end
  512.   #--------------------------------------------------------------------------
  513.   # ● 刷新
  514.   #--------------------------------------------------------------------------
  515.   def refresh
  516.     make_item_list
  517.     create_contents
  518.     draw_all_items
  519.   end
  520. end
  521. #==============================================================================
  522. # ■ Window_Description
  523. #------------------------------------------------------------------------------
  524. #  显示食谱的说明的窗口
  525. #==============================================================================

  526. class Window_Description < Window_Base
  527.   #--------------------------------------------------------------------------
  528.   # ● 初始化对象
  529.   #--------------------------------------------------------------------------
  530.   def initialize(x, y)
  531.     super(x, y, Graphics.width*0.5, fitting_height(4))
  532.   end
  533.   #--------------------------------------------------------------------------
  534.   # ● 设置内容
  535.   #--------------------------------------------------------------------------
  536.   def set_text(text)
  537.     if text != @text
  538.       @text = text
  539.       refresh
  540.     end
  541.   end
  542.   #--------------------------------------------------------------------------
  543.   # ● 清除
  544.   #--------------------------------------------------------------------------
  545.   def clear
  546.     set_text("")
  547.   end
  548.   #--------------------------------------------------------------------------
  549.   # ● 设置食谱的介绍
  550.   #--------------------------------------------------------------------------
  551.   def set_item(item)
  552.     set_text(item ? item.description : "")
  553.   end
  554.   #--------------------------------------------------------------------------
  555.   # ● 刷新
  556.   #--------------------------------------------------------------------------
  557.   def refresh
  558.     contents.clear
  559.     draw_text_ex(4, 0, @text)
  560.   end
  561. end

  562. #==============================================================================
  563. # ■ Window_NeedsList
  564. #------------------------------------------------------------------------------
  565. #  制造画面中,显示食谱所需材料的窗口。
  566. #==============================================================================

  567. class Window_NeedsList < Window_Selectable
  568.   #--------------------------------------------------------------------------
  569.   # ● 初始化对象
  570.   #--------------------------------------------------------------------------
  571.   def initialize(x, y, width, height)
  572.     super
  573.     @category = :item
  574.     @cookbook = nil
  575.     @data = []
  576.     refresh
  577.   end
  578.   #--------------------------------------------------------------------------
  579.   # ● 获取列数
  580.   #--------------------------------------------------------------------------
  581.   def col_max
  582.     return 1
  583.   end
  584.   #--------------------------------------------------------------------------
  585.   # ● 获取项目数
  586.   #--------------------------------------------------------------------------
  587.   def item_max
  588.     @data ? @data.size : 1
  589.   end
  590.   #--------------------------------------------------------------------------
  591.   # ● 获取物品
  592.   #--------------------------------------------------------------------------
  593.   def item
  594.     @data && index >= 0 ? @data[index] : nil
  595.   end
  596.   #--------------------------------------------------------------------------
  597.   # ● 查询列表中是否含有此物品
  598.   #--------------------------------------------------------------------------
  599.   def include?(item)
  600.     item.is_a?(RPG::Item) && !item.key_item?
  601.   end
  602.   #--------------------------------------------------------------------------
  603.   # ● 获取选择食谱的有效状态
  604.   #--------------------------------------------------------------------------
  605.   def current_item_enabled?
  606.     enable?(@data[index])
  607.   end
  608.   #--------------------------------------------------------------------------
  609.   # ● 查询此食谱是否可用
  610.   #--------------------------------------------------------------------------
  611.   def enable?(item)
  612.     $game_party.usable?(item) && @cookbook.item_enough?(item)
  613.   end
  614.   #--------------------------------------------------------------------------
  615.   # ● 生成物品列表
  616.   #--------------------------------------------------------------------------
  617.   def make_item_list
  618.     @data = []
  619.     return if @cookbook== nil
  620.     tmp1 = []
  621.     tmp2 = []
  622.     $data_items.each do |item|
  623.       tmp1.push([item, 0]) if item && !item.name.empty? && @cookbook.resource?(item)
  624.       tmp2.push([item, 1]) if item && !item.name.empty? && @cookbook.output?(item)
  625.     end
  626.     if tmp1.size > 0 && tmp2.size > 0
  627.       @data.push(["需要材料:",0])
  628.       @data += tmp1
  629.       @data.push(["可以获得:",1])
  630.       @data += tmp2
  631.     end
  632.   end
  633.   #--------------------------------------------------------------------------
  634.   # ● 返回上一个选择的位置
  635.   #--------------------------------------------------------------------------
  636.   def select_last
  637.     select(0)
  638.   end
  639.   #--------------------------------------------------------------------------
  640.   # ● 绘制项目
  641.   #--------------------------------------------------------------------------
  642.   def draw_item(index)
  643.     item = @data[index]
  644.     if item
  645.       rect = item_rect(index)
  646.       rect.width -= 4
  647.       if item[0].is_a?(RPG::Item)
  648.         draw_item_name(item, rect.x, rect.y, enable?(item[0]))
  649.         draw_item_number(rect, item[0])
  650.       else
  651.         draw_input_output(item, rect.x, rect.y)
  652.       end
  653.     end
  654.   end
  655.   #--------------------------------------------------------------------------
  656.   # ● 绘制物品名称
  657.   #     enabled : 有效的标志。false 的时候使用半透明效果绘制
  658.   #--------------------------------------------------------------------------
  659.   def draw_item_name(item, x, y, enabled = true, width = 172)
  660.     return unless item
  661.     text = item[0].name + "*" + String(@cookbook.amount(item[0], item[1]))
  662.     draw_icon(item[0].icon_index, x, y, enabled)
  663.     change_color(normal_color, enable?(item[0]))
  664.     draw_text(x + 24, y, width, line_height, text)
  665.   end
  666.   #--------------------------------------------------------------------------
  667.   # ● 绘制输入和产出
  668.   #--------------------------------------------------------------------------
  669.   def draw_input_output(item, x, y, enabled = false, width = 172)
  670.     return unless item
  671.     if item[1] == 0
  672.       text = "[需要]"
  673.     else
  674.       text = "[可以获得]"
  675.     end
  676.     change_color(normal_color, @cookbook.enough?)
  677.     draw_text(x , y, width, line_height, text)
  678.   end
  679.   #--------------------------------------------------------------------------
  680.   # ● 绘制物品个数
  681.   #--------------------------------------------------------------------------
  682.   def draw_item_number(rect, item)
  683.     draw_text(rect, sprintf("现有%2d", $game_party.item_number(item)), 2)
  684.   end
  685.   #--------------------------------------------------------------------------
  686.   # ● 刷新
  687.   #--------------------------------------------------------------------------
  688.   def refresh
  689.     make_item_list
  690.     create_contents
  691.     draw_all_items
  692.   end
  693.   #--------------------------------------------------------------------------
  694.   # ● 设置食谱的材料
  695.   #--------------------------------------------------------------------------
  696.   def set_item(item)
  697.     @cookbook = item
  698.     refresh
  699.   end
  700. end

  701. #==============================================================================
  702. # 本腳本來自www.66RPG.com,使用和轉載請保留此信息
  703. #==============================================================================


  704. # add by Sion 2013.12.17
  705. # 作者修改了原范例的菜单,但是在原系统脚本里改的。
  706. # 整理出来写在这里, 不需要改菜单的同学把这些删掉就可以。
  707. class Scene_Menu
  708.   def command_cook
  709.     SceneManager.call(Scene_Cook)
  710.   end
  711.   alias_method :s20131217_create_command_window, :create_command_window
  712.   def create_command_window
  713.     s20131217_create_command_window
  714.     @command_window.set_handler(:cook, method(:command_cook))
  715.   end
  716. end
  717. class Window_MenuCommand
  718.   alias_method :s20131217_add_main_commands, :add_main_commands
  719.   def add_main_commands
  720.     s20131217_add_main_commands
  721.     add_command("合成",   :cook,   main_commands_enabled)
  722.   end
  723. end
复制代码
[/fold]
[fold=物品制造2]
  1. class Game_Party < Game_Unit
  2.   #--------------------------------------------------------------------------
  3.   # ● 添加新的制造类型
  4.   #--------------------------------------------------------------------------
  5.   def add_cook_type(n, d, en)
  6.     cook_types.push(Cookbook_Type.new(cook_types.size, n, d, en)) if !have_cook_type?(n)
  7.   end
  8.   #--------------------------------------------------------------------------
  9.   # ● 添加新的食谱
  10.   #--------------------------------------------------------------------------
  11.   def add_cookbook(n, d, type, input, output, en)
  12.     if !have_cookbook?(n) && have_cook_type?(type)
  13.       cookbooks.push(Cookbook.new(cookbooks.size, n, d, type, input, output, en))
  14.     end
  15.   end
  16.   #--------------------------------------------------------------------------
  17.   # ● 判断名称为n的制造类型是否存在
  18.   #--------------------------------------------------------------------------
  19.   def have_cook_type?(n)
  20.     cook_types.each do |x|
  21.       return true if x.name == n
  22.     end
  23.     return false
  24.   end
  25.   #--------------------------------------------------------------------------
  26.   # ● 判断名称为n的食谱是否存在
  27.   #--------------------------------------------------------------------------
  28.   def have_cookbook?(n)
  29.     cookbooks.each do |x|
  30.       return true if x.name == n
  31.     end
  32.     return false
  33.   end
  34.   #--------------------------------------------------------------------------
  35.   # ● 返回制造类型列表
  36.   #--------------------------------------------------------------------------
  37.   def cook_types
  38.     @cook_types = [] if @cook_types.nil?
  39.     return @cook_types
  40.   end
  41.   #--------------------------------------------------------------------------
  42.   # ● 返回食谱列表
  43.   #--------------------------------------------------------------------------
  44.   def cookbooks(type = nil)
  45.     @cookbooks = [] if @cookbooks.nil?
  46.     return @cookbooks if type == nil
  47.     arr = []
  48.     @cookbooks.each do |x|
  49.       arr.push(x) if x.type == type
  50.     end
  51.     return arr
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # ● 更改序号为i的制造类型的使用状态
  55.   #--------------------------------------------------------------------------
  56.   def set_cook_type(i, en)
  57.     cook_types[i].enable(en)
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # ● 更改序号为i的食谱的使用状态
  61.   #--------------------------------------------------------------------------
  62.   def set_cookbook(i, en)
  63.     cookbooks[i].enable(en)
  64.   end
  65.   #--------------------------------------------------------------------------
  66.   # ● 返回制造类型数目
  67.   #--------------------------------------------------------------------------
  68.   def cook_types_size
  69.     return cook_types.size
  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # ● 查询名称为n的制造类型的描述
  73.   #--------------------------------------------------------------------------
  74.   def cook_type_description(n)
  75.     cook_types.each do |x|
  76.       return x.description if x.name == n
  77.     end
  78.     return ""
  79.   end
  80. end
复制代码
[/fold]
44、如果有不想在战斗中显示的技能选项,那就用这个脚本来隐藏吧。
[fold=战斗中隐藏技能]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. class Window_ActorCommand
  3.   Hide_Skill_Id = [15,16]  # 不显示在战斗选项列表的技能类型ID
  4.   def add_skill_commands
  5.     @actor.added_skill_types.sort.each do |stype_id|
  6.       name = $data_system.skill_types[stype_id]
  7.       unless Hide_Skill_Id.include?(stype_id)
  8.         add_command(name, :skill, true, stype_id)
  9.       end
  10.     end
  11.   end
  12. end
复制代码
[/fold]
45、给对话添加声效,可改变对话速度。
[fold=对话声效]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #==============================================================================
  3. # ★ RGSS3_メッセージ効果音 Ver1.1
  4. #==============================================================================
  5. =begin

  6. 作者:tomoaky
  7. webサイト:ひきも記 (http://hikimoki.sakura.ne.jp/)

  8. 文章の表示コマンド実行時、文字の表示と一緒に効果音を鳴らします。

  9. 制御文字 \B を使って効果音を再生するかどうかを設定できます。
  10. \B が出てくるたびに切り替わりますが AUTO_SE が true の場合は
  11. 最初から効果音が鳴る状態になっています。

  12. おまけ機能として文章の表示速度を変更することができます。
  13. 設定したゲーム変数(初期設定では8番)の値が大きければ大きいほど
  14. 表示速度は遅くなります。1 がデフォルトの速度で最低値です。

  15. 使用するゲーム変数(初期設定)
  16.   0008
  17.   
  18. 2012.01.22  Ver1.1
  19.   おまけ機能の文章表示速度変更を追加
  20.   
  21. 2012.01.21  Ver1.0
  22.   公開

  23. =end

  24. #==============================================================================
  25. # □ 設定項目
  26. #==============================================================================
  27. module TMMESSAGESE
  28.   MESSAGE_SE = RPG::SE.new("Cursor2", 70, 150)    # Cursor2是声效文件名。
  29.   AUTO_SE = true    # true で自動的に再生、false で制御文字があったときのみ再生
  30.   
  31.   VN_MESSAGE_WAIT = 200  # 字显示速度变量控制ID
  32. end

  33. #==============================================================================
  34. # ■ Window_Message
  35. #==============================================================================
  36. class Window_Message
  37.   #--------------------------------------------------------------------------
  38.   # ● フラグのクリア
  39.   #--------------------------------------------------------------------------
  40.   alias tmmessagese_window_message_clear_flags clear_flags
  41.   def clear_flags
  42.     tmmessagese_window_message_clear_flags
  43.     @se_flag = TMMESSAGESE::AUTO_SE
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ● 一文字出力後のウェイト
  47.   #--------------------------------------------------------------------------
  48.   alias tmessagese_window_message_wait_for_one_character wait_for_one_character
  49.   def wait_for_one_character
  50.     [$game_variables[TMMESSAGESE::VN_MESSAGE_WAIT], 1].max.times do |i|
  51.       tmessagese_window_message_wait_for_one_character
  52.     end
  53.   end
  54.   #--------------------------------------------------------------------------
  55.   # ● 通常文字の処理
  56.   #--------------------------------------------------------------------------
  57.   alias tmmessagese_window_message_process_normal_character process_normal_character
  58.   def process_normal_character(c, pos)
  59.     tmmessagese_window_message_process_normal_character(c, pos)
  60.     TMMESSAGESE::MESSAGE_SE.play if @se_flag
  61.   end
  62.   #--------------------------------------------------------------------------
  63.   # ● 制御文字の処理
  64.   #     code : 制御文字の本体部分(「\C[1]」なら「C」)
  65.   #     text : 描画処理中の文字列バッファ(必要なら破壊的に変更)
  66.   #     pos  : 描画位置 {:x, :y, :new_x, :height}
  67.   #--------------------------------------------------------------------------
  68.   alias tmmessage_window_message_process_escape_character process_escape_character
  69.   def process_escape_character(code, text, pos)
  70.     case code.upcase
  71.     when 'B'
  72.       @se_flag ^= true
  73.     else
  74.       tmmessage_window_message_process_escape_character(code, text, pos)
  75.     end
  76.   end
  77. end
复制代码
[/fold]
46、非常不错的脚本,就是有点鸡肋!每次更新游戏添加新装备读档得到装备是空白的,要重新开档才能显示。所以这个脚本留着等游戏制作完结再放上去。
[fold=随机属性装备]
  1. #使用方法:打开脚本编辑器,将脚本插入到main上。
  2. #encoding:utf-8
  3. #==============================================================================
  4. # ■ 随机属性装备 By wyongcan
  5. #==============================================================================
  6. #说明性注释
  7. #==============================================================================
  8. #  FEATURE_ELEMENT_RATE  = 11              # 属性抗性
  9. #  FEATURE_DEBUFF_RATE   = 12              # 弱化抗性
  10. #  FEATURE_STATE_RATE    = 13              # 状态抗性
  11. #  FEATURE_STATE_RESIST  = 14              # 状态免疫
  12. #  FEATURE_PARAM         = 21              # 普通能力
  13. #  FEATURE_XPARAM        = 22              # 添加能力
  14. #  FEATURE_SPARAM        = 23              # 特殊能力
  15. #  FEATURE_ATK_ELEMENT   = 31              # 攻击附带属性
  16. #  FEATURE_ATK_STATE     = 32              # 攻击附带状态
  17. #  FEATURE_ATK_SPEED     = 33              # 修正攻击速度
  18. #  FEATURE_ATK_TIMES     = 34              # 添加攻击次数
  19. #  FEATURE_STYPE_ADD     = 41              # 添加技能类型
  20. #  FEATURE_STYPE_SEAL    = 42              # 禁用技能类型
  21. #  FEATURE_SKILL_ADD     = 43              # 添加技能
  22. #  FEATURE_SKILL_SEAL    = 44              # 禁用技能
  23. #  FEATURE_EQUIP_WTYPE   = 51              # 可装备武器类型
  24. #  FEATURE_EQUIP_ATYPE   = 52              # 可装备护甲类型
  25. #  FEATURE_EQUIP_FIX     = 53              # 固定装备
  26. #  FEATURE_EQUIP_SEAL    = 54              # 禁用装备
  27. #  FEATURE_SLOT_TYPE     = 55              # 装备风格
  28. #  FEATURE_ACTION_PLUS   = 61              # 添加行动次数
  29. #  FEATURE_SPECIAL_FLAG  = 62              # 特殊标志
  30. #  FEATURE_COLLAPSE_TYPE = 63              # 消失效果
  31. #  FEATURE_PARTY_ABILITY = 64              # 队伍能力
  32. #--------------------------------------------------------------------------
  33. # ● 特殊标志
  34. #--------------------------------------------------------------------------
  35. # 自动战斗 0   # 擅长防御 1   # 保护弱者 2   # 特技专注 3
  36. #--------------------------------------------------------------------------
  37. # ● 各种能力值的简易访问方法
  38. #--------------------------------------------------------------------------
  39. #  ——普通能力——
  40. # 物理攻击 2  # 物理防御 3  # 魔法攻击  4 #  魔法防御 5  # 敏捷值 6  # 幸运值 7
  41. #  ——添加能力——
  42. # 成功几率 1  # 必杀几率 2  # 闪避必杀几率 3  # 闪避魔法几率 4
  43. # 反射魔法几率 5  # 反击几率 6  # HP再生速度 7  # MP再生速度 8  # TP再生速度 9
  44. #  ——特殊能力——
  45. #(0)  受到攻击的几率        
  46. #(1)  防御效果比率
  47. #(2)  恢复效果比率
  48. #(3)  药理知识
  49. #(4)  MP消费率
  50. #(5)  TP消耗率
  51. #(6)  物理伤害加成
  52. #(7)  魔法伤害加成  
  53. #(8)  地形伤害加成   
  54. #(9)  经验获得加成  
  55. #————————————————————————————————————————
  56. module Equipplus
  57. #得到随机属性装备方法:gainequip(装备ID,属性数)
  58. #~ 前缀结构:
  59. #~ ①权重(1-100) 越大越重要
  60. #~ ②名称(多个名称用","分开,会随机取其中一个添加到武器名前)
  61. #~ ③属性数组  提供两种方式:
  62. #~ 1.[属性ID,增加值]    属性ID参考说明增强脚本 增加了9号属性“极品出现率” ID为8,影响前缀的好坏 1 - 100
  63. #~ 2.与装备特性相同[code,data_id,value]  code,data_id参考说明增强脚本
  64.   @maxparamplus = 3 #最大前缀数
  65.   @moneyrate = 15 #物品价格计算公式为:原价格 + 前缀权重 * @moneyrate
  66.   @transpose = [*1..100].reverse #用于把1变成100,100变成1
  67.   @paramsplus = [           #暂时写了三个前缀,可以自己添加,参照前缀结构
  68.   [16,"",[[0,10]]],# 附加10HP
  69. [16,"",[[1,10]]],# 附加10MP
  70. [22,"",[[0,15]]],# 附加15HP
  71. [22,"",[[1,15]]],# 附加15MP
  72. [28,"",[[0,20]]],#附加20HP
  73. [28,"",[[1,20]]],# 附加20MP
  74. [18,"",[[2,4]]], #附加4点物理攻击
  75. [18,"",[[3,4]]], #附加4点防御攻击
  76. [18,"",[[4,4]]],#附加4魔法攻击   
  77. [18,"",[[5,4]]],#附加4魔法防御
  78. [18,"",[[6,4]]], #附加4速度
  79. [26,"",[[2,8]]], #物理攻击
  80. [26,"",[[3,8]]], #防御攻击
  81. [26,"",[[4,8]]],#魔法攻击   
  82. [26,"",[[5,8]]],# 魔法防御
  83. [26,"",[[6,8]]], #速度
  84. [34,"",[[2,12]]], #物理攻击
  85. [34,"",[[3,12]]], #防御攻击
  86. [34,"",[[4,12]]],#魔法攻击   
  87. [34,"",[[5,12]]],# 魔法防御
  88. [34,"",[[6,12]]], #速度
  89. [17,"",[[22,0,0.06]]],# 命中
  90. [17,"",[[22,1,0.06]]],# 物理躲避
  91. [17,"",[[22,2,0.06]]],# 必杀
  92. [17,"",[[22,3,0.06]]],# 必杀躲避
  93. [17,"",[[22,4,0.06]]],# 魔法躲避
  94. [17,"",[[22,5,0.06]]],# 魔法反射
  95. [17,"",[[22,6,0.06]]],# 物理反击
  96. [31,"",[[22,0,0.1]]],# 命中
  97. [31,"",[[22,1,0.1]]],# 物理躲避
  98. [31,"",[[22,2,0.1]]],# 必杀
  99. [31,"",[[22,3,0.1]]],# 必杀躲避
  100. [31,"",[[22,4,0.1]]],# 魔法躲避
  101. [31,"",[[22,5,0.1]]],# 魔法反射
  102. [31,"",[[22,6,0.1]]],# 物理反击
  103. [24,"",[[22,0,0.08]]],# 命中
  104. [24,"",[[22,1,0.08]]],# 物理躲避
  105. [24,"",[[22,2,0.08]]],# 必杀
  106. [24,"",[[22,3,0.08]]],# 必杀躲避
  107. [24,"",[[22,4,0.08]]],# 魔法躲避
  108. [24,"",[[22,5,0.08]]],# 魔法反射
  109. [24,"",[[22,6,0.08]]],# 物理反击
  110.   [16,"",[[0,10]]],# HP
  111. [16,"",[[1,10]]],# MP
  112. [22,"",[[0,15]]],# HP
  113. [22,"",[[1,15]]],# MP
  114. [28,"",[[0,20]]],# HP
  115. [28,"",[[1,20]]],# MP
  116. [18,"",[[2,4]]], #物理攻击
  117. [18,"",[[3,4]]], #防御攻击
  118. [18,"",[[4,4]]],#魔法攻击   
  119. [18,"",[[5,4]]],# 魔法防御
  120. [18,"",[[6,4]]], #速度
  121. [26,"",[[2,8]]], #物理攻击
  122. [26,"",[[3,8]]], #防御攻击
  123. [26,"",[[4,8]]],#魔法攻击   
  124. [26,"",[[5,8]]],# 魔法防御
  125. [26,"",[[6,8]]], #速度
  126. [34,"",[[2,12]]], #物理攻击
  127. [34,"",[[3,12]]], #防御攻击
  128. [34,"",[[4,12]]],#魔法攻击   
  129. [34,"",[[5,12]]],# 魔法防御
  130. [34,"",[[6,12]]], #速度
  131. [17,"",[[22,0,0.06]]],# 命中
  132. [17,"",[[22,1,0.06]]],# 物理躲避
  133. [17,"",[[22,2,0.06]]],# 必杀
  134. [17,"",[[22,3,0.06]]],# 必杀躲避
  135. [17,"",[[22,4,0.06]]],# 魔法躲避
  136. [17,"",[[22,5,0.06]]],# 魔法反射
  137. [17,"",[[22,6,0.06]]],# 物理反击
  138. [31,"",[[22,0,0.1]]],# 命中
  139. [31,"",[[22,1,0.1]]],# 物理躲避
  140. [31,"",[[22,2,0.1]]],# 必杀
  141. [31,"",[[22,3,0.1]]],# 必杀躲避
  142. [31,"",[[22,4,0.1]]],# 魔法躲避
  143. [31,"",[[22,5,0.1]]],# 魔法反射
  144. [31,"",[[22,6,0.1]]],# 物理反击
  145. [24,"",[[22,0,0.08]]],# 命中
  146. [24,"",[[22,1,0.08]]],# 物理躲避
  147. [24,"",[[22,2,0.08]]],# 必杀
  148. [24,"",[[22,3,0.08]]],# 必杀躲避
  149. [24,"",[[22,4,0.08]]],# 魔法躲避
  150. [24,"",[[22,5,0.08]]],# 魔法反射
  151. [24,"",[[22,6,0.08]]],# 物理反击
  152. [19,"",[[22,7,0.01]]],# HP再生
  153. [19,"",[[22,8,0.01]]],# MP再生
  154. [19,"",[[22,9,0.1]]],# SP再生
  155. [13,"",[[23,2,0.05]]],# 恢复效果
  156. [16,"",[[23,2,0.1]]],# 恢复效果
  157. [19,"",[[23,2,0.15]]],# 恢复效果
  158. [12,"",[[23,3,0.1]]],# 药物恢复效果
  159. [14,"",[[23,3,0.15]]],# 药物恢复效果
  160. [16,"",[[23,3,0.20]]],# 药物恢复效果
  161. [23,"",[[13,1,0.1]]],# 抗性
  162. [23,"",[[13,2,0.1]]],#
  163. [23,"",[[13,3,0.1]]],#
  164. [23,"",[[13,4,0.1]]],#
  165. [23,"",[[13,5,0.1]]],#
  166. [23,"",[[13,6,0.1]]],#
  167. [23,"",[[13,7,0.1]]],# 抗性
  168. [36,"",[[14,2,0.1]]],# 免疫
  169. [36,"",[[14,3,0.1]]],#
  170. [36,"",[[14,4,0.1]]],#
  171. [36,"",[[14,5,0.1]]],#
  172. [36,"",[[14,6,0.1]]],#
  173. [36,"",[[14,7,0.1]]],# 免疫
  174. [35,"",[[51,1,0.1]]],#武器
  175. [35,"",[[51,2,0.1]]],
  176. [35,"",[[51,3,0.1]]],
  177. [35,"",[[51,4,0.1]]],
  178. [35,"",[[51,5,0.1]]],
  179. [35,"",[[51,9,0.1]]],
  180. [35,"",[[51,10,0.1]]],
  181. [35,"",[[51,11,0.1]]],



  182.   ]
  183.   $商店随机 = false #商店买装备时出随机属性false
  184.   $战斗随机 = true #战斗后获得随机属性装备
  185.   def self.getname(paramsplus)
  186.     name = ""
  187.     paramsplus.is_a?(Array) ? paramsplus.each{|a| @temp = []; a[1].scan(/^[\u4e00-\u9fa5|\w]*|,[\u4e00-\u9fa5|\w]*/){|b| @temp.push b.gsub(","){}}; name += @temp[rand(@temp.size)]} : paramsplus[1].scan(/^[\u4e00-\u9fa5|\w]*|,[\u4e00-\u9fa5|\w]*/){|b| @temp = [] if @temp == nil ;@temp.push b.gsub(","){}}
  188.     name += @temp[rand(@temp.size)] if paramsplus.is_a?(Array) != true
  189.     name += ""
  190.   end
  191.   def self.getluck #获得极品出现率
  192.     luck = 0
  193.     $game_party.all_members.each{|a| a.weapons.each{|a| luck += a.params[8] if a.params.size == 9};a.armors.each{|a| luck += a.params[8] if a.params.size == 9}}
  194.     luck
  195.   end
  196.   def self.getnewequip(xequip,params = nil) #提供两个参数  装备(RPG::Equip类下的)和附加前缀数,不填则为随机
  197.     return unless xequip.is_a?(RPG::EquipItem)
  198.     #xparamplus为前缀数
  199.     xequip.paramsplus = [] if xequip.paramsplus == nil
  200.     return if xequip.paramsplus.size >= @maxparamplus
  201.     params != nil ? xparamplus = params :  xparamplus = rand(@maxparamplus * 110) / 100
  202.     xparamplus = xparamplus.to_int
  203.     return xequip if xparamplus == 0
  204.     equip = xequip.dup
  205.     paramsplus = equip.paramsplus.dup  #无奈的方法,不这样改一个装备所有同父装备的装备都会变
  206.     newparams = equip.params.dup
  207.     newfeatures = equip.features.dup
  208.     aparamsplus = @paramsplus.collect{|a| [a[0] = @transpose[a[0]-1],a[1],a[2]]}.sort_by{|a| a[0]}
  209.     while paramsplus.size < xparamplus
  210.       temp = rand(aparamsplus[-1][0])
  211.       temp = [temp - getluck,0].max
  212.       x = []
  213.       for i in aparamsplus
  214.         x.push i if i[0] >= temp && paramsplus.include?(i) != true
  215.       end
  216.       if x != []
  217.         a = [(x.size-1)*100 - getluck,0].max
  218.         a = (rand(a)/100).to_int
  219.         paramsplus.push x[a]
  220.       end
  221.     end
  222.     equip.name = getname(paramsplus) + equip.name #更新名称
  223.     paramsplus.each{|a| equip.price += @transpose[a[0] - 1] * @moneyrate} #更新价格
  224.     paramsplus.select{|a| a[2].select{|a| a.size == 2}.each{|a| newparams[a[0]] += a[1]}} #更新属性
  225.     #以下为更新特性
  226.     features = []
  227.     paramsplus.each{|a| a[2].each{|a| features.push a if a.size == 3}}
  228.     while features.size > 0
  229.       i = features.pop
  230.       newfeatures.select{|a| a.code == i[0] && a.data_id == i[1]}.size == 0 ? newfeatures.push(RPG::BaseItem::Feature.new(i[0],i[1],i[2])) : newfeatures.each_with_index{|a,b| newfeatures[b].value += i[2] if a.code == i[0] && a.data_id == i[1]}
  231.     end
  232.     if equip.is_a?(RPG::Weapon)
  233.       equip.id = $data_weapons.size
  234.       $data_weapons.insert $data_weapons.size,equip
  235.       $data_weapons[equip.id].paramsplus = paramsplus
  236.       $data_weapons[equip.id].params = newparams
  237.       $data_weapons[equip.id].features = newfeatures
  238.     else
  239.       equip.id = $data_armors.size
  240.       $data_armors.insert $data_armors.size,equip
  241.       $data_armors[equip.id].paramsplus = paramsplus
  242.       $data_armors[equip.id].params = newparams
  243.       $data_armors[equip.id].features = newfeatures
  244.     end
  245.     equip
  246.   end
  247.   def self.gainequip(id,params = nil)
  248.     $game_party.gain_item(Equipplus.getnewequip($data_weapons[id],params),1,true)
  249.   end
  250. end
  251. if $商店随机 == true
  252.   class Scene_Shop < Scene_MenuBase
  253.     def do_buy(number)
  254.       $game_party.lose_gold(number * buying_price)
  255.       if @item.is_a?(RPG::EquipItem)
  256.         x = number
  257.         loop do
  258.           break if x <= 0
  259.           x -= 1
  260.           $game_party.gain_item(Equipplus.getnewequip(@item), 1)
  261.         end
  262.       else
  263.         $game_party.gain_item(@item, number)
  264.       end
  265.     end
  266.   end
  267. end
  268. if $战斗随机 == true
  269.   module BattleManager
  270.     def self.gain_drop_items
  271.       $game_troop.make_drop_items.each do |item|
  272.         item.is_a?(RPG::EquipItem) ? xitem = Equipplus.getnewequip(item) : xitem = item
  273.         $game_party.gain_item(xitem, 1)
  274.         $game_message.add(sprintf(Vocab::ObtainItem, xitem.name))
  275.       end
  276.       wait_for_message
  277.     end
  278.   end
  279. end
  280. class RPG::EquipItem < RPG::BaseItem
  281.   alias old initialize
  282.   def initialize
  283.     old
  284.     @paramsplus #前缀
  285.   end
  286.   attr_accessor :paramsplus
  287. end
  288. # ■ 强化系统DataManager
  289. #------------------------------------------------------------------------------
  290. #  将武器和防具数据保存入存档
  291. #==============================================================================
  292. module DataManager
  293.   #--------------------------------------------------------------------------
  294.   # ● 生成存档内容
  295.   #--------------------------------------------------------------------------
  296.   def self.make_save_contents
  297.     contents = {}
  298.     contents[:system]        = $game_system
  299.     contents[:timer]         = $game_timer
  300.     contents[:message]       = $game_message
  301.     contents[:switches]      = $game_switches
  302.     contents[:variables]     = $game_variables
  303.     contents[:self_switches] = $game_self_switches
  304.     contents[:actors]        = $game_actors
  305.     contents[:party]         = $game_party
  306.     contents[:troop]         = $game_troop
  307.     contents[:map]           = $game_map
  308.     contents[:player]        = $game_player
  309.     contents[:weapons]       = $data_weapons
  310.     contents[:armors]        = $data_armors
  311.     contents
  312.   end
  313.   #--------------------------------------------------------------------------
  314.   # ● 展开存档内容
  315.   #--------------------------------------------------------------------------
  316.   def self.extract_save_contents(contents)
  317.     $game_system        = contents[:system]
  318.     $game_timer         = contents[:timer]
  319.     $game_message       = contents[:message]
  320.     $game_switches      = contents[:switches]
  321.     $game_variables     = contents[:variables]
  322.     $game_self_switches = contents[:self_switches]
  323.     $game_actors        = contents[:actors]
  324.     $game_party         = contents[:party]
  325.     $game_troop         = contents[:troop]
  326.     $game_map           = contents[:map]
  327.     $game_player        = contents[:player]
  328.     $data_weapons       = contents[:weapons]
  329.     $data_armors        = contents[:armors]
  330.   end
  331. end
复制代码
[/fold]
47、战斗时会跳动镜头接近放大目标。
[fold=战斗动态镜头]
  1. #打开脚本编辑器,将脚本插入到main上。
  2. #==============================================================================
  3. # F14 - 战斗镜头 - By芙蕾娅
  4. #------------------------------------------------------------------------------
  5. #  ★ - 新增  ☆ - 修改  ■ - 删除 ● - 无变更
  6. #==============================================================================
  7. module Freya
  8.   # 镜头帧速,数字越小越快
  9.   Camera_Frame_Speed = 12
  10.   # 镜头放大率,正常大小1.0,默认放大1.2
  11.   Take_Zoom = 1.2
  12.   # 背景增大率,默认0.1
  13.   # 避免默认素材背景在镜头移动后出现黑边所做的处理
  14.   Back_Zoom = 0.3
  15. end
  16. #==============================================================================
  17. # ■ Battle_Camera
  18. #------------------------------------------------------------------------------
  19. #  保存着战斗镜头的讯息
  20. #==============================================================================
  21. class Battle_Camera
  22.   #--------------------------------------------------------------------------
  23.   # ● 定义实例变量
  24.   #--------------------------------------------------------------------------
  25.   attr_accessor :x
  26.   attr_accessor :y
  27.   attr_accessor :zoom
  28.   attr_accessor :new_zoom
  29.   attr_reader :center_width
  30.   attr_reader :center_height
  31.   #--------------------------------------------------------------------------
  32.   # ● 初始化对象
  33.   #--------------------------------------------------------------------------
  34.   def initialize
  35.     @x = @new_x = @center_width = Graphics.width / 2
  36.     @y = @new_y = @center_height = Graphics.height / 1.5
  37.     @zoom = @new_zoom = 1.0
  38.     @frame_speed = Freya::Camera_Frame_Speed
  39.   end
  40.   #--------------------------------------------------------------------------
  41.   # ● 初始化帧率
  42.   #--------------------------------------------------------------------------
  43.   def reset_frame_speed
  44.     @frame_speed = Freya::Camera_Frame_Speed
  45.   end
  46.   #--------------------------------------------------------------------------
  47.   # ● 设置镜头瞄准对象
  48.   #--------------------------------------------------------------------------
  49.   def look(target,zoom=nil,speed=nil)
  50.     if target.is_a?(Game_Enemy)
  51.       reset_frame_speed
  52.       @new_x = target.screen_x
  53.       @new_y = target.screen_y
  54.       @new_zoom = zoom unless zoom.nil?
  55.       @frame_speed = speed unless speed.nil?
  56.     end
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   # ● 将镜头移至中心
  60.   #--------------------------------------------------------------------------
  61.   def center(zoom = 1.0)
  62.     @new_x = @center_width
  63.     @new_y = @center_height
  64.     @new_zoom = zoom
  65.   end
  66.   #--------------------------------------------------------------------------
  67.   # ● 计算x坐标
  68.   #--------------------------------------------------------------------------
  69.   def battler_x(battler)
  70.     distance = battler.screen_x - @x
  71.     value = distance * (@zoom - 1.0)
  72.     pos = battler.screen_x - (@x - @center_width)
  73.     return pos + value
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● 计算y坐标
  77.   #--------------------------------------------------------------------------
  78.   def battler_y(battler)
  79.     distance = battler.screen_y - @y
  80.     value = distance * (@zoom - 1.0)
  81.     pos = battler.screen_y - (@y - @center_height)
  82.     return pos + value
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # ● 更新画面
  86.   #--------------------------------------------------------------------------
  87.   def update
  88.     if @x != @new_x
  89.       @x = (@new_x - @x > 0) ?
  90.         [@x + move_speed_x, @new_x].min : [@x - move_speed_x, @new_x].max
  91.     end
  92.     if @y != @new_y
  93.       @y = (@new_y - @y > 0) ?
  94.         [@y + move_speed_y, @new_y].min : [@y - move_speed_y, @new_y].max
  95.     end
  96.     if @zoom != @new_zoom
  97.       @zoom = (@new_zoom - @zoom > 0) ?
  98.         [@zoom + zoom_speed, @new_zoom].min : [@zoom - zoom_speed, @new_zoom].max
  99.     end
  100.   end
  101.   #--------------------------------------------------------------------------
  102.   # ● 镜头x坐标与指定点x坐标的距离
  103.   #--------------------------------------------------------------------------
  104.   def dis_x
  105.     (@x - @new_x).abs
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # ● 镜头y坐标与指定点y坐标的距离
  109.   #--------------------------------------------------------------------------
  110.   def dis_y
  111.     (@y - @new_y).abs
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # ● 镜头放大率与指定放大率的差距
  115.   #--------------------------------------------------------------------------
  116.   def dis_zoom
  117.     (@zoom - @new_zoom).abs
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # ● 镜头x坐标移动速度
  121.   #--------------------------------------------------------------------------
  122.   def move_speed_x
  123.     return [(dis_x / @frame_speed).to_i, 1].max
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # ● 镜头y坐标移动速度
  127.   #--------------------------------------------------------------------------
  128.   def move_speed_y
  129.     return [(dis_y / @frame_speed).to_i, 1].max
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # ● 镜头缩放速度
  133.   #--------------------------------------------------------------------------
  134.   def zoom_speed
  135.     return [(dis_zoom / @frame_speed), 0.01].max
  136.   end
  137. end
  138. #==============================================================================
  139. # ■ Sprite_Battler
  140. #------------------------------------------------------------------------------
  141. #  显示战斗者的精灵。根据 Game_Battler 类的实例自动变化。
  142. #==============================================================================
  143. class Sprite_Battler < Sprite_Base
  144.   #--------------------------------------------------------------------------
  145.   # ● 定义实例变量
  146.   #--------------------------------------------------------------------------
  147.   attr_accessor :hp_gauge
  148.   #--------------------------------------------------------------------------
  149.   # ☆ 设置动画的精灵
  150.   #--------------------------------------------------------------------------
  151.   def animation_set_sprites(frame)
  152.     cell_data = frame.cell_data
  153.     set_animation_origin
  154.     @ani_sprites.each_with_index do |sprite, i|
  155.       next unless sprite
  156.       pattern = cell_data[i, 0]
  157.       if !pattern || pattern < 0
  158.         sprite.visible = false
  159.         next
  160.       end
  161.       sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2
  162.       sprite.visible = true
  163.       sprite.src_rect.set(pattern % 5 * 192,
  164.         pattern % 100 / 5 * 192, 192, 192)
  165.       if @ani_mirror
  166.         sprite.x = @ani_ox - cell_data[i, 1]
  167.         sprite.y = @ani_oy + cell_data[i, 2]
  168.         sprite.angle = (360 - cell_data[i, 4])
  169.         sprite.mirror = (cell_data[i, 5] == 0)
  170.       else
  171.         sprite.x = @ani_ox + cell_data[i, 1]
  172.         sprite.y = @ani_oy + cell_data[i, 2]
  173.         sprite.angle = cell_data[i, 4]
  174.         sprite.mirror = (cell_data[i, 5] == 1)
  175.       end
  176.       sprite.z = self.z + 300 + i
  177.       sprite.ox = 96
  178.       sprite.oy = 96
  179.       sprite.zoom_x = cell_data[i, 3] / 100.0 * self.zoom_x
  180.       sprite.zoom_y = cell_data[i, 3] / 100.0 * self.zoom_y
  181.       sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  182.       sprite.blend_type = cell_data[i, 7]
  183.     end
  184.   end
  185. end
  186. #==============================================================================
  187. # ■ Spriteset_Battle
  188. #------------------------------------------------------------------------------
  189. #  处理战斗画面的精灵的类。本类在 Scene_Battle 类的内部使用。
  190. #==============================================================================
  191. class Spriteset_Battle
  192.   #--------------------------------------------------------------------------
  193.   # ★ 定义实例变量
  194.   #--------------------------------------------------------------------------
  195.   attr_accessor :battle_camera
  196.   #--------------------------------------------------------------------------
  197.   # ☆ 初始化对象
  198.   #--------------------------------------------------------------------------
  199.   alias initialize_freya_camera initialize
  200.   def initialize
  201.     create_camera
  202.     initialize_freya_camera
  203.   end
  204.   #--------------------------------------------------------------------------
  205.   # ★ 创建镜头
  206.   #--------------------------------------------------------------------------
  207.   def create_camera
  208.     @battle_camera = Battle_Camera.new
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # ☆ 更新画面
  212.   #--------------------------------------------------------------------------
  213.   alias update_freya_camera update
  214.   def update
  215.     update_freya_camera
  216.     update_camera
  217.   end
  218.   #--------------------------------------------------------------------------
  219.   # ● 刷新镜头
  220.   #--------------------------------------------------------------------------
  221.   def update_camera
  222.     @battle_camera.update
  223.     update_battleback_position
  224.     update_enemy_position
  225.   end
  226.   #--------------------------------------------------------------------------
  227.   # ● 刷新背景坐标
  228.   #--------------------------------------------------------------------------
  229.   def update_battleback_position
  230.     zom = Freya::Take_Zoom + Freya::Back_Zoom
  231.     zoom = @back1_sprite.zoom_x = @back2_sprite.zoom_x = @battle_camera.zoom * zom
  232.     zoom = @back1_sprite.zoom_y = @back2_sprite.zoom_y = @battle_camera.zoom * zom
  233.     x = @back1_sprite.ox
  234.     y = @back1_sprite.oy
  235.     bbx = (x - (@battle_camera.x - @battle_camera.center_width))
  236.     bby = (y - (@battle_camera.y - @battle_camera.center_height))
  237.     @back1_sprite.x = @back2_sprite.x = bbx
  238.     @back1_sprite.y = @back2_sprite.y = bby
  239.   end
  240.   #--------------------------------------------------------------------------
  241.   # ● 刷新敌人坐标
  242.   #--------------------------------------------------------------------------
  243.   def update_enemy_position
  244.     for sprite in @enemy_sprites
  245.       next if sprite.nil? || sprite.battler.nil?
  246.       sprite.zoom_x = @battle_camera.zoom
  247.       sprite.zoom_y = @battle_camera.zoom
  248.       sprite.x = @battle_camera.battler_x(sprite.battler)
  249.       sprite.y = @battle_camera.battler_y(sprite.battler)
  250.       unless sprite.hp_gauge.nil?
  251.         sprite.hp_gauge.x = sprite.x - sprite.hp_gauge.width / 2
  252.         sprite.hp_gauge.y = sprite.y
  253.       end
  254.     end
  255.   end
  256. end
  257. #==============================================================================
  258. # ■ Scene_Battle
  259. #------------------------------------------------------------------------------
  260. #  战斗画面
  261. #==============================================================================
  262. class Scene_Battle < Scene_Base
  263.   #--------------------------------------------------------------------------
  264.   # ★ 获取镜头
  265.   #--------------------------------------------------------------------------
  266.   def camera
  267.     return @spriteset.battle_camera
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ☆ 使用技能/物品
  271.   #--------------------------------------------------------------------------
  272.   def use_item
  273.     camera.look(@subject,Freya::Take_Zoom)
  274.     wait(Freya::Camera_Frame_Speed)
  275.     item = @subject.current_action.item
  276.     @log_window.display_use_item(@subject, item)
  277.     @subject.use_item(item)
  278.     refresh_status
  279.     targets = @subject.current_action.make_targets.compact
  280.     camera.look(targets,Freya::Take_Zoom)
  281.     wait(Freya::Camera_Frame_Speed)
  282.     show_animation(targets, item.animation_id)
  283.     targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  284.     camera.center
  285.   end
  286.   #--------------------------------------------------------------------------
  287.   # ☆ 应用技能/物品效果
  288.   #--------------------------------------------------------------------------
  289.   alias apply_item_effects_freya_camera apply_item_effects
  290.   def apply_item_effects(target, item)
  291.     camera.look(target, Freya::Take_Zoom)
  292.     wait(Freya::Camera_Frame_Speed)
  293.     apply_item_effects_freya_camera(target, item)
  294.   end
  295.   #--------------------------------------------------------------------------
  296.   # ☆ 发动反击
  297.   #--------------------------------------------------------------------------
  298.   alias invoke_counter_attack_freya_camera invoke_counter_attack
  299.   def invoke_counter_attack(target, item)
  300.     camera.look(target, Freya::Take_Zoom)
  301.     wait(Freya::Camera_Frame_Speed)
  302.     invoke_counter_attack_freya_camera(target, item)
  303.   end
  304.   #--------------------------------------------------------------------------
  305.   # ☆ 发动反射魔法攻击
  306.   #--------------------------------------------------------------------------
  307.   alias invoke_magic_reflection_freya_camera invoke_magic_reflection
  308.   def invoke_magic_reflection(target, item)
  309.     camera.look(target, Freya::Take_Zoom)
  310.     wait(Freya::Camera_Frame_Speed)
  311.     invoke_magic_reflection_freya_camera(target, item)
  312.   end
  313.   #--------------------------------------------------------------------------
  314.   # ☆ 显示普通动画
  315.   #--------------------------------------------------------------------------
  316.   def show_normal_animation(targets, animation_id, mirror = false)
  317.     animation = $data_animations[animation_id]
  318.     if animation
  319.       camera.center if animation.to_screen?
  320.       targets.each do |target|
  321.         camera.look(target, Freya::Take_Zoom) unless animation.to_screen?
  322.         target.animation_id = animation_id
  323.         target.animation_mirror = mirror
  324.         abs_wait_short unless animation.to_screen?
  325.       end
  326.       abs_wait_short if animation.to_screen?
  327.     end
  328.   end
  329. end
复制代码
[/fold]

评分

参与人数 2赞 +2 收起 理由
涅炎 + 1 精品文章
深海鱼罐头 + 1 认可答案

查看全部评分


【同人游戏】勇者斗恶龙TG
欢迎加入游戏测试群333599798
如有需私聊请加QQ:516425000
梦石
0
星屑
50
在线时间
256 小时
注册时间
2016-3-22
回帖
16
发表于 2016-7-10 07:14:29 | 显示全部楼层
我可以发言吗?真的很棒!支持楼主!

点评

欢迎来参观!  发表于 2016-7-10 10:49
回复 1 0

使用道具 举报

梦石
0
星屑
9292
在线时间
2504 小时
注册时间
2011-5-20
回帖
14521

开拓者

发表于 2016-7-12 11:03:15 | 显示全部楼层
有的脚本好像作者禁止直接贴出来···然后这些是完全兼容的吗

点评

没考虑过,不过有的作者信息保留在脚本开头,有的没有作者显示。  发表于 2016-7-12 19:32
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复

使用道具 举报

梦石
1
星屑
3913
在线时间
592 小时
注册时间
2007-8-14
回帖
141
发表于 2016-7-16 23:17:00 | 显示全部楼层
感谢分享,29号脚本一进游戏就报错,报错的是这一句:

Taroxd::AttackSkill = true

点评

原来是这样!抱歉我没注意,谢谢!  发表于 2016-7-17 15:58
是不是没打基础脚本?就是前面第二个基础  发表于 2016-7-17 05:33
赞美灵魂……
回复

使用道具 举报

梦石
0
星屑
66
在线时间
258 小时
注册时间
2013-2-5
回帖
50
发表于 2016-7-18 22:08:52 | 显示全部楼层
本帖最后由 蒹露球 于 2016-7-18 22:18 编辑

那个碎屏脚本,记得发布帖是有收糖的,楼主就这么贴出来……
全年都是五月病
回复

使用道具 举报

梦石
0
星屑
50
在线时间
49 小时
注册时间
2015-10-17
回帖
34
发表于 2016-9-13 16:31:42 | 显示全部楼层
25号脚本添加了没反应,在战斗中找不到新增选项{:2_259:}
回复

使用道具 举报

梦石
0
星屑
64
在线时间
5 小时
注册时间
2019-3-10
回帖
4
发表于 2023-7-21 21:41:05 | 显示全部楼层
感謝分享,第二貨幣感覺很有趣
回复

使用道具 举报

梦石
0
星屑
31
在线时间
3 小时
注册时间
2019-8-29
回帖
1
发表于 2024-1-18 15:20:18 | 显示全部楼层
感谢分享
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部