| 赞 | 7 |
| VIP | |
| 好人卡 | |
| 积分 | 15 |
| 经验 | |
| 最后登录 | 2026-6-20 |
| 在线时间 | 815 小时 |
- 梦石
- 0
- 星屑
- 1461
- 在线时间
- 815 小时
- 注册时间
- 2013-8-3
- 回帖
- 355
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 小小西 于 2016-7-10 15:03 编辑
PS:这些脚本都是在自己制作游戏的时候收集的,首先在这里要非常感谢这些脚本的创始人,66RPG有你们更精彩。
有的脚本由于个人需要已经被修改过了,脚本的使用方法我直接写在脚本最上面,我就不发范例了。
目前还未发现哪个脚本有冲突现象,有的话请大家及时汇报以便更改。
这里有很多常见的脚本,有的人会说我闲着蛋疼,那么就让我蛋疼一次吧!
建议先打上基础脚本,有的脚本会用到,先放进脚本编辑器无妨,不然有的脚本会报错(特别是 By喵呜喵5 的脚本)。
[fold=基础脚本]- #==============================================================================
- # ■ 基础脚本
- #------------------------------------------------------------------------------
- # 请将基础脚本放在我的所有脚本之上。
- #
- # Tips: 什么是基础脚本?
- #
- # 这个基础脚本包含我自己的脚本中经常使用的一些【完全相同】的代码
- # 虽然不能保证百分百兼容,但是基础脚本中所有的代码都能与大部分脚本和谐共处
- # 相应的,如果基础脚本中的某些代码与其他脚本发生了冲突
- # 只能证明,我脚本的【思路】和那个脚本【必定会发生冲突】
- # 这种情况下,即使我将脚本改写成一个不需要基础脚本的版本,冲突仍然会发生
- #
- #==============================================================================
- $m5script ||= {}; $m5script[:ScriptData] ||= {}
- $m5script[:M5Base] = 20160320
- #--------------------------------------------------------------------------
- # ● 版本检查
- #
- # M5script.version(ver) 检查脚本版本是否高于指定版本
- #--------------------------------------------------------------------------
- module M5script
- def self.version(ver,hint = "喵呜喵5基础脚本版本过低!",key = :M5Base, h2="")
- version = $m5script[key.to_sym] || $m5script[key.to_s] || raise(h2)
- raise(hint) if (ver > version)
- end
- end
- #--------------------------------------------------------------------------
- # ● 读取备注、匹配文本
- #
- # M5script::M5note.match_text(text, note[, option, &block])
- # 匹配文本的基本指令
- #
- # text : 文本内容(String)
- # note : 需要匹配的文字(String)
- # option : 匹配文本的设置的哈希表
- # :default 缺省值(nil)
- # :value 待匹配文字是否包含内容(true)
- # :list 是否返回全部匹配结果的数组(nil)
- # &block : 成功匹配时执行的回调
- #
- # M5script::M5note.map_note(map, note[, option, &block])
- # 读取地图备注
- #
- # M5script::M5note.event_note(map, id, note[, option, &block])
- # 读取活动事件页的第一条指令,如果为注释则进行匹配
- #
- #--------------------------------------------------------------------------
- module M5script; module M5note; class << self
- def match_text(text, note, *option, &block)
- config = option[0].is_a?(Hash) ?
- [option[0][:default], option[0][:value], option[0][:list]] : option
- default, value, list = *config
- value = true if value.nil?
- return list ? [] : default if text.empty?
- all_result = []
- text.each_line do |line|
- line.chomp!
- if value
- result = /^\s*<\s*#{note}\s+(\S+)\s*>\s*$/ =~ line ? $1 : nil
- next unless result
- yield(result) if block_given?
- return result unless list
- all_result << result
- else
- return true if /^\s*<\s*#{note}\s*>\s*$/ =~ line
- end
- end
- return false unless value
- list ? all_result : default
- end
- def map_note(map, *args)
- text = load_data(sprintf("Data/Map%03d.rvdata2", map)).note
- match_text(text, *args)
- end
- def event_note(map, id, *args)
- begin
- if map == $game_map.map_id then page = $game_map.events[id]
- else
- ev = load_data(sprintf("Data/Map%03d.rvdata2", map)).events[id]
- (page = Game_Event.new(map,ev)).refresh
- end
- page.empty? ? raise : ev_list = page.list
- rescue then return match_text('', *args)
- end
- text = ''
- ev_list.each do |c|
- c.code == 108 || c.code == 408 || break
- text += c.parameters[0] + "\n"
- end
- match_text(text, *args)
- end
- end; end; end
- #--------------------------------------------------------------------------
- # ● 读取物品备注
- #--------------------------------------------------------------------------
- class RPG::BaseItem
- def m5note *a,&b; M5script::M5note.match_text(@note,*a,&b); end
- end
- #--------------------------------------------------------------------------
- # ● 与旧版基础脚本的兼容
- #--------------------------------------------------------------------------
- class << M5script
- def match_text *a,&b; M5script::M5note.match_text *a,&b; end
- def read_map_note *a,&b; M5script::M5note.map_note *a,&b; end
- def read_event_note *a,&b; M5script::M5note.event_note *a,&b; end
- end
- #--------------------------------------------------------------------------
- # ● 精灵 Sprite_M5_Base / Sprite_M5
- #--------------------------------------------------------------------------
- class Sprite_M5_Base < Sprite
- def dispose
- dispose_bitmap
- super
- end
- def dispose_bitmap; end
- end
- class Sprite_M5 < Sprite_M5_Base; end
- #--------------------------------------------------------------------------
- # ● 显示端口 Viewport_M5
- #--------------------------------------------------------------------------
- class Viewport_M5 < Viewport; end
- #--------------------------------------------------------------------------
- # ● 精灵组 Spriteset_M5
- #--------------------------------------------------------------------------
- class Spriteset_M5
- def update; end
- def dispose; end
- end
- #--------------------------------------------------------------------------
- # ● 自动更新释放精灵以及显示端口
- #--------------------------------------------------------------------------
- class Scene_Base
- alias m5_20141113_update_basic update_basic
- def update_basic
- m5_20141113_update_basic
- instance_variables.each do |varname|
- ivar = instance_variable_get(varname)
- ivar.update if ivar.is_a?(Sprite_M5) && !ivar.disposed?
- ivar.update if ivar.is_a?(Spriteset_M5)
- end
- end
- alias m5_20141113_terminate terminate
- def terminate
- m5_20141113_terminate
- instance_variables.each do |varname|
- ivar = instance_variable_get(varname)
- ivar.dispose if ivar.is_a?(Sprite_M5_Base)
- ivar.dispose if ivar.is_a?(Spriteset_M5)
- ivar.dispose if ivar.is_a?(Viewport_M5)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 获取控制符的参数(这个方法会破坏原始数据)
- #
- # m5_obtain_escape_param(text)
- #--------------------------------------------------------------------------
- class Window_Base
- def m5_obtain_escape_param(text)
- text.slice!(/^\[.*?\]/)[1..-2] rescue ""
- end
- end
- #--------------------------------------------------------------------------
- # ● 字体大小调整
- #
- # include M5script::M5_Window_FontSize
- #
- # m5_font_width 默认文字宽度
- # m5_font_height 默认文字高度
- # m5_font_size_change 调整文字大小
- #--------------------------------------------------------------------------
- module M5script; module M5_Window_FontSize
- def m5_font_size_change(width = m5_font_width, height = m5_font_height)
- contents.font.size = 40
- contents.font.size -= 1 while text_size("口").width > width if width
- contents.font.size -= 1 while text_size("口").height > height if height
- end
- def m5_font_width; return nil; end
- def m5_font_height; return nil; end
- end;end
- class Window_Base
- alias m5_20140728_reset_font_settings reset_font_settings
- def reset_font_settings
- m5_20140728_reset_font_settings
- m5_font_size_change if respond_to?(:m5_font_size_change)
- end
- alias m5_20140728_create_contents create_contents
- def create_contents
- m5_20140728_create_contents
- m5_font_size_change if respond_to?(:m5_font_size_change)
- end
- end
- #--------------------------------------------------------------------------
- # ● M5script::Window_Cal
- #
- # 计算一段文字大小时使用的临时窗口
- #
- # cal_all_text_height(text) 计算总高度
- # cal_all_text_width(text) 计算最大宽度
- # calc_line_width(text) 计算单行宽度
- # m5_contents 要描绘目标文字的contents
- # line_height 设置每行文字的高度
- #--------------------------------------------------------------------------
- module M5script; class Window_Cal < Window_Base
- attr_writer :line_height, :m5_contents
- def initialize
- super(0, 0, Graphics.width, Graphics.height)
- self.visible = false
- @text = ""
- @line_height = nil
- @m5_contents = nil
- end
- def line_height
- return @line_height if @line_height
- super
- end
- def initialize_contents
- if @m5_contents
- self.contents.dispose
- self.contents = @m5_contents.clone
- end
- end
- def cal_all_text_height(text)
- initialize_contents
- reset_font_settings
- @text = text.clone
- all_text_height = 1
- convert_escape_characters(@text).each_line do |line|
- all_text_height += calc_line_height(line, false)
- end
- @m5_contents = nil
- return all_text_height
- end
- def cal_all_text_width(text)
- initialize_contents
- reset_font_settings
- @text = text.clone
- all_text_width = 1
- convert_escape_characters(@text).each_line do |line|
- all_text_width = [all_text_width,calc_line_width(line,false)].max
- end
- @m5_contents = nil
- return all_text_width
- end
- def calc_line_width(target, need_refresh = true)
- initialize_contents if need_refresh
- reset_font_settings
- text = target.clone
- pos = {:x => 0, :y => 0, :new_x => 0, :height => Graphics.height}
- process_character(text.slice!(0, 1), text, pos) until text.empty?
- @m5_contents = nil if need_refresh
- return pos[:x]
- end
- def process_new_line(text, pos);end
- def draw_text(*args);end
- end; end
- #--------------------------------------------------------------------------
- # ● 自动计算大小和位置并包含背景的信息显示窗口
- #
- # M5script::Window_Var
- #
- # cal 计算窗口大小使用的临时窗口,M5script::Window_Cal 的实例
- # config 窗口设置的哈希表,使用了以下键值:
- # :X :X2 :Y :Y2 :Z :BACK :SX :SY
- #--------------------------------------------------------------------------
- module M5script; class Window_Var < Window_Base
- def initialize(config, cal = nil)
- get_config(config)
- @dispose_flag = true unless cal
- @size_window = cal || M5script::Window_Cal.new
- super(0,0,0,0)
- self.arrows_visible = false
- self.z = @config[:Z]
- self.openness = 0
- create_back_sprite
- end
- def get_config(config)
- @config = config.clone
- @config[:SX] ||= 0
- @config[:SY] ||= 0
- @config[:Z] ||= 0
- end
- def create_back_sprite
- return unless @config[:BACK]
- self.opacity = 0
- bitmap = Cache.system(@config[:BACK]) rescue nil
- return unless bitmap
- @background_sprite = Sprite.new
- @background_sprite.x, @background_sprite.y = @config[:SX], @config[:SY]
- @background_sprite.z = self.z - 1
- @background_sprite.bitmap = bitmap
- end
- def update_placement
- if @config[:X] && @config[:X2]
- self.width = (@config[:X2] - @config[:X]).abs
- else
- @size_window.m5_contents = self.contents
- self.width = @size_window.cal_all_text_width(@word)
- self.width += standard_padding * 2
- end
- if @config[:Y] && @config[:Y2]
- self.height = (@config[:Y2] - @config[:Y]).abs
- else
- @size_window.m5_contents = self.contents
- self.height = @size_window.cal_all_text_height(@word)
- self.height += standard_padding * 2
- end
- create_contents
- end
- def update_position
- if @config[:X] then self.x = @config[:X]
- elsif @config[:X2] then self.x = @config[:X2] - self.width
- else self.x = 0
- end
- if @config[:Y] then self.y = @config[:Y]
- elsif @config[:Y2] then self.y = @config[:Y2] - self.height
- else self.y = 0
- end
- end
- def dispose
- super
- @size_window.dispose if @dispose_flag
- @background_sprite.dispose if @background_sprite
- end
- end; end
- #--------------------------------------------------------------------------
- # ● 生成TXT
- #
- # M5script.creat_text(name,word,type)
- #--------------------------------------------------------------------------
- module M5script
- def self.creat_text(name,word,type = 'w')
- content = File.open("#{name}",type)
- content.puts word
- content.close
- end
- end
- #--------------------------------------------------------------------------
- # ● 打开地址
- #
- # M5script.open_url(addr)
- #--------------------------------------------------------------------------
- module M5script
- def self.open_url(addr)
- api = Win32API.new('shell32.dll','ShellExecuteA','pppppi','i')
- api.call(0,'open',addr,0, 0, 1)
- end
- end
- #--------------------------------------------------------------------------
- # ● 读取、写入Game.ini
- #
- # M5script::M5ini.get(key, default_value[, section])
- # M5script::M5ini.write(key, value[, section])
- #--------------------------------------------------------------------------
- module M5script; module M5ini; class << self
- def filename; './Game.ini'; end
- def default_section; 'M5script'; end
- def get(key, default_value, section = default_section)
- buffer = [].pack('x256')
- api = Win32API.new('kernel32','GetPrivateProfileString','ppppip', 'i')
- l = api.call(section, key, default_value, buffer, buffer.size, filename)
- return buffer[0, l]
- end
- def write(key, value, section = default_section)
- api = Win32API.new('kernel32','WritePrivateProfileString','pppp', 'i')
- api.call(section, key, value.to_s, filename)
- end
- end; end; end
复制代码 [/fold]
[fold=基础脚本]- #----------------------------------------------------------------------------
- # ● Taroxd 基础设置
- # 定义了一些经常会用到的方法。
- #----------------------------------------------------------------------------
- #
- # 模块或类
- # 方法名(参数) { block } / 别名 -> 返回值的类型或介绍
- # 方法的介绍。
- # 如果返回值没有给出,表明返回值无意义或没有确定的类型。
- #
- # Module
- # get_access_control(method_name) -> Symbol or nil
- # 获取方法的访问控制。返回 :public, :protected, :private 或 nil(未定义)
- # method_name 为字符串或符号(Symbol),下同。
- #
- # def_after(method_name) { |args| block } -> method_name
- # def_after(method_name, hook) -> method_name
- # 重定义方法 method_name。
- # 第一种形式中,将 block 定义为方法,在原方法之后调用。
- # 第二种形式中,
- # * 如果 hook 为符号或字符串,那么会在原方法之后调用对应的方法。
- # * 如果 hook 可以响应方法 call,那么会在原方法之后调用 call。
- # * 如果 hook 是 UnboundMethod,那么会将 hook 绑定到对象后调用。
- #
- # 不改变原方法的返回值和访问控制。
- # 无论哪种调用,参数都和原来的参数相同。
- # 以下 def_* 的所有方法均有这两种形式。为了方便起见只写出第一种。
- #
- # 例:
- # class Game_Actor < Game_Battler
- # def_after :initialize do |actor_id|
- # @my_attribute = actor_id
- # end
- # end
- #
- # def_after!(method_name) { |args| block } -> method_name
- # 与 def_after 类似,但改变原方法的返回值。
- #
- # def_before(method_name) { |args| block } -> method_name
- # 与 def_after 类似,但在原方法之前调用。
- #
- # def_with(method_name) { |old, args| block } -> method_name
- # 与 def_after! 类似,但参数不同。old 参数是原方法的返回值。
- #
- # def_chain(method_name) { |old, args| block } -> method_name
- # 与 def_with 类似,但 old 参数为对应原方法的一个 Method 对象。
- #
- # def_and(method_name) { |args| block } -> method_name
- # 与 def_after 类似,但仅当原方法的返回值为真时调用。
- # 仅当原方法的返回值为真时,才会改变原方法的返回值。
- #
- # def_or(method_name) { |args| block } -> method_name
- # 与 def_after 类似,但仅当原方法的返回值为伪时调用。
- # 仅当原方法的返回值为假时,才会改变原方法的返回值。
- #
- # def_if(method_name) { |args| block } -> method_name
- # 与 def_before 类似,但仅当调用结果为真时调用原方法。
- # 仅当调用的结果为假时,改变原方法的返回值为 nil。
- #
- # def_unless(method_name) { |args| block } -> method_name
- # 与 def_before 类似,但仅当调用结果为假时调用原方法。
- # 仅当调用的结果为真时,改变原方法的返回值为 nil。
- #
- # Taroxd::ReadNote
- # 该模块由以下类 extend。
- # RPG::BaseItem
- # RPG::Map
- # RPG::Event(将事件名称作为备注)
- # RPG::Tileset
- # RPG::Class::Learning
- #
- # note_i(method_name, default = 0)
- # 定义方法 method_name,读取备注中 <method_name x> 形式的内容。其中 x 为整数。
- # 读取到的话,定义的方法会返回读取到的整数值,否则返回 default。
- #
- # 例:RPG::UsableItem.note_i :item_cost
- #
- # note_f(method_name, default = 0.0)
- # 与 note_i 类似,但读取的是实数。
- #
- # note_s(method_name, default = '')
- # 与 note_i 类似,但读取的是字符串。
- #
- # note_bool(method_name)
- # 定义 method_name 方法,判断备注中是否存在 <method_name> 子字符串。
- # 特别地,若 method_name 以问号或感叹号结尾,读取内容中不需要包含问号、感叹号。
- # (上面几个方法也是一样)
- #
- # Taroxd::DisposeBitmap
- # dispose
- # 释放位图后调用父类的 dispose 方法。
- #
- # Spriteset_Map / Spriteset_Battle
- # self.use_sprite(SpriteClass)
- # self.use_sprite(SpriteClass) { block }
- # 在 Spriteset 中使用一个 SpriteClass 的精灵。
- # 如果给出 block,则生成精灵使用的参数是 block 在 Spriteset 的上下文中执行后的返回值。
- # 自动管理精灵的生成、更新、释放。
- #
- # 例:Spriteset_Map.use_sprite(Sprite_OnMap) { @viewport1 }
- #
- # Fixnum
- # id -> self
- # 返回 self。这使得之后一些方法的参数既可以用数据库的数据,也可以用整数。
- #
- # Enumerable
- # sum(base = 0) { |element| block }
- # 对所有元素 yield 后求和。base 为初始值。
- # 没有 block 参数时,对所有元素求和。
- #
- # 例:
- # class Game_Unit
- # def tgr_sum
- # alive_members.sum(&:tgr)
- # end
- # end
- #
- # pi(base = 1) { |element| block }
- # 与 sum 类似,但对所有元素求积。
- #
- # Game_BaseItem
- # id / item_id -> Fixnum
- # 返回物品 id。
- #
- # Game_BattlerBase
- # mtp -> Numeric
- # 返回 max_tp。
- #
- # initialized? -> true
- # 返回 true。
- #
- # Game_Battler
- # note_objects -> Enumerator
- # note_objects { |obj| ... } -> self
- # 迭代战斗者拥有的所有带有备注的对象。
- # (角色、职业、装备、技能、敌人、状态等)
- # 没有 block 给出时,返回 Enumerator 对象。
- #
- # note -> String
- # 返回数据库对象的备注。
- #
- # equips / weapons / armors -> []
- # 返回空数组。
- #
- # skill?(skill) -> true / false
- # 判断是否拥有技能。skill 可以为技能 ID,也可以为 RPG::Skill 的实例。
- #
- # skill_learn?(skill) -> true / false
- # 判断是否习得技能。skill 可以为技能 ID,也可以为 RPG::Skill 的实例。
- #
- # Game_Actor
- # data_object -> RPG::Actor
- # 返回数据库对象,等价于 actor。
- #
- # weapon?(item) / armor?(item) -> true / false
- # 检测是否装备对应的物品。item 可以为装备 ID,也可以为 RPG::EquipItem 的实例。
- #
- # initialized? -> true / false
- # 判断角色是否已经初始化。
- #
- # Game_Enemy
- # id -> Fixnum
- # 返回敌人 id。
- #
- # data_object -> RPG::Enemy
- # 返回数据库对象,等价于 enemy。
- #
- # skills -> Array
- # 返回敌人的所有技能实例的数组。
- # skill? 方法判断是否拥有技能与该数组有关。
- #
- # basic_skills -> Array
- # 返回敌人行动列表中的技能 ID 的数组(元素可以重复)。
- # skill_learn? 方法判断是否学会技能与该数组有关。
- #
- # Game_Actors
- # include Enumerable
- #
- # each -> Enumerator
- # each { |actor| block } -> self
- # 迭代已经初始化的每个角色。
- # 如果没有给出 block,返回一个 Enumerator 对象。
- #
- # include?(actor)
- # 角色是否已经初始化。actor 可以为 Game_Actor / RPG::Actor 的对象或 ID。
- #
- # Game_Unit
- # include Enumerable
- #
- # each -> Enumerator
- # each { |battler| block } -> self
- # 迭代队伍中的每个成员。
- # 如果没有给出 block,返回一个 Enumerator 对象。
- # 等价于 members.each。
- #
- # each_member -> Enumerator / self
- # each 的别名。
- #
- # self[*args] / slice(*args) -> Game_Actor / Array / nil
- # 等价于 members[*args]
- #
- # empty? -> true / false
- # 判断队伍是否为空。
- #
- # size / length -> Integer
- # 返回队伍人数。
- #
- # Game_Party
- # include?(actor) -> true / false
- # 队伍中是否存在角色。actor 可以为 Game_Actor / RPG::Actor 的对象或 ID。
- #
- # Game_Map
- # id -> Fixnum
- # 返回地图 ID。
- #
- # data_object -> RPG::Map
- # 返回数据库对象。
- #
- # note -> String
- # 返回备注内容。
- #
- # Game_CharacterBase
- # same_pos?(character) -> true / false
- # 判定是否处在相同位置。
- # character 是任意能够响应方法 x 和 y 的对象。
- # 仅作为点(x, y)进行比较,不考虑 Game_Vehicle 的地图 ID 等问题。
- #
- #-----------------------------------------------------------------------------
- module Taroxd end
- module Taroxd::Def
- Singleton = Module.new { Object.send :include, self }
- Module.send :include, self
- def get_access_control(sym)
- return :public if public_method_defined? sym
- return :protected if protected_method_defined? sym
- return :private if private_method_defined? sym
- nil
- end
- template = lambda do |singleton|
- if singleton
- klass = 'singleton_class'
- get_method = 'method'
- define = 'define_singleton_method'
- else
- klass = 'self'
- get_method = 'instance_method'
- define = 'define_method'
- end
- %(
- def <name>(sym, hook = nil, &b)
- access = #{klass}.get_access_control sym
- old = #{get_method} sym
- if b
- #{define} sym, &b
- hook = #{get_method} sym
- end
- if hook.respond_to? :to_sym
- hook = hook.to_sym
- #{define} sym do |*args, &block|
- <pattern_sym>
- end
- elsif hook.respond_to? :call
- #{define} sym do |*args, &block|
- <pattern_call>
- end
- elsif hook.kind_of? UnboundMethod
- #{define} sym do |*args, &block|
- <pattern_unbound>
- end
- end
- #{klass}.send access, sym
- sym
- end
- )
- end
- # 保存模板和替换 'hook(' 字符串的字符
- template = {false => template.call(false), true => template.call(true)}
- # 替换掉 pattern 中的语法
- gsub_pattern = lambda do |pattern, singleton|
- old = singleton ? 'old' : 'old.bind(self)'
- pattern.gsub('*', '*args, &block')
- .gsub(/old(\()?/) { $1 ? "#{old}.call(" : old }
- end
- # 存入代替 "hook(" 的字符串
- template['sym'] = '__send__(hook, '
- template['call'] = 'hook.call('
- template['unbound'] = 'hook.bind(self).call('
- # 获取定义方法内容的字符串
- # 得到的代码较长,请输出查看
- code = lambda do |name, pattern, singleton|
- pattern = gsub_pattern.call(pattern, singleton)
- template[singleton]
- .sub('<name>', name)
- .gsub(/<pattern_(\w+?)>/) { pattern.gsub('hook(', template[$1]) }
- end
- main = TOPLEVEL_BINDING.eval('self')
- # 定义 def_ 系列方法的方法
- define_singleton_method :def_ do |name, pattern|
- name = "#{__method__}#{name}"
- module_eval code.call(name, pattern, false)
- Singleton.module_eval code.call("singleton_#{name}", pattern, true)
- main.define_singleton_method name, &Kernel.method(name)
- end
- # 实际定义 def_ 系列的方法
- def_ :after, 'ret = old(*); hook(*); ret'
- def_ :after!, 'old(*); hook(*)'
- def_ :before, 'hook(*); old(*)'
- def_ :with, 'hook(old(*), *)'
- def_ :chain, 'hook(old, *)'
- def_ :and, 'old(*) && hook(*)'
- def_ :or, 'old(*) || hook(*)'
- def_ :if, 'old(*) if hook(*)'
- def_ :unless, 'old(*) unless hook(*)'
- end
- module Taroxd::ReadNote
- include RPG
- BaseItem.extend self
- Map.extend self
- Event.extend self
- Tileset.extend self
- Class::Learning.extend self
- # 获取 note 的方法
- def note_method
- :note
- end
- # 事件名称作为备注
- def Event.note_method
- :name
- end
- # 备注模板
- def note_any(name, default, re, capture)
- name = name.to_s
- mark = name.slice!(/[?!]\Z/)
- re = re.source if re.kind_of?(Regexp)
- re = "/<#{name.gsub('_', '\s*')}#{re}>/i"
- default = default.inspect
- class_eval %{
- def #{name}
- return @#{name} if instance_variable_defined? :@#{name}
- @#{name} = #{note_method} =~ #{re} ? (#{capture}) : (#{default})
- end
- }, __FILE__, __LINE__
- alias_method name + mark, name if mark
- end
- def note_i(name, default = 0)
- note_any(name, default, '\s*(-?\d+)', '$1.to_i')
- end
- def note_f(name, default = 0.0)
- note_any(name, default, '\s*(-?\d+(?:\.\d+)?)', '$1.to_f')
- end
- def note_s(name, default = '')
- note_any(name, default, '\s*(\S.*)', '$1')
- end
- def note_bool(name)
- note_any(name, false, '', 'true')
- end
- end
- module Taroxd::DisposeBitmap
- def dispose
- bitmap.dispose if bitmap
- super
- end
- end
- module Taroxd::SpritesetDSL
- # 方法名
- CREATE_METHOD_NAME = :create_taroxd_sprites
- UPDATE_METHOD_NAME = :update_taroxd_sprites
- DISPOSE_METHOD_NAME = :dispose_taroxd_sprites
- # 定义管理精灵的方法
- def self.extended(klass)
- klass.class_eval do
- sprites = nil
- define_method CREATE_METHOD_NAME do
- sprites = klass.sprite_list.map do |sprite_class, get_args|
- if get_args
- sprite_class.new(*instance_eval(&get_args))
- else
- sprite_class.new
- end
- end
- end
- define_method(UPDATE_METHOD_NAME) { sprites.each(&:update) }
- define_method(DISPOSE_METHOD_NAME) { sprites.each(&:dispose) }
- end
- end
- def use_sprite(klass, &get_args)
- sprite_list.push [klass, get_args]
- end
- def sprite_list
- @_taroxd_use_sprite ||= []
- end
- # 在一系列方法上触发钩子
- def sprite_method_hook(name)
- def_after :"create_#{name}", CREATE_METHOD_NAME
- def_after :"update_#{name}", UPDATE_METHOD_NAME
- def_after :"dispose_#{name}", DISPOSE_METHOD_NAME
- end
- end
- class Fixnum < Integer
- alias_method :id, :to_int
- end
- module Enumerable
- def sum(base = 0)
- block_given? ? inject(base) { |a, e| a + yield(e) } : inject(base, :+)
- end
- def pi(base = 1)
- block_given? ? inject(base) { |a, e| a * yield(e) } : inject(base, :*)
- end
- end
- class Game_BaseItem
- attr_reader :item_id
- alias_method :id, :item_id
- end
- class Game_BattlerBase
- def initialized?
- true
- end
- def mtp
- max_tp
- end
- end
- class Game_Battler < Game_BattlerBase
- # 迭代拥有备注的对象
- def note_objects
- return to_enum(__method__) unless block_given?
- states.each { |e| yield e }
- equips.each { |e| yield e if e }
- skills.each { |e| yield e }
- yield data_object
- yield self.class if actor?
- end
- def regenerate_tp
- self.tp += max_tp * trg
- end
- def data_object
- raise NotImplementedError
- end
- def note
- data_object.note
- end
- def id
- data_object.id
- end
- def skills
- (basic_skills | added_skills).sort.map { |id| $data_skills[id] }
- end
- def equips
- []
- end
- alias_method :weapons, :equips
- alias_method :armors, :equips
- alias_method :basic_skills, :equips
- def skill?(skill)
- basic_skills.include?(skill.id) || added_skills.include?(skill.id)
- end
- def skill_learn?(skill)
- basic_skills.include?(skill.id)
- end
- end
- class Game_Actor < Game_Battler
- alias_method :data_object, :actor
- def weapon?(weapon)
- @equips.any? { |item| item.id == weapon.id && item.is_weapon? }
- end
- def armor?(armor)
- @equips.any? { |item| item.id == armor.id && item.is_armor? }
- end
- def initialized?
- $game_actors.include?(self)
- end
- private
- def basic_skills
- @skills
- end
- end
- class Game_Enemy < Game_Battler
- alias_method :data_object, :enemy
- alias_method :id, :enemy_id
- def basic_skills
- enemy.actions.map(&:skill_id)
- end
- end
- class Game_Actors
- include Enumerable
- def each
- return to_enum(__method__) unless block_given?
- @data.each { |actor| yield actor if actor }
- self
- end
- def include?(actor)
- @data[actor.id]
- end
- end
- class Game_Unit
- include Enumerable
- def to_a
- members
- end
- def each
- return to_enum(__method__) unless block_given?
- members.each { |battler| yield battler }
- self
- end
- alias_method :each_member, :each
- def [](*args)
- members[*args]
- end
- alias_method :slice, :[]
- def empty?
- members.empty?
- end
- def size
- members.size
- end
- alias_method :length, :size
- end
- class Game_Party < Game_Unit
- def include?(actor)
- @actors.include?(actor.id)
- end
- end
- class Game_Map
- alias_method :id, :map_id
- def data_object
- @map
- end
- def note
- @map.note
- end
- end
- class Game_CharacterBase
- def same_pos?(character)
- @x == character.x && @y == character.y
- end
- end
- class Spriteset_Map
- extend Taroxd::SpritesetDSL
- sprite_method_hook :timer
- end
- class Spriteset_Battle
- extend Taroxd::SpritesetDSL
- sprite_method_hook :timer
- end
复制代码 [/fold]
1、这是事件党必备的脚本,个人觉得防卡效果最好的。
[fold=【超级防卡脚本】][/fold]
2、这个应该是非常常见的脚本,不过为了集合一下还是发上来吧。
[fold=详细的状态显示脚本]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- #==============================================================================
- #
- # ▼ Yanfly Engine Ace - Ace Status Menu v1.01
- # -- Last Updated: 2011.12.26
- # -- Level: Normal
- # -- Requires: n/a
- #
- #==============================================================================
-
- $imported = {} if $imported.nil?
- $imported["YEA-StatusMenu"] = true
-
- #==============================================================================
- # ▼ Updates
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # 2011.12.26 - Compatibility Update: Rename Actor
- # 2011.12.23 - Started Script and Finished.
- #
- #==============================================================================
- # ▼ Introduction
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # This script changes the status screen completely to something the player can
- # interact with more and be able to view actor data with more clarity. The
- # player is able to view the general information for an actor (parameters and
- # experience), a parameters bar graph, the various hidden extra parameters
- # (named properties in the script), and a customizable biography for the actor.
- # Also with this script, biographies can be changed at any time using a script
- # call to add more of a personal touch to characters.
- #
- #==============================================================================
- # ▼ Instructions
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
- #
- # -----------------------------------------------------------------------------
- # Script Calls - These commands are used with script calls.
- # -----------------------------------------------------------------------------
- # $game_actors[x].description = string
- # Changes the biography description for actor x to that of the string. Use \n
- # to designate linebreaks in the string. If you wish to use text codes, write
- # them in the strings as \\n[2] or \\c[3] to make them work properly.
- #
- #==============================================================================
- # ▼ Compatibility
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
- # it will run with RPG Maker VX without adjusting.
- #
- #==============================================================================
-
- module YEA
- module STATUS
-
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - Command Window Settings -
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # This section adjusts the commands that appear in the command window used
- # for the status screen. Rearrange the commands, add new ones, remove them
- # as you see fit.
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- COMMANDS =[ # The order at which the menu items are shown.
- # [ :command, "Display"],
- [ :general, "信息"],
- [ :parameters, "数据"],
- [ :properties, "属性"],
- # [ :custom1, "Skills"],
- #[ :custom2, "Equipment"],
- #[ :custom3, "Class"],
- [ :rename, "Rename"], # Requires YEA - Rename Actor
- [ :retitle, "Retitle"], # Requires YEA - Rename Actor
- ] # Do not remove this.
-
- #--------------------------------------------------------------------------
- # - Status Custom Commands -
- # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- # For those who use scripts to that may produce unique effects for the
- # status menu, use this hash to manage the custom commands for the Status
- # Command Window. You can disable certain commands or prevent them from
- # appearing by using switches. If you don't wish to bind them to a switch,
- # set the proper switch to 0 for it to have no impact.
- #--------------------------------------------------------------------------
- CUSTOM_STATUS_COMMANDS ={
- # :command => [EnableSwitch, ShowSwitch, Handler Method, Window Draw],
- :custom1 => [ 0, 0, :command_name1, :draw_custom1],
- :custom2 => [ 0, 0, :command_name2, :draw_custom2],
- :custom3 => [ 0, 0, :command_name3, :draw_custom3],
- } # Do not remove this.
-
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - General Window Settings -
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # These settings adjust the way the general window visually appears.
- # Not many changes need to be done here other than vocab changes.
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- PARAMETERS_VOCAB = "数据" # Title used for Parameters.
- EXPERIENCE_VOCAB = "经验值" # Title used for Experience.
- NEXT_TOTAL_VOCAB = "下次 %s 经验值总数" # Label used for total experience.
-
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - Parameters Window Settings -
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # These settings adjust the way the parameters window visually appears.
- # Each of the stats have a non-window colour. Adjust them as you see fit.
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- PARAM_COLOUR ={
- # ParamID => [:stat, Colour1, Colour2 ],
- 2 => [ :atk, Color.new(225, 100, 100), Color.new(240, 150, 150)],
- 3 => [ :def, Color.new(250, 150, 30), Color.new(250, 180, 100)],
- 4 => [ :mat, Color.new( 70, 140, 200), Color.new(135, 180, 230)],
- 5 => [ :mdf, Color.new(135, 130, 190), Color.new(170, 160, 220)],
- 6 => [ :agi, Color.new( 60, 180, 80), Color.new(120, 200, 120)],
- 7 => [ :luk, Color.new(255, 240, 100), Color.new(255, 250, 200)],
- } # Do not remove this.
-
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - Properties Window Settings -
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # These settings adjust the way the properties window visually appears.
- # The properties have abbreviations, but leaving them as such makes things
- # confusing (as it's sometimes hard to figure out what the abbreviations
- # mean). Change the way the appear, whether or not they appear, and what
- # order they will appear in.
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- PROPERTIES_FONT_SIZE = 16 # Font size used for properties.
-
- # These are the properties that appear in column 1.
- PROPERTIES_COLUMN1 =[
- [:hit, "命中"],
- [:eva, "躲避"],
- [:cri, "致命一击"],
- [:cev, "致命闪避"],
- [:mev, "魔法躲避"],
- [:mrf, "魔法反射"],
- [:cnt, "反击"],
- [:tgr, "受敌攻击"],
- ] # Do not remove this.
-
- # These are the properties that appear in column 2.
- PROPERTIES_COLUMN2 =[
- [:hrg, "hp逐渐恢复"],
- [:mrg, "mp逐渐恢复"],
- [:trg, "SP逐渐恢复"],
- [:rec, "魔法恢复"],
- [:grd, "防御力"],
- [:pha, "药品恢复"],
- [:exr, "获得经验"],
- [:tcr, "SP获得率"],
- ] # Do not remove this.
-
- # These are the properties that appear in column 3.
- PROPERTIES_COLUMN3 =[
- [:hcr, "SB伤害"], # Requires YEA - Skill Cost Manager
- [:mcr, "MF消耗"],
- [:tcr, "SQ伤害"], # Requires YEA - Skill Cost Manager
- [:cdr, "直接伤害"], # Requires YEA - Skill Restrictions
- [:wur, "间接伤害"], # Requires YEA - Skill Restrictions
- [:pdr, "物理伤害"],
- [:mdr, "魔法伤害"],
- [:fdr, "基本伤害"],
- ] # Do not remove this.
-
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - Biography Window Settings -
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # These settings adjust the way the biography appears including the title
- # used at the top, the font size, and whatnot.
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- BIOGRAPHY_NICKNAME_TEXT = "%s %s" # How the nickname will appear.
- BIOGRAPHY_NICKNAME_SIZE = 32 # Size of the font used.
-
-
-
- end # STATUS
- end # YEA
-
- #==============================================================================
- # ▼ Editting anything past this point may potentially result in causing
- # computer damage, incontinence, explosion of user's head, coma, death, and/or
- # halitosis so edit at your own risk.
- #==============================================================================
-
- #==============================================================================
- # ■ Numeric
- #==============================================================================
-
- class Numeric
-
- #--------------------------------------------------------------------------
- # new method: group_digits
- #--------------------------------------------------------------------------
- unless $imported["YEA-CoreEngine"]
- def group; return self.to_s; end
- end # $imported["YEA-CoreEngine"]
-
- end # Numeric
-
- #==============================================================================
- # ■ Game_Temp
- #==============================================================================
-
- class Game_Temp
-
- #--------------------------------------------------------------------------
- # public instance variables
- #--------------------------------------------------------------------------
- attr_accessor :scene_status_index
- attr_accessor :scene_status_oy
-
- end # Game_Temp
-
- #==============================================================================
- # ■ Game_Actor
- #==============================================================================
-
- class Game_Actor < Game_Battler
-
- #--------------------------------------------------------------------------
- # new method: description=
- #--------------------------------------------------------------------------
- def description=(text)
- @description = text
- end
-
- #--------------------------------------------------------------------------
- # overwrite method: description
- #--------------------------------------------------------------------------
- def description
- return @description unless @description.nil?
- return actor.description
- end
-
- end # Game_Actor
-
- #==============================================================================
- # ■ Window_StatusCommand
- #==============================================================================
-
- class Window_StatusCommand < Window_Command
-
- #--------------------------------------------------------------------------
- # public instance variables
- #--------------------------------------------------------------------------
- attr_accessor :item_window
-
- #--------------------------------------------------------------------------
- # initialize
- #--------------------------------------------------------------------------
- def initialize(dx, dy)
- super(dx, dy)
- @actor = nil
- end
-
- #--------------------------------------------------------------------------
- # window_width
- #--------------------------------------------------------------------------
- def window_width; return 160; end
-
- #--------------------------------------------------------------------------
- # actor=
- #--------------------------------------------------------------------------
- def actor=(actor)
- return if @actor == actor
- @actor = actor
- refresh
- end
-
- #--------------------------------------------------------------------------
- # visible_line_number
- #--------------------------------------------------------------------------
- def visible_line_number; return 4; end
-
- #--------------------------------------------------------------------------
- # ok_enabled?
- #--------------------------------------------------------------------------
- def ok_enabled?
- return handle?(current_symbol)
- end
-
- #--------------------------------------------------------------------------
- # make_command_list
- #--------------------------------------------------------------------------
- def make_command_list
- return unless @actor
- for command in YEA::STATUS::COMMANDS
- case command[0]
- #--- Default ---
- when :general, :parameters, :properties, :biography
- add_command(command[1], command[0])
- #--- Yanfly Engine Ace ---
- when :rename
- next unless $imported["YEA-RenameActor"]
- add_command(command[1], command[0], @actor.rename_allow?)
- when :retitle
- next unless $imported["YEA-RenameActor"]
- add_command(command[1], command[0], @actor.retitle_allow?)
- #--- Custom Commands ---
- else
- process_custom_command(command)
- end
- end
- if !$game_temp.scene_status_index.nil?
- select($game_temp.scene_status_index)
- self.oy = $game_temp.scene_status_oy
- end
- $game_temp.scene_status_index = nil
- $game_temp.scene_status_oy = nil
- end
-
- #--------------------------------------------------------------------------
- # process_ok
- #--------------------------------------------------------------------------
- def process_ok
- $game_temp.scene_status_index = index
- $game_temp.scene_status_oy = self.oy
- super
- end
-
- #--------------------------------------------------------------------------
- # process_custom_command
- #--------------------------------------------------------------------------
- def process_custom_command(command)
- return unless YEA::STATUS::CUSTOM_STATUS_COMMANDS.include?(command[0])
- show = YEA::STATUS::CUSTOM_STATUS_COMMANDS[command[0]][1]
- continue = show <= 0 ? true : $game_switches[show]
- return unless continue
- text = command[1]
- switch = YEA::STATUS::CUSTOM_STATUS_COMMANDS[command[0]][0]
- enabled = switch <= 0 ? true : $game_switches[switch]
- add_command(text, command[0], enabled)
- end
-
- #--------------------------------------------------------------------------
- # update
- #--------------------------------------------------------------------------
- def update
- super
- update_item_window
- end
-
- #--------------------------------------------------------------------------
- # update_item_window
- #--------------------------------------------------------------------------
- def update_item_window
- return if @item_window.nil?
- return if @current_index == current_symbol
- @current_index = current_symbol
- @item_window.refresh
- end
-
- #--------------------------------------------------------------------------
- # item_window=
- #--------------------------------------------------------------------------
- def item_window=(window)
- @item_window = window
- update
- end
-
- #--------------------------------------------------------------------------
- # update_help
- #--------------------------------------------------------------------------
- def update_help
- return if @actor.nil?
- @help_window.set_text(@actor.actor.description)
- end
-
- end # Window_StatusCommand
-
- #==============================================================================
- # ■ Window_StatusActor
- #==============================================================================
-
- class Window_StatusActor < Window_Base
-
- #--------------------------------------------------------------------------
- # initialize
- #--------------------------------------------------------------------------
- def initialize(dx, dy)
- super(dx, dy, window_width, fitting_height(4))
- @actor = nil
- end
-
- #--------------------------------------------------------------------------
- # window_width
- #--------------------------------------------------------------------------
- def window_width; return Graphics.width - 160; end
-
- #--------------------------------------------------------------------------
- # actor=
- #--------------------------------------------------------------------------
- def actor=(actor)
- return if @actor == actor
- @actor = actor
- refresh
- end
-
- #--------------------------------------------------------------------------
- # refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- return unless @actor
- draw_actor_face(@actor, 0, 0)
- draw_actor_simple_status(@actor, 108, line_height / 2)
- end
-
- end # Window_StatusActor
-
- #==============================================================================
- # ■ Window_StatusItem
- #==============================================================================
-
- class Window_StatusItem < Window_Base
-
- #--------------------------------------------------------------------------
- # initialize
- #--------------------------------------------------------------------------
- def initialize(dx, dy, command_window)
- super(dx, dy, Graphics.width, Graphics.height - dy)
- @command_window = command_window
- @actor = nil
- refresh
- end
-
- #--------------------------------------------------------------------------
- # actor=
- #--------------------------------------------------------------------------
- def actor=(actor)
- return if @actor == actor
- @actor = actor
- refresh
- end
-
- #--------------------------------------------------------------------------
- # refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- reset_font_settings
- return unless @actor
- draw_window_contents
- end
-
- #--------------------------------------------------------------------------
- # draw_window_contents
- #--------------------------------------------------------------------------
- def draw_window_contents
- case @command_window.current_symbol
- when :general
- draw_actor_general
- when :parameters
- draw_parameter_graph
- when :properties
- draw_properties_list
- when :biography, :rename, :retitle
- draw_actor_biography
- else
- draw_custom
- end
- end
-
- #--------------------------------------------------------------------------
- # draw_actor_general
- #--------------------------------------------------------------------------
- def draw_actor_general
- change_color(system_color)
- text = YEA::STATUS::PARAMETERS_VOCAB
- draw_text(0, 0, contents.width/2, line_height, text, 1)
- text = YEA::STATUS::EXPERIENCE_VOCAB
- draw_text(contents.width/2, 0, contents.width/2, line_height, text, 1)
- draw_general_parameters
- draw_general_experience
- end
-
- #--------------------------------------------------------------------------
- # draw_general_parameters
- #--------------------------------------------------------------------------
- def draw_general_parameters
- dx = 24
- dy = line_height / 2
- draw_actor_level(dx, line_height*1+dy, contents.width/2 - 24)
- draw_actor_param(0, dx, line_height*2+dy, contents.width/2 - 24)
- draw_actor_param(1, dx, line_height*3+dy, contents.width/2 - 24)
- draw_actor_param(2, dx, line_height*4+dy, contents.width/4 - 12)
- draw_actor_param(4, dx, line_height*5+dy, contents.width/4 - 12)
- draw_actor_param(6, dx, line_height*6+dy, contents.width/4 - 12)
- dx += contents.width/4 - 12
- draw_actor_param(3, dx, line_height*4+dy, contents.width/4 - 12)
- draw_actor_param(5, dx, line_height*5+dy, contents.width/4 - 12)
- draw_actor_param(7, dx, line_height*6+dy, contents.width/4 - 12)
- end
-
- #--------------------------------------------------------------------------
- # draw_actor_level
- #--------------------------------------------------------------------------
- def draw_actor_level(dx, dy, dw)
- colour = Color.new(0, 0, 0, translucent_alpha/2)
- rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
- contents.fill_rect(rect, colour)
- change_color(system_color)
- draw_text(dx+4, dy, dw-8, line_height, Vocab::level)
- change_color(normal_color)
- draw_text(dx+4, dy, dw-8, line_height, @actor.level.group, 2)
- end
-
- #--------------------------------------------------------------------------
- # draw_actor_param
- #--------------------------------------------------------------------------
- def draw_actor_param(param_id, dx, dy, dw)
- colour = Color.new(0, 0, 0, translucent_alpha/2)
- rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
- contents.fill_rect(rect, colour)
- change_color(system_color)
- draw_text(dx+4, dy, dw-8, line_height, Vocab::param(param_id))
- change_color(normal_color)
- draw_text(dx+4, dy, dw-8, line_height, @actor.param(param_id).group, 2)
- end
-
- #--------------------------------------------------------------------------
- # draw_general_experience
- #--------------------------------------------------------------------------
- def draw_general_experience
- if @actor.max_level?
- s1 = @actor.exp.group
- s2 = "-------"
- s3 = "-------"
- else
- s1 = @actor.exp.group
- s2 = (@actor.next_level_exp - @actor.exp).group
- s3 = @actor.next_level_exp.group
- end
- s_next = sprintf(Vocab::ExpNext, Vocab::level)
- total_next_text = sprintf(YEA::STATUS::NEXT_TOTAL_VOCAB, Vocab::level)
- change_color(system_color)
- dx = contents.width/2 + 12
- dy = line_height * 3 / 2
- dw = contents.width/2 - 36
- draw_text(dx, dy + line_height * 0, dw, line_height, Vocab::ExpTotal)
- draw_text(dx, dy + line_height * 2, dw, line_height, s_next)
- draw_text(dx, dy + line_height * 4, dw, line_height, total_next_text)
- change_color(normal_color)
- draw_text(dx, dy + line_height * 1, dw, line_height, s1, 2)
- draw_text(dx, dy + line_height * 3, dw, line_height, s2, 2)
- draw_text(dx, dy + line_height * 5, dw, line_height, s3, 2)
- end
-
- #--------------------------------------------------------------------------
- # draw_parameter_graph
- #--------------------------------------------------------------------------
- def draw_parameter_graph
- draw_parameter_title
- dy = line_height * 3/2
- maximum = 1
- minimum = @actor.param_max(2)
- for i in 2..7
- maximum = [@actor.param(i), maximum].max
- minimum = [@actor.param(i), minimum].min
- end
- maximum += minimum * 0.33 unless maximum == minimum
- for i in 2..7
- rate = calculate_rate(maximum, minimum, i)
- dy = line_height * i - line_height/2
- draw_param_gauge(i, dy, rate)
- change_color(system_color)
- draw_text(28, dy, contents.width - 56, line_height, Vocab::param(i))
- dw = (contents.width - 48) * rate - 8
- change_color(normal_color)
- draw_text(28, dy, dw, line_height, @actor.param(i).group, 2)
- end
- end
-
- #--------------------------------------------------------------------------
- # calculate_rate
- #--------------------------------------------------------------------------
- def calculate_rate(maximum, minimum, param_id)
- return 1.0 if maximum == minimum
- rate = (@actor.param(param_id).to_f - minimum) / (maximum - minimum).to_f
- rate *= 0.67
- rate += 0.33
- return rate
- end
-
- #--------------------------------------------------------------------------
- # draw_param_gauge
- #--------------------------------------------------------------------------
- def draw_param_gauge(param_id, dy, rate)
- dw = contents.width - 48
- colour1 = param_gauge1(param_id)
- colour2 = param_gauge2(param_id)
- draw_gauge(24, dy, dw, rate, colour1, colour2)
- end
-
- #--------------------------------------------------------------------------
- # param_gauge1
- #--------------------------------------------------------------------------
- def param_gauge1(param_id)
- return YEA::STATUS::PARAM_COLOUR[param_id][1]
- end
-
- #--------------------------------------------------------------------------
- # param_gauge2
- #--------------------------------------------------------------------------
- def param_gauge2(param_id)
- return YEA::STATUS::PARAM_COLOUR[param_id][2]
- end
-
- #--------------------------------------------------------------------------
- # draw_parameter_title
- #--------------------------------------------------------------------------
- def draw_parameter_title
- colour = Color.new(0, 0, 0, translucent_alpha/2)
- rect = Rect.new(0, 0, contents.width, contents.height)
- contents.fill_rect(rect, colour)
- change_color(system_color)
- text = YEA::STATUS::PARAMETERS_VOCAB
- draw_text(0, line_height/3, contents.width, line_height, text, 1)
- end
-
- #--------------------------------------------------------------------------
- # draw_properties_list
- #--------------------------------------------------------------------------
- def draw_properties_list
- contents.font.size = YEA::STATUS::PROPERTIES_FONT_SIZE
- draw_properties_column1
- draw_properties_column2
- draw_properties_column3
- reset_font_settings
- end
-
- #--------------------------------------------------------------------------
- # draw_properties_column1
- #--------------------------------------------------------------------------
- def draw_properties_column1
- dx = 24
- dw = (contents.width - 24) / 3 - 24
- dy = 0
- for property in YEA::STATUS::PROPERTIES_COLUMN1
- dy = draw_property(property, dx, dy, dw)
- end
- end
-
- #--------------------------------------------------------------------------
- # draw_properties_column2
- #--------------------------------------------------------------------------
- def draw_properties_column2
- dx = 24 + (contents.width - 24) / 3
- dw = (contents.width - 24) / 3 - 24
- dy = 0
- for property in YEA::STATUS::PROPERTIES_COLUMN2
- dy = draw_property(property, dx, dy, dw)
- end
- end
-
- #--------------------------------------------------------------------------
- # draw_properties_column3
- #--------------------------------------------------------------------------
- def draw_properties_column3
- dx = 24 + (contents.width - 24) / 3 * 2
- dw = (contents.width - 24) / 3 - 24
- dy = 0
- for property in YEA::STATUS::PROPERTIES_COLUMN3
- dy = draw_property(property, dx, dy, dw)
- end
- end
-
- #--------------------------------------------------------------------------
- # draw_property
- #--------------------------------------------------------------------------
- def draw_property(property, dx, dy, dw)
- case property[0]
- #---
- when :hit
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.hit * 100)
- when :eva
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.eva * 100)
- when :cri
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.cri * 100)
- when :cev
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.cev * 100)
- when :mev
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.mev * 100)
- when :mrf
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.mrf * 100)
- when :cnt
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.cnt * 100)
- when :hrg
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.hrg * 100)
- when :mrg
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.mrg * 100)
- when :trg
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.trg * 100)
- when :tgr
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.tgr * 100)
- when :grd
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.grd * 100)
- when :rec
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.rec * 100)
- when :pha
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.pha * 100)
- when :mcr
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.mcr * 100)
- when :tcr
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.tcr * 100)
- when :pdr
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.pdr * 100)
- when :mdr
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.mdr * 100)
- when :fdr
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.fdr * 100)
- when :exr
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.exr * 100)
- when :hcr
- return dy unless $imported["YEA-SkillCostManager"]
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.hcr * 100)
- when :tcr
- return dy unless $imported["YEA-SkillCostManager"]
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.tcr * 100)
- when :gcr
- return dy unless $imported["YEA-SkillCostManager"]
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.gcr * 100)
- when :cdr
- return dy unless $imported["YEA-SkillRestrictions"]
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.cdr * 100)
- when :wur
- return dy unless $imported["YEA-SkillRestrictions"]
- fmt = "%1.2f%%"
- value = sprintf(fmt, @actor.wur * 100)
- #---
- else; return dy
- end
- colour = Color.new(0, 0, 0, translucent_alpha/2)
- rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
- contents.fill_rect(rect, colour)
- change_color(system_color)
- draw_text(dx+4, dy, dw-8, line_height, property[1], 0)
- change_color(normal_color)
- draw_text(dx+4, dy, dw-8, line_height, value, 2)
- return dy + line_height
- end
-
- #--------------------------------------------------------------------------
- # draw_actor_biography
- #--------------------------------------------------------------------------
- def draw_actor_biography
- fmt = YEA::STATUS::BIOGRAPHY_NICKNAME_TEXT
- text = sprintf(fmt,@actor.nickname, @actor.name )
- contents.font.size = YEA::STATUS::BIOGRAPHY_NICKNAME_SIZE
- draw_text(0, 0, contents.width, line_height*2, text, 1)
- reset_font_settings
- draw_text_ex(24, line_height*2, @actor.description)
- end
-
- #--------------------------------------------------------------------------
- # draw_custom
- #--------------------------------------------------------------------------
- def draw_custom
- current_symbol = @command_window.current_symbol
- return unless YEA::STATUS::CUSTOM_STATUS_COMMANDS.include?(current_symbol)
- method(YEA::STATUS::CUSTOM_STATUS_COMMANDS[current_symbol][3]).call
- end
-
- #--------------------------------------------------------------------------
- # draw_custom1
- #--------------------------------------------------------------------------
- def draw_custom1
- dx = 0; dy = 0
- for skill in @actor.skills
- next if skill.nil?
- next unless @actor.added_skill_types.include?(skill.stype_id)
- draw_item_name(skill, dx, dy)
- dx = dx == contents.width / 2 + 16 ? 0 : contents.width / 2 + 16
- dy += line_height if dx == 0
- return if dy + line_height > contents.height
- end
- end
-
- #--------------------------------------------------------------------------
- # draw_custom2
- #--------------------------------------------------------------------------
- def draw_custom2
- dx = 4; dy = 0; slot_id = 0
- for equip in @actor.equips
- change_color(system_color)
- text = Vocab.etype(@actor.equip_slots[slot_id])
- draw_text(dx, dy, contents.width - dx, line_height, text)
- reset_font_settings
- draw_item_name(equip, dx+92, dy) unless equip.nil?
- slot_id += 1
- dy += line_height
- break if dy + line_height > contents.height
- end
- dw = Graphics.width * 2 / 5 - 24
- dx = contents.width - dw; dy = 0
- param_id = 0
- 8.times do
- colour = Color.new(0, 0, 0, translucent_alpha/2)
- rect = Rect.new(dx+1, dy+1, dw - 2, line_height - 2)
- contents.fill_rect(rect, colour)
- size = $imported["YEA-AceEquipEngine"] ? YEA::EQUIP::STATUS_FONT_SIZE : 20
- contents.font.size = size
- change_color(system_color)
- draw_text(dx+4, dy, dw, line_height, Vocab::param(param_id))
- change_color(normal_color)
- dwa = (Graphics.width * 2 / 5 - 2) / 2
- draw_text(dx, dy, dwa, line_height, @actor.param(param_id).group, 2)
- reset_font_settings
- change_color(system_color)
- draw_text(dx + dwa, dy, 22, line_height, "→", 1)
- param_id += 1
- dy += line_height
- break if dy + line_height > contents.height
- end
- end
-
- #--------------------------------------------------------------------------
- # draw_custom3
- #--------------------------------------------------------------------------
- def draw_custom3
- return unless $imported["YEA-ClassSystem"]
- data = []
- for class_id in YEA::CLASS_SYSTEM::CLASS_ORDER
- next if $data_classes[class_id].nil?
- item = $data_classes[class_id]
- next unless @actor.unlocked_classes.include?(item.id) or
- YEA::CLASS_SYSTEM::DEFAULT_UNLOCKS.include?(item.id)
- data.push(item)
- end
- dx = 0; dy = 0; class_index = 0
- for class_id in data
- item = data[class_index]
- reset_font_settings
- if item == @actor.class
- change_color(text_color(YEA::CLASS_SYSTEM::CURRENT_CLASS_COLOUR))
- elsif item == @actor.subclass
- change_color(text_color(YEA::CLASS_SYSTEM::SUBCLASS_COLOUR))
- else
- change_color(normal_color)
- end
- icon = item.icon_index
- draw_icon(icon, dx, dy)
- text = item.name
- draw_text(24, dy, contents.width-24, line_height, text)
- next if YEA::CLASS_SYSTEM::MAINTAIN_LEVELS
- level = @actor.class_level(item.id)
- contents.font.size = YEA::CLASS_SYSTEM::LEVEL_FONT_SIZE
- text = sprintf(YEA::CLASS_SYSTEM::CLASS_LEVEL, level.group)
- dwa = contents.width - (Graphics.width * 2 / 5 - 24) - 28
- draw_text(dx, dy, dwa, line_height, text, 2)
- class_index += 1
- dy += line_height
- break if dy + line_height > contents.height
- end
- dw = Graphics.width * 2 / 5 - 24
- dx = contents.width - dw; dy = 0
- param_id = 0
- 8.times do
- colour = Color.new(0, 0, 0, translucent_alpha/2)
- rect = Rect.new(dx+1, dy+1, dw - 2, line_height - 2)
- contents.fill_rect(rect, colour)
- contents.font.size = YEA::CLASS_SYSTEM::PARAM_FONT_SIZE
- change_color(system_color)
- draw_text(dx+4, dy, dw, line_height, Vocab::param(param_id))
- change_color(normal_color)
- dwa = (Graphics.width * 2 / 5 - 2) / 2
- draw_text(dx, dy, dwa, line_height, @actor.param(param_id).group, 2)
- reset_font_settings
- change_color(system_color)
- draw_text(dx + dwa, dy, 22, line_height, "→", 1)
- param_id += 1
- dy += line_height
- break if dy + line_height > contents.height
- end
- end
-
- end # Window_StatusItem
-
- #==============================================================================
- # ■ Scene_Status
- #==============================================================================
-
- class Scene_Status < Scene_MenuBase
-
- #--------------------------------------------------------------------------
- # start
- #--------------------------------------------------------------------------
- def start
- super
-
- create_help_window
- create_command_window
- create_status_window
- create_item_window
- relocate_windows
- end
-
- #--------------------------------------------------------------------------
- # create_command_window
- #--------------------------------------------------------------------------
- def create_command_window
- wy = @help_window.height
- @command_window = Window_StatusCommand.new(0, wy)
- @command_window.viewport = @viewport
- @command_window.actor = @actor
- @command_window.help_window = @help_window
- @command_window.set_handler(:cancel, method(:return_scene))
- @command_window.set_handler(:pagedown, method(:next_actor))
- @command_window.set_handler(:pageup, method(:prev_actor))
- process_custom_status_commands
- end
-
- #--------------------------------------------------------------------------
- # process_custom_status_commands
- #--------------------------------------------------------------------------
- def process_custom_status_commands
- for command in YEA::STATUS::COMMANDS
- next unless YEA::STATUS::CUSTOM_STATUS_COMMANDS.include?(command[0])
- called_method = YEA::STATUS::CUSTOM_STATUS_COMMANDS[command[0]][2]
- @command_window.set_handler(command[0], method(called_method))
- end
- end
-
- #--------------------------------------------------------------------------
- # create_status_window
- #--------------------------------------------------------------------------
- def create_status_window
- wy = @help_window.height
- @status_window = Window_StatusActor.new(@command_window.width, wy)
- @status_window.viewport = @viewport
- @status_window.actor = @actor
- end
-
- #--------------------------------------------------------------------------
- # create_item_window
- #--------------------------------------------------------------------------
- def create_item_window
- dy = @command_window.y + @command_window.height
- @item_window = Window_StatusItem.new(0, dy, @command_window)
- @item_window.viewport = @viewport
- @item_window.actor = @actor
- @command_window.item_window = @item_window
- end
-
- #--------------------------------------------------------------------------
- # relocate_windows
- #--------------------------------------------------------------------------
- def relocate_windows
- return unless $imported["YEA-AceMenuEngine"]
- case Menu.help_window_location
- when 0 # Top
- @help_window.y = 0
- @command_window.y = @help_window.height
- @item_window.y = @command_window.y + @command_window.height
- when 1 # Middle
- @command_window.y = 0
- @help_window.y = @command_window.height
- @item_window.y = @help_window.y + @help_window.height
- else # Bottom
- @command_window.y = 0
- @item_window.y = @command_window.height
- @help_window.y = @item_window.y + @item_window.height
- end
- @status_window.y = @command_window.y
- end
-
- #--------------------------------------------------------------------------
- # on_actor_change
- #--------------------------------------------------------------------------
- def on_actor_change
- @command_window.actor = @actor
- @status_window.actor = @actor
- @item_window.actor = @actor
- @command_window.activate
- end
-
- #--------------------------------------------------------------------------
- # new method: command_name1
- #--------------------------------------------------------------------------
- def command_name1
- SceneManager.call(Scene_Skill)
- end
-
- #--------------------------------------------------------------------------
- # new method: command_name2
- #--------------------------------------------------------------------------
- def command_name2
- SceneManager.call(Scene_Equip)
- end
-
- #--------------------------------------------------------------------------
- # new method: command_name3
- #--------------------------------------------------------------------------
- def command_name3
- unless $imported["YEA-ClassSystem"]
- @command_window.activate
- return
- end
- SceneManager.call(Scene_Class)
- end
-
- end # Scene_Status
-
- #==============================================================================
- #
- # ▼ End of File
- #
- #==============================================================================
复制代码 [/fold]
3、地图左上角会显示一个坐标窗口。
[fold=显示坐标脚本]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- #encoding:utf-8
- #------------------------------------------------------------------------
- #■ 地图上显示变量
- # 原作者:非法用户 lqn619修改并增加开关控制显示功能 脚本来自于66RPG
- #------------------------------------------------------------------------
- # 使用者设定部分
- $s_id3 = 45 #控制是否显示的开关ID,可以自己修改
- #------------------------------------------------------------------------
- class Window_Variables < Window_Base
- def initialize
- super(0,0,100,48) # 创建大小
- @text = "" # 初始化内容
- @variable = 0
- refresh #调用refresh方法(下文定义)
- end
- def refresh #定义refresh方法
- if $game_switches[$s_id3] == false #判断是否显示窗口
- self.visible = false
- else
- self.visible = true
- end
- if @text != $text or @variable != $game_variables[$v_id] #内容变化时
- self.contents.clear #清除窗口的位图
- self.contents.draw_text(0,0,64,24,$text) #重绘
- self.contents.draw_text(0,0,94,24,"坐标:" + $game_player.getX.to_s + "," + $game_player.getY.to_s,0)
- @type = $type # 代入当前内容
- @owner = $owner
- end
- end
- end
- class Scene_Map < Scene_Base
- alias new_start start #生成窗体
- def start
- new_start
- @varia_window = Window_Variables.new
- end
- alias new_update update #更新窗体
- def update
- new_update
- @varia_window.refresh
- end
- alias new_terminate terminate #消除窗体
- def terminate
- @varia_window.dispose
- new_terminate
- end
- end
复制代码 [/fold]
4、扩展攻击目标,技能可以攻击一组同种敌人。
[fold=种族灭绝者]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- #在需要这个效果的技能的备注:<种族毁灭者>
- #然后效果范围要设置为【单个敌人】
- #==============================================================================
- # ■ 种族灭绝者 v1.0 魔族宝 2014.9.13
- #==============================================================================
- # ■ Game_Action
- #==============================================================================
- class Game_Action
- #--------------------------------------------------------------------------
- # ● 目标为敌人
- alias targets_for_opponents1 targets_for_opponents
- #--------------------------------------------------------------------------
- def targets_for_opponents
- return opponents_unit.semm_target(@target_index) if @subject.is_a?(Game_Actor) and item.note =~ /<种族灭绝者>/
- targets_for_opponents1
- end
- end
- #==============================================================================
- # ■ Game_Unit
- #==============================================================================
- class Game_Unit
- def semm_target(index)
- members.select {|member| member.enemy_id==members[index].enemy_id}
- end
- end[/fold]
- [size=3][color=Blue][b]5、默认菜单左边空白处显示一些变量,比如:战斗次数、游戏时间、行走步数。还可以控制变量来显示时间24小时哦。[/b][/color][/size]
- [fold=菜单扩展脚本]#使用方法:打开脚本编辑器,将脚本插入到main上。
- #自己在游戏中设置事件添加变量就可以了,显示变量的ID可以自己在下面修改。
- #==============================================================================
- # ■ Game_Player
- #------------------------------------------------------------------------------
- # 处理玩家人物的类。拥有事件启动的判定、地图的卷动等功能。
- # 本类的实例请参考 $game_player 。
- $v_id1 = 10 #显示变量的编号ID
- $v_id2 = 11 #显示变量的编号ID
- $v_id3 = 12 #显示变量的编号ID
- $v_id4 = 13 #显示变量的编号ID
- $v_id5 = 14 #显示变量的编号ID
- #==============================================================================
- class Game_Player < Game_Character
-
- def getX
- @x
- end
-
- def getY
- @y
- end
-
- end
- #encoding:utf-8
- #==============================================================================
- # ■ Scene_Menu
- #------------------------------------------------------------------------------
- # 菜单画面
- #==============================================================================
- class Scene_Menu < Scene_MenuBase
- #--------------------------------------------------------------------------
- # ● 生成窗口
- #--------------------------------------------------------------------------
- def create_gold_window
- @gold_window = Window_Gold.new
- @gold_window.x = 0
- @gold_window.y = Graphics.height - @gold_window.height
- # 生成地图信息窗口
- @mapinfos_window = Window_MapInfo.new
- @mapinfos_window.x = 0
- @mapinfos_window.y = 211
-
- end
-
- end
- #==============================================================================
- # ■ Window_MapInfo
- #------------------------------------------------------------------------------
- # 显示当前信息的窗口。 By SkyZH
- #==============================================================================
- class Window_MapInfo < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, window_width, fitting_height(4))
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 获取窗口的宽度
- #--------------------------------------------------------------------------
- def window_width
- return 160
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.font.color = normal_color
-
- @a=$game_map.width
- @b=$game_map.height
- @BGMNAME=RPG::BGM.last.name
-
- draw_text(0, line_height*0, window_width-24, line_height,"时间: :" + $game_variables[$v_id1].to_s,0)
- draw_text(0, line_height*0, window_width-24, line_height,"时间 " + $game_variables[$v_id2].to_s,0)
- draw_text(0, line_height*1, window_width-24, line_height,"活跃:" + $game_variables[$v_id3].to_s,0)
- draw_text(0, line_height*2, window_width-24, line_height,"荣誉:" + $game_variables[$v_id4].to_s,0)
- draw_text(0, line_height*3, window_width-24, line_height,"强度:" + $game_variables[$v_id5].to_s,0)
- end
- end
复制代码 [/fold]
6、修改过的显示敌人血槽状态脚本,敌人附加了什么状态都一目了然,我把血条显示去了,其实不显示敌人HP能让玩家感到更加的刺激。
[fold=敌人状態显示脚本]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- #==============================================================================
-
- # ■エネミーの状態を表示 for RGSS3 Ver0.80-α
-
- # □作成者 kure
-
- #==============================================================================
-
- $kure_base_script = {} if $kure_base_script == nil
-
- $kure_base_script[:InfoBar] = 100
-
- p "エネミーの情報表示"
-
- module KURE
-
- module InfoBar
-
- #初期設定(変更しない事)-----------------------------------------------------
-
- COLOR = []
-
-
- #表示色(IDによって割り当てが決まっています。)
-
- #バーの背景色(ID0)
-
- COLOR[0] = Color.new(32 ,32, 64, 255)
-
-
-
- #HPバーの色(ID1,ID2)
-
- COLOR[1] = Color.new(224 ,128, 64, 255)
-
- COLOR[2] = Color.new(240 ,192, 64, 255)
-
-
- end
-
- end
-
- #==============================================================================
-
- # ■ RPG::Enemy(追加定義)
-
- #==============================================================================
-
- class RPG::Enemy < RPG::BaseItem
-
- #--------------------------------------------------------------------------
-
- # ☆ バーの表示幅の定義(追加定義)
-
- #--------------------------------------------------------------------------
-
- def infobar_width
-
- @note.match(/<情報表示幅\s?(\d+)\s?>/)
-
- return 100 unless $1
-
- return $1.to_i
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ バーの表示幅の定義(追加定義)
-
- #--------------------------------------------------------------------------
-
- def infobar_visible?
-
- return false if @note.include?("<情報非表示>")
-
- return true
-
- end
-
- end
-
- #==============================================================================
-
- # ■ Game_Enemy
-
- #==============================================================================
-
- class Game_Enemy < Game_Battler
-
- #--------------------------------------------------------------------------
-
- # ☆ バーの表示幅の定義(追加定義)
-
- #--------------------------------------------------------------------------
-
- def infobar_width
-
- return enemy.infobar_width
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ バーの表示幅の定義(追加定義)
-
- #--------------------------------------------------------------------------
-
- def infobar_visible?
-
- return enemy.infobar_visible?
-
- end
-
- end
-
- #==============================================================================
-
- # ■ Spriteset_Battle
-
- #==============================================================================
-
- class Spriteset_Battle
-
- #--------------------------------------------------------------------------
-
- # ● 敵キャラスプライトの作成(エイリアス再定義)
-
- #--------------------------------------------------------------------------
-
- alias k_basescript_before_create_enemies create_enemies
-
- def create_enemies
-
- k_basescript_before_create_enemies
-
- @enemy_info_bar = $game_troop.members.reverse.collect do |enemy|
-
- Sprite_Infobar.new(@viewport1, enemy)
-
- end
-
- end
-
- #--------------------------------------------------------------------------
-
- # ● 敵キャラスプライトの更新(エイリアス再定義)
-
- #--------------------------------------------------------------------------
-
- alias k_basescript_before_update_enemies update_enemies
-
- def update_enemies
-
- k_basescript_before_update_enemies
-
- @enemy_info_bar.each {|sprite| sprite.update }
-
- end
-
- #--------------------------------------------------------------------------
-
- # ● 敵キャラスプライトの解放(エイリアス再定義)
-
- #--------------------------------------------------------------------------
-
- alias k_basescript_before_dispose_enemies dispose_enemies
-
- def dispose_enemies
-
- k_basescript_before_dispose_enemies
-
- @enemy_info_bar.each {|sprite| sprite.dispose }
-
- end
-
- end
-
- #==============================================================================
-
- # ■ Sprite_Infobar
-
- #==============================================================================
-
- class Sprite_Infobar < Sprite_Base
-
- #--------------------------------------------------------------------------
-
- # ● 公開インスタンス変数
-
- #--------------------------------------------------------------------------
-
- attr_accessor :battler
-
- #--------------------------------------------------------------------------
-
- # ● オブジェクト初期化
-
- #--------------------------------------------------------------------------
-
- def initialize(viewport, battler = nil)
-
- super(viewport)
-
- @battler = battler
-
- @fill_w = nil
-
- @bitmap_data = Cache.battler(battler.battler_name, battler.battler_hue)
-
- @state = battler.states
-
- @icon_set = Cache.system("Iconset")
-
- end
-
- #--------------------------------------------------------------------------
-
- # ● フレーム更新
-
- #--------------------------------------------------------------------------
-
- def update
-
- super
-
- if @battler
-
- @use_sprite = @battler.use_sprite?
-
- if @use_sprite
-
- update_bitmap
-
- update_origin
-
- update_position
-
- end
-
- else
-
- self.bitmap = nil
-
- end
-
- end
-
- #--------------------------------------------------------------------------
-
- # ● 解放
-
- #--------------------------------------------------------------------------
-
- def dispose
-
- bitmap.dispose if bitmap
-
- super
-
- end
-
- #--------------------------------------------------------------------------
-
- # ● 転送元ビットマップの更新
-
- #--------------------------------------------------------------------------
-
- def update_bitmap
-
- fill_w = @battler.infobar_width * (@battler.hp.to_f / @battler.mhp)
-
- state = battler.states
-
- if @fill_w != fill_w or @state != state
-
- @fill_w = fill_w
-
- @state = state
-
-
-
- width = @battler.infobar_width + 4
-
-
-
- new_bitmap = Bitmap.new(width, 35)
-
- @state.each_with_index {|state, index|
-
- next if 24 * (index + 1) > new_bitmap.width
-
- rect = Rect.new(state.icon_index % 16 * 24, state.icon_index / 16 * 24, 24, 24)
-
- new_bitmap.blt(24 * index, 0, @icon_set, rect, 255)
-
- }
-
- #new_bitmap.fill_rect(0, 25, width, 10, color(0))
-
- #new_bitmap.gradient_fill_rect(2, 27, fill_w, 6, color(1), color(2))
-
-
- self.bitmap = new_bitmap
-
- init_visibility
-
-
-
- self.opacity = 0 unless @battler.infobar_visible?
-
- end
-
- end
-
- #--------------------------------------------------------------------------
-
- # ● 可視状態の初期化
-
- #--------------------------------------------------------------------------
-
- def init_visibility
-
- @battler_visible = @battler.alive?
-
- self.opacity = 0 unless @battler_visible
-
- end
-
- #--------------------------------------------------------------------------
-
- # ● 文字色取得
-
- #--------------------------------------------------------------------------
-
- def color(num)
-
- return KURE::InfoBar::COLOR[num]
-
- end
-
- #--------------------------------------------------------------------------
-
- # ● 原点の更新
-
- #--------------------------------------------------------------------------
-
- def update_origin
-
- if bitmap
-
- self.ox = bitmap.width / 2
-
- self.oy = bitmap.height
-
- end
-
- end
-
- #--------------------------------------------------------------------------
-
- # ● 位置の更新
-
- #--------------------------------------------------------------------------
-
- def update_position
-
- self.x = @battler.screen_x
-
- self.y = @battler.screen_y - @bitmap_data.height
-
- self.z = @battler.screen_z + 10
-
- end
-
- end
复制代码 [/fold]
7、如果想添加游戏难度,这个脚本一定少不了!玩家等级越高,敌人越强!这个脚本让我想起了fc金庸群侠传书剑江山里面的怪物,他们应该也是用了这个系统。
[fold=敌人等级跟随玩家脚本][/fold]
8、在回合制游戏经常看得到的系统,例如梦幻西游里面的小怪头领,大家都知道名字后面有头领两个字的敌人会比较强一点,这个脚本就是这种效果。
[fold=精英敌人脚本]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- =begin
- # 精英敌人,作者:66RPG的tan12345
- # 功能:遇敌时,敌人有一定几率(可设定)变成精英,精英怪比普通怪属性有加成(可修改),
- # 当然了,精英怪的经验、金钱、掉落率也同样有加成。
- # 也可以设定指定的敌人不会变成精英(比如BOSS)
- #
- # 使用方法:将脚本插入到main上
- #
- =end
- module Tan_by_enemy_set
- #精英怪出现几率,35代表35%
- Tan_enemy_by = 35
- #精英怪属性加成比例(同时也是经验、金钱、掉落率加成比例),1.1代表属性是普通怪的1.1倍
- Tan_enemy_by_num = 1.1
- #不会成为精英的敌人
- NO_BY_ENEMY = [2,3]#表示2号ID和3号ID敌人不会变成精英,适合设定BOSS,
- end
- class Game_Enemy < Game_Battler
-
- attr_reader :is_by # 是否精英
-
- #--------------------------------------------------------------------------
- # ● 精英初始化
- #--------------------------------------------------------------------------
- def init_by_enemy
- @is_by = false
- @is_by = true if rand(100) <= Tan_by_enemy_set::Tan_enemy_by && !Tan_by_enemy_set::NO_BY_ENEMY.include?(enemy_id)
- @original_name = @original_name + "" if @is_by == true
- @hp = mhp
- @mp = mmp
- end
- #--------------------------------------------------------------------------
- # ● 是否精英
- #--------------------------------------------------------------------------
- def is_by?
- return true if @is_by
- return false
- end
-
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- alias tan_by_enemy_initialize initialize
- def initialize(index, enemy_id)
- tan_by_enemy_initialize(index, enemy_id)
- init_by_enemy
- end
- #--------------------------------------------------------------------------
- # ● 获取普通能力的基础值
- #--------------------------------------------------------------------------
- alias tan_by_enemy_param_base param_base
- def param_base(param_id)
- v = tan_by_enemy_param_base(param_id)
- v *= Tan_by_enemy_set::Tan_enemy_by_num if is_by?
- return v.to_i
- end
- #--------------------------------------------------------------------------
- # ● 获取经验值
- #--------------------------------------------------------------------------
- alias tan_by_enemy_exp exp
- def exp
- v = tan_by_enemy_exp
- v *= Tan_by_enemy_set::Tan_enemy_by_num if is_by?
- return v.to_i
- end
- #--------------------------------------------------------------------------
- # ● 获取金钱
- #--------------------------------------------------------------------------
- alias tan_by_enemy_gold gold
- def gold
- v = tan_by_enemy_gold
- v *= Tan_by_enemy_set::Tan_enemy_by_num if is_by?
- return v.to_i
- end
- #--------------------------------------------------------------------------
- # ● 获取物品掉率的倍率
- #--------------------------------------------------------------------------
- alias tan_by_enemy_drop_item_rate drop_item_rate
- def drop_item_rate
- v = tan_by_enemy_drop_item_rate
- v *= Tan_by_enemy_set::Tan_enemy_by_num if is_by?
- return v
- end
- end
复制代码 [/fold]
9、附加状态效果可以重叠起来,适合集气技能使用,其实这个系统的原理就是把1号状态变成2号状态。
[fold=状态效果重叠]- #使用方法:直接放进脚本编辑器,然后在下面自己设置。
- class Game_Battler
-
- STATE_UPGRADE = {
- 50 => [51, 52, 53], #51、52、53号状态为三个等级。通过添加50号状态来升级
- 60 => [61, 62], #想添加更多可以自己尝试修改。
- }
-
- alias as_20141212 add_state
- def add_state(id)
- levels = STATE_UPGRADE[id]
- return as_20141212(id) unless levels
- index = levels.index { |state| state?(state) } # 当前等级
- return as_20141212(id) unless index
- return if index == levels.size - 1 # 已经达到最高等级
- remove_state levels[index]
- as_20141212 levels[index + 1]
- end
-
- end
复制代码 [/fold]
10、甩不掉的诅咒,如果玩家想到死亡后那些附加在身上的状态就消失了,那么你错了!!。
[fold=状态残留脚本]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- #在状态备注:<残留>
- #==============================================================================
- # ■ RGSS3 戦闘不能時残留ステート Ver1.01 by 星潟
- #------------------------------------------------------------------------------
- # 戦闘不能に陥った際、消去されないステートを作成します。
- # 用于那些全恢复时也不想要他消除的状态
- # 設定方法.
- # ステート欄に<残留>と記入する。
- #
- # Ver1.01
- # 全回復時・逃走の処理でも戦闘不能時残留ステートの効果が表れていた問題を修正。
- #==============================================================================
- module UnclearableState
-
- #ステートのメモ欄に記入する為の設定用ワード
- WORD = "<残留>"
-
- end
- #==============================================================================
- # ■ Game_BattlerBase
- #------------------------------------------------------------------------------
- # バトラーを扱う基本のクラスです。主に能力値計算のメソッドを含んでいます。こ
- # のクラスは Game_Battler クラスのスーパークラスとして使用されます。
- #==============================================================================
- class Game_BattlerBase
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- alias initialize_un_s initialize
- def initialize
- initialize_un_s
- clear_states2
- end
- #--------------------------------------------------------------------------
- # ● 全回復
- #--------------------------------------------------------------------------
- alias recover_all_un_s recover_all
- def recover_all
- recover_all_un_s
- clear_states2
- end
- #--------------------------------------------------------------------------
- # ● ステート情報をクリア
- #--------------------------------------------------------------------------
- def clear_states
- @states = [] if @states == nil
- stc = 0
- stcl = []
- stcl_turns = {}
- stcl_steps = {}
- for state in @states
- if state != nil && $data_states[state].note.include?(UnclearableState::WORD)
- stcl.push(@states[stc])
- stcl_turns[state] = @state_turns[state]
- stcl_steps[state] = @state_steps[state]
- end
- stc += 1
- end
- @states = stcl
- @state_turns = stcl_turns
- @state_steps = stcl_steps
- end
- #--------------------------------------------------------------------------
- # ● ステート情報をクリア
- #--------------------------------------------------------------------------
- def clear_states2
- @states = []
- @state_turns = {}
- @state_steps = {}
- end
- end
- class Game_Battler < Game_BattlerBase
- #--------------------------------------------------------------------------
- # ● 逃げる
- #--------------------------------------------------------------------------
- alias escape_un_s escape
- def escape
- escape_un_s
- clear_states2
- end
- end
复制代码 [/fold]
11、当队伍要面临全灭时就会切换BGM来提示玩家,当解除危机时BGM就会恢复。
[fold=危急时切换BGM][/fold]
12、存档为空时显示提示文字。
[fold=空存档提示]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- =begin
- ===============================================================================
- 空存档提示 By喵呜喵5
- ===============================================================================
- 【说明】
- 存档为空时显示提示文字
-
- =end
- $m5script = {} if $m5script.nil?
- $m5script["M5EmptyHint"] = true
- module M5EmptyHint
- #==============================================================================
- # 设定部分
- #==============================================================================
- WORD = '\i[115]这个存档没有记录内容!'
- #单引号中间设置提示的文字,支持符号、姓名等转义字符
-
- X_OFF = 140
- #提示文字的X坐标
-
- Y_OFF = 20
- #提示文字的Y坐标
-
- FONT = ["黑体"]
- #提示文字所使用的字体
-
- SIZE = 20
- #提示文字字体的大小
-
- COLOR = Color.new(255, 255, 255, 210)
- #提示文字的颜色,四个数值分别是R、G、B以及透明度
-
- BOLD = false
- #提示文字是否加粗
-
- ITALIC = false
- #提示文字是否斜体
-
- SHADOW = false
- #提示文字是否有阴影
-
- OUT = true
- #提示文字是否加边框
-
- OUT_COLOR = Color.new(255, 255, 255, 100)
- #提示文字边框的颜色,四个数值分别是R、G、B以及透明度
-
- #==============================================================================
- # 设定结束
- #==============================================================================
- #==============================================================================
- # 脚本部分
- #==============================================================================
- end
- class Window_SaveFile
- alias m5_20140227_draw_party_characters draw_party_characters
- def draw_party_characters(x, y)
- header = DataManager.load_header(@file_index)
- if header
- m5_20140227_draw_party_characters(x, y)
- else
- wx = M5EmptyHint::X_OFF
- wy = M5EmptyHint::Y_OFF
- contents.font.name = M5EmptyHint::FONT
- contents.font.size = M5EmptyHint::SIZE
- contents.font.bold = M5EmptyHint::BOLD
- contents.font.italic = M5EmptyHint::ITALIC
- contents.font.outline = M5EmptyHint::OUT
- contents.font.shadow = M5EmptyHint::SHADOW
- contents.font.color = M5EmptyHint::COLOR
- contents.font.out_color = M5EmptyHint::OUT_COLOR
- draw_text_ex_plus(wx, wy, M5EmptyHint::WORD)
- reset_font_settings
- end
- end
- def draw_text_ex_plus(x, y, text)
- text = convert_escape_characters(text)
- pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
- process_character(text.slice!(0, 1), text, pos) until text.empty?
- end
- end
复制代码 [/fold]
13、多样化物品分类扩展脚本,适合养成小游戏。
[fold=物品分类扩展]- #打开脚本编辑器,将脚本插入到main上。
- #==============================================================================
- # ■ 物品分类扩展
- # By :VIPArcher
- # -- 本脚本来自 [url]https://rpg.blue[/url] 使用或转载请保留以上信息。
- #==============================================================================
- # 使用说明:
- # 在设定区设定好分类后在道具/武器/防具备注栏备注
- # <分类:分类名称>
- # 即可把对应物品归到对应分类下,备注未填写分类的物品按默认分类归类
- #==============================================================================
- $VIPArcherScript ||= {};$VIPArcherScript[:item_category] = 20141017
- #==============================================================================
- # ● 设定区
- #==============================================================================
- module VIPArcher
- ITEM_CATEGORY = { # <- 别删
- #格式:分类标识符号 => "分类名称", 注:标识尽量独特不重复即可
- :item => "道具", #默认分类
- :weapon => "武器", #默认分类
- :armor => "防具", #默认分类
- :key_item => "特殊", #默认分类
- :viparcher => "食品",
- :viparcher1 => "食材",
- :viparcher2 => "材料",#不是默认的不想要可以自己在这里删掉。
- #在这里继续添加...
- } # <- 别删
- end
- class Window_ItemList < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 查询列表中是否含有此物品
- #--------------------------------------------------------------------------
- alias vip_include? include?
- def include?(item)
- if item && item.note =~ /<分类[:].*>/
- note_include?(item)
- else
- vip_include?(item)
- end
- end
- #--------------------------------------------------------------------------
- # ● 检查备注分类
- #--------------------------------------------------------------------------
- def note_include?(item)
- item.note =~ /<分类[:]\s*#{VIPArcher::ITEM_CATEGORY[@category]}>/
- end
- end
- class Window_ItemCategory < Window_HorzCommand
- #--------------------------------------------------------------------------
- # ● 生成指令列表
- #--------------------------------------------------------------------------
- def make_command_list
- VIPArcher::ITEM_CATEGORY.each{|key, value| add_command(value,key)}
- end
- end
复制代码 [/fold]
14、更详细的描述物品效果,不管什么游戏都可必备。
[fold=物品属性介绍(加强)]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- #encoding:utf-8
- #==============================================================================
- # ■ 技能物品说明增强 蓝本:wyongcan
- # 修改 :VIPArcher
- #
- # 改动说明:
- # 改用新的帮助窗口和新定义draw_text_vip方法来增强兼容性
- # 更改初始化数据时机以支持跳过标题
- # 追加对普通物品和技能的说明内容
- # 修改了对帮助窗口行数的计算以支持控制符
- # 加上了各种颜色的设置,具体更高级的玩法自己领悟吧
- # 改成光标不动一段时间后才会出现帮助窗口
- #
- # -- 本脚本来自 [url]https://rpg.blue[/url] 使用或转载请保留以上信息。
- #==============================================================================
- $VIPArcherScript ||= {};$VIPArcherScript[:help_ex] = 20141007
- $VIPArcherScript[:equip_limit] = false #是否使用了后知后觉的装备能力限制
- class << DataManager
- alias_method :vip_load_database, :load_database
- #--------------------------------------------------------------------------
- # ● 读取数据库
- #--------------------------------------------------------------------------
- def load_database
- vip_load_database
- VIPArcher::Equipplus.equiphelpready
- end
- end
- module VIPArcher;end
- module VIPArcher::Equipplus
- TIME = 30 #帮助窗口自动出现的时间(单位帧
- Font_Name = Font.default_name # 推荐"微软雅黑"
- Font_Size = 18 # "微软雅黑"的话就20号字体
- UP = 24 #能力值提升颜色编号
- DOWN = 25 #能力值下降颜色编号
- VIP = 14 #特殊能力颜色编号
- MP = 23
- TP = 29
- CODE ={
- 11 => "属性抗性",
- 12 => "弱化抗性",
- 13 => "状态抗性",
- 14 => "状态免疫",
- 21 => "普通能力",
- 22 => "添加能力",
- 23 => "特殊能力",
- 31 => "附带属性",
- 32 => "附带状态",
- 33 => "攻击速度",
- 34 => "添加攻击次数",
- 41 => "添加技能类型",
- 42 => "禁用技能类型",
- 43 => "添加技能",
- 44 => "禁用技能",
- 51 => "可用武器",
- 52 => "可用护甲",
- 53 => "固定装备",
- 54 => "禁用装备",
- 55 => "装备风格",
- 61 => "添加行动次数",
- 62 => "特殊标志",
- 63 => "消失效果",
- 64 => "队伍"}
- #特殊标志
- FLAG ={
- 0 => "自动战斗",
- 1 => "擅长防御",
- 2 => "保护弱者",
- 3 => "特技专注"}
- #技能效果范围
- SCOPE ={
- 0 => "无",
- 1 => "单个敌人",
- 2 => "全体敌人",
- 3 => "一个随机敌人",
- 4 => "两个随机敌人",
- 5 => "三个随机敌人",
- 6 => "四个随机敌人",
- 7 => "单个队友",
- 8 => "全体队友",
- 9 => "单个队友(战斗不能)",
- 10 => "全体队友(战斗不能)",
- 11 => "使用者" }
- #技能命中类型
- HIT ={
- 0 => "必定命中",
- 1 => "物理攻击",
- 2 => "魔法攻击"}
- #使用限制
- OCCASION ={
- 0 => "随时可用",
- 1 => "仅战斗中",
- 2 => "仅菜单中",
- 3 => "不能使用"}
- #添加能力
- XPARAM ={
- 0 => "物理命中几率:",
- 1 => "物理闪避几率:",
- 2 => "必杀几率:",
- 3 => "必杀闪避几率:",
- 4 => "魔法闪避几率:",
- 5 => "魔法反射几率:",
- 6 => "物理反击几率:",
- 7 => "HP逐渐恢复:",
- 8 => "MP逐渐恢复:",
- 9 => "SP逐渐增加:"}
- #特殊能力
- SPARAM ={
- 0 => "受到攻击的几率",
- 1 => "防御效果比率",
- 2 => "魔法恢复效果",
- 3 => "道具恢复效果",
- 4 => "MP消耗率",
- 5 => "SP获得率",
- 6 => "物理伤害加成",
- 7 => "魔法伤害加成",
- 8 => "地形伤害加成",
- 9 => "经验获得加成"}
- #装备风格 require 装备风格扩展脚本
- SLOT_TYPE ={
- 0 => "普通",
- 1 => "双持武器",
- 2 => "索爷三刀流",
- 3 => "NPC",
- 4 => "233",
- 5 => "论坛@的BUG好烦啊"}
- #队伍能力
- PARTY_ABILITY ={
- 0 => "遇敌几率减半",
- 1 => "随机遇敌无效",
- 2 => "敌人偷袭无效",
- 3 => "先制攻击提高",
- 4 => "获得金钱加倍",
- 5 => "掉落几率加倍"}
- #伤害类型
- DAMAGE_TYPE = {
- 0 => "无",
- 1 => "属性伤害",
- 2 => "属性伤害",
- 3 => "HP值恢复",
- 4 => "MP值恢复",
- 5 => "HP值吸收",
- 6 => "MP值吸收"}
- #普通能力
- #这只是个示范,你也可以依照个人喜好对这些用语添加颜色控制符
- @params ={
- 0 => "\\c[17]最大HP",
- 1 => "\\c[16]最大MP",
- 2 => "\\c[20]物攻",
- 3 => "\\c[21]物防",
- 4 => "\\c[30]魔攻",
- 5 => "\\c[31]魔防",
- 6 => "\\c[14]敏捷",
- 7 => "\\c[17]幸运"}
- #我举例技能类型的原因就是因为它 短
- @skill_types = { # 这个和下面equiphelpready里注释掉的做的是一样的事
- # 只是下面是读取数据库添加用语,这里是手动枚举
- 1 => "\\c[1]特技",
- 2 => "\\c[2]魔法",
- 3 => "\\c[3]必杀",
- 4 => "\\c[5]卖萌"}
- #初始化数据,当然如果你要用上面那样的控制符改变颜色的话
- #欢迎枚举格式就是上面这样用Hash,用ID做键把用语对应起来
- def self.equiphelpready
- params = $data_system.terms.params
- elements = $data_system.elements
- weapon_types = $data_system.weapon_types
- armor_types = $data_system.armor_types
- etypes = $data_system.terms.etypes
- skill_types = $data_system.skill_types
- @states ||= {}
- @params ||= {}
- @weapon_types ||= {}
- @armor_types ||= {}
- @etypes ||= {}
- @skill_types ||= {}
- @elements ||= {}
- skill_types.each_with_index{|x,y| @skill_types[y] = x if !x.nil?} if @skill_types == {}
- $data_states.each{|x| @states[x.id] = x.name if !x.nil?} if @states == {}
- elements.each_with_index{|x,y| @elements[y] = x if !x.nil?} if @elements == {}
- weapon_types.each_with_index{|x,y| @weapon_types[y] = x if !x.nil?} if @weapon_types == {}
- armor_types.each_with_index{|x,y| @armor_types[y] = x if !x.nil?} if @armor_types == {}
- etypes.each_with_index{|x,y| @etypes[y] = x} if @etypes == {}
- params.each_with_index{|x,y| @params[y] = x} if @params == {}
- end
- #获取装备帮助内容
- def self.getequiphelp(equip)
- help = ""
- param = []
- help += "\\c[16]装备位置:#{Vocab::etype(equip.etype_id)}\\c[0]\n"
- if $VIPArcherScript[:equip_limit] #装备能力限制
- help += "\\c[16]等级需求:#{equip.level_limit}\n" if equip.level_limit > 0
- param_limit = []
- for i in 0..7
- if equip.params_limit(i) != 0
- help += "\\c[16]#{@params[i]}需求:#{equip.params_limit(i)}\\c[0]\n"
- end
- end
- end
- equip.params.each_with_index{|x,y| param.push([@params[y],x])}
- param = param.select{|x| x[1] != 0}
- 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"}
- features = equip.features
- featuresparam = []
- featuresparam.push features.select{|x| x.code == 21}
- featuresparam.push features.select{|x| x.code == 22}
- featuresparam.push features.select{|x| x.code == 23}
- 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"}
- 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"}
- 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"}
- if $VIPArcherScript[:slot_type]
- help += "\\c[#{VIP}]#{CODE[55]}:#{SLOT_TYPE[$1.to_i]}\\c[0]\n" if equip.note =~ /<slot_type\s*[:](.*)>/i
- else
- features.select{|x| x.code == 55}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:双持武器\\c[0]\n"}
- end
- 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"}
- 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"}
- 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"}
- features.select{|x| x.code == 14}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:#{@states[x.data_id]}\\c[0]\n"}
- features.select{|x| x.code == 31}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@elements[x.data_id]}\\c[0]\n"}
- 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"}
- features.select{|x| x.code == 33}.each{|x| help += "\\c[#{x.value>0? UP : DOWN}]#{CODE[x.code]}:#{x.value}\\c[0]\n"}
- features.select{|x| x.code == 34}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{x.value}\\c[0]\n"}
- features.select{|x| x.code == 41}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@skill_types[x.data_id]}\\c[0]\n"}
- features.select{|x| x.code == 42}.each{|x| help += "\\c[#{DOWN}]#{CODE[x.code]}:#{@skill_types[x.data_id]}\\c[0]\n"}
- features.select{|x| x.code == 43}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{$data_skills[x.data_id].name}\\c[0]\n"}
- features.select{|x| x.code == 44}.each{|x| help += "\\c[#{DOWN}]#{CODE[x.code]}:#{$data_skills[x.data_id].name}\\c[0]\n"}
- features.select{|x| x.code == 51}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@weapon_types[x.data_id]}\\c[0]\n"}
- features.select{|x| x.code == 52}.each{|x| help += "\\c[#{UP}]#{CODE[x.code]}:#{@armor_types[x.data_id]}\\c[0]\n"}
- features.select{|x| x.code == 53}.each{|x| help += "\\c[#{DOWN}]#{CODE[x.code]}:#{@etypes[x.data_id]}\\c[0]\n"}
- features.select{|x| x.code == 54}.each{|x| help += "\\c[#{DOWN}]#{CODE[x.code]}:#{@etypes[x.data_id]}\\c[0]\n"}
- features.select{|x| x.code == 61}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:#{x.value}\\c[0]\n"}
- features.select{|x| x.code == 62}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:#{FLAG[x.data_id]}\\c[0]\n"}
- features.select{|x| x.code == 64}.each{|x| help += "\\c[#{VIP}]#{CODE[x.code]}:#{PARTY_ABILITY[x.data_id]}\\c[0]\n"}
- help
- end
- #获取技能帮助内容
- def self.getskillhelp(skill)
- help = ""
- effects = skill.effects
- damage = skill.damage
- r = [skill.required_wtype_id1,skill.required_wtype_id2]
- 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
- help += "\\c[16]消耗:\\c[#{MP}]MP:#{skill.mp_cost.to_s}\\c[0]\n" if skill.mp_cost > 0 && skill.tp_cost <= 0
- help += "\\c[16]消耗:\\c[#{TP}]SP:#{skill.tp_cost.to_s}\\c[0]\n" if skill.tp_cost > 0 && skill.mp_cost <= 0
- help += "\\c[#{skill.speed<0?DOWN: UP}]速度修正:#{skill.speed}\\c[0]\n" if skill.speed != 0
- help += "\\c[#{DOWN}]成功率:#{skill.success_rate}%\\c[0]\n" if skill.success_rate != 100
- help += "\\c[16]类型:#{HIT[skill.hit_type]}\\c[0]\n"
- help += "\\c[16]效果:#{@elements[damage.element_id]}#{DAMAGE_TYPE[damage.type]}\\c[0]\n" if damage.type != 0
- effects.select{|x| x.code == 31}.each{|x| help += "\\c[#{UP}]强化:#{@params[x.data_id]} #{x.value1.to_i}回合\\c[0]\n"}
- effects.select{|x| x.code == 32}.each{|x| help += "\\c[#{UP}]弱化:#{@params[x.data_id]} #{x.value1.to_i}回合\\c[0]\n"}
- effects.select{|x| x.code == 33}.each{|x| help += "\\c[#{UP}]解除:强化#{@params[x.data_id]}\n"}
- effects.select{|x| x.code == 34}.each{|x| help += "\\c[#{UP}]解除:弱化#{@params[x.data_id]}\n"}
- effects.select{|x| x.code == 22}.each{|x| help += "\\c[#{UP}]解除:#{@states[x.data_id]} #{(x.value1*100).to_i}%\\c[0]\n"}
- effects.select{|x| x.code == 41}.each{|x| help += "\\c[#{VIP}]特殊效果:撤退\n"}
- effects.select{|x| x.code == 42}.each{|x| help += "\\c[#{UP}]提升:#{@params[x.data_id]}#{x.value1.to_i}点\\c[0]\n"}
- effects.select{|x| x.code == 43}.each{|x| help += "\\c[#{VIP}]学会:#{$data_skills[x.data_id].name}\\c[0]\n"}
- help += "\\c[16]场合:#{OCCASION[skill.occasion]}\n"
- 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]
- help
- end
- #获取道具帮助内容
- def self.getitemhelp(item)
- help = ""
- effects = item.effects
- damage = item.damage
- help += "\\c[16]类型:\\c[#{VIP}]#{"贵重物品 "if item.itype_id != 1}\\c[#{DOWN}]#{item.consumable ? "消耗品":"非消耗品"}\\c[0]\n"
- help += "\\c[16]效果:#{@elements[damage.element_id]}#{DAMAGE_TYPE[damage.type]}\\c[0]\n" if damage.type != 0
- effects.select{|x| x.code == 31}.each{|x| help += "\\c[#{UP}]强化:#{@params[x.data_id]} #{x.value1.to_i}回合\\c[0]\n"}
- effects.select{|x| x.code == 32}.each{|x| help += "\\c[#{UP}]弱化:#{@params[x.data_id]} #{x.value1.to_i}回合\\c[0]\n"}
- effects.select{|x| x.code == 33}.each{|x| help += "\\c[#{UP}]解除:强化#{@params[x.data_id]}\\c[0]\n"}
- effects.select{|x| x.code == 34}.each{|x| help += "\\c[#{UP}]解除:弱化#{@params[x.data_id]}\\c[0]\n"}
- effects.select{|x| x.code == 22}.each{|x| help += "\\c[#{UP}]解除:#{@states[x.data_id]} #{(x.value1*100).to_i}%\\c[0]\n"}
- effects.select{|x| x.code == 41}.each{|x| help += "\\c[#{VIP}]特殊效果:撤退\n"}
- effects.select{|x| x.code == 42}.each{|x| help += "\\c[#{VIP}]提升:#{@params[x.data_id]}#{x.value1.to_i}点\\c[0]\n"}
- effects.select{|x| x.code == 43}.each{|x| help += "\\c[#{VIP}]学会:#{$data_skills[x.data_id].name}\\c[0]\n"}
- help += "\\c[16]场合:#{OCCASION[item.occasion]}\\c[0]\n"
- help
- end
- #计算行数(有些字体的汉字和[字母,数字,符号]的宽度不同,
- #有可能会照成行数计算不对,尽量用宽度相同的字体吧)
- def self.getline(text,maxtext)
- text_new = ""
- xtext = []
- line = 0
- text.each_line{|x| text_new += x.gsub(/\\\S\[\d+\]/i){}} #去掉控制符
- text_new.each_line{|x| xtext.push x.gsub(/\n/){}} #去掉换行符
- xtext.each{|x| line += (x.size / (maxtext.to_f + 1).to_i) + 1}
- line
- end
- end
- #==============================================================================
- # ■ Window_Help_Ex
- #------------------------------------------------------------------------------
- # 加强显示特技和物品等的说明
- #==============================================================================
-
- class Window_Help_Ex < Window_Base
- include VIPArcher::Equipplus
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize(line_number = 0)
- super(0, 0, 210, 0)
- self.z = 150
- contents.font.size = 14
- @time = 0
- end
- #--------------------------------------------------------------------------
- # ● 设置内容
- #--------------------------------------------------------------------------
- def set_text(text)
- @text = text
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 清除
- #--------------------------------------------------------------------------
- def clear
- set_text("")
- end
- #--------------------------------------------------------------------------
- # ● 更新帮助位置
- #--------------------------------------------------------------------------
- def uppos(index,rect,window)
- self.height = fitting_height_vip(VIPArcher::Equipplus.getline(@xtext,13))
- create_contents
- contents.font.name = Font_Name
- contents.font.size = Font_Size
- rect.x -= window.ox
- rect.y -= window.oy
- ax = rect.x + rect.width + 10
- ax = rect.x - self.width + 10 if ax + self.width > window.width + 10
- ax += window.x
- ax = 0 if ax < 0
- ay = rect.y + rect.height
- ay = rect.y - self.height if ay + self.height > window.height
- ay += window.y
- ay = 0 if ay < 0
- self.x = ax
- self.y = ay + 12
- set_text(@xtext)
- @time = TIME
- self.show
- self.openness = 0
- end
- #--------------------------------------------------------------------------
- # ● 设置物品
- # item : 技能、物品等
- #--------------------------------------------------------------------------
- def set_item(item)
- if item == nil
- set_text("")
- return
- end
- @xtext = ""
- if $VIPArcherScript[:itemcolor] # require 物品描绘颜色脚本
- @xtext = "\\c[16]名称:\\c[#{VIPArcher::ItemColor::Color_Lv[item.color]}]" +
- "#{item.name} #{item.color if item.color != 0}#{"★" if item.color != 0}\\c[0]\n"
- else
- @xtext = "\\c[16]名称:\\c[0]#{item.name}\n"
- end
- if $VIPArcherScript[:load] # require 队伍负重脚本
- @xtext += "\\c[16]售价:#{item.price} 重量:#{item.load}\\c[0]\n"
- else
- @xtext += item.price == 0 ? "\\c[16]售价:\\c[14]无法出售\\c[0]\n":"\\c[16]售价:#{item.price}\\c[0]\n"
- end if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Item)
- @xtext += VIPArcher::Equipplus.getequiphelp(item) if item.is_a?(RPG::EquipItem)
- @xtext += VIPArcher::Equipplus.getskillhelp(item) if item.is_a?(RPG::Skill)
- @xtext += VIPArcher::Equipplus.getitemhelp(item) if item.is_a?(RPG::Item)
- if $VIPArcherScript[:exdrop_rate] # require 队伍掉率扩展
- @xtext += "\\c[#{$2.to_i > 0 ? UP : DOWN}]#{$1}掉率: #{$2}%\\c[0]\n" if
- item.note =~ /<(\W+)掉率:\s*([0-9+.-]+)%>/i
- end if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Skill)
- @xtext = @xtext[0,@text.size - 2] if @xtext[@xtext.size - 2,2] == "\n"
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- self.hide if @text == ""
- draw_text_vip(4, 0, @text,width,40,false)
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- @time -= 1 if @time > 0
- self.open if @time == 0
- end
- end
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● 计算窗口显示指定行数时的应用高度2*************************
- #--------------------------------------------------------------------------
- def fitting_height_vip(line_number)
- line_number * contents.font.size + standard_padding * 2
- end
- # draw_text_ex的增强,使其可以自动换行 原作者:叶子 修改:wyongcan
- #--------------------------------------------------------------------------
- # ● 绘制带有控制符的文本内容
- # 如果传递了width参数的话,会自动换行
- #--------------------------------------------------------------------------
- def draw_text_vip(x, y, text, width = nil,textwidth = nil,normalfont = true)
- reset_font_settings if normalfont == true
- text = convert_escape_characters(text)
- pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
- if width != nil
- pos[:height] = contents.font.size
- pos[:width] = width
- pos[:textwidth] = textwidth
- end
- process_character(text.slice!(0, 1), text, pos) until text.empty?
- end
- #--------------------------------------------------------------------------
- # ● 文字的处理
- # c : 文字
- # text : 绘制处理中的字符串缓存(字符串可能会被修改)
- # pos : 绘制位置 {:x, :y, :new_x, :height}
- #--------------------------------------------------------------------------
- def process_character(c, text, pos)
- case c
- when "\r" # 回车
- return
- when "\n" # 换行
- process_new_line(text, pos)
- when "\f" # 翻页
- process_new_page(text, pos)
- when "\e" # 控制符
- process_escape_character(obtain_escape_code(text), text, pos)
- else # 普通文字
- pos[:textwidth] == nil ? text_width = text_size(c).width : text_width = pos[:textwidth]
- if pos[:width] != nil && pos[:x] - pos[:new_x] + text_width > pos[:width]
- process_new_line(text, pos)
- end
- process_normal_character(c, pos)
- end
- end
- #--------------------------------------------------------------------------
- # ● 处理换行文字
- #--------------------------------------------------------------------------
- alias vip_20141007_process_new_line process_new_line
- def process_new_line(text, pos)
- vip_20141007_process_new_line(text, pos)
- pos[:height] = contents.font.size if pos[:width] != nil
- end
- end
-
- #==============================================================================
- # ■ 设置帮助增强窗口
- #==============================================================================
- class Window_Selectable < Window_Base
- attr_reader :help_ex_window
- #--------------------------------------------------------------------------
- # ● 调用帮助窗口的更新方法
- #--------------------------------------------------------------------------
- alias help_ex_call_update_help call_update_help
- def call_update_help
- help_ex_call_update_help
- update_ex_help if active && @help_ex_window
- end
- #--------------------------------------------------------------------------
- # ● 更新帮助内容
- #--------------------------------------------------------------------------
- def update_ex_help
- @help_ex_window.set_item(item) if @help_ex_window
- if index != -1 && item != nil
- @help_ex_window.uppos(index,item_rect(index),self)
- end
- end
- #--------------------------------------------------------------------------
- # ● 设置帮助增强窗口
- #--------------------------------------------------------------------------
- def help_ex_window=(help_ex_window)
- @help_ex_window = help_ex_window
- end
- end
- #==============================================================================
- # ■ 在各场景处理帮助窗口
- #==============================================================================
- class Scene_Base
- #--------------------------------------------------------------------------
- # ● 生成帮助增强窗口
- #--------------------------------------------------------------------------
- def create_help_ex
- @help_ex_window = Window_Help_Ex.new
- @help_ex_window .viewport = @viewport
- @item_window.help_ex_window = @help_ex_window if @item_window
- @slot_window.help_ex_window = @help_ex_window if @slot_window
- @skill_window.help_ex_window = @help_ex_window if @skill_window
- @buy_window.help_ex_window = @help_ex_window if @buy_window
- @sell_window.help_ex_window = @help_ex_window if @sell_window
- end
- end
- #道具栏
- class Scene_Item < Scene_ItemBase
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- alias help_ex_start start
- def start
- help_ex_start
- create_help_ex
- end
- #--------------------------------------------------------------------------
- # ● 物品“取消”
- #--------------------------------------------------------------------------
- alias help_ex_on_item_cancel on_item_cancel
- def on_item_cancel
- help_ex_on_item_cancel
- @help_ex_window.hide
- end
- end
- #装备栏
- class Scene_Equip < Scene_MenuBase
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- alias help_ex_start start
- def start
- help_ex_start
- create_help_ex
- end
- #--------------------------------------------------------------------------
- # ● 装备栏“取消”
- #--------------------------------------------------------------------------
- alias help_ex_on_slot_cancel on_slot_cancel
- def on_slot_cancel
- help_ex_on_slot_cancel
- @help_ex_window.hide
- end
- end
- #技能栏
- class Scene_Skill < Scene_ItemBase
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- alias help_ex_start start
- def start
- help_ex_start
- create_help_ex
- end
- #--------------------------------------------------------------------------
- # ● 物品“确定”
- #--------------------------------------------------------------------------
- alias help_ex_on_item_ok on_item_ok
- def on_item_ok
- help_ex_on_item_ok
- @help_ex_window.hide
- end
- #--------------------------------------------------------------------------
- # ● 物品“取消”
- #--------------------------------------------------------------------------
- alias help_ex_on_item_cancel on_item_cancel
- def on_item_cancel
- help_ex_on_item_cancel
- @help_ex_window.hide
- end
- end
- #战斗界面
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- alias help_ex_start start
- def start
- help_ex_start
- create_help_ex
- end
- #--------------------------------------------------------------------------
- # ● 技能“确定”
- #--------------------------------------------------------------------------
- alias help_ex_on_skill_ok on_skill_ok
- def on_skill_ok
- help_ex_on_skill_ok
- @help_ex_window.hide
- end
- #--------------------------------------------------------------------------
- # ● 技能“取消”
- #--------------------------------------------------------------------------
- alias help_ex_on_skill_cancel on_skill_cancel
- def on_skill_cancel
- help_ex_on_skill_cancel
- @help_ex_window.hide
- end
- #--------------------------------------------------------------------------
- # ● 物品“确定”
- #--------------------------------------------------------------------------
- alias help_ex_on_item_ok on_item_ok
- def on_item_ok
- help_ex_on_item_ok
- @help_ex_window.hide
- end
- #--------------------------------------------------------------------------
- # ● 物品“取消”
- #--------------------------------------------------------------------------
- alias help_ex_on_item_cancel on_item_cancel
- def on_item_cancel
- help_ex_on_item_cancel
- @help_ex_window.hide
- end
- end
- #商店界面
- class Scene_Shop < Scene_MenuBase
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- alias help_ex_start start
- def start
- help_ex_start
- create_help_ex
- end
- #--------------------------------------------------------------------------
- # ● 买入“确定”
- #--------------------------------------------------------------------------
- alias help_ex_on_buy_ok on_buy_ok
- def on_buy_ok
- help_ex_on_buy_ok
- @help_ex_window.hide
- end
- #--------------------------------------------------------------------------
- # ● 买入“取消”
- #--------------------------------------------------------------------------
- alias help_ex_on_buy_cancel on_buy_cancel
- def on_buy_cancel
- help_ex_on_buy_cancel
- @help_ex_window.hide
- end
- #--------------------------------------------------------------------------
- # ● 卖出“确定”
- #--------------------------------------------------------------------------
- alias help_ex_on_sell_ok on_sell_ok
- def on_sell_ok
- help_ex_on_sell_ok
- @help_ex_window.hide
- end
- #--------------------------------------------------------------------------
- # ● 卖出“取消”
- #--------------------------------------------------------------------------
- alias help_ex_on_sell_cancel on_sell_cancel
- def on_sell_cancel
- help_ex_on_sell_cancel
- @help_ex_window.hide
- end
- end
复制代码 [/fold]
15、这是根据DQ打造的脚本,能让游戏更具有探索性。
[fold=隐藏地图]- #打开脚本编辑器,将脚本插入到main上。
- #==============================================================================
- # ■ 隐藏房间黑块
- # by:VIPArcher [email: VIPArcher@sina.com]
- # -- 本脚本来自 https://rpg.blue 使用或转载请保留以上信息。
- #==============================================================================
- # 使用说明:
- # · 在需要用黑块遮罩的地图上建一个事件,事件名为 "Black_Room"并且在该事件里注释上
- # 需要遮罩的范围矩形,例如 <6,4,10,17> 就为从地图坐标(6,4)开始到坐标(10,17)的矩形
- # 区域填充上黑色块遮罩掉,当玩家踏入这个矩形时遮罩块消失。查看坐标可以看地图编辑器
- # 右下角,把要遮罩的区域的左上角的坐标和右下角的坐标带入即可。
- # · 指定遮罩块颜色可在设置的第一行注释上<color=Color.new(R,G,B)>
- # · 每个遮罩可以指定角色踏入的矩形,规则同上,注释方法为在对应的矩形后面同一行注释
- # 例如<6,4,10,17>,[6,4,10,18],未指定踏入区域时默认原矩形为踏入区域
- # · 如需注释多个黑块房间请注意换行。
- # · 需要用图片做为遮罩块,就像这样备注 <name=文件名 x:5 y:5>,[5,5,10,10]
- # 使用图片做为遮罩块必须设置踏入的矩形。文件放在"\Graphics\Parallaxes"文件夹下
- #==============================================================================
- $VIPArcherScript ||= {};$VIPArcherScript[:black_room] = 20150211
- #-------------------------------------------------------------------------------
- module VIPArcher end
- #==============================================================================
- # ★ 设定部分 ★
- #==============================================================================
- module VIPArcher::BlackRoom
- Z = 999 # 遮罩块的Z值
- SW = 1 # 该开关开启时遮罩块不可见
- Edge = 0 # 遮罩块边距留空的距离
- Room_Color = Color.new(0,0,0) # 默认遮罩块填充的颜色
- Event_Name = 'Black_Room' # 设置遮罩块的事件名
- Opacity_Speed = 17 # 透明度变化的速度
- end
- #==============================================================================
- # ☆ 设定结束 ☆
- #==============================================================================
- class Sprite_BlackRoom < Sprite
- include VIPArcher::BlackRoom
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize(rect,check_rect,color,viewport)
- super(viewport)
- @check_rect, @color = check_rect,color
- if rect.is_a?(Rect)
- self.x, self.y, self.z = rect.x * 32, rect.y * 32, Z
- width, height = rect.width - rect.x + 1,rect.height - rect.y + 1
- set_bitmap(width * 32,height * 32)
- elsif rect.is_a?(Array)
- self.x, self.y, self.z = rect[1] * 32, rect[2] * 32, Z
- set_bitmap(rect[0])
- end
- end
- #--------------------------------------------------------------------------
- # ● 设置Bitmap
- #--------------------------------------------------------------------------
- def set_bitmap(*args)
- case args.size
- when 1
- self.bitmap = Cache.parallax(args[0])
- when 2
- self.bitmap = Bitmap.new(args[0], args[1])
- rect = Rect.new(Edge, Edge, args[0] - Edge * 2, args[1] - Edge * 2)
- self.bitmap.fill_rect(rect, @color)
- end
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def dispose
- super
- self.bitmap.dispose
- end
- #--------------------------------------------------------------------------
- # ● 位置判定
- #--------------------------------------------------------------------------
- def character_pos?
- $game_player.x > @check_rect.width || $game_player.x < @check_rect.x ||
- $game_player.y > @check_rect.height || $game_player.y < @check_rect.y
- end
- #--------------------------------------------------------------------------
- # ● 更新透明度
- #--------------------------------------------------------------------------
- def update_opacity
- self.opacity += character_pos? ? Opacity_Speed : - Opacity_Speed
- self.opacity = 0 if $game_switches[SW]
- end
- #--------------------------------------------------------------------------
- # ● 更新位置
- #--------------------------------------------------------------------------
- def update_position
- self.ox = $game_map.display_x * 32
- self.oy = $game_map.display_y * 32
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- update_opacity
- update_position
- end
- end
- #-------------------------------------------------------------------------------
- class Spriteset_Map
- include VIPArcher::BlackRoom
- #--------------------------------------------------------------------------
- # ● 生成黑色遮罩块
- #--------------------------------------------------------------------------
- alias black_room_create_characters create_characters
- def create_characters
- black_room_create_characters
- room_sprite_dispose if @black_room_sprites
- @black_room_sprites = []
- $game_map.events.values.each do |event|
- if event.instance_variable_get(:@event).name =~ /#{Event_Name}/i
- return if event.list.nil?
- event.list.each { |command| get_setup(command) }
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 获取遮罩块设置
- #--------------------------------------------------------------------------
- def get_setup(command)
- return unless command.code == 108 or 408
- command.parameters.each {|line|get_rect_setup(line);get_bitmap_setup(line)}
- end
- #--------------------------------------------------------------------------
- # ● 备注文件名的设置
- #--------------------------------------------------------------------------
- def get_bitmap_setup(line)
- if line =~ /<name\s*=\s*(\S+?)\s*x:\s*(\d+?)\s*y:\s*(\d+)>/i
- rect = [$1,$2.to_i,$3.to_i]
- if line =~ /\[(\d+.*?)\]/; x = $1.split(',')
- check_rect = Rect.new(x[0].to_i,x[1].to_i,x[2].to_i,x[3].to_i)
- end
- sprite = Sprite_BlackRoom.new(rect,check_rect,@color,@viewport1)
- sprite.opacity = 0 unless sprite.character_pos?
- @black_room_sprites.push(sprite)
- end
- end
- #--------------------------------------------------------------------------
- # ● 备注矩形的设置
- #--------------------------------------------------------------------------
- def get_rect_setup(line)
- @color = eval($1) if line =~ /<color\s*=\s*(.*?)\s*>/i
- @color ||= Room_Color
- if line =~ /<(\d+.*?)>/; x = $1.split(',')
- check_rect = rect = Rect.new(x[0].to_i,x[1].to_i,x[2].to_i,x[3].to_i)
- if line =~ /\[(\d+.*?)\]/; x = $1.split(',')
- check_rect = Rect.new(x[0].to_i,x[1].to_i,x[2].to_i,x[3].to_i)
- end
- sprite = Sprite_BlackRoom.new(rect,check_rect,@color,@viewport1)
- sprite.opacity = 0 unless sprite.character_pos?
- @black_room_sprites.push(sprite)
- end
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- alias black_room_dispose dispose
- def dispose
- black_room_dispose
- room_sprite_dispose
- end
- #--------------------------------------------------------------------------
- # ● 释放遮罩块
- #--------------------------------------------------------------------------
- def room_sprite_dispose
- @black_room_sprites.each {|sprite| sprite.dispose }
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- alias black_room_update update
- def update
- black_room_update
- @black_room_sprites.each {|sprite| sprite.update }
- end
- end
复制代码 [/fold]
16、在战斗中菜单加入一个“队伍”(名字可以在脚本改)选项,战斗中可以不限制的切换没有出来参战的同伴出来战斗。
[fold=战斗支援脚本1]- #使用方法:打开脚本编辑器,将“战斗支援脚本1”“战斗支援脚本2"脚本插入到main上。
- # ===========================================================================
-
- # ◆ A1 Scripts ◆
-
- # A1バトル共通スクリプト(RGSS3)
-
- #
-
- # バージョン : 1.23 (2012/01/27)
-
- # 作者 : A1
-
- # URL : http://a1tktk.web.fc2.com/
-
- # ---------------------------------------------------------------------------
-
- # 更新履歴 :2012/01/18 Ver1.00 リリース
-
- # 2012/01/21 Ver1.10 装備拡張対応
-
- # 2012/01/21 Ver1.10 メンバー加入時の不具合を修正
-
- # 2012/01/21 Ver1.10 メンバー加入時に既にパーティに居るさい何もしないように修正
-
- # 2012/01/24 Ver1.20 スキル拡張対応
-
- # 2012/01/24 Ver1.21 Window_BattleActorの不具合を修正
-
- # 2012/01/26 Ver1.22 Window_BattleSkillの不具合を修正
-
- # 2012/01/27 Ver1.23 戦闘行動がない際の不具合を修正
-
- # ---------------------------------------------------------------------------
-
- # 設置場所
-
- # A1共通スクリプトより下
-
- # 一部再定義メソッドがあるため、なるべく上の方
-
- #
-
- # 必要スクリプト
-
- # A1共通スクリプトVer4.30以上
-
- #==============================================================================
-
- $imported = {} if $imported == nil
-
- if $imported["A1_Common_Script"]
-
- $imported["A1_BattleCommonScript"] = true
-
- old_common_script("A1バトル共通スクリプト", "4.30") if common_version < 4.30
-
- #==============================================================================
-
- # ■ Window_Base
-
- #------------------------------------------------------------------------------
-
- # ゲーム中の全てのウィンドウのスーパークラスです。
-
- #==============================================================================
-
- class Window_Base < Window
-
- #--------------------------------------------------------------------------
-
- # ○ メソッドの定義
-
- #--------------------------------------------------------------------------
-
- def define_method(method, symbol)
-
- @method ||= {}
-
- @method[symbol] = method
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ メソッドのコール
-
- #--------------------------------------------------------------------------
-
- def call_method(symbol, *args)
-
- @method ||= {}
-
- @method[symbol].call(*args) if @method[symbol]
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 顔グラフィックの描画(解放なし)
-
- #--------------------------------------------------------------------------
-
- def draw_face_no_dispose(face_name, face_index, x, y, enabled = true)
-
- bitmap = Cache.face(face_name)
-
- rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 96)
-
- contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 背景の描画
-
- #--------------------------------------------------------------------------
-
- def draw_background(rect)
-
- temp_rect = rect.clone
-
- temp_rect.width /= 2
-
- contents.gradient_fill_rect(temp_rect, back_color2, back_color1)
-
- temp_rect.x = temp_rect.width
-
- contents.gradient_fill_rect(temp_rect, back_color1, back_color2)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 背景色 1 の取得
-
- #--------------------------------------------------------------------------
-
- def back_color1
-
- Color.new(0, 0, 0, 192)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 背景色 2 の取得
-
- #--------------------------------------------------------------------------
-
- def back_color2
-
- Color.new(0, 0, 0, 0)
-
- end
-
- end
-
- #==============================================================================
-
- # ■ Window_Help
-
- #------------------------------------------------------------------------------
-
- # スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
-
- #==============================================================================
-
- class Window_Help < Window_Base
-
- #--------------------------------------------------------------------------
-
- # ○ センターにテキストを描画
-
- #--------------------------------------------------------------------------
-
- def draw_center_text(text)
-
- contents.clear
-
- draw_text(0, 0, contents.width, line_height, text, 1)
-
- end
-
- end
-
- #==============================================================================
-
- # ■ Window_BattleActor
-
- #------------------------------------------------------------------------------
-
- # バトル画面で、行動対象のアクターを選択するウィンドウです。
-
- #==============================================================================
-
- class Window_BattleActor < Window_BattleStatus
-
- #--------------------------------------------------------------------------
-
- # ★ ウィンドウの表示
-
- #--------------------------------------------------------------------------
-
- def show
-
- setup_remain if @info_viewport
-
- self.visible = true
-
- refresh
-
- open
-
- self
-
- end
-
- #--------------------------------------------------------------------------
-
- # ★ ウィンドウの非表示
-
- #--------------------------------------------------------------------------
-
- def hide
-
- close
-
- @info_viewport.rect.width = Graphics.width if @info_viewport
-
- call_method(:select_actor_end)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ フレーム更新
-
- #--------------------------------------------------------------------------
-
- def update
-
- return update_basic unless self.visible
-
- super
-
- self.visible = false if self.openness == 0
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ フレーム更新(基本)
-
- #--------------------------------------------------------------------------
-
- def update_basic
-
- process_cursor_move
-
- process_handling
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 項目の選択
-
- #--------------------------------------------------------------------------
-
- def select(index)
-
- super
-
- call_method(:select_actor, index)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ウィンドウの調整
-
- #--------------------------------------------------------------------------
-
- def setup_remain
-
- width_remain = Graphics.width - width
-
- self.x = width_remain
-
- @info_viewport.rect.width = width_remain
-
- select(0)
-
- end
-
- end
-
- #==============================================================================
-
- # ■ Window_BattleEnemy
-
- #------------------------------------------------------------------------------
-
- # バトル画面で、行動対象の敵キャラを選択するウィンドウです。
-
- #==============================================================================
-
- class Window_BattleEnemy < Window_Selectable
-
- #--------------------------------------------------------------------------
-
- # ★ ウィンドウの表示
-
- #--------------------------------------------------------------------------
-
- def show
-
- setup_remain if @info_viewport
-
- self.visible = true
-
- open
-
- self
-
- end
-
- #--------------------------------------------------------------------------
-
- # ★ ウィンドウの非表示
-
- #--------------------------------------------------------------------------
-
- def hide
-
- close
-
- @info_viewport.rect.width = Graphics.width if @info_viewport
-
- call_method(:select_enemy_end)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ フレーム更新
-
- #--------------------------------------------------------------------------
-
- def update
-
- return update_basic unless self.visible
-
- super
-
- self.visible = false if self.openness == 0
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ フレーム更新(基本)
-
- #--------------------------------------------------------------------------
-
- def update_basic
-
- process_cursor_move
-
- process_handling
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 項目の選択
-
- #--------------------------------------------------------------------------
-
- def select(index)
-
- super
-
- call_method(:select_enemy, index)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ウィンドウの調整
-
- #--------------------------------------------------------------------------
-
- def setup_remain
-
- width_remain = Graphics.width - width
-
- self.x = width_remain
-
- @info_viewport.rect.width = width_remain
-
- select(0)
-
- end
-
- end
-
- #==============================================================================
-
- # ■ Window_BattleSkill
-
- #------------------------------------------------------------------------------
-
- # バトル画面で、使用するスキルを選択するウィンドウです。
-
- #==============================================================================
-
- class Window_BattleSkill < Window_SkillList
-
- #--------------------------------------------------------------------------
-
- # ☆ オブジェクト初期化
-
- # info_viewport : 情報表示用ビューポート
-
- #--------------------------------------------------------------------------
-
- alias a1_psw_wbs_initialize initialize
-
- def initialize(help_window, info_viewport)
-
- a1_psw_wbs_initialize(help_window, info_viewport)
-
- self.openness = 0
-
- self.visible = true
-
- @help_window.openness = 0
-
- @help_window.visible = true
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 高さを変える
-
- #--------------------------------------------------------------------------
-
- def resize_height(base_y)
-
- self.height = base_y - self.y
-
- create_contents
-
- end
-
- #--------------------------------------------------------------------------
-
- # ★ ウィンドウの表示
-
- #--------------------------------------------------------------------------
-
- def show
-
- self.visible = true
-
- @help_window.visible = true
-
- select_last
-
- open
-
- @help_window.open
-
- self
-
- end
-
- #--------------------------------------------------------------------------
-
- # ★ ウィンドウの非表示
-
- #--------------------------------------------------------------------------
-
- def hide
-
- close
-
- @help_window.close
-
- @info_viewport.rect.width = Graphics.width if @info_viewport
-
- call_method(:skill_item_window_hide)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ オープン
-
- #--------------------------------------------------------------------------
-
- def open
-
- self.visible = true
-
- call_method(:skill_item_window_show)
-
- super
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アクティブ化
-
- #--------------------------------------------------------------------------
-
- def activate
-
- open
-
- @help_window.open
-
- super
-
- end
-
- end
-
- #==============================================================================
-
- # ■ Window_BattleItem
-
- #------------------------------------------------------------------------------
-
- # バトル画面で、使用するアイテムを選択するウィンドウです。
-
- #==============================================================================
-
- class Window_BattleItem < Window_ItemList
-
- #--------------------------------------------------------------------------
-
- # ☆ オブジェクト初期化
-
- # info_viewport : 情報表示用ビューポート
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_wbi_initialize initialize
-
- def initialize(help_window, info_viewport)
-
- a1_battle_common_wbi_initialize(help_window, info_viewport)
-
- self.openness = 0
-
- self.visible = true
-
- @help_window.openness = 0
-
- @help_window.visible = true
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 高さを変える
-
- #--------------------------------------------------------------------------
-
- def resize_height(base_y)
-
- self.height = base_y - self.y
-
- create_contents
-
- end
-
- #--------------------------------------------------------------------------
-
- # ★ ウィンドウの表示
-
- #--------------------------------------------------------------------------
-
- def show
-
- self.visible = true
-
- @help_window.visible = true
-
- select_last
-
- open
-
- @help_window.open
-
- self
-
- end
-
- #--------------------------------------------------------------------------
-
- # ★ ウィンドウの非表示
-
- #--------------------------------------------------------------------------
-
- def hide
-
- close
-
- @help_window.close
-
- call_method(:skill_item_window_hide)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ オープン
-
- #--------------------------------------------------------------------------
-
- def open
-
- self.visible = true
-
- call_method(:skill_item_window_show)
-
- super
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アクティブ化
-
- #--------------------------------------------------------------------------
-
- def activate
-
- open
-
- @help_window.open
-
- super
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ フレーム更新
-
- #--------------------------------------------------------------------------
-
- def update
-
- return unless self.visible
-
- super
-
- self.visible = false if self.openness == 0
-
- end
-
- end
-
- #==============================================================================
-
- # ■ Window_ActorCommand
-
- #------------------------------------------------------------------------------
-
- # バトル画面で、アクターの行動を選択するウィンドウです。
-
- #==============================================================================
-
- class Window_ActorCommand < Window_Command
-
- #--------------------------------------------------------------------------
-
- # ☆ セットアップ
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_wac_setup setup
-
- def setup(actor)
-
- call_method(:actor_command_setup, actor)
-
- a1_battle_common_wac_setup(actor)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ウィンドウのアクティブ化
-
- #--------------------------------------------------------------------------
-
- def activate
-
- open
-
- super
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ オープン
-
- #--------------------------------------------------------------------------
-
- def open
-
- call_method(:actor_command_open)
-
- super
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ クローズ
-
- #--------------------------------------------------------------------------
-
- def close
-
- call_method(:actor_command_close)
-
- super
-
- end
-
- end
-
- #==============================================================================
-
- # ■ Window_BattleStatus
-
- #------------------------------------------------------------------------------
-
- # バトル画面で、パーティメンバーのステータスを表示するウィンドウです。
-
- #==============================================================================
-
- class Window_BattleStatus < Window_Selectable
-
- #--------------------------------------------------------------------------
-
- # ☆ リフレッシュ
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_wbs_refresh refresh
-
- def refresh
-
- call_method(:refresh_statsu_window)
-
- return unless self.visible
-
- a1_battle_common_wbs_refresh
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ウィンドウを開く
-
- #--------------------------------------------------------------------------
-
- def open
-
- super
-
- call_method(:open_status_window)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ウィンドウを閉じる
-
- #--------------------------------------------------------------------------
-
- def close
-
- super
-
- call_method(:close_status_window)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 項目の選択
-
- #--------------------------------------------------------------------------
-
- def select(index)
-
- super
-
- call_method(:select_status_window, index)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ フレーム更新
-
- #--------------------------------------------------------------------------
-
- def update
-
- call_method(:update_status_window)
-
- return unless self.visible
-
- super
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 解放
-
- #--------------------------------------------------------------------------
-
- def dispose
-
- super
-
- call_method(:dispose_status_window)
-
- end
-
- end
-
- #==============================================================================
-
- # ■ Window_PersonalStatus
-
- #==============================================================================
-
- class Window_PersonalStatus < Window_Base
-
- #--------------------------------------------------------------------------
-
- # ○ オブジェクト初期化
-
- #--------------------------------------------------------------------------
-
- def initialize(x, y, opacity = 0)
-
- super(x, y, Graphics.width / 2, 120)
-
- self.opacity = opacity
-
- self.openness = 0
-
- @actor = nil
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アクターの設定
-
- #--------------------------------------------------------------------------
-
- def actor=(actor)
-
- @actor = actor
-
- refresh
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ リフレッシュ
-
- #--------------------------------------------------------------------------
-
- def refresh
-
- contents.clear
-
- draw_face(@actor.face_name, @actor.face_index, 0, 0)
-
- draw_text(116, line_height * 0, contents.width, line_height, @actor.name)
-
- draw_actor_level(@actor, 116, 0 + line_height * 1)
-
- draw_actor_icons(@actor, 180, 0 + line_height * 1)
-
- draw_actor_hp(@actor, 116, 0 + line_height * 2, 128)
-
- draw_actor_mp(@actor, 116, 0 + line_height * 3, 60)
-
- draw_actor_tp(@actor, 184, 0 + line_height * 3, 60) if $data_system.opt_display_tp
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ フレーム更新
-
- #--------------------------------------------------------------------------
-
- def update
-
- return unless self.visible
-
- super
-
- self.visible = false if self.openness == 0
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ オープン
-
- #--------------------------------------------------------------------------
-
- def open
-
- self.visible = true
-
- super
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 顔グラフィックの描画
-
- #--------------------------------------------------------------------------
-
- def draw_face(face_name, face_index, x, y, enabled = true)
-
- draw_face_no_dispose(face_name, face_index, x, y, enabled)
-
- end
-
- end
-
- #==============================================================================
-
- # ■ RPG::Enemy
-
- #==============================================================================
-
- class RPG::Enemy < RPG::BaseItem
-
- #--------------------------------------------------------------------------
-
- # ○ 初期装備
-
- #--------------------------------------------------------------------------
-
- def equips
-
- @equips ||= [0,0,0,0,0]
-
- @equips[0] ||= $a1_common.note_data_one(self.note, "エネミー武器", 0)
-
- return @equips
-
- end
-
- end
-
- #==============================================================================
-
- # ■ Game_Enemy
-
- #------------------------------------------------------------------------------
-
- # 敵キャラを扱うクラスです。このクラスは Game_Troop クラス($game_troop)の
-
- # 内部で使用されます。
-
- #==============================================================================
-
- class Game_Enemy < Game_Battler
-
- #--------------------------------------------------------------------------
-
- # ☆ オブジェクト初期化
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_ge_initialize initialize
-
- def initialize(index, enemy_id)
-
- @equips = []
-
- a1_battle_common_ge_initialize(index, enemy_id)
-
- init_equips(enemy.equips)
-
- end
-
- end
-
- #==============================================================================
-
- # ■ Game_Actor
-
- #------------------------------------------------------------------------------
-
- # アクターを扱うクラスです。このクラスは Game_Actors クラス($game_actors)
-
- # の内部で使用され、Game_Party クラス($game_party)からも参照されます。
-
- #==============================================================================
-
- class Game_Actor < Game_Battler
-
- #--------------------------------------------------------------------------
-
- # ★ 装備品の初期化
-
- # equips : 初期装備の配列
-
- #--------------------------------------------------------------------------
-
- def init_equips(equips)
-
- super
-
- end
-
- #--------------------------------------------------------------------------
-
- # ★ 装備タイプからスロット ID に変換(空きを優先)
-
- #--------------------------------------------------------------------------
-
- def empty_slot(etype_id)
-
- super
-
- end
-
- #--------------------------------------------------------------------------
-
- # ★ 装備タイプからスロット ID のリストに変換
-
- #--------------------------------------------------------------------------
-
- def slot_list(etype_id)
-
- super
-
- end
-
- #--------------------------------------------------------------------------
-
- # ★ エディタで設定されたインデックスを装備タイプ ID に変換
-
- #--------------------------------------------------------------------------
-
- def index_to_etype_id(index)
-
- super
-
- end
-
- #--------------------------------------------------------------------------
-
- # ★ 装備スロットの配列を取得
-
- #--------------------------------------------------------------------------
-
- def equip_slots
-
- super
-
- end
-
- #--------------------------------------------------------------------------
-
- # ★ 装備品オブジェクトの配列取得
-
- #--------------------------------------------------------------------------
-
- def equips
-
- super
-
- end
-
- #--------------------------------------------------------------------------
-
- # ★ 武器オブジェクトの配列取得
-
- #--------------------------------------------------------------------------
-
- def weapons
-
- super
-
- end
-
- #--------------------------------------------------------------------------
-
- # ★ 通常能力値の加算値取得
-
- #--------------------------------------------------------------------------
-
- def param_plus(param_id)
-
- super
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ 通常攻撃 アニメーション ID の取得
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_ga_atk_animation_id1 atk_animation_id1
-
- def atk_animation_id1
-
- return a1_battle_common_ga_atk_animation_id1 if !@current_weapon || @current_weapon.is_a?(Array)
-
- @current_weapon.animation_id
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ 通常攻撃 アニメーション ID の取得(二刀流:武器2)
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_ga_atk_animation_id2 atk_animation_id2
-
- def atk_animation_id2
-
- return a1_battle_common_ga_atk_animation_id2 if !@current_weapon || @current_weapon.is_a?(Array)
-
- @current_weapon.animation_id
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 装備タイプ名を取得
-
- #--------------------------------------------------------------------------
-
- def e_type_name(item)
-
- return $data_system.weapon_types[item.wtype_id] if item.is_a?(RPG::Weapon)
-
- return $data_system.armor_types[item.atype_id] if item.is_a?(RPG::Armor)
-
- end
-
- end
-
- #==============================================================================
-
- # ■ Game_BattlerBase
-
- #------------------------------------------------------------------------------
-
- # バトラーを扱う基本のクラスです。主に能力値計算のメソッドを含んでいます。こ
-
- # のクラスは Game_Battler クラスのスーパークラスとして使用されます。
-
- #==============================================================================
-
- class Game_BattlerBase
-
- #--------------------------------------------------------------------------
-
- # ○ 二刀流?
-
- #--------------------------------------------------------------------------
-
- def two_sword_style?
-
- weapons[0] && weapons[1]
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ バトラーオブジェクト取得
-
- #--------------------------------------------------------------------------
-
- def battler
-
- return actor if self.actor?
-
- return enemy
-
- end
-
- end
-
- #==============================================================================
-
- # ■ Game_Battler
-
- #------------------------------------------------------------------------------
-
- # スプライトや行動に関するメソッドを追加したバトラーのクラスです。このクラス
-
- # は Game_Actor クラスと Game_Enemy クラスのスーパークラスとして使用されます。
-
- #==============================================================================
-
- class Game_Battler < Game_BattlerBase
-
- #--------------------------------------------------------------------------
-
- # ○ 公開インスタンス変数
-
- #--------------------------------------------------------------------------
-
- attr_accessor :current_weapon
-
- attr_accessor :current_main
-
- #--------------------------------------------------------------------------
-
- # ○ 装備品の初期化
-
- # equips : 初期装備の配列
-
- #--------------------------------------------------------------------------
-
- def init_equips(equips)
-
- @equips = Array.new(equip_slots.size) { Game_BaseItem.new }
-
- equips.each_with_index do |item_id, i|
-
- etype_id = index_to_etype_id(i)
-
- slot_id = empty_slot(etype_id)
-
- @equips[slot_id].set_equip(etype_id == 0, item_id) if slot_id
-
- end
-
- refresh
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 装備タイプからスロット ID に変換(空きを優先)
-
- #--------------------------------------------------------------------------
-
- def empty_slot(etype_id)
-
- list = slot_list(etype_id)
-
- list.find {|i| @equips[i].is_nil? } || list[0]
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 装備タイプからスロット ID のリストに変換
-
- #--------------------------------------------------------------------------
-
- def slot_list(etype_id)
-
- result = []
-
- equip_slots.each_with_index {|e, i| result.push(i) if e == etype_id }
-
- result
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ エディタで設定されたインデックスを装備タイプ ID に変換
-
- #--------------------------------------------------------------------------
-
- def index_to_etype_id(index)
-
- index == 1 && dual_wield? ? 0 : index
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 装備スロットの配列を取得
-
- #--------------------------------------------------------------------------
-
- def equip_slots
-
- return [0,0,2,3,4] if dual_wield? # 二刀流
-
- return [0,1,2,3,4] # 通常
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 装備品オブジェクトの配列取得
-
- #--------------------------------------------------------------------------
-
- def equips
-
- @equips.collect {|item| item.object }
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 武器オブジェクトの配列取得
-
- #--------------------------------------------------------------------------
-
- def weapons
-
- @equips.select {|item| item.is_weapon? }.collect {|item| item.object }
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 通常能力値の加算値取得
-
- #--------------------------------------------------------------------------
-
- def param_plus(param_id)
-
- equips.compact.inject(super) {|r, item| r += item.params[param_id] + ex_item_params(item, param_id) }
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アイテムにかける追加要素
-
- #--------------------------------------------------------------------------
-
- def ex_item_params(item, param_id)
-
- return 0
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ スキルを取得
-
- #--------------------------------------------------------------------------
-
- def skill(skill_id)
-
- $data_skills[skill_id]
-
- end
-
- end
-
- #==============================================================================
-
- # ■ Game_Party
-
- #------------------------------------------------------------------------------
-
- # パーティを扱うクラスです。所持金やアイテムなどの情報が含まれます。このクラ
-
- # スのインスタンスは $game_party で参照されます。
-
- #==============================================================================
-
- class Game_Party < Game_Unit
-
- #--------------------------------------------------------------------------
-
- # ☆ アクターを加える
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_gp_add_actor add_actor
-
- def add_actor(actor_id)
-
- return a1_battle_common_gp_add_actor(actor_id) unless in_battle
-
- return if @actors.include?(actor_id)
-
- prev_add_actor(battle_members)
-
- insert_actor(actor_id)
-
- post_add_actor($game_actors[actor_id])
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アクターを加える
-
- #--------------------------------------------------------------------------
-
- def insert_actor(actor_id)
-
- @new_index = @remove_member_index ? @remove_member_index[0] : @actors.size
-
- @actors.insert(@new_index, actor_id) unless @actors.include?(actor_id)
-
- $game_player.refresh
-
- $game_map.need_refresh = true
-
- return unless @remove_member_index
-
- @remove_member_index.delete_at(0)
-
- @remove_member_index = nil if @remove_member_index.empty?
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アクターを加えたIndexを取得
-
- #--------------------------------------------------------------------------
-
- def new_index
-
- @new_index
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アクターを加える前処理
-
- #--------------------------------------------------------------------------
-
- def prev_add_actor(members)
-
- BattleManager.call_method(:prev_add_battler, members)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アクターを加えた後処理
-
- #--------------------------------------------------------------------------
-
- def post_add_actor(member)
-
- BattleManager.call_method(:post_add_battler, member)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ アクターを外す
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_gp_remove_actor remove_actor
-
- def remove_actor(actor_id)
-
- prev_remove_actor($game_actors[actor_id]) if in_battle
-
- a1_battle_common_gp_remove_actor(actor_id)
-
- post_remove_actor if in_battle
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アクターを外す前処理
-
- #--------------------------------------------------------------------------
-
- def prev_remove_actor(member)
-
- @remove_member_index ||= []
-
- @remove_member_index.push(member.index)
-
- BattleManager.call_method(:prev_remove_battler, member)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アクターを外した後処理
-
- #--------------------------------------------------------------------------
-
- def post_remove_actor
-
- BattleManager.call_method(:post_remove_battler)
-
- end
-
- end
-
- #==============================================================================
-
- # ■ BattleManager
-
- #------------------------------------------------------------------------------
-
- # 戦闘の進行を管理するモジュールです。
-
- #==============================================================================
-
- module BattleManager
-
- #--------------------------------------------------------------------------
-
- # ○ エイリアス用特異メソッド
-
- #--------------------------------------------------------------------------
-
- class << self
-
- alias :a1_battle_common_bm_turn_end :turn_end
-
- alias :a1_battle_common_bm_turn_start :turn_start
-
- alias :a1_battle_common_bm_battle_end :battle_end
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ ターン開始
-
- #--------------------------------------------------------------------------
-
- def self.turn_start
-
- @turn_end_wait = 0
-
- a1_battle_common_bm_turn_start
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ ターン終了
-
- #--------------------------------------------------------------------------
-
- def self.turn_end
-
- call_method(:wait, @turn_end_wait) if @turn_end_wait > 0
-
- @turn_end_wait = 0
-
- a1_battle_common_bm_turn_end
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ メソッドの設定
-
- #--------------------------------------------------------------------------
-
- def self.define_method(method, symbol)
-
- @method ||= {}
-
- @method[symbol] = method
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ メソッドのコール
-
- #--------------------------------------------------------------------------
-
- def self.call_method(symbol, *args)
-
- @method[symbol].call(*args) if @method[symbol]
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ターン終了後ウェイト設定
-
- #--------------------------------------------------------------------------
-
- def self.turn_end_wait=(flame)
-
- @turn_end_wait = flame if @turn_end_wait < flame || flame == 0
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ 戦闘終了
-
- # result : 結果(0:勝利 1:逃走 2:敗北)
-
- #--------------------------------------------------------------------------
-
- def self.battle_end(result)
-
- call_method(:battle_end, result)
-
- a1_battle_common_bm_battle_end(result)
-
- end
-
- end
-
- #==============================================================================
-
- # ■ Game_Action
-
- #------------------------------------------------------------------------------
-
- # 戦闘行動を扱うクラスです。このクラスは Game_Battler クラスの内部で使用され
-
- # ます。
-
- #==============================================================================
-
- class Game_Action
-
- #--------------------------------------------------------------------------
-
- # ☆ ターゲットの配列作成
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_gac_make_targets make_targets
-
- def make_targets
-
- @targets ||= pre_make_targets
-
- return @targets
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ターゲットの配列先行作成
-
- #--------------------------------------------------------------------------
-
- def pre_make_targets
-
- @targets = a1_battle_common_gac_make_targets
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ターゲットの配列を取得
-
- #--------------------------------------------------------------------------
-
- def targets
-
- @targets.compact
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ターゲットの配列をクリア
-
- #--------------------------------------------------------------------------
-
- def clear_targets
-
- @targets = nil
-
- end
-
- end
-
- #==============================================================================
-
- # ■ Scene_Battle
-
- #------------------------------------------------------------------------------
-
- # バトル画面の処理を行うクラスです。
-
- #==============================================================================
-
- class Scene_Battle < Scene_Base
-
- #--------------------------------------------------------------------------
-
- # ☆ 開始処理
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_sb_start start
-
- def start
-
- a1_battle_common_sb_start
-
- define_battle_manager_method
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ バトルマネージャメソッドの定義
-
- #--------------------------------------------------------------------------
-
- def define_battle_manager_method
-
- BattleManager.define_method(method(:wait), :wait)
-
- BattleManager.define_method(method(:post_add_battler), :post_add_battler)
-
- BattleManager.define_method(method(:post_remove_battler), :post_remove_battler)
-
- BattleManager.define_method(method(:prev_remove_battler), :prev_remove_battler)
-
- BattleManager.define_method(method(:prev_add_battler), :prev_add_battler)
-
- BattleManager.define_method(method(:process_victory), :process_victory)
-
- BattleManager.define_method(method(:battle_end), :battle_end)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ ステータスウィンドウの作成
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_sb_create_status_window create_status_window
-
- def create_status_window
-
- a1_battle_common_sb_create_status_window
-
- post_create_status_window
-
- define_status_window_method
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ステータスウィンドウ作成の後処理
-
- #--------------------------------------------------------------------------
-
- def post_create_status_window
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ステータスウィンドウメソッドの定義
-
- #--------------------------------------------------------------------------
-
- def define_status_window_method
-
- @status_window.define_method(method(:refresh_statsu_window), :refresh_statsu_window)
-
- @status_window.define_method(method(:close_status_window), :close_status_window)
-
- @status_window.define_method(method(:open_status_window), :open_status_window)
-
- @status_window.define_method(method(:select_status_window), :select_status_window)
-
- @status_window.define_method(method(:update_status_window), :update_status_window)
-
- @status_window.define_method(method(:dispose_status_window), :dispose_status_window)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ステータスウィンドウがリフレッシュされた時の処理
-
- #--------------------------------------------------------------------------
-
- def refresh_statsu_window
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ステータスウィンドウがクローズされた時の処理
-
- #--------------------------------------------------------------------------
-
- def close_status_window
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ステータスウィンドウがオープンされた時の処理
-
- #--------------------------------------------------------------------------
-
- def open_status_window
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ステータスウィンドウがセレクトされた時の処理
-
- #--------------------------------------------------------------------------
-
- def select_status_window(index)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ステータスウィンドウが更新された時の処理
-
- #--------------------------------------------------------------------------
-
- def update_status_window
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ステータスウィンドウが解放された時の処理
-
- #--------------------------------------------------------------------------
-
- def dispose_status_window
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ 情報表示ビューポートの作成
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_sb_create_info_viewport create_info_viewport
-
- def create_info_viewport
-
- a1_battle_common_sb_create_info_viewport
-
- post_create_info_viewport
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 情報表示ビューポート作成の後処理
-
- #--------------------------------------------------------------------------
-
- def post_create_info_viewport
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ スキルウィンドウの作成
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_sb_create_skill_window create_skill_window
-
- def create_skill_window
-
- a1_battle_common_sb_create_skill_window
-
- post_create_skill_window
-
- define_skill_window_method
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ スキルウィンドウ作成の後処理
-
- #--------------------------------------------------------------------------
-
- def post_create_skill_window
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ スキルウィンドウメソッドの定義
-
- #--------------------------------------------------------------------------
-
- def define_skill_window_method
-
- @skill_window.define_method(method(:skill_item_window_show), :skill_item_window_show)
-
- @skill_window.define_method(method(:skill_item_window_hide), :skill_item_window_hide)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ アイテムウィンドウの作成
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_sb_create_item_window create_item_window
-
- def create_item_window
-
- a1_battle_common_sb_create_item_window
-
- post_create_item_window
-
- define_item_window_method
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アイテムウィンドウ作成の後処理
-
- #--------------------------------------------------------------------------
-
- def post_create_item_window
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アイテムウィンドウメソッドの定義
-
- #--------------------------------------------------------------------------
-
- def define_item_window_method
-
- @item_window.define_method(method(:skill_item_window_show), :skill_item_window_show)
-
- @item_window.define_method(method(:skill_item_window_hide), :skill_item_window_hide)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ スキル/アイテムウィンドウが表示された時の処理
-
- #--------------------------------------------------------------------------
-
- def skill_item_window_show
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ スキル/アイテムウィンドウが非表示になった時の処理
-
- #--------------------------------------------------------------------------
-
- def skill_item_window_hide
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ パーティコマンドウィンドウの作成
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_sb_create_party_command_window create_party_command_window
-
- def create_party_command_window
-
- a1_battle_common_sb_create_party_command_window
-
- post_create_party_command_window
-
- define_party_command_window_method
-
- define_party_command_window_handle
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ パーティコマンドウィンドウ作成の後処理
-
- #--------------------------------------------------------------------------
-
- def post_create_party_command_window
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ パーティコマンドウィンドウメソッドの定義
-
- #--------------------------------------------------------------------------
-
- def define_party_command_window_method
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ パーティコマンドウィンドウハンドルの定義
-
- #--------------------------------------------------------------------------
-
- def define_party_command_window_handle
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ アクターウィンドウの作成
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_sb_create_actor_window create_actor_window
-
- def create_actor_window
-
- a1_battle_common_sb_create_actor_window
-
- post_create_actor_window
-
- define_actor_window_method
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アクターウィンドウ作成の後処理
-
- #--------------------------------------------------------------------------
-
- def post_create_actor_window
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アクターウィンドウメソッドの定義
-
- #--------------------------------------------------------------------------
-
- def define_actor_window_method
-
- @actor_window.define_method(method(:select_actor), :select_actor)
-
- @actor_window.define_method(method(:select_actor_end), :select_actor_end)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アクターウィンドウをセレクトした時の処理
-
- #--------------------------------------------------------------------------
-
- def select_actor(index)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アクターウィンドウをセレクト終了した時の処理
-
- #--------------------------------------------------------------------------
-
- def select_actor_end
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ 敵キャラウィンドウの作成
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_sb_create_enemy_window create_enemy_window
-
- def create_enemy_window
-
- a1_battle_common_sb_create_enemy_window
-
- post_create_enemy_window
-
- define_enemy_window_method
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 敵キャラウィンドウ作成の後処理
-
- #--------------------------------------------------------------------------
-
- def post_create_enemy_window
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 敵キャラウィンドウメソッドの定義
-
- #--------------------------------------------------------------------------
-
- def define_enemy_window_method
-
- @enemy_window.define_method(method(:select_enemy), :select_enemy)
-
- @enemy_window.define_method(method(:select_enemy_end) ,:select_enemy_end)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 敵キャラウィンドウをセレクトした時の処理
-
- #--------------------------------------------------------------------------
-
- def select_enemy(index)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 敵キャラウィンドウをセレクト終了した時の処理
-
- #--------------------------------------------------------------------------
-
- def select_enemy_end
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ アクターコマンドウィンドウの作成
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_sb_start_create_actor_command_window create_actor_command_window
-
- def create_actor_command_window
-
- a1_battle_common_sb_start_create_actor_command_window
-
- post_create_actor_command_window
-
- define_actor_command_handle
-
- define_actor_command_window
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アクターコマンドウィンドウ作成の後処理
-
- #--------------------------------------------------------------------------
-
- def post_create_actor_command_window
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アクターコマンドウィンドウメソッドの定義
-
- #--------------------------------------------------------------------------
-
- def define_actor_command_window
-
- @actor_command_window.define_method(method(:actor_command_open), :actor_command_open)
-
- @actor_command_window.define_method(method(:actor_command_close), :actor_command_close)
-
- @actor_command_window.define_method(method(:actor_command_setup), :actor_command_setup)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アクターコマンドウィンドウハンドルの定義
-
- #--------------------------------------------------------------------------
-
- def define_actor_command_handle
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アクターコマンドウィンドウがオープンした時の処理
-
- #--------------------------------------------------------------------------
-
- def actor_command_open
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アクターコマンドウィンドウがクローズした時の処理
-
- #--------------------------------------------------------------------------
-
- def actor_command_close
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アクターコマンドウィンドウのセットアップ時の処理
-
- #--------------------------------------------------------------------------
-
- def actor_command_setup(actor)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ パーティコマンド選択の開始
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_sb_start_party_command_selection start_party_command_selection
-
- def start_party_command_selection
-
- prev_start_party_command_selection
-
- a1_battle_common_sb_start_party_command_selection
-
- post_start_party_command_selection
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ パーティコマンド選択の開始の前処理
-
- #--------------------------------------------------------------------------
-
- def prev_start_party_command_selection
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ パーティコマンド選択の開始の後処理
-
- #--------------------------------------------------------------------------
-
- def post_start_party_command_selection
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ 次のコマンド入力へ
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_sb_next_command next_command
-
- def next_command
-
- prev_next_command
-
- a1_battle_common_sb_next_command
-
- post_next_command
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 次のコマンド入力への前処理
-
- #--------------------------------------------------------------------------
-
- def prev_next_command
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 次のコマンド入力への後処理
-
- #--------------------------------------------------------------------------
-
- def post_next_command
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ 前のコマンド入力へ
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_sb_prior_command prior_command
-
- def prior_command
-
- prev_prior_command
-
- a1_battle_common_sb_prior_command
-
- post_prior_command
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 前のコマンド入力への前処理
-
- #--------------------------------------------------------------------------
-
- def prev_prior_command
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 前のコマンド入力への後処理
-
- #--------------------------------------------------------------------------
-
- def post_prior_command
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ ターン開始
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_sb_turn_start turn_start
-
- def turn_start
-
- prev_turn_start
-
- a1_battle_common_sb_turn_start
-
- post_turn_start
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ターン開始の前処理
-
- #--------------------------------------------------------------------------
-
- def prev_turn_start
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ターン開始の後処理
-
- #--------------------------------------------------------------------------
-
- def post_turn_start
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ ターン終了
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_sb_turn_end turn_end
-
- def turn_end
-
- prev_turn_end
-
- a1_battle_common_sb_turn_end
-
- post_turn_end
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ターン終了の前処理
-
- #--------------------------------------------------------------------------
-
- def prev_turn_end
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ターン終了の後処理
-
- #--------------------------------------------------------------------------
-
- def post_turn_end
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ウィンドウが閉じるまでウェイト
-
- #--------------------------------------------------------------------------
-
- def wait_fot_window_close(window)
-
- update_basic while window.close?
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アクターのバトルメンバー取得
-
- #--------------------------------------------------------------------------
-
- def battle_members
-
- @party_battle_members ||= $game_party.battle_members
-
- return @party_battle_members
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ バトルメンバーの追加の前処理
-
- #--------------------------------------------------------------------------
-
- def prev_add_battler(members)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ バトルメンバーの追加後の処理
-
- #--------------------------------------------------------------------------
-
- def post_add_battler(member)
-
- @party_battle_members = $game_party.battle_members
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ バトルメンバー削除の前処理
-
- #--------------------------------------------------------------------------
-
- def prev_remove_battler(member)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ バトルメンバーの削除後の処理
-
- #--------------------------------------------------------------------------
-
- def post_remove_battler
-
- @party_battle_members = $game_party.battle_members
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ 戦闘行動の実行
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_sb_execute_action execute_action
-
- def execute_action
-
- prev_execute_action
-
- a1_battle_common_sb_execute_action
-
- post_execute_action
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 戦闘行動の実行の前処理
-
- #--------------------------------------------------------------------------
-
- def prev_execute_action
-
- @subject.current_action.pre_make_targets
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 戦闘行動の実行の後処理
-
- #--------------------------------------------------------------------------
-
- def post_execute_action
-
- @subject.current_action.clear_targets if @subject.current_action
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ スキル/アイテムの使用
-
- #--------------------------------------------------------------------------
-
- alias a1_battle_common_sb_use_item use_item
-
- def use_item
-
- prev_use_item
-
- a1_battle_common_sb_use_item
-
- post_use_item
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ スキル/アイテムの使用の前処理
-
- #--------------------------------------------------------------------------
-
- def prev_use_item
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ スキル/アイテムの使用の後処理
-
- #--------------------------------------------------------------------------
-
- def post_use_item
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 勝利の処理
-
- #--------------------------------------------------------------------------
-
- def process_victory
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 戦闘終了
-
- #--------------------------------------------------------------------------
-
- def battle_end(result)
-
- $game_party.all_members.each {|member| init_member_battle_end(member) }
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 戦闘終了時のメンバー初期化
-
- #--------------------------------------------------------------------------
-
- def init_member_battle_end(member)
-
- member.current_weapon = nil
-
- member.current_main = nil
-
- end
-
- end
-
- end
复制代码 [/fold]
[fold=战斗支援脚本2]- #===========================================================================
-
- # ◆ A1 Scripts ◆
-
- # 戦闘中入れ替え(RGSS3)
-
- #
-
- # バージョン : 1.00 (2012/01/18)
-
- # 作者 : A1
-
- # URL : http://a1tktk.web.fc2.com/
-
- #---------------------------------------------------------------------------
-
- # 機能:
-
- # ・戦闘中にメンバーを入れ替えます
-
- #---------------------------------------------------------------------------
-
- # 更新履歴 :2012/01/18 Ver1.00 リリース
-
- #---------------------------------------------------------------------------
-
- # 設置場所
-
- # A1バトル共通スクリプト以下
-
- #
-
- # 必要スクリプト
-
- # A1バトル共通スクリプト
-
- #---------------------------------------------------------------------------
-
- # 使い方
-
- # 導入することで適用されます
-
- #==============================================================================
-
- $imported ||= {}
-
- if $imported["A1_BattleCommonScript"]
-
- $imported["A1_ChangeMember"] = true
-
- old_common_script("戦闘中入れ替え", "3.90") if common_version < 3.90
-
- #==============================================================================
-
- # ■ Window_PartyCommand
-
- #==============================================================================
-
- class Window_MemberChange < Window_Selectable
-
- #--------------------------------------------------------------------------
-
- # ○ オブジェクト初期化
-
- #--------------------------------------------------------------------------
-
- def initialize
-
- @form_actor_window = Window_PersonalStatus.new(0, Graphics.height - 120, 255)
-
- @to_actor_window = Window_PersonalStatus.new(Graphics.width / 2, Graphics.height - 120, 255)
-
- setup_members
-
- width = @battle_members.size * 48 + standard_padding * 2
-
- height = (@all_members.size / @battle_members.size.to_f).ceil * 48 + standard_padding * 2 + 36
-
- super((Graphics.width - width) / 2, (Graphics.height - height) / 2, width, height)
-
- self.y = Graphics.height - @form_actor_window.height - height if self.y + height > Graphics.height - @form_actor_window.height
-
- self.index = 0
-
- @from_actor = -1
-
- self.openness = 0
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ アクティブ化
-
- #--------------------------------------------------------------------------
-
- def activate
-
- super
-
- refresh
-
- @form_actor_window.actor = @all_members[self.index]
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ メンバーのセットアップ
-
- #--------------------------------------------------------------------------
-
- def setup_members
-
- @all_members = $game_party.all_members
-
- @battle_members = $game_party.battle_members
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 項目の選択
-
- #--------------------------------------------------------------------------
-
- def select(index)
-
- super
-
- @form_actor_window.actor = @all_members[self.index] if @from_actor == -1
-
- @to_actor_window.actor = @all_members[self.index] if @from_actor >= 0
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 項目数の取得
-
- #--------------------------------------------------------------------------
-
- def item_max
-
- @all_members.size
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 桁数の取得
-
- #--------------------------------------------------------------------------
-
- def col_max
-
- @battle_members.size
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ リフレッシュ
-
- #--------------------------------------------------------------------------
-
- def refresh
-
- super
-
- draw_horz_line(52)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 水平線の描画
-
- #--------------------------------------------------------------------------
-
- def draw_horz_line(y)
-
- line_y = y + line_height / 2 - 1
-
- contents.fill_rect(0, line_y, contents_width, 2, line_color)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 水平線の色を取得
-
- #--------------------------------------------------------------------------
-
- def line_color
-
- color = normal_color
-
- color.alpha = 128
-
- color
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 項目の描画
-
- #--------------------------------------------------------------------------
-
- def draw_item(index)
-
- c_name = member(index).character_name
-
- c_index = member(index).character_index
-
- rect = item_rect(index)
-
- draw_character(c_name, c_index, rect.x + 24, rect.y + 40)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 項目を描画する矩形の取得
-
- #--------------------------------------------------------------------------
-
- def item_rect(index)
-
- rect = Rect.new
-
- rect.width = item_width
-
- rect.height = item_height
-
- rect.x = index % col_max * item_width
-
- rect.y = index / col_max * item_height
-
- rect.y += 24 if index > @battle_members.size - 1
-
- rect
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 項目の幅を取得
-
- #--------------------------------------------------------------------------
-
- def item_width
-
- return 48
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 項目の高さを取得
-
- #--------------------------------------------------------------------------
-
- def item_height
-
- return 48
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ ウィンドウ内容の高さを計算
-
- #--------------------------------------------------------------------------
-
- def contents_height
-
- row_max * item_height + 24
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 下端パディングの更新
-
- #--------------------------------------------------------------------------
-
- def update_padding_bottom
-
- surplus = (height - standard_padding * 2) % item_height - 24
-
- self.padding_bottom = padding + surplus
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ メンバーの取得
-
- #--------------------------------------------------------------------------
-
- def member(index)
-
- @all_members[index]
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 決定処理の有効状態を取得
-
- #--------------------------------------------------------------------------
-
- def ok_enabled?
-
- return true
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 決定ボタンが押されたときの処理
-
- #--------------------------------------------------------------------------
-
- def process_ok
-
- Sound.play_ok
-
- Input.update
-
- return select_start_to_actor if @from_actor == -1
-
- return call_cancel_handler if @from_actor == self.index
-
- change_member if @from_actor >= 0
-
- post_change_member
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ メンバー入れ替え
-
- #--------------------------------------------------------------------------
-
- def change_member
-
- $game_party.swap_order(@from_actor, self.index)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ メンバー入れ替え後の処理
-
- #--------------------------------------------------------------------------
-
- def post_change_member
-
- setup_members
-
- self.index = @from_actor
-
- @form_actor_window.actor = @all_members[self.index]
-
- @from_actor = -1
-
- @to_actor_window.close
-
- refresh
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 入れ替え先のアクター選択開始
-
- #--------------------------------------------------------------------------
-
- def select_start_to_actor
-
- @from_actor = self.index
-
- @to_actor_window.open
-
- self.index = self.index < @battle_members.size ? @battle_members.size : 0
-
- @to_actor_window.actor = @all_members[self.index]
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 入れ替え元のアクター
-
- #--------------------------------------------------------------------------
-
- def from_actor
-
- @from_actor
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ オープン
-
- #--------------------------------------------------------------------------
-
- def open
-
- super
-
- @form_actor_window.open
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ キャンセルハンドラの呼び出し
-
- #--------------------------------------------------------------------------
-
- def call_cancel_handler
-
- super if @from_actor == -1
-
- @from_actor = -1
-
- @to_actor_window.close
-
- @form_actor_window.actor = @all_members[self.index]
-
- activate
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ クローズ
-
- #--------------------------------------------------------------------------
-
- def close
-
- super
-
- @form_actor_window.close
-
- @to_actor_window.close
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ フレーム更新
-
- #--------------------------------------------------------------------------
-
- def update
-
- super
-
- @form_actor_window.update
-
- @to_actor_window.update
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 解放
-
- #--------------------------------------------------------------------------
-
- def dispose
-
- super
-
- @form_actor_window.dispose
-
- @to_actor_window.dispose
-
- end
-
- end
-
- #==============================================================================
-
- # ■ Window_PartyCommand
-
- #------------------------------------------------------------------------------
-
- # バトル画面で、戦うか逃げるかを選択するウィンドウです。
-
- #==============================================================================
-
- class Window_PartyCommand < Window_Command
-
- #--------------------------------------------------------------------------
-
- # ☆ コマンドリストの作成
-
- #--------------------------------------------------------------------------
-
- alias a1_cbm_wpc_make_command_list make_command_list
-
- def make_command_list
-
- a1_cbm_wpc_make_command_list
-
- add_command("同伴", :member_change, $game_party.all_members.size > $game_party.max_battle_members)
-
- end
-
- end
-
- #==============================================================================
-
- # ■ Scene_Battle
-
- #------------------------------------------------------------------------------
-
- # バトル画面の処理を行うクラスです。
-
- #==============================================================================
-
- class Scene_Battle < Scene_Base
-
- #--------------------------------------------------------------------------
-
- # ☆ 全ウィンドウの作成
-
- #--------------------------------------------------------------------------
-
- alias a1_cbm_wpc_create_all_windows create_all_windows
-
- def create_all_windows
-
- a1_cbm_wpc_create_all_windows
-
- create_member_change_window
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 入れ替えウィンドウの作成
-
- #--------------------------------------------------------------------------
-
- def create_member_change_window
-
- @window_member_change = Window_MemberChange.new
-
- @window_member_change.set_handler(:cancel, method(:on_member_change_cancel))
-
- end
-
- #--------------------------------------------------------------------------
-
- # ☆ パーティコマンドウィンドウハンドルの定義
-
- #--------------------------------------------------------------------------
-
- alias a1_cbm_sb_define_party_command_window_handle define_party_command_window_handle
-
- def define_party_command_window_handle
-
- a1_cbm_sb_define_party_command_window_handle
-
- @party_command_window.set_handler(:member_change, method(:command_member_change))
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 入れ替え
-
- #--------------------------------------------------------------------------
-
- def command_member_change
-
- @prev_battle_members = $game_party.battle_members
-
- @status_window.close
-
- @party_command_window.close
-
- @window_member_change.open
-
- @window_member_change.activate
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ 変更したメンバーを取得
-
- #--------------------------------------------------------------------------
-
- def change_diss_members(ret = [])
-
- $game_party.battle_members.each_with_index {|member, i| ret.push(member) if member != @prev_battle_members[i] }
-
- return ret
-
- end
-
- #--------------------------------------------------------------------------
-
- # ○ メンバーチェンジ[キャンセル]
-
- #--------------------------------------------------------------------------
-
- def on_member_change_cancel
-
- @party_command_window.activate
-
- @status_window.refresh
-
- @status_window.open
-
- @party_command_window.open
-
- @window_member_change.close
-
- change_diss_members.each {|member| member.make_actions }
-
- @party_battle_members = $game_party.battle_members
-
- end
-
- end
-
- end
复制代码 [/fold]
18、当战斗小队全灭时后备队员惨战。
[fold=全灭后待机成员参战 v1.2]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- $imported = {} if $imported.nil?
-
- $imported["Sub_Party"] = true
-
- #==============================================================================
-
- # 全灭后待机成员参战 v1.2
-
- #------------------------------------------------------------------------------
-
- # 2015.05.31 by 企鹅达达
-
- # 2015.06.03 修正事件扣血时不更换队员的bug
-
- # 2015.06.04 防止整队类脚本对为加入队伍的成员调用draw_actor_simple_status等出错
-
- #==============================================================================
-
- # 如题,这个脚本的功能就是让非战斗人员按照序号编成小队,全灭后一个小队一个
-
- # 小队上场战斗。嗯,感觉不是很好用,反正是自用的╮(╯_╰)╭
-
- # 用这个脚本建议把濒死设置成战斗后解除,这样可以避免某些小队战斗
-
- # 时空了一些死掉的队员。
-
- # 顺带一提这脚本和战斗中整队、战斗中添加成员(比如召唤)类型的脚本天生不对头,
-
- # 如果因为这些原因报错,本人也无能为力了 ← ←
-
- #==============================================================================
-
- #参战时显示的信息,可以使用转义符,%s取代角色名。
-
- # JION_MESSAGE = "\ec[6]%s\ec[0] 参战!"
-
- #如果不想要这个信息,可以设置为 nil
-
- # JION_MESSAGE = nil
-
- JION_MESSAGE = "%s 参战!"
-
- # 在菜单里显示的名字,SUB_PARTY_NAME里没有的话会用下面的SUB_PARTY_DEFAULT_NAME
-
- SUB_PARTY_SHOW_IN_MENU = true
-
- SUB_PARTY_NAME = [" "," ",]
-
- SUB_PARTY_DEFAULT_NAME = "候补小队"
-
- #==============================================================================
-
- # ■ Game_Battler
-
- #------------------------------------------------------------------------------
-
- # 处理战斗者的类。Game_Actor 和 Game_Enemy 类的父类。
-
- #==============================================================================
-
- class Game_Battler < Game_BattlerBase
-
- attr_accessor :battle_formation_order #队伍顺序标记
-
- #--------------------------------------------------------------------------
-
- # ● 保存队伍顺序
-
- #--------------------------------------------------------------------------
-
- def save_battle_formation_order
-
- @battle_formation_order = index
-
- end
-
- #--------------------------------------------------------------------------
-
- # ● 行动结束
-
- #--------------------------------------------------------------------------
-
- alias sub_party_on_action_end on_action_end
-
- def on_action_end
-
- sub_party_on_action_end
-
- while $game_party.all_dead?
-
- break if $game_party.sub_party_now >= $game_party.sub_party_max
-
- $game_party.sub_party_jion_battle
-
- end
-
- end
-
- end
-
- #==============================================================================
-
- # ■ Game_Party
-
- #------------------------------------------------------------------------------
-
- # 管理队伍的类。保存有金钱及物品的信息。本类的实例请参考 $game_party 。
-
- #==============================================================================
-
- class Game_Party < Game_Unit
-
- attr_accessor :sub_party_now #参战分队编号
-
- attr_accessor :sub_party_max #参战分队最大编号
-
- #--------------------------------------------------------------------------
-
- # ● 战斗开始处理
-
- #--------------------------------------------------------------------------
-
- def sub_party_jion_battle
-
- @sub_party_now += 1
-
- max_battle_members.times do |i|
-
- next if all_members[ max_battle_members * @sub_party_now + i ].nil?
-
- next if all_members[ max_battle_members * @sub_party_now + i ].dead?
-
- swap_order( i, max_battle_members * @sub_party_now + i)
-
- if JION_MESSAGE
-
- # BattleManager.log_window.add_text(sprintf(JION_MESSAGE, $game_party.all_members[i].name))
-
- # BattleManager.log_window.abs_wait(90)
-
- $game_message.add(sprintf(JION_MESSAGE, $game_party.all_members[i].name))
-
- BattleManager.wait_for_message
-
- end
-
- end
-
- end
-
- #--------------------------------------------------------------------------
-
- # ● 队伍顺序恢复
-
- #--------------------------------------------------------------------------
-
- def sub_party_reset_order
-
- @actors.sort! {|a, b|$game_actors[a].battle_formation_order <=> $game_actors[b].battle_formation_order }
- end
-
- #--------------------------------------------------------------------------
-
- # ● 保存队伍顺序
-
- #--------------------------------------------------------------------------
-
- def sub_party_save_order
-
- all_members.each do |member|
-
- member.save_battle_formation_order
-
- end
-
- end
-
- #--------------------------------------------------------------------------
-
- # ● 初始化参战分队信息,顺带让第一个有成活队员的分队上阵。
-
- #--------------------------------------------------------------------------
-
- def make_sub_party
-
- @sub_party_now = 0
-
- @sub_party_max = all_members.size / max_battle_members
- @sub_party_max -= 1 if all_members.size == max_battle_members * @sub_party_max
-
- while battle_members.select {|member|member.alive?}.empty?
-
- break if @sub_party_now >= @sub_party_max
-
- sub_party_jion_battle
-
- end
-
- end
-
- #--------------------------------------------------------------------------
-
- # ● 战斗开始处理
-
- #--------------------------------------------------------------------------
-
- alias sub_party_on_battle_start on_battle_start
-
- def on_battle_start
-
- sub_party_save_order
-
- make_sub_party
-
- sub_party_on_battle_start
-
- end
-
- #--------------------------------------------------------------------------
-
- # ● 战斗结束处理
-
- #--------------------------------------------------------------------------
-
- alias sub_party_on_battle_end on_battle_end
-
- def on_battle_end
-
- sub_party_reset_order
-
- sub_party_on_battle_end
-
- end
-
- end
-
- #==============================================================================
-
- # ■ Game_Interpreter
-
- #------------------------------------------------------------------------------
-
- # 事件指令的解释器。
-
- # 本类在 Game_Map、Game_Troop、Game_Event 类的内部使用。
-
- #==============================================================================
-
- class Game_Interpreter
-
- #--------------------------------------------------------------------------
-
- # ● 增减 HP v 1.1更新
-
- #--------------------------------------------------------------------------
-
- def command_311
-
- value = operate_value(@params[2], @params[3], @params[4])
-
- iterate_actor_var(@params[0], @params[1]) do |actor|
-
- next if actor.dead?
-
- actor.change_hp(value, @params[5])
-
- actor.perform_collapse_effect if actor.dead?
-
- end
-
- ##############################################
-
- if SceneManager.scene_is?(Scene_Battle)
-
- while $game_party.all_dead?
-
- break if $game_party.sub_party_now >= $game_party.sub_party_max
-
- $game_party.sub_party_jion_battle
-
- end
-
- end
-
- ##############################################
-
- SceneManager.goto(Scene_Gameover) if $game_party.all_dead?
-
- end
-
- #--------------------------------------------------------------------------
-
- # ● 更改状态 v 1.1更新
-
- #--------------------------------------------------------------------------
-
- alias sub_party_command_313 command_313
-
- def command_313
-
- sub_party_command_313
-
- ##############################################
-
- if SceneManager.scene_is?(Scene_Battle)
-
- while $game_party.all_dead?
-
- break if $game_party.sub_party_now >= $game_party.sub_party_max
-
- $game_party.sub_party_jion_battle
-
- end
-
- end
-
- ##############################################
-
- end
-
- end
-
- if SUB_PARTY_SHOW_IN_MENU
-
- #==============================================================================
-
- # ■ Window_Base
-
- #------------------------------------------------------------------------------
-
- # 游戏中所有窗口的父类
-
- #==============================================================================
-
- class Window_Base < Window
-
- #--------------------------------------------------------------------------
-
- # ● 绘制分队名
-
- #--------------------------------------------------------------------------
-
- def draw_actor_sub_party(actor, x, y, width = 112)
-
- return if actor.index.nil? # v1.2修改
-
- change_color(system_color)
-
- sub_party_index = actor.index / $game_party.max_battle_members
-
- text = SUB_PARTY_NAME[sub_party_index].nil? ? SUB_PARTY_DEFAULT_NAME : SUB_PARTY_NAME[sub_party_index]
-
- draw_text(x, y, width, line_height, text)
-
- change_color(normal_color)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ● 绘制简单的状态
-
- #--------------------------------------------------------------------------
-
- alias sub_party_draw_actor_simple_status draw_actor_simple_status
-
- def draw_actor_simple_status(actor, x, y)
-
- sub_party_draw_actor_simple_status(actor, x, y)
-
- draw_actor_sub_party(actor, x-108, y+56)
-
- end
-
- end
-
- #encoding:utf-8
-
- #==============================================================================
-
- # ■ Window_Status
-
- #------------------------------------------------------------------------------
-
- # 显示队伍成员状态的窗口
-
- #==============================================================================
-
- class Window_Status < Window_Selectable
-
- #--------------------------------------------------------------------------
-
- # ● 绘制基本区域
-
- #--------------------------------------------------------------------------
-
- alias sub_party_draw_basic_info draw_basic_info
-
- def draw_basic_info(x, y)
-
- sub_party_draw_basic_info(x, y)
-
- draw_actor_sub_party(@actor, x -132, y+72, 100)
-
- end
-
- end
-
- end # if SUB_PARTY_SHOW_IN_MENU
复制代码 [/fold]
19、破解系统默认事件选择贵重物品处理脚本,应该很少人会使用到。
[fold=物品选择处理扩张]- 打开脚本编辑器,将脚本插入到main上。
- #==============================================================================
- # ■ 物品选择处理扩张
- # 作者:影月千秋
- #------------------------------------------------------------------------------
- # ● 简介
- # 使事件中物品选择处理允许选择武器、防具、普通物品
- #------------------------------------------------------------------------------
- # ● 使用方法
- # 安装此脚本后,在事件中物品选择处理之前加上一句脚本:
- # mca_change(symbol)
- # 其中symbol是【:item】【:armor】【:weapon】之一,分别对应物品、防具、武器
- # 这样的话,这一个物品选择处理就会处理对应项目
- # 但是注意!!该脚本的作用域只有一个物品选择处理
- # 如果连续使用两个物品选择处理,第一个会是对应项目,第二个则会是关键物品
- #------------------------------------------------------------------------------
- # ● 声明
- # 本脚本来自【影月千秋】,使用、修改和转载请保留此信息
- #==============================================================================
- module MoVar;@ckiaddition = :key_item;end
- class Game_Interpreter;def mca_change(symbol)
- MoVar.instance_variable_set("@ckiaddition", symbol)
- end;end
- class Window_KeyItem
- def enable?(item);true;end
- def category=(category)
- @category = MoVar.instance_variable_get("@ckiaddition") rescue category
- MoVar.instance_variable_set("@ckiaddition", category)
- refresh
- self.oy = 0
- end
- end
- #==============================================================================#
- #===== =================================================#
- "■ 脚 本 尾"
- #===== =================================================#
- #==============================================================================#
复制代码 [/fold]
20、目前我还没有使用过,不知道小伙伴们用不用得上。
[fold=等级属性限制]- #打开脚本编辑器,将脚本插入到main上。
- #==============================================================================
- # ■ 装备等级、属性限制 作者:后知后觉 2012-7-25 Ver:1.2
- #--------------------------------------------------------------------------
- # 本脚本来自 www.66rpg.com 使用或转载请保留此信息。
- #--------------------------------------------------------------------------
- #~ 说明:
- #~ 限制的属性只会计算人物当前的基础属性.装备、状态增加的属性不会计算在内
- #~ 默认给武器、护甲增加一行说明.说明内容是需要的各种限制信息
- #~ 但默认帮助窗口一共只能显示2行内容.
- #~ 因此你在数据库设置武器、护甲说明的时候
- #~ 如果设置了2行内容.那么这新增加的第3行将无法显示出来.
- #~ 设置:
- #~ 在武器、护甲的备注里写入下面格式的内容表示要做要求.
- #~ <lv 数值> 等级限制
- #~ <mhp 数值> 最大HP限制
- #~ <mmp 数值> 最大MP限制
- #~ <atk 数值> 物理攻击限制
- #~ <pdf 数值> 物理防御限制
- #~ <mat 数值> 魔法攻击限制
- #~ <mdf 数值> 魔法防御限制
- #~ <agi 数值> 敏捷限制
- #~ <luk 数值> 幸运限制
- #==============================================================================
- #==============================================================================
- # ■ RPG::EquipItem
- #==============================================================================
- class RPG::EquipItem < RPG::BaseItem
- ParamName = ["mhp","mmp","atk","pdf","mat","mdf","agi","luk"]
- def level_limit
- if /<lv (\d+?)>/i =~ @note
- return $1.to_i
- else
- return 0
- end
- end
- def params_limit(param_id)
- if /<#{ParamName[param_id]} (\d+?)>/i =~ @note
- return $1.to_i
- else
- return 0
- end
- end
- end
- #==============================================================================
- # ■ Game_BattlerBase
- #==============================================================================
- class Game_BattlerBase
- #--------------------------------------------------------------------------
- # ● 判定物品是否可以装备
- #--------------------------------------------------------------------------
- alias original_equippable? equippable?
- def equippable?(item)
- original_equippable?(item) && equip_params_ok?(item)
- end
- #--------------------------------------------------------------------------
- # ● 判定物品是否可以装备
- #--------------------------------------------------------------------------
- def equip_params_ok?(item)
- return true if enemy?
- return false if item.level_limit > level
- for param_id in 0..7
- value = param_base(param_id) + @param_plus[param_id]
- value = [[value, param_max(param_id)].min, param_min(param_id)].max.to_i
- return false if item.params_limit(param_id) > value
- end
- return true
- end
- end
- #==============================================================================
- # ■ Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # ● 强制更换装备
- #--------------------------------------------------------------------------
- def hzhj_force_change_equip(slot_id, item)
- @equips[slot_id].object = item if original_equippable?(item) || !item
- end
- end
- #==============================================================================
- # ■ Window_EquipItem
- #==============================================================================
- class Window_EquipItem < Window_ItemList
- #--------------------------------------------------------------------------
- # ● 查询使用列表中是否含有此物品
- #--------------------------------------------------------------------------
- def include?(item)
- return true if item == nil
- return false unless item.is_a?(RPG::EquipItem)
- return false if @slot_id < 0
- return false if item.etype_id != @actor.equip_slots[@slot_id]
- return @actor.original_equippable?(item)
- end
- #--------------------------------------------------------------------------
- # ● 查询此文件是否可以装备
- #--------------------------------------------------------------------------
- def enable?(item)
- return true unless item
- return @actor.equippable?(item)
- end
- #--------------------------------------------------------------------------
- # ● 更新帮助内容
- #--------------------------------------------------------------------------
- def update_help
- super
- if @actor && @status_window
- temp_actor = Marshal.load(Marshal.dump(@actor))
- temp_actor.hzhj_force_change_equip(@slot_id, item)
- @status_window.set_temp_actor(temp_actor)
- end
- end
- end
- #==============================================================================
- # ■ Window_ShopStatus
- #==============================================================================
- class Window_ShopStatus < Window_Base
- #--------------------------------------------------------------------------
- # ● 绘制角色的装备信息
- #--------------------------------------------------------------------------
- def draw_actor_equip_info(x, y, actor)
- enabled = actor.equippable?(@item)
- change_color(normal_color, enabled)
- draw_text(x, y, 112, line_height, actor.name)
- item1 = current_equipped_item(actor, @item.etype_id)
- draw_actor_param_change(x, y, actor, item1) if actor.original_equippable?(@item)
- draw_item_name(item1, x, y + line_height, enabled)
- contents.font.size = 14
- end
- end
复制代码 [/fold]
21、进入战斗就会自动附加状态,战斗结束就解除,非常适合战斗类型游戏。
[fold=战斗附加状态]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- # 随便写的,没有详细测试过。用法是在角色|职业|装备|敌人的备注栏
- # 备注<被动状态:状态ID> 例如<被动状态:18> 那么就会在战斗开始前
- # 会为该角色附加18号状态,战斗结束时移除这个状态。同时装备2个以
- # 上的有被动状态的装备亦可叠加,都会附加上对应的状态。
- class Game_Battler < Game_BattlerBase
- #--------------------------------------------------------------------------
- # ● 战斗开始处理
- #--------------------------------------------------------------------------
- alias state_battle_start on_battle_start
- def on_battle_start
- state_battle_start
- self.feature_objects.each {|obj|
- self.add_state($1.to_i) if obj.note =~ /<被动状态:\s*(\d+)>/}
- end
- end
复制代码 [/fold]
22、一个简洁没有分类的怪物图鉴系统,但怪物描述可以做得非常详细。
[fold=怪物图鉴1][/fold]
[fold=怪物图鉴2]- #==============================================================================
- # ■ RGSS3 魔物図鑑 ver 1.00 本体プログラム
- #------------------------------------------------------------------------------
- # 配布元:
- # 白の魔 [url]http://izumiwhite.web.fc2.com/[/url]
- #
- # 利用規約:
- # RPGツクールVXの正規の登録者のみご利用になれます。
- # 利用報告・著作権表示とかは必要ありません。
- # 改造もご自由にどうぞ。
- # 何か問題が発生しても責任は持ちません。
- #==============================================================================
- #==============================================================================
- # ■ WD_monsterdictionary
- #------------------------------------------------------------------------------
- # 魔物図鑑用の共通メソッドです。
- #==============================================================================
- module WD_monsterdictionary
- def m_dictionary_encount_switch_on(id)
- $game_system.m_dic_encount_sw = [] if $game_system.m_dic_encount_sw == nil
- $game_system.m_dic_encount_sw[id] = false if $game_system.m_dic_encount_sw[id] == nil
- $game_system.m_dic_encount_sw[id] = true
- end
- def m_dictionary_encount_switch_off(id)
- $game_system.m_dic_encount_sw = [] if $game_system.m_dic_encount_sw == nil
- $game_system.m_dic_encount_sw[id] = false if $game_system.m_dic_encount_sw[id] == nil
- $game_system.m_dic_encount_sw[id] = false
- end
- def m_dictionary_encount_switch_on?(id)
- $game_system.m_dic_encount_sw = [] if $game_system.m_dic_encount_sw == nil
- $game_system.m_dic_encount_sw[id] = false if $game_system.m_dic_encount_sw[id] == nil
- return $game_system.m_dic_encount_sw[id]
- end
- def m_dictionary_victory_switch_on(id)
- $game_system.m_dic_victory_sw = [] if $game_system.m_dic_victory_sw == nil
- $game_system.m_dic_victory_sw[id] = false if $game_system.m_dic_victory_sw[id] == nil
- $game_system.m_dic_victory_sw[id] = true
- end
- def m_dictionary_victory_switch_off(id)
- $game_system.m_dic_victory_sw = [] if $game_system.m_dic_victory_sw == nil
- $game_system.m_dic_victory_sw[id] = false if $game_system.m_dic_victory_sw[id] == nil
- $game_system.m_dic_victory_sw[id] = false
- end
- def m_dictionary_victory_switch_on?(id)
- $game_system.m_dic_victory_sw = [] if $game_system.m_dic_victory_sw == nil
- $game_system.m_dic_victory_sw[id] = false if $game_system.m_dic_victory_sw[id] == nil
- return $game_system.m_dic_victory_sw[id]
- end
- def m_dictionary_drop_switch_on(id, n)
- $game_system.m_dic_drop_sw = [] if $game_system.m_dic_drop_sw == nil
- $game_system.m_dic_drop_sw[id] = [] if $game_system.m_dic_drop_sw[id] == nil
- $game_system.m_dic_drop_sw[id][n] = false if $game_system.m_dic_drop_sw[id][n] == nil
- $game_system.m_dic_drop_sw[id][n] = true
- end
- def m_dictionary_drop_switch_off(id, n)
- $game_system.m_dic_drop_sw = [] if $game_system.m_dic_drop_sw == nil
- $game_system.m_dic_drop_sw[id] = [] if $game_system.m_dic_drop_sw[id] == nil
- $game_system.m_dic_drop_sw[id][n] = false if $game_system.m_dic_drop_sw[id][n] == nil
- $game_system.m_dic_drop_sw[id][n] = false
- end
- def m_dictionary_drop_switch_on?(id, n)
- $game_system.m_dic_drop_sw = [] if $game_system.m_dic_drop_sw == nil
- $game_system.m_dic_drop_sw[id] = [] if $game_system.m_dic_drop_sw[id] == nil
- $game_system.m_dic_drop_sw[id][n] = false if $game_system.m_dic_drop_sw[id][n] == nil
- return $game_system.m_dic_drop_sw[id][n]
- end
- def m_dictionary_genoside_number_add(id, n)
- $game_system.m_dic_genoside_num = [] if $game_system.m_dic_genoside_num == nil
- $game_system.m_dic_genoside_num[id] = 0 if $game_system.m_dic_genoside_num[id] == nil
- $game_system.m_dic_genoside_num[id] += n
- end
- def m_dictionary_genoside_number(id)
- $game_system.m_dic_genoside_num = [] if $game_system.m_dic_genoside_num == nil
- $game_system.m_dic_genoside_num[id] = 0 if $game_system.m_dic_genoside_num[id] == nil
- return $game_system.m_dic_genoside_num[id]
- end
- def print_dictionary?(enemy)
- if enemy != nil
- if enemy.name.size > 0
- hantei = /<图鉴无效>/ =~ enemy.note
- if hantei == nil
- return true
- end
- end
- end
- return false
- end
- def monster_dictionary_perfection
- dic_max = 0
- dic_num = 0
- $data_enemies.each do |enemy|
- if print_dictionary?(enemy)
- dic_max += 1
- if WD_monsterdictionary_layout::Perfection_timing == 1
- if m_dictionary_encount_switch_on?(enemy.id) == true
- dic_num += 1
- end
- elsif WD_monsterdictionary_layout::Perfection_timing == 2
- if m_dictionary_victory_switch_on?(enemy.id) == true
- dic_num += 1
- end
- end
- end
- end
- return (100*dic_num)/dic_max
- end
- end
- class Game_Interpreter
- include WD_monsterdictionary
- end
- class Game_System
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_accessor :m_dic_encount_sw
- attr_accessor :m_dic_victory_sw
- attr_accessor :m_dic_drop_sw
- attr_accessor :m_dic_genoside_num
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- alias wd_orig_initialize002 initialize
- def initialize
- wd_orig_initialize002
- @m_dic_encount_sw = []
- @m_dic_victory_sw = []
- @m_dic_drop_sw = []
- @m_dic_genoside_num = []
- end
- end
- class Game_Troop < Game_Unit
- include WD_monsterdictionary
- #--------------------------------------------------------------------------
- # ● 図鑑への登録(遭遇済み判定)
- #--------------------------------------------------------------------------
- def dictionary1
- for enemy in members
- m_dictionary_encount_switch_on(enemy.enemy_id) unless enemy.hidden? #遭遇済み図鑑登録
- end
- end
- #--------------------------------------------------------------------------
- # ● 図鑑への登録(撃破済み判定)
- #--------------------------------------------------------------------------
- def dictionary2
- for enemy in dead_members
- m_dictionary_victory_switch_on(enemy.enemy_id) unless enemy.hidden? #撃破済み図鑑登録
- m_dictionary_genoside_number_add(enemy.enemy_id, 1) unless enemy.hidden? #撃破数カウント
- end
- end
- end
- class << BattleManager
- #--------------------------------------------------------------------------
- # ● 戦闘開始
- #--------------------------------------------------------------------------
- alias wd_orig_battle_start002 battle_start
- def battle_start
- wd_orig_battle_start002
- $game_troop.dictionary1 #図鑑への登録(遭遇済み判定)
- end
- #--------------------------------------------------------------------------
- # ● 勝利の処理
- #--------------------------------------------------------------------------
- alias wd_orig_process_victory002 process_victory
- def process_victory
- $game_troop.dictionary2 #図鑑への登録(撃破済み判定)
- wd_orig_process_victory002
- end
- end
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # ● 敵キャラの出現
- #--------------------------------------------------------------------------
- alias wd_orig_command_335_002 command_335
- def command_335
- wd_orig_command_335_002
- $game_troop.dictionary1 #図鑑への登録(遭遇済み判定)
- end
- end
- class Game_Enemy < Game_Battler
- include WD_monsterdictionary
- #--------------------------------------------------------------------------
- # ● ドロップアイテムの配列作成(再定義)
- #--------------------------------------------------------------------------
- def make_drop_items
- n = -1
- enemy.drop_items.inject([]) do |r, di|
- n += 1
- if di.kind > 0 && rand * di.denominator < drop_item_rate
- m_dictionary_drop_switch_on(@enemy_id, n)
- r.push(item_object(di.kind, di.data_id))
- else
- r
- end
- end
- end
- end
- #==============================================================================
- # ■ Scene_MonsterDictionary
- #------------------------------------------------------------------------------
- # 魔物図鑑画面の処理を行うクラスです。
- #==============================================================================
- class Scene_MonsterDictionary < Scene_ItemBase
- #--------------------------------------------------------------------------
- # ● 開始処理
- #--------------------------------------------------------------------------
- def start
- super
- create_status_window
- create_item_window
- create_perfection_window
- end
- #--------------------------------------------------------------------------
- # ● アイテムウィンドウの作成
- #--------------------------------------------------------------------------
- def create_item_window
- wy = 0
- wh = Graphics.height - 48
- @item_window = Window_MonsterDictionaryList.new(Graphics.width-172-48, wy, 172+48, wh)
- @item_window.viewport = @viewport
- @item_window.status_window = @status_window
- @item_window.set_handler(:cancel, method(:return_scene))
- @item_window.update_help
- end
- def return_scene
- $game_map.autoplay
- SceneManager.return
- end
- #--------------------------------------------------------------------------
- # ● アイテムステータスウィンドウの作成
- #--------------------------------------------------------------------------
- def create_status_window
- wy = 0
- wh = Graphics.height
- @status_window = Window_MonsterDictionaryStatus.new(0, wy, Graphics.width-172-48, wh)
- @status_window.viewport = @viewport
- end
- #--------------------------------------------------------------------------
- # ● 図鑑完成度ウィンドウの作成
- #--------------------------------------------------------------------------
- def create_perfection_window
- wy = @item_window.y + @item_window.height
- wh = 48
- @perfection_window = Window_MonsterDictionaryPerfection.new(Graphics.width-172-48, wy, 172+48, wh)
- @perfection_window.viewport = @viewport
- end
- end
- #==============================================================================
- # ■ Window_MonsterDictionaryList
- #------------------------------------------------------------------------------
- # 魔物図鑑画面で、魔物の一覧を表示するウィンドウです。
- #==============================================================================
- class Window_MonsterDictionaryList < Window_Selectable
- include WD_monsterdictionary
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize(x, y, width, height)
- super
- @data = []
- refresh
- activate
- select(0)
- end
- #--------------------------------------------------------------------------
- # ● 桁数の取得
- #--------------------------------------------------------------------------
- def col_max
- return 1
- end
- #--------------------------------------------------------------------------
- # ● 項目数の取得
- #--------------------------------------------------------------------------
- def item_max
- @data ? @data.size : 1
- end
- #--------------------------------------------------------------------------
- # ● アイテムの取得
- #--------------------------------------------------------------------------
- def enemy
- @data && index >= 0 ? @data[index] : nil
- end
- #--------------------------------------------------------------------------
- # ● アイテムリストの作成
- #--------------------------------------------------------------------------
- def make_item_list
- @data = []
- $data_enemies.each do |enemy|
- if print_dictionary?(enemy)
- @data.push(enemy)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 項目の描画
- #--------------------------------------------------------------------------
- def draw_item(index)
- enemy = @data[index]
- if enemy
- rect = item_rect(index)
- rect.width -= 4
- if m_dictionary_encount_switch_on?(enemy.id)
- change_color(normal_color, true)
- draw_text(rect.x, rect.y, 172, line_height, enemy.name)
- else
- change_color(normal_color, false)
- draw_text(rect.x, rect.y, 172, line_height, "无数据")
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● ヘルプウィンドウ更新メソッドの呼び出し
- #--------------------------------------------------------------------------
- def call_update_help
- update_help if active
- end
- #--------------------------------------------------------------------------
- # ● ヘルプテキスト更新
- #--------------------------------------------------------------------------
- def update_help
- if @status_window
- if m_dictionary_encount_switch_on?(enemy.id)
- @status_window.set_item(enemy, @index, true)
- else
- @status_window.set_item(enemy, @index, false)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- make_item_list
- create_contents
- draw_all_items
- end
- #--------------------------------------------------------------------------
- # ● ステータスウィンドウの設定
- #--------------------------------------------------------------------------
- def status_window=(status_window)
- @status_window = status_window
- end
- end
- #==============================================================================
- # ■ Window_MonsterDictionaryPerfection
- #------------------------------------------------------------------------------
- # 魔物図鑑画面で、図鑑の完成度を表示するウィンドウです。
- #==============================================================================
- class Window_MonsterDictionaryPerfection < Window_Selectable
- include WD_monsterdictionary
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize(x, y, width, height)
- super
- refresh(width)
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh(width)
- contents.clear
- draw_text(0, 0, width-24, line_height, "图鉴进度: #{monster_dictionary_perfection} %", 1)
- end
- end
- #==============================================================================
- # ■ Window_MonsterDictionaryStatus
- #------------------------------------------------------------------------------
- # 魔物図鑑画面で、エネミーの詳細を表示するウィンドウです。
- #==============================================================================
- class Window_MonsterDictionaryStatus < Window_Selectable
- include WD_monsterdictionary
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize(x, y, width, height)
- super
- @enemy = nil
- refresh
- end
- #--------------------------------------------------------------------------
- # ● アイテムの設定
- #--------------------------------------------------------------------------
- def set_item(enemy, index=-1, print=false)
- return if ((@enemy == enemy) and (@index == index))
- @enemy = enemy
- @index = index
- @print = print
- refresh
- end
- #--------------------------------------------------------------------------
- # ● アイテムオブジェクトの取得,掉落物取得
- #--------------------------------------------------------------------------
- def item_object(kind, data_id)
- return $data_items [data_id] if kind == 1
- return $data_weapons[data_id] if kind == 2
- return $data_armors [data_id] if kind == 3
- return nil
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- contents.font.size = 24
- if @print
- if WD_monsterdictionary_layout::M_id_display
- text1 = sprintf("%0#{WD_monsterdictionary_layout::M_id_display_digit}d",@index+1)
- x = WD_monsterdictionary_layout::M_id_display_x
- y = WD_monsterdictionary_layout::M_id_display_y
- width = WD_monsterdictionary_layout::M_id_display_width
- height = line_height
- draw_text(x, y, width, height, text1, 0)
- end
- if WD_monsterdictionary_layout::M_name_display
- text1 = @enemy.name
- x = WD_monsterdictionary_layout::M_name_display_x
- y = WD_monsterdictionary_layout::M_name_display_y
- width = WD_monsterdictionary_layout::M_name_display_width
- height = line_height
- draw_text(x, y, width, height, text1, 0)
- end
- if WD_monsterdictionary_layout::M_pic_display
- pic_name = @enemy.battler_name
- pic_hue = @enemy.battler_hue
- x = WD_monsterdictionary_layout::M_pic_display_x
- y = WD_monsterdictionary_layout::M_pic_display_y
- opacity= WD_monsterdictionary_layout::M_pic_display_opacity
- bitmap = Cache.battler(pic_name, pic_hue)
- rect = Rect.new(0, 0, bitmap.width, bitmap.height)
- contents.blt(x - rect.width/2, y - rect.height, bitmap, rect, opacity)
- end
- font_size = WD_monsterdictionary_layout::C_font_size
- contents.font.size = font_size
- if WD_monsterdictionary_layout::M_mhp_display
- text1 = Vocab::param(0)
- text2 = "?"
- text2 = @enemy.params[0] if m_dictionary_victory_switch_on?(@enemy.id)
- x = WD_monsterdictionary_layout::M_mhp_display_x
- y = WD_monsterdictionary_layout::M_mhp_display_y
- width = WD_monsterdictionary_layout::M_mhp_display_width
- change_color(system_color)
- draw_text(x, y, width, font_size, text1, 0)
- change_color(normal_color)
- draw_text(x, y, width, font_size, text2, 2)
- end
- if WD_monsterdictionary_layout::M_mmp_display
- text1 = Vocab::param(1)
- text2 = "?"
- text2 = @enemy.params[1] if m_dictionary_victory_switch_on?(@enemy.id)
- x = WD_monsterdictionary_layout::M_mmp_display_x
- y = WD_monsterdictionary_layout::M_mmp_display_y
- width = WD_monsterdictionary_layout::M_mmp_display_width
- change_color(system_color)
- draw_text(x, y, width, font_size, text1, 0)
- change_color(normal_color)
- draw_text(x, y, width, font_size, text2, 2)
- end
- if WD_monsterdictionary_layout::M_atk_display
- text1 = Vocab::param(2)
- text2 = "?"
- text2 = @enemy.params[2] if m_dictionary_victory_switch_on?(@enemy.id)
- x = WD_monsterdictionary_layout::M_atk_display_x
- y = WD_monsterdictionary_layout::M_atk_display_y
- width = WD_monsterdictionary_layout::M_atk_display_width
- change_color(system_color)
- draw_text(x, y, width, font_size, text1, 0)
- change_color(normal_color)
- draw_text(x, y, width, font_size, text2, 2)
- end
- if WD_monsterdictionary_layout::M_def_display
- text1 = Vocab::param(3)
- text2 = "?"
- text2 = @enemy.params[3] if m_dictionary_victory_switch_on?(@enemy.id)
- x = WD_monsterdictionary_layout::M_def_display_x
- y = WD_monsterdictionary_layout::M_def_display_y
- width = WD_monsterdictionary_layout::M_def_display_width
- change_color(system_color)
- draw_text(x, y, width, font_size, text1, 0)
- change_color(normal_color)
- draw_text(x, y, width, font_size, text2, 2)
- end
- if WD_monsterdictionary_layout::M_mat_display
- text1 = Vocab::param(4)
- text2 = "?"
- text2 = @enemy.params[4] if m_dictionary_victory_switch_on?(@enemy.id)
- x = WD_monsterdictionary_layout::M_mat_display_x
- y = WD_monsterdictionary_layout::M_mat_display_y
- width = WD_monsterdictionary_layout::M_mat_display_width
- change_color(system_color)
- draw_text(x, y, width, font_size, text1, 0)
- change_color(normal_color)
- draw_text(x, y, width, font_size, text2, 2)
- end
- if WD_monsterdictionary_layout::M_mdf_display
- text1 = Vocab::param(5)
- text2 = "?"
- text2 = @enemy.params[5] if m_dictionary_victory_switch_on?(@enemy.id)
- x = WD_monsterdictionary_layout::M_mdf_display_x
- y = WD_monsterdictionary_layout::M_mdf_display_y
- width = WD_monsterdictionary_layout::M_mdf_display_width
- change_color(system_color)
- draw_text(x, y, width, font_size, text1, 0)
- change_color(normal_color)
- draw_text(x, y, width, font_size, text2, 2)
- end
- if WD_monsterdictionary_layout::M_agi_display
- text1 = Vocab::param(6)
- text2 = "?"
- text2 = @enemy.params[6] if m_dictionary_victory_switch_on?(@enemy.id)
- x = WD_monsterdictionary_layout::M_agi_display_x
- y = WD_monsterdictionary_layout::M_agi_display_y
- width = WD_monsterdictionary_layout::M_agi_display_width
- change_color(system_color)
- draw_text(x, y, width, font_size, text1, 0)
- change_color(normal_color)
- draw_text(x, y, width, font_size, text2, 2)
- end
- if WD_monsterdictionary_layout::M_feature_display
- text1 = WD_monsterdictionary_layout::M_feature_display_text1
- text2 = "?"
- text2 = WD_monsterdictionary_layout::M_feature_display_text2 if m_dictionary_victory_switch_on?(@enemy.id)
- x = WD_monsterdictionary_layout::M_feature_display_x
- y = WD_monsterdictionary_layout::M_feature_display_y
- width = WD_monsterdictionary_layout::M_feature_display_width
- change_color(system_color)
- draw_text(x, y, width, font_size, text1, 0)
- change_color(normal_color)
- i = 0
- if m_dictionary_victory_switch_on?(@enemy.id)
- @enemy.note.scan(/<图鉴技能:(.*)>/){|matched|
- i += 1
- self.contents.draw_text(x + font_size, y + font_size * i, width - font_size, font_size, matched[0], 0)
- }
- end
- if i == 0
- self.contents.draw_text(x + font_size, y + font_size, width - font_size, font_size, text2, 0)
- end
- end
- if WD_monsterdictionary_layout::M_exp_display
- text1 = WD_monsterdictionary_layout::M_exp_display_text1
- text2 = "?"
- text2 = @enemy.exp if m_dictionary_victory_switch_on?(@enemy.id)
- x = WD_monsterdictionary_layout::M_exp_display_x
- y = WD_monsterdictionary_layout::M_exp_display_y
- width = WD_monsterdictionary_layout::M_exp_display_width
- change_color(system_color)
- draw_text(x, y, width, font_size, text1, 0)
- change_color(normal_color)
- draw_text(x, y, width, font_size, text2, 2)
- end
- if WD_monsterdictionary_layout::M_gold_display
- text1 = WD_monsterdictionary_layout::M_gold_display_text1
- text2 = "?"
- text2 = @enemy.gold if m_dictionary_victory_switch_on?(@enemy.id)
- text3 = Vocab::currency_unit
- x = WD_monsterdictionary_layout::M_gold_display_x
- y = WD_monsterdictionary_layout::M_gold_display_y
- width = WD_monsterdictionary_layout::M_gold_display_width
- change_color(system_color)
- draw_text(x, y, width, font_size, text1, 0)
- cx = text_size(Vocab::currency_unit).width
- change_color(normal_color)
- draw_text(x, y, width - cx - 2, font_size, text2, 2)
- change_color(system_color)
- draw_text(x, y, width, font_size, text3, 2)
- change_color(normal_color)
- end
- if WD_monsterdictionary_layout::M_drop_display
- text1 = WD_monsterdictionary_layout::M_drop_display_text1
- text2 = WD_monsterdictionary_layout::M_drop_display_text2 if m_dictionary_victory_switch_on?(@enemy.id)
- x = WD_monsterdictionary_layout::M_drop_display_x
- y = WD_monsterdictionary_layout::M_drop_display_y
- width = WD_monsterdictionary_layout::M_drop_display_width
- change_color(system_color)
- draw_text(x, y, width, font_size, text1, 0)
- change_color(normal_color)
- i = 0
- @enemy.drop_items.each do |di|
- if di.kind > 0
- i += 1
- item = item_object(di.kind, di.data_id)
- n = i -1
- if m_dictionary_drop_switch_on?(@enemy.id, n)
- text2 = item.name
- text3 = "1/#{di.denominator}"
- else
- text2 = "未知"
- text3 = ""
- end
- self.contents.draw_text(x + font_size, y + font_size * i, width - font_size, font_size, text2, 0)
- self.contents.draw_text(x + font_size, y + font_size * i, width - font_size, font_size, text3, 2)
- end
- end
- if i == 0
- self.contents.draw_text(x + font_size, y + font_size, width - font_size, font_size, text2, 0)
- end
- end
- if WD_monsterdictionary_layout::M_help_display
- text1 = WD_monsterdictionary_layout::M_help_display_text1
- text2 = "?"
- text2 = WD_monsterdictionary_layout::M_help_display_text2 if m_dictionary_victory_switch_on?(@enemy.id)
- x = WD_monsterdictionary_layout::M_help_display_x
- y = WD_monsterdictionary_layout::M_help_display_y
- width = WD_monsterdictionary_layout::M_help_display_width
- change_color(system_color)
- draw_text(x, y, width, font_size, text1, 0)
- change_color(normal_color)
- i = 0
- if m_dictionary_victory_switch_on?(@enemy.id)
- @enemy.note.scan(/<图鉴说明:(.*)>/){|matched|
- i += 1
- self.contents.draw_text(x + font_size, y + font_size * i, width - font_size, font_size, matched[0], 0)
- }
- end
- if i == 0
- self.contents.draw_text(x + font_size, y + font_size, width - font_size, font_size, text2, 0)
- end
- end
- if WD_monsterdictionary_layout::M_geno_display
- text1 = WD_monsterdictionary_layout::M_geno_display_text1
- text2 = "#{m_dictionary_genoside_number(@enemy.id)}"
- x = WD_monsterdictionary_layout::M_geno_display_x
- y = WD_monsterdictionary_layout::M_geno_display_y
- width = WD_monsterdictionary_layout::M_geno_display_width
- change_color(system_color)
- draw_text(x, y, width, font_size, text1, 0)
- change_color(normal_color)
- draw_text(x, y, width, font_size, text2, 2)
- end
- elsif @enemy != nil
- if WD_monsterdictionary_layout::M_id_display
- text1 = sprintf("%0#{WD_monsterdictionary_layout::M_id_display_digit}d",@index+1)
- x = WD_monsterdictionary_layout::M_id_display_x
- y = WD_monsterdictionary_layout::M_id_display_y
- width = WD_monsterdictionary_layout::M_id_display_width
- height = line_height
- draw_text(x, y, width, height, text1, 0)
- end
- if WD_monsterdictionary_layout::M_name_display
- text1 = "- ???? -"
- x = WD_monsterdictionary_layout::M_name_display_x
- y = WD_monsterdictionary_layout::M_name_display_y
- width = WD_monsterdictionary_layout::M_name_display_width
- height = line_height
- draw_text(x, y, width, height, text1, 0)
- end
- end
- end
- end
复制代码 [/fold]
[fold=怪物图鉴3]- #==============================================================================
- # 菜单画面
- #==============================================================================
- class Scene_Menu < Scene_MenuBase
- #--------------------------------------------------------------------------
- # alias 给 create_command_window 方法取个别名 尽量命名独特不容易重名
- #--------------------------------------------------------------------------
- alias miao_20150812_create_1 create_command_window
- #--------------------------------------------------------------------------
- # ● 生成指令窗口
- #--------------------------------------------------------------------------
- def create_command_window
- miao_20150812_create_1
- @command_window.set_handler(:neko_commands1, method(:command_neko1))
- end
- #--------------------------------------------------------------------------
- # ● 按钮所执行的内容方法名与上面的 method() 里的符号对应
- #--------------------------------------------------------------------------
- def command_neko1
- #通常指令内容是呼出场景
- SceneManager.call(Scene_MonsterDictionary)
- #但是按钮按下去的效果不一定局限于切换场景
- end
- end
- #==============================================================================
- # 菜单画面中显示指令的窗口
- #==============================================================================
- class Window_MenuCommand < Window_Command
- alias miao_20150812_aoc add_original_commands
- #--------------------------------------------------------------------------
- # ● 独自添加指令用
- #--------------------------------------------------------------------------
- def add_original_commands
- miao_20150812_aoc
- add_command("图鉴", :neko_commands1, main_commands_enabled)#添加按钮
-
- =begin
- add_command()里的3个参数依次为:
- ● name:选项的名称,在描绘选项时使用
- ● symbol:选项的符号,这是一个标志与上面set_handler里对应
- ● enabled:有效状态,当值为 false 时选项无效且用半透明绘制
- =end
- end
- end
复制代码 [/fold]
23、在特殊战斗中可以使用到的雾景。
[fold=战斗中雾效果][/fold]
24、遇敌时碎屏画面进入战斗特效。
附件
[fold=碎屏特效1]- #使用方法:打开脚本编辑器,将“碎屏特效1”“碎屏特效2”脚本插入到main上。
- #将附件下载解压sptx.png到Graphics/system文件夹里面。
- #===================================================
- # Broken_Screen
- #----------------------------------------------------
- # ■ 碎屏特效
- #===================================================
- =begin
- 名称:碎屏转场特效
- 版本:1.01
- 效果:场景更换时,产生屏幕碎开的效果。
- 使用说明:
- 你可以修改Graphics/system/sptx.png文件,改成自己想要的碎片效果。
- 在转场前的场景,如地图到战斗
- 则在地图的 切换战斗画面前的处理 方法 内添加
- $swtf = Broken_Screen.new(文件名,可省略)
- 此时可定格画面(其实是把当前画面制作成碎片)
- 然后在需要碎开的地方添加
- if $swtf != nil
- $swtf.get_bomb
- $swtf=nil
- end
- 即可实现碎开。
-
- 由于脚本的优化,所以有时候会出现实际碎片与碎片图有差别,不过这影响不大
- 如果必要的话,可以适当减少 @step_w @step_h的值(步长)即可
- 但会增加计算量,也许很大。
- =end
- class Broken_Screen
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize(filename="Graphics/system/sptx.png")
- @width = Graphics.width #获取宽高
- @height = Graphics.height
- #===========================
- @step_w = @width/2 #★★★★★★★★★★★#★★★★★★★★★★★
- @step_h = @height/2 #★★★★★★★★★★★#★★★★★★★★★★★
- #可以设置这两项数据,以减少可能会出现的误差,
- #因为脚本并不会检查所有的像素,所以有时候会出现误差,减少
- #步长可以减少出现误差的可能,但会增加计算量。
- #===========================
- @picture = Graphics.snap_to_bitmap #获取当前的图像
- @borken_pic = Bitmap.new(filename)#获取破碎辅助图
- #~ pic = Sprite.new
- #~ pic.bitmap = Bitmap.new(544,416)
- #~ pic.bitmap.blt(20,20,@picture,Rect.new(20,20,100,100))
- #~ pic.x+= 200
- # return
- @shards = {} #碎片的数组
- start #开始绘图
- end
- #--------------------------------------------------------------------------
- # ● 开始绘图
- #--------------------------------------------------------------------------
- def start
- y0=0
- loop do
- x0 = 0
- loop do
- area = x0,y0,[@width-x0,@step_w].min,[@height-y0,@step_h].min
- part_pic(area)
- x0+=@step_w
- break if x0>=@width
- end
- y0+=@step_h
- break if y0>=@height
- end
- end
- #--------------------------------------------------------------------------
- # ● 开始炸开
- #--------------------------------------------------------------------------
- def get_bomb
- Audio.se_play("Audio/SE/battle1")
- temp = [] #将哈希表转换为数组
- @shards.each_value{|shard|
- temp.push shard
- }
- @shards = temp
- shards_v = []
-
- for i in 0..@shards.size-1
- # 对象 中心位置 转速
- # @shards[i].angle=rand(2)*45
- shards_v.push [@shards[i],rand(@shards[i].x)+20-rand(40),@shards[i].y-208,rand(2)]
- end
- for t in 0..89
- for sha in shards_v
- sha[0].x+= sha[1]/10
- sha[0].y+= sha[2]/20
- #~ msgbox sha[0].x
- sha[2]+=10
- #~ sha[0].angle+=sha[3]
- if sha[3] == 0
- sha[0].zoom_x -= 0.01
-
- else
- sha[0].zoom_y -= 0.01
-
- end
-
- end
- Graphics.update
- end
- for sha in shards_v
- sha[0].dispose
- end
- @picture.dispose
- @borken_pic.dispose
- end
-
- #--------------------------------------------------------------------------
- # ● 拆分图块 若颜色不单一,继续四分图块
- # 递归算法 area 被拆分的范围
- #--------------------------------------------------------------------------
- def part_pic(area)
- x,y,w,h = *area
- if w>=1 and h>=1 and w+h>2 #如果长宽大于1,并且长宽之和大于2
- #四分区域
- areas = []
- areas[0] = [x,y,w/2,h/2]
- areas[1] = [x+w/2,y,w-w/2,h/2]
- areas[2] = [x,y+h/2,w/2,h-h/2]
- areas[3] = [x+w/2,y+h/2,w-w/2,h-h/2]
- for area in areas
- test = area_test(area)
- if test[0]
- make_shard(area,test[1]) #绘图
- else
- part_pic(area) #递归
- end
-
- end
- else#if w>1 and h>1
- if w*h == 0
- return #如果长宽其中之一为0,则忽略
- else #这里表示只有一格的情况
- make_shard(area,area_test(area)[1])#绘图
- end
-
- end#if w>1 and h>1
-
- end
-
- #--------------------------------------------------------------------------
- # ● 区块检测
- # 检测区块颜色是否单一 area 检测的范围
- #--------------------------------------------------------------------------
- def area_test(area)
- x,y,w,h = *area #获取位置,长宽
- color = @borken_pic.get_pixel(x, y) #获取左上角像素的颜色
- if @borken_pic.get_pixel(x+w-1, y) != color #依次检测剩下三个点是否和单一
- return [false]
- end
- if @borken_pic.get_pixel(x, y+h-1) != color
- return [false]
- end
- if @borken_pic.get_pixel(x+w-1, y+h-1) != color
- return [false]
- end
- return [true,color.red]
- end
- #--------------------------------------------------------------------------
- # ● 制作碎片
- # area,可以被绘图的区域,color该区域的颜色(这里的颜色是只辅助图内的颜色)
- #--------------------------------------------------------------------------
- def make_shard(area,color)
- unless @shards.include?(color) #如果没有该颜色的记录
- spr = Sprite.new
- spr.z = 100
- spr.bitmap = Bitmap.new(@width,@height)
- # spr.x,spr.y,spr.bitmap.width,spr.bitmap.height = *area#获得长宽
- spr.ox=(area[0]+area[2])/2
- spr.oy=(area[1]+area[3])/2
- spr.x=(area[0]+area[2])/2
- spr.y=(area[1]+area[3])/2
- @shards[color] = spr
-
- end
-
- #----------------------绘图----------------------
- # @shards[color].bitmap.fill_rect(*area,Color.new(125,125,125,255))
- @shards[color].bitmap.blt(area[0], area[1], @picture, Rect.new(*area))
- #~ @shards[color].ox = (x+xt)/2
- #~ @shards[color].x = (x+xt)/2
- #~ @shards[color].oy = (y+yt)/2
- #~ @shards[color].y = (y+yt)/2
-
- end
-
- end
- #============================================================
- # 本脚本由九夜神尊制作
- # 欢迎任意转载修改,但请保留作者名。
- #===========================================================
复制代码 [/fold]
[fold=碎屏特效2]- #encoding:utf-8
- #==============================================================================
- # ■ Scene_Map
- #------------------------------------------------------------------------------
- # 地图画面
- #==============================================================================
- class Scene_Map < Scene_Base
- #--------------------------------------------------------------------------
- # ● 执行战斗前的渐变
- #--------------------------------------------------------------------------
- def perform_battle_transition
- #~ Graphics.transition(60, "Graphics/System/BattleStart", 100)
- #~ Graphics.freeze
- end
- #--------------------------------------------------------------------------
- # ● 切换战斗画面前的处理
- #--------------------------------------------------------------------------
- def pre_battle_scene
- Graphics.update
- Graphics.freeze
- @spriteset.dispose_characters
- BattleManager.save_bgm_and_bgs
- BattleManager.play_battle_bgm
- Sound.play_battle_start
- $swtf = Broken_Screen.new if $swtf==nil #★★★★★★★★★★★★★★★★★
- end
- end
- #encoding:utf-8
- #==============================================================================
- # ■ Scene_Battle
- #------------------------------------------------------------------------------
- # 战斗画面
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # ● 执行渐变
- #--------------------------------------------------------------------------
- def perform_transition
- super
- Graphics.transition(transition_speed)
- if $swtf != nil
- $swtf.get_bomb
- $swtf=nil
- end
- end
- end
复制代码 [/fold]
25、战斗菜单添加一个新选项,选项效果是自己设定的公共事件。
[fold=新战斗选项]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- #11横改选项名字 31横改执第几个行公共事件ID
- class Window_PartyCommand
- alias shijian_make_command_list make_command_list
- def make_command_list
- shijian_make_command_list
- add_command("作战", :shijian)
- end
- end
- class Scene_Battle
- alias shijian_create_party_command_window create_party_command_window
- def create_party_command_window
- shijian_create_party_command_window
- @party_command_window.set_handler(:shijian, method(:command_shijian))
- end
- def command_shijian
- $game_temp.reserve_common_event(19)
- process_event
- start_party_command_selection
- end
- end
复制代码 [/fold]
26、突破装备能力值表示没用过,太强大了!喜欢的可以试试超神的感觉。
[fold=装备属性突破]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- #==============================================================================
- # ☆VXAce RGSS3 「装備能力限界突破」☆
- # EnDlEss DREamER
- # URL:[url]http://mitsu-evo.6.ql.bz/[/url]
- # 製作者 mitsu-evo
- # Last:2012/1/25
- # 武器防具の能力上限「500」を超えて設定する。
- # ▼ 「▼ 素材」に近い位置に挿入。
- #==============================================================================
- =begin
-
- 1/25:設定能力値が最大HPにしか反映されない現象を修正。
-
-
- ☆☆☆☆☆☆ 挿入位置 ☆☆☆☆☆☆
-
- 素材の最上部に挿入してください。
- 個別武器コマンドや装備拡張:武器拡張追加などのスクリプトよりも上。
-
-
- ☆☆☆☆☆☆ 機能説明 ☆☆☆☆☆☆
-
- 武器和防具的备注栏
- <物理攻击 9999> <物理防御 9999> <魔法攻击 9999> <魔法防御 9999>
- <敏 捷 值 9999> <幸 运 值 9999> <体力上限 9999> <魔力上限 9999>
- <ATK 9999> <DEF 9999> <MAT 9999> <MDF 9999>
- <AGI 9999> <LUC 9999> <MHP 9999> <MMP 9999>
- 等の記述を入れると設定した数値の攻撃力となります。
-
- データベース設定での500上限が物足りないという人用の素材です。
-
- =end
- $ed_rgss3 = {} if $ed_rgss3 == nil
- $ed_rgss3["ed_equip_over_param"] = true
- # メモ欄取得用定数
-
- EQUIP_MHP_PARAM = /<(?:MHP|体力上限)\s*(\d+)>/i
- EQUIP_MMP_PARAM = /<(?:MMP|魔力上限)\s*(\d+)>/i
- EQUIP_ATK_PARAM = /<(?:ATK|物理攻击)\s*(\d+)>/i
- EQUIP_DEF_PARAM = /<(?:DEF|物理防御)\s*(\d+)>/i
- EQUIP_MAT_PARAM = /<(?:MAT|魔法攻击)\s*(\d+)>/i
- EQUIP_MDF_PARAM = /<(?:MDF|魔法防御)\s*(\d+)>/i
- EQUIP_AGI_PARAM = /<(?:AGI|敏 捷 值)\s*(\d+)>/i
- EQUIP_LUK_PARAM = /<(?:LUC|幸 运 值)\s*(\d+)>/i
-
- module RPG
- class EquipItem < BaseItem
- #--------------------------------------------------------------------------
- # ● パラメータの取得
- #--------------------------------------------------------------------------
- def params
- @params.each_index{|index|
- case index
- when 0
- self.note.each_line { |line|
- @params[0] = $1.to_i if line =~ EQUIP_MHP_PARAM}
- when 1
- self.note.each_line { |line|
- @params[1] = $1.to_i if line =~ EQUIP_MMP_PARAM}
- when 2
- self.note.each_line { |line|
- @params[2] = $1.to_i if line =~ EQUIP_ATK_PARAM}
- when 3
- self.note.each_line { |line|
- @params[3] = $1.to_i if line =~ EQUIP_DEF_PARAM}
- when 4
- self.note.each_line { |line|
- @params[4] = $1.to_i if line =~ EQUIP_MAT_PARAM}
- when 5
- self.note.each_line { |line|
- @params[5] = $1.to_i if line =~ EQUIP_MDF_PARAM}
- when 6
- self.note.each_line { |line|
- @params[6] = $1.to_i if line =~ EQUIP_AGI_PARAM}
- when 7
- self.note.each_line { |line|
- @params[7] = $1.to_i if line =~ EQUIP_LUK_PARAM}
- end
- }
- return @params
- end
- end
- end
复制代码 [/fold]
27、有的物品不想要怎么办?那就选择丢弃吧!这个脚本也算是拟补了VA一项必备功能。
[fold=丢弃物品]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- #按C键可以选择丢弃物品,不能丢弃贵重物品,按键可以在19横改“R”默认。
- #==============================================================================
- # ■ VXAce-RGSS3-2 アイテム捨てる [Ver.1.0.0] by Claimh
- #------------------------------------------------------------------------------
- # アイテム画面上でXボタンを押すと、アイテムを捨てることができます。
- #==============================================================================
- #==============================================================================
- # ■ Window_ItemList
- #==============================================================================
- class Window_ItemList < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 決定やキャンセルなどのハンドリング処理
- #--------------------------------------------------------------------------
- def process_handling
- return unless open? && active
- return call_handler(:append_R) if handle?(:append_R) && Input.trigger?(:R)
- super
- end
- end
- #==============================================================================
- # ■ Window_ItemNumber
- #==============================================================================
- class Window_ItemNumber < Window_ShopNumber
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_reader :number # 入力された個数
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- x = (Graphics.width - window_width) / 2
- super(x, 200, line_height*2 + 32)
- @item = nil
- @max = 1
- @number = 1
- end
- #--------------------------------------------------------------------------
- # ● アイテム、最大個数の設定
- #--------------------------------------------------------------------------
- def set(item, max)
- @item = item
- @max = max
- @number = 1
- refresh
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- contents.draw_text(0, 0, 200, line_height, "丢弃数:")
- draw_item_name(@item, 4, line_height)
- draw_number
- end
- #--------------------------------------------------------------------------
- # ● アイテム名表示行の Y 座標
- #--------------------------------------------------------------------------
- def item_y
- line_height
- end
- end
- #==============================================================================
- # ■ Scene_Item
- #==============================================================================
- class Scene_Item < Scene_ItemBase
- #--------------------------------------------------------------------------
- # ● 開始処理
- #--------------------------------------------------------------------------
- alias start_dump start
- def start
- start_dump
- create_item_dump_window
- end
- #--------------------------------------------------------------------------
- # ● アイテムウィンドウの作成
- #--------------------------------------------------------------------------
- alias create_item_window_dump create_item_window
- def create_item_window
- create_item_window_dump
- @item_window.set_handler(:append_R, method(:on_item_dump))
- end
- #--------------------------------------------------------------------------
- # ● アイテム数選択ウィンドウの作成
- #--------------------------------------------------------------------------
- def create_item_dump_window
- @number_window = Window_ItemNumber.new
- @number_window.viewport = @viewport
- @number_window.hide
- @number_window.set_handler(:ok, method(:on_number_ok))
- @number_window.set_handler(:cancel, method(:on_number_cancel))
- end
- #--------------------------------------------------------------------------
- # ● アイテム[捨てる]
- #--------------------------------------------------------------------------
- def on_item_dump
- if item_dumpable?
- Sound.play_ok
- @number_window.set(item, max_item)
- @number_window.show.activate
- @item_window.deactivate
- else
- Sound.play_buzzer
- end
- end
- #--------------------------------------------------------------------------
- # ● 個数入力[決定]
- #--------------------------------------------------------------------------
- def on_number_ok
- Sound.play_ok
- do_item_dump(@number_window.number)
- @number_window.hide
- activate_item_window
- end
- #--------------------------------------------------------------------------
- # ● 個数入力[キャンセル]
- #--------------------------------------------------------------------------
- def on_number_cancel
- Sound.play_cancel
- @number_window.hide
- activate_item_window
- end
- #--------------------------------------------------------------------------
- # ● 捨てるの実行
- #--------------------------------------------------------------------------
- def do_item_dump(number)
- $game_party.lose_item(item, number)
- end
- #--------------------------------------------------------------------------
- # ● アイテムを捨てる判定
- #--------------------------------------------------------------------------
- def item_dumpable?
- item.is_a?(RPG::Item) ? !item.key_item? : (!item.nil?)
- end
- #--------------------------------------------------------------------------
- # ● 所持数の取得
- #--------------------------------------------------------------------------
- def max_item
- $game_party.item_number(item)
- end
- end
复制代码 [/fold]
28、事件或者角色显示影子,当然!某些事件想不显示影子也可以。
附件
[fold=影子脚本][/fold]
29、装备,技能,角色,职业,敌人都更改普通攻击技能ID,比如:装备魔法杖,魔法师的普通攻击变成火球攻击。或者魔法师默认普通攻击就是火球。
[fold=更改普通攻击ID]- #打开脚本编辑器,将脚本插入到main上。
- #--------------------------------------------------------------------------
- # ● require Taroxd基础设置
- # 更改角色/敌人普通攻击/防御的技能ID
- #
- # 使用方法:
- # 在装备/技能/角色/职业/敌人上备注 <attackskill x> / <guardskill x>
- # 建议与“战斗指令优化”配合使用。
- #--------------------------------------------------------------------------
- Taroxd::AttackSkill = true
- class RPG::BaseItem
- note_i :attack_skill, false
- note_i :guard_skill, false
- end
- class Game_BattlerBase
- def_chain :attack_skill_id do |old|
- note_objects { |item| return item.attack_skill if item.attack_skill }
- old.call
- end
- def_chain :guard_skill_id do |old|
- note_objects { |item| return item.guard_skill if item.guard_skill }
- old.call
- end
- end
复制代码 [/fold]
30、菜单添加一个新选项,选项效果是自己设定的公共事件(和第25个脚本差不多一样的效果)。
[fold=新增菜单选项]- #打开脚本编辑器,将脚本插入到main上。
- =begin
- ===============================================================================
- 物品添加到菜单选项中 By喵呜喵5
- ===============================================================================
- 【说明】
- 在菜单选项中添加指定选项,选择该选项即可使用特定的物品
- 配合物品使用效果中的“公共事件”以及其他脚本,
- 可以很简单的实现添加可执行公共事件的菜单选项的效果
- =end
- $m5script ||= {};$m5script[:M5IM20150215] = 20150406
- module M5IM20150215; LIST = [
- #==============================================================================
- # 设定部分
- #==============================================================================
- ["帐篷", 5, false], #这里可以修改选项名字,5是使用物品的ID
- # 设置添加的选项,设置的格式为:
- # [选项的名称, 选择该选项后使用的物品ID, 未持有该物品时的选项状态],
- # 选项的名称前后要加上英文引号
- # 未持有物品时选项状态设置为 true 时,即使未持有特定物品也显示该物品的选项
- # 未持有物品时选项状态设置为 false 时,不显示未持有物品对应的选项
- # 各个设置之间以及每条设置内容之间需要加上英文逗号分隔
- #==============================================================================
- # 设定结束
- #==============================================================================
- ]
- class Scene_ItemTarget < Scene_ItemBase
- attr_reader :actor_window
- attr_writer :item_id
- def initialize(scene)
- super
- @viewport = Viewport.new
- @item_window = scene.instance_variable_get(:@command_window)
- @status_window = scene.instance_variable_get(:@status_window)
- end
- def item; $data_items[@item_id]; end
- def cursor_left?; true; end
- def play_se_for_item; Sound.play_use_item; end
- def show_sub_window(window)
- super(window)
- @status_window.hide if @status_window
- end
- def hide_sub_window(window)
- super(window)
- @item_window.height = @item_window.window_height
- @item_window.create_contents
- @item_window.refresh
- @status_window.show.refresh if @status_window
- end
- def use_item
- super
- on_actor_cancel
- end
- end
- end
- class Window_MenuCommand
- alias m5_20150215_add_original_commands add_original_commands
- def add_original_commands
- m5_20150215_add_original_commands
- M5IM20150215::LIST.each do |item|
- name = "m520150215im#{item[1]}".to_sym
- has = $game_party.has_item?($data_items[item[1]])
- if item[2] then add_command(item[0], name, has)
- else add_command(item[0], name) if has
- end
- end
- end
- end
- class Scene_Menu
- alias m5_20150215_start start
- def start
- m5_20150215_start
- @m520150215SA = M5IM20150215::Scene_ItemTarget.new(self)
- @m520150215SA.create_actor_window
- @m520150215SA.actor_window.hide.deactivate
- M5IM20150215::LIST.each do |item|
- name = "m520150215im#{item[1]}".to_sym
- proc = Proc.new {
- @m520150215SA.item_id = item[1]
- @m520150215SA.determine_item
- }
- @command_window.set_handler(name, proc)
- end
- end
- alias m5_20150215_update update
- def update
- m5_20150215_update
- @m520150215SA.actor_window.update
- end
- alias m5_20150215_terminate terminate
- def terminate
- m5_20150215_terminate
- @m520150215SA.actor_window.dispose
- @m520150215SA.dispose_main_viewport
- end
- end
复制代码 [/fold]
31、这个脚本涉及到的东西很广,自己灵活运用。
[fold=隐藏物品/装备/技能]- #打开脚本编辑器,将脚本插入到main上。
- =begin
- ===============================================================================
- 隐藏物品/装备/技能 By 喵呜喵5
- ===============================================================================
- 【说明】
- 在物品/装备/技能的数据库备注栏中输入“<hide>”(不包括双引号)
-
- 实际游戏时即使玩家获得了这个物品/装备/技能玩家也无法在游戏中看到
- =end
- #==============================================================================
- # 脚本部分
- #==============================================================================
- $m5script ||= {};raise("需要喵呜喵5基础脚本的支持") unless $m5script[:M5Base]
- $m5script[:M5HI20150131] = 20150131;M5script.version(20150129)
- class Window_ItemList
- alias m5_20150131_include? include?
- def include?(item)
- return false if item && item.m5note("hide",false,false)
- return m5_20150131_include?(item)
- end
- end
- class Window_SkillList
- alias m5_20150131_include? include?
- def include?(item)
- return false if item && item.m5note("hide",false,false)
- return m5_20150131_include?(item)
- end
- end
- class Window_EquipItem
- alias m5_20150131_include? include?
- def include?(item)
- return false if item && item.m5note("hide",false,false)
- return m5_20150131_include?(item)
- end
- end
- class Window_BattleItem
- alias m5_20150131_include? include?
- def include?(item)
- return false if item && item.m5note("hide",false,false)
- return m5_20150131_include?(item)
- end
- end
复制代码 [/fold]
32、得失物品自动提示功能很多人会用到。
[fold=得失物品自动提示]- #打开脚本编辑器,将脚本插入到main上。
- #==============================================================================
- # 本腳本來自www.66RPG.com,使用和轉載請保留此信息
- #==============================================================================
- # 注意!!!在對話後得到物品,請在對話後先用事件等待3幀,否則對話框來不及消失。
- # 開關定義:
- $noshowgold = 41 # 不显示金钱得失
- $noshowitem = 42 # 不显示物品得失
- $noshowweapon = 43 # 不显示武器得失
- $noshowarmor = 44 # 不显示防具得失
- # 以上開關,當打開的時候,獲得物品將不會提示,比如默認打開41號開關,獲得金錢不再提示
- # 不想提示等级升降时,就在事件命令直接选择是否显示就行了。
- #——聲效,可以自己改
- folder = "Audio/SE/"
- $gain_gold_se = folder +"Shop" # 获得金钱声效
- $loss_gold_se = folder +"Blow2" # 失去金钱声效
- $gain_item_se = folder +"Item1" # 获得物品声效
- $loss_item_se = folder +"Blow2" # 失去物品声效
- $gain_weapon_se = folder +"Item1" # 获得武器声效
- $loss_weapon_se = folder +"Blow2" # 失去武器声效
- $gain_armor_se = folder +"Item1" # 获得防具声效
- $loss_armor_se = folder +"Blow2" # 失去防具声效
- $gain_lv_se = folder +"Item1" # 提升等级声效
- $loss_lv_se = folder +"Blow2" # 降低等级声效
- # ————————————————————————————————————
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # ● 增減金錢
- #--------------------------------------------------------------------------
- def command_125
- value = operate_value(@params[0], @params[1], @params[2])
- $game_party.gain_gold(value)
- if $game_switches[$noshowgold]==false
- show_gain_window(0, value)
- end
- return true
- end
- #--------------------------------------------------------------------------
- # ● 增減物品
- #--------------------------------------------------------------------------
- def command_126
- value = operate_value(@params[1], @params[2], @params[3])
- $game_party.gain_item($data_items[@params[0]], value)
- if $game_switches[$noshowitem]==false
- show_gain_window(1, value)
- end
- $game_map.need_refresh = true
- return true
- end
- #--------------------------------------------------------------------------
- # ● 增減武器
- #--------------------------------------------------------------------------
- def command_127
- value = operate_value(@params[1], @params[2], @params[3])
- $game_party.gain_item($data_weapons[@params[0]], value, @params[4])
- if $game_switches[$noshowweapon]==false
- show_gain_window(2, value)
- end
- return true
- end
- #--------------------------------------------------------------------------
- # ● 增減防具
- #--------------------------------------------------------------------------
- def command_128
- value = operate_value(@params[1], @params[2], @params[3])
- $game_party.gain_item($data_armors[@params[0]], value, @params[4])
- if $game_switches[$noshowarmor]==false
- show_gain_window(3, value)
- end
- return true
- end
- def show_gain_window(type, value)
- snstar2006_66rpg_item = $data_armors[@params[0]]
- snstar2006_66rpg = Window_Base.new((640-300)/2,128,200,100)
- snstar2006_66rpg.contents = Bitmap.new(snstar2006_66rpg.width - 32, snstar2006_66rpg.height - 32)
- if value >= 0
- gain_text = "获得"
- else
- gain_text = "失去"
- end
-
- case type
- when 0
- gain_type = "金钱"
- if value >=0
- Audio.se_play($gain_gold_se,80,100)
- else
- Audio.se_play("Audio/SE/"+"Item1",80,100)
- end
- when 1
- gain_type = "物品"
- string = $data_items[@params[0]]
- if value >=0
- Audio.se_play($gain_item_se,80,100)
- else
- Audio.se_play($loss_item_se,80,100)
- end
- when 2
- gain_type = "武器"
- string = $data_weapons[@params[0]]
- if value >=0
- Audio.se_play($gain_weapon_se,80,100)
- else
- Audio.se_play($loss_weapon_se,80,100)
- end
- when 3
- gain_type = "防具"
- string = $data_armors[@params[0]]
- if value >=0
- Audio.se_play($gain_armor_se,80,100)
- else
- Audio.se_play($loss_armor_se,80,100)
- end
- end
-
- snstar2006_66rpg.contents.draw_text(0,0,160,30,gain_text+gain_type+":")
-
- unless type == 0
- snstar2006_66rpg.draw_item_name(string, 0, 30, true)
- snstar2006_66rpg.contents.draw_text(0, 30, 160, 30, "×"+value.abs.to_s, 2)
- else
- snstar2006_66rpg.contents.draw_text(0,30,165,30,value.abs.to_s + " "+ Vocab.currency_unit, 2)
- end
-
- snstar2006_66rpg.opacity = 160
-
- for i in 0..50
- Graphics.update
- end
-
- for i in 0..10
- snstar2006_66rpg.opacity -= 10
- snstar2006_66rpg.contents_opacity -= 10
- Graphics.update
- end
-
- snstar2006_66rpg.dispose
-
- end
- def show_gain_level_window(actor,value)
- lvstring = Vocab::level
-
- snstar2006_66rpg = Window_Base.new((640-300)/2,128,200,100)
- snstar2006_66rpg.contents = Bitmap.new(snstar2006_66rpg.width - 30, snstar2006_66rpg.height - 30)
-
- if value >= 0
- gain_text = "提升"
- Audio.se_play($gain_lv_se,80,100)
- else
- gain_text = "降低"
- Audio.se_play($loss_lv_se,80,100)
- end
-
- snstar2006_66rpg.contents.draw_text(0, 0, 110, 30, actor.name)
- string = lvstring+gain_text+value.abs.to_s+"级"
- snstar2006_66rpg.contents.draw_text(0,30,160,30,string, 2)
- snstar2006_66rpg.opacity = 160
-
- for i in 0..50
- Graphics.update
- end
-
- for i in 0..10
- snstar2006_66rpg.opacity -= 10
- snstar2006_66rpg.contents_opacity -= 10
- Graphics.update
- end
-
- snstar2006_66rpg.dispose
- end
- end
- #==============================================================================
- # 本腳本來自www.66RPG.com,使用和轉載請保留此信息
- #==============================================================================
复制代码 [/fold]
33、消耗变量购买物品,可配合第二货币脚本使用。
[fold=变量商店]- #打开脚本编辑器,将脚本插入到main上。
- =begin
- ===============================================================================
- 变量商店 By喵呜喵5
- ===============================================================================
- 【说明】
- 可以使用变量在商店进行购物
- 首先先在事件中使用脚本命令输入
- m5_20160528_shop(变量的ID,"变量的名称")
- 例如:m5_20160528_shop(1,"节操")
- 若事件指令中下一条指令为商店处理,则进入商店时购买物品消耗的是对应的变量
- =end
- $m5script ||= {}; $m5script[:M5VS20160528] = 20160528
- module M5VS20160528
- #==============================================================================
- # 设定部分
- #==============================================================================
- EQUAL = false
- # 设置为 true 时,变量商店物品的出售价格为【数据库中】物品售价的一半
- # 设置为 false 时,变量商店物品的出售价格为【该商店】物品售价的一半
- # (一般来说,个人建议将变量商店请设置为只允许购买)
- #==============================================================================
- # 设定结束
- #==============================================================================
- def self.init; set(0, nil); end
- def self.gold; @data[0]; end
- def self.unit; @data[1]; end
- def self.set(gold, unit); @data = [gold, unit]; end
- def self.work(&block)
- origin_gold = $game_party.gold
- $game_party.m5_20160528_set_gold($game_variables[gold]) if unit
- block.call
- return unless unit
- $game_variables[gold] = $game_party.gold
- $game_party.m5_20160528_set_gold(origin_gold)
- end
- end
- M5VS20160528.init
- class Game_Interpreter
- def m5_20160528_shop(gold, unit)
- return unless next_event_code == 302
- M5VS20160528.set(gold, unit)
- @index += 1
- execute_command
- M5VS20160528.init
- end
- end
- class Window_Gold
- alias m5_20160528_value value
- def value
- M5VS20160528.unit ? $game_variables[M5VS20160528.gold] : m5_20160528_value
- end
- alias m5_20160528_unit currency_unit
- def currency_unit; M5VS20160528.unit || m5_20160528_unit; end
- end
- class Game_Party; def m5_20160528_set_gold(gold); @gold = gold; end; end
- class Scene_Shop
- alias m5_20140318_do_buy do_buy
- def do_buy(number); M5VS20160528.work{ m5_20140318_do_buy(number) }; end
- alias m5_20140318_do_sell do_sell
- def do_sell(number); M5VS20160528.work{ m5_20140318_do_sell(number) }; end
- alias m5_20140318_selling_price selling_price
- def selling_price
- return m5_20140318_selling_price unless M5VS20160528.unit
- return m5_20140318_selling_price if M5VS20160528::EQUAL
- p = buying_price || 0
- p / 2
- end
- end
复制代码 [/fold]
34、新货币,显示的是某项变量,也可以不当货币看待。
[fold=第二货币]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- #41横可以修改显示变量的ID,44横可修改货币名字。
- #=============================================================================
-
- # 第二货币 by 子弹君
-
- #=============================================================================
-
- #=============================================================================
-
- #说明:
-
- #在菜单里显示一个第二货币的窗口。
-
- #=============================================================================
-
- $BombScript ||= {};$BombScript["第二货币"] = "第二货币20140919"
-
- #=============================================================================
-
- # 设定部分
-
- #=============================================================================
-
- module BOMB
-
- module DEHB
-
- BOMB_X = 0
-
- # 调整窗口的X坐标
-
- BOMB_Y = 325
-
- # 调整窗口的X坐标
-
- BOMB_VAL = 14
-
- # 设置一个变量,等于货币的数量
-
- BOMB_STH = 5
-
- # 设置一个开关,开启时第二货币窗口打开,关闭时关闭。
- BOMB_CU = "G"
-
- # 这里设置货币的单位
-
- end
-
- end
-
- class BOMB_Gold < Window_Base
-
- #--------------------------------------------------------------------------
-
- # ● 初始化对象
-
- #--------------------------------------------------------------------------
-
- def initialize
-
- super(0, 0, window_width, fitting_height(1))
-
- refresh
-
- end
-
- #--------------------------------------------------------------------------
-
- # ● 获取窗口的宽度
-
- #--------------------------------------------------------------------------
-
- def window_width
-
- return 160
-
- end
-
- #--------------------------------------------------------------------------
-
- # ● 刷新
-
- #--------------------------------------------------------------------------
-
- def refresh
-
- contents.clear
- draw_icon(3782,0,0)
- draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)
-
- end
-
- #--------------------------------------------------------------------------
-
- # ● 获取货币单位
-
- #--------------------------------------------------------------------------
-
- def currency_unit
-
- return BOMB::DEHB::BOMB_CU
-
- end
- #--------------------------------------------------------------------------
-
- # ● 获取持有金钱
-
- #--------------------------------------------------------------------------
-
- def value
-
- $game_variables[BOMB::DEHB::BOMB_VAL]
-
- end
- #--------------------------------------------------------------------------
-
- # ● 打开窗口
-
- #--------------------------------------------------------------------------
-
- def open
-
- refresh
-
- super
-
- end
-
- end
-
- class Scene_Menu < Scene_MenuBase
-
- #--------------------------------------------------------------------------
-
- # ● 生成金钱窗口
-
- #--------------------------------------------------------------------------
-
- alias bomb2014919start start
-
- def start
-
- bomb2014919start
-
- create_bomb_window if
- $game_switches[BOMB::DEHB::BOMB_STH] == true
-
- end
-
- def create_bomb_window
-
- @bomb_window = BOMB_Gold.new
-
- @bomb_window.x = BOMB::DEHB::BOMB_X
-
- @bomb_window.y = BOMB::DEHB::BOMB_Y
-
- end
-
- end
复制代码 [/fold]
35、在默认战斗界面中显示角色的脸图,虽然不是显示全脸,但也足够了。
[fold=战斗显示脸图]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- #==============================================================================
- # F03 - 战斗显示脸图 - By芙蕾娅
- #------------------------------------------------------------------------------
- # ★ - 新增 ☆ - 修改 ■ - 删除 ● - 无变更
- #==============================================================================
- # ■ Window_BattleStatus
- #------------------------------------------------------------------------------
- # 战斗画面中,显示“队伍成员状态”的窗口。
- #==============================================================================
- class Window_BattleStatus < Window_Selectable
- #--------------------------------------------------------------------------
- # ☆ 绘制角色战斗用肖像图
- # enabled : 有效的标志。false 的时候使用半透明效果绘制
- #--------------------------------------------------------------------------
- def draw_face(face_name, face_index, x, y, enabled = true)
- bitmap = Cache.face(face_name)
- rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96 + 32, 96, 22)
- contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
- bitmap.dispose
- end
- #--------------------------------------------------------------------------
- # ☆ 绘制基本区域
- #--------------------------------------------------------------------------
- def draw_basic_area(rect, actor)
- draw_actor_face(actor, rect.x, rect.y + 1)
- contents.font.size = 16
- draw_actor_name(actor, rect.x, rect.y + 4, 100)
- contents.font.size = Font.default_size
- draw_actor_icons(actor, rect.x + 104, rect.y, rect.width - 104)
- end
- end
复制代码 [/fold]
36、战斗菜单添加一个查看状态的选项。
[fold=战斗中查看状态]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- #==============================================================================
- # ■ RGSS3 状況確認コマンド Ver1.05 by 星潟
- #------------------------------------------------------------------------------
- # RPGツクールVXAceでは、現在のステートや強化/弱体の表示数が
- # 著しく制限されており、非常に確認し辛いです。
- #
- # しかし、状況確認コマンドではステートを22個、強化/弱体も全て表示されます。
- #
- # パーティコマンドに、敵味方の現在能力値やステート/強化/弱体の状態を
- # 確認する為の新規コマンドを追加します。
- # 最初はアクターを表示し、LボタンかRボタンを押すことで
- # エネミーに表示を切り替えます。
- # アクターかエネミーを指定して決定キーを押すことで詳細表示を行います。
- # 詳細表示中に更に決定キーを押すと、属性耐性とステート耐性が表示されます。
- #
- # エネミーを表示しない機能や、詳細を表示せず
- # ステート/強化/弱体の確認に留めさせる設定も可能です。
- #
- # テストモードでの利用に限定する事も可能です。
- #------------------------------------------------------------------------------
- # Ver1.01 %表示に関する設定や、属性/ステート耐性の表示機能が追加されました。
- # Ver1.02 操作性を向上させました。
- # Ver1.03 隠れている敵を表示しないようにする機能を追加しました。
- # Ver1.04 詳細モードで敵のHPが表示限界でも見えてしまう不具合を修正しました。
- # また、表示限界の適用を敵のみにする機能を追加しました。
- # Ver1.05 システム側のTP表示設定が無効化されていてもTPが表示される不具合を修正。
- #==============================================================================
- module B_CONFIRM
-
- #テストモード限定化するか否かを設定します。
- #(trueで限定化/falseで常時使用可)
-
- TONLY = false
-
- #状況確認コマンドの名称を取得します。
-
- WORD1 = "状态"
-
- #ステート表示用の項目名を取得します。
-
- WORD2 = "状态"
-
- #強化/弱体表示用の項目名を取得します。
-
- WORD3 = ""
-
- #背景透過度を設定します。
-
- BOPAC = 255
-
- #控えメンバーも表示するかどうかを設定します。
- #(trueで表示/falseで非表示)
-
- PTMT = true
-
- #メンバーの詳細情報を表示するかどうかを設定します。
- #(trueで表示/falseで非表示)
-
- PTDT = true
-
- #ページ切り替えで敵も表示するかどうかを設定します。
- #(trueで表示/falseで非表示)
-
- TROK = true
-
- #敵の詳細情報を表示するかどうかを設定します。
- #(trueで表示/falseで非表示)
-
- TRDT = true
-
- #隠れている敵も表示するかどうかを指定します。
-
- HIDE = false
-
- #HP/MP/TPの表示限界値を設定します。
- #この値を以上の値となった時はTEXTの文字列を表示します。
-
- OVER = 10000
-
- #HP/MP/TPが表示限界値に達した際に、代わりに表示する文字列を設定します。
-
- TEXT = "?????"
-
- #表示限界に達した際に代わりに表示するのは敵のみにするかを設定します。
- #trueで敵のみ、falseで双方となります。
-
- EN_O = true
-
- #2ページ目を有効にするか否かを設定します。
- #(trueで有効/falseで無効)
-
- P2 = true
-
- #詳細情報での追加能力値の表示設定を行います。
- #[追加能力値ID(0~9の数字), 追加能力値名称(文字列), 敵も表示するか否か(true/false)]で
- #1セットとなっています。
-
- XPRM = [
- [0, "命中率", true],
- [1, "物理回避", true],
- [2, "必杀率", true],
- [3, "暴击回避", true],
- [4, "魔法回避", true],
- [5, "魔法反射", true],
- [6, "反击率", true],
- [7, "HP再生率", true],
- [8, "MP再生率", true],
- [9, "TP再生率", true]
- ]
-
- #追加能力値の後に%の文字を付けるか否かを設定します。
- #(trueで有効/falseで無効)
-
- ADP = false
-
- #詳細情報での特殊能力値の表示設定を行います。
- #[特殊能力値ID(0~9の数字), 特殊能力値名称(文字列), 敵も表示するか否か(true/false)]で
- #1セットとなっています。
-
- SPRM = [
- [0, "敌人目标", false],
- [1, "防御効果", false],
- [2, "回復効果", false],
- [3, "药的知识", false],
- [4, "MP消耗率", false],
- [5, "TP补充率", false],
- [6, "物攻抗性", false],
- [7, "魔法抗性", false],
- [9, "经验加成", false]
- ]
-
- #特殊能力値の後に%の文字を付けるか否かを設定します。
- #(trueで有効/falseで無効)
-
- SPP = false
-
- #詳細情報での属性有効度の表示設定を行います。
- #[属性ID, 属性名の後に付ける文字(文字列),
- #敵も表示するか否か(true/false),
- #100から該当の値を引いた数で表示するかを否か,
- #数字の後に付ける文字(文字列)]で
- #1セットとなっています。
-
- ELEM = [
- [3, "抗性", true, true],
- [4, "抗性", true, true],
- [5, "抗性", true, true],
- [6, "抗性", true, true],
- [7, "抗性", true, true],
- [8, "抗性", true, true],
- [9, "抗性", true, true],
- [10, "抗性", true, true],
- ]
-
- #属性有効度の後に%の文字を付けるか否かを設定します。
- #(trueで有効/falseで無効)
-
- ELP = false
-
- #1行目に表示するステートの最大数を指定します。
- #(2行目までしか想定していません)
-
- MAX = 11
-
- #詳細情報でのステート有効度の表示設定を行います。
- #[ステートID(0~-7で指定した場合は、絶対数の値の弱体有効度ID),
- #ステート名の後に付ける文字(文字列), 敵も表示するか否か(true/false),
- #100から該当の値を引いた数で表示するかを否か]で
- #1セットとなっています。
-
- STAT = [
- [1, "抗性", true, true],
- [2, "抗性", true, true],
- [3, "抗性", true, true],
- [4, "抗性", true, true],
- [5, "抗性", true, true],
- [6, "抗性", true, true],
- [7, "抗性", true, true],
- [8, "抗性", true, true],
- ]
-
- #ステート有効度の後に%の文字を付けるか否かを設定します。
- #(trueで有効/falseで無効)
-
- STP = false
-
- end
-
- #テストモード限定化されており、なおかつテストモードの場合か
- #テストモード限定化されていない場合は処理を行う。
-
- if (B_CONFIRM::TONLY && ($TEST or $BTEST)) or !B_CONFIRM::TONLY
-
- class Game_Troop < Game_Unit
- def unhidden_members
- B_CONFIRM::HIDE ? members : members.select {|e| !e.hidden?}
- end
- end
- class Game_Temp
- attr_accessor :b_confirm_limit_flag
- end
- class Window_Base < Window
- alias draw_current_and_max_values_overnumber draw_current_and_max_values
- def draw_current_and_max_values(x, y, width, current, max, color1, color2)
-
- #状況確認ウィンドウである場合のみ
- #現在値と最大値を必要に応じて読み替える。
-
- if (self.is_a?(Window_B_Confirm) or self.is_a?(Window_B_Confirm_Detail)) && $game_temp.b_confirm_limit_flag
- current = B_CONFIRM::TEXT if current >= B_CONFIRM::OVER
- max = B_CONFIRM::TEXT if max >= B_CONFIRM::OVER
- end
-
- #本来の処理を実行する。
-
- draw_current_and_max_values_overnumber(x, y, width, current, max, color1, color2)
- end
- end
- class Window_PartyCommand < Window_Command
- #--------------------------------------------------------------------------
- # コマンドリストの作成
- #--------------------------------------------------------------------------
- alias make_command_list_b_confirm make_command_list
- def make_command_list
-
- #本来の処理を実行する。
-
- make_command_list_b_confirm
-
- #状況確認コマンドを追加する。
-
- add_command(B_CONFIRM::WORD1, :b_confirm)
- end
- end
- class Window_B_Confirm < Window_Selectable
- attr_accessor :end_flag
- attr_accessor :display_mode
- attr_accessor :last_actor
- def initialize(x, y, type, actor = nil)
-
- #各種データを取得する。
-
- @display_mode = type
- @last_actor = actor
- @end_flag = false
-
- #ウィンドウを作成する。
-
- super(x, y, window_width, window_height)
-
- #背景透過度を設定する。
-
- self.back_opacity = B_CONFIRM::BOPAC
-
- activate
-
- self.index = 0
-
- #描写を行う。
-
- refresh
-
- end
- #--------------------------------------------------------------------------
- # フレーム更新
- #--------------------------------------------------------------------------
- def update
-
- #ウィンドウを閉じている最中は何もしない。
-
- return if @end_flag
-
- super
-
- return if !self.active
-
- if Input.trigger?(:B)#キャンセルキーを押した場合
-
- #キャンセルのSEを鳴らす。
-
- Sound.play_cancel
-
- @end_flag = true
- @last_actor = nil
- @display_mode = 2
-
- elsif Input.trigger?(:C)#決定キーを押した場合
-
- #バトラーが指定されていない場合はウィンドウを閉じる。
- #バトラーが指定されている場合はウィンドウを切り替える。
- case @display_mode
- when 0
- actor = B_CONFIRM::PTMT ? $game_party.all_members[index] : $game_party.members[index]
- when 1
- actor = $game_troop.unhidden_members[index]
- end
-
- #バトラーがアクターであり、なおかつアクターの詳細表示が可能な場合
- #あるいはバトラーがエネミーであり、なおかつエネミーの詳細表示が可能な場合続行。
-
- return if actor.actor? && !B_CONFIRM::PTDT
- return if !actor.actor? && !B_CONFIRM::TRDT
-
- #OKのSEを鳴らす。
-
- Sound.play_ok
-
- @end_flag = true
- @last_actor = actor
-
- elsif (Input.trigger?(:L) or Input.trigger?(:R)) && B_CONFIRM::TROK
-
- #カーソルのSEを鳴らす。
-
- Sound.play_cursor
-
- #ウィンドウを作り直す準備を行う。
-
- @end_flag = true
- @last_actor = nil
- @display_mode = @display_mode == 0 ? 1 : 0
-
- end
- end
- #--------------------------------------------------------------------------
- # ウィンドウ幅の取得
- #--------------------------------------------------------------------------
- def window_width
- Graphics.width
- end
- #--------------------------------------------------------------------------
- # ウィンドウ高さの取得
- #--------------------------------------------------------------------------
- def window_height
- Graphics.height
- end
- #--------------------------------------------------------------------------
- # 項目数の取得
- #--------------------------------------------------------------------------
- def item_max
-
- #バトラーが指定されていない場合は項目数は1個にする。
-
- return 1 if @last_actor != nil
-
- #アクターかエネミーのどちらを表示するかで処理を分岐し
- #それぞれ設定に適した値を返す。
-
- case @display_mode
- when 0
- B_CONFIRM::PTMT ? $game_party.all_members.size : $game_party.members.size
- when 1
- $game_troop.unhidden_members.size
- end
- end
- #--------------------------------------------------------------------------
- # 項目の高さを取得
- #--------------------------------------------------------------------------
- def item_height
- (height - standard_padding * 2) / 4
- end
- #--------------------------------------------------------------------------
- # 項目の描画
- #--------------------------------------------------------------------------
- def draw_item(index)
-
- #バトラーが指定されているか否かで処理を分岐。
-
- if @last_actor == nil
-
- #アクターかエネミーのどちらを表示するかで設定に応じて処理を分岐。
-
- case @display_mode
- when 0
- actor = B_CONFIRM::PTMT ? $game_party.all_members[index] : $game_party.members[index]
- when 1
- actor = $game_troop.unhidden_members[index]
- end
-
- #項目の矩形を取得。
-
- rect = item_rect(index)
-
- #項目内のデータを描写していく。
-
- $game_temp.b_confirm_limit_flag = (!B_CONFIRM::EN_O or (B_CONFIRM::EN_O && @display_mode == 1))
- draw_actor_name(actor, rect.x, rect.y)
- draw_actor_hp(actor, rect.x + 4, rect.y + line_height * 1)
- draw_actor_mp(actor, rect.x + 4, rect.y + line_height * 2)
- draw_actor_tp(actor, rect.x + 4, rect.y + line_height * 3) if $data_system.opt_display_tp
- self.contents.font.color = system_color
- draw_text(rect.x + 150, rect.y + line_height * 1, 96, line_height, B_CONFIRM::WORD2)
- draw_text(rect.x + 150, rect.y + line_height * 3, 96, line_height, B_CONFIRM::WORD3)
- self.contents.font.color = normal_color
- icons_width = (rect.width - rect.x - 150 - 96) / 24
- icons = (actor.state_icons)[0, icons_width]
- icons.each_with_index {|n, i| draw_icon(n, rect.x + 246 + 24 * i, rect.y + line_height * 1) }
- icons = (actor.state_icons)[icons_width, icons_width * 2]
- icons.each_with_index {|n, i| draw_icon(n, rect.x + 246 + 24 * i, rect.y + line_height * 2) } if icons != nil
- icons = (actor.buff_icons)[0, icons_width]
- icons.each_with_index {|n, i| draw_icon(n, rect.x + 246 + 24 * i, rect.y + line_height * 3) }
-
- end
- end
- #--------------------------------------------------------------------------
- # 決定ボタンが押されたときの処理(邪魔なので消す)
- #--------------------------------------------------------------------------
- def process_ok
- end
- #--------------------------------------------------------------------------
- # キャンセルボタンが押されたときの処理(邪魔なので消す)
- #--------------------------------------------------------------------------
- def process_cancel
- end
- #--------------------------------------------------------------------------
- # Lボタンが押されたときの処理(邪魔なので消す)
- #--------------------------------------------------------------------------
- def process_pageup
- end
- #--------------------------------------------------------------------------
- # Rボタンが押されたときの処理(邪魔なので消す)
- #--------------------------------------------------------------------------
- def process_pagedown
- end
- end
-
- class Window_B_Confirm_Detail < Window_Base
- attr_accessor :window_b_confirm
- attr_accessor :end_flag
- #--------------------------------------------------------------------------
- # 初期化
- #--------------------------------------------------------------------------
- def initialize(window_b_confirm)
- @page_data = 0
- @window_b_confirm = window_b_confirm
- @end_flag = false
- super(0, 0, window_width, window_height)
-
- #背景透過度を設定する。
-
- self.back_opacity = B_CONFIRM::BOPAC
-
- refresh
- end
- #--------------------------------------------------------------------------
- # ウィンドウ幅の取得
- #--------------------------------------------------------------------------
- def window_width
- Graphics.width
- end
- #--------------------------------------------------------------------------
- # ウィンドウ高さの取得
- #--------------------------------------------------------------------------
- def window_height
- Graphics.height
- end
- #--------------------------------------------------------------------------
- # フレーム更新
- #--------------------------------------------------------------------------
- def update
- super
- if Input.trigger?(:B)#キャンセルキーを押した場合
-
- #キャンセルのSEを鳴らす。
-
- Sound.play_cancel
- @end_flag = true
-
- elsif page_change? #決定キー、左右キー、LRボタンを押した場合
-
- Sound.play_cursor
- @page_data = @page_data == 0 ? 1 : 0
- contents.clear
- refresh
-
- end
- end
- #--------------------------------------------------------------------------
- # ページ切り替えを行うか?
- #--------------------------------------------------------------------------
- def page_change?
- flag = false
- [:C, :L, :R, :LEFT, :RIGHT].each {|k|flag = true if Input.trigger?(k)}
- flag
- end
- #--------------------------------------------------------------------------
- # リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- #バトラーを取得。
-
- actor = @window_b_confirm.last_actor
-
- #項目内のデータを描写していく。
-
- draw_actor_name(actor, x, y)
- $game_temp.b_confirm_limit_flag = (!B_CONFIRM::EN_O or (B_CONFIRM::EN_O && !actor.actor?))
- draw_actor_hp(actor, x + 4, y + line_height * 1)
- draw_actor_mp(actor, x + 4, y + line_height * 2)
- draw_actor_tp(actor, x + 4, y + line_height * 3) if $data_system.opt_display_tp
- self.contents.font.color = system_color
- draw_text(x + 150, y + line_height * 1, 96, line_height, B_CONFIRM::WORD2)
- draw_text(x + 150, y + line_height * 3, 96, line_height, B_CONFIRM::WORD3)
- self.contents.font.color = normal_color
- icons_width = (width - x - 162 - 96) / 24
- icons = (actor.state_icons)[0, icons_width]
- icons.each_with_index {|n, i| draw_icon(n, x + 246 + 24 * i, y + line_height * 1) }
- icons = (actor.state_icons)[icons_width, icons_width * 2]
- icons.each_with_index {|n, i| draw_icon(n, x + 246 + 24 * i, y + line_height * 2) } if icons != nil
- icons = (actor.buff_icons)[0, icons_width]
- icons.each_with_index {|n, i| draw_icon(n, x + 246 + 24 * i, y + line_height * 3) }
- draw_horz_line(line_height * 4)
-
- if @page_data == 0
-
- 6.times {|i|draw_actor_param(actor, x, y + line_height * (5 + i), (i + 2))}
- ex_xprms_draw(actor, x, y)
- ex_sprms_draw(actor, x, y)
-
- else
-
- ex_elem_draw(actor, x, y)
- ex_state_draw(actor, x, y)
-
- end
- end
- #--------------------------------------------------------------------------
- # 水平線の色を取得(Window_Statusからそのままコピー)
- #--------------------------------------------------------------------------
- def line_color
- color = normal_color
- color.alpha = 48
- color
- end
- #--------------------------------------------------------------------------
- # 水平線の描画(Window_Statusからそのままコピー)
- #--------------------------------------------------------------------------
- def draw_horz_line(y)
- line_y = y + line_height / 2 - 1
- contents.fill_rect(0, line_y, contents_width, 2, line_color)
- end
- #--------------------------------------------------------------------------
- # 追加能力値
- #--------------------------------------------------------------------------
- def ex_xprms_draw(actor, x, y)
-
- #追加能力値の描写対象がない場合は飛ばす。
-
- return if B_CONFIRM::XPRM.empty?
-
- #追加能力値を描写する。
-
- B_CONFIRM::XPRM.each_with_index do |xp, i|
- next if !actor.actor? && !xp[2]
- change_color(system_color)
- draw_text(x + 170, y + line_height * (5 + i), 120, line_height, xp[1])
- change_color(normal_color)
- 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)
- end
- end
- #--------------------------------------------------------------------------
- # 特殊能力値
- #--------------------------------------------------------------------------
- def ex_sprms_draw(actor, x, y)
-
- #特殊能力値の描写対象がない場合は飛ばす。
-
- return if B_CONFIRM::SPRM.empty?
-
- #特殊能力値を描写する。
-
- B_CONFIRM::SPRM.each_with_index do |sp, i|
- next if !actor.actor? && !sp[2]
- change_color(system_color)
- draw_text(x + 344, y + line_height * (5 + i), 120, line_height, sp[1])
- change_color(normal_color)
- 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)
- end
- end
- #--------------------------------------------------------------------------
- # 属性有効度
- #--------------------------------------------------------------------------
- def ex_elem_draw(actor, x, y)
-
- #属性有効度の描写対象がない場合は飛ばす。
-
- return if B_CONFIRM::ELEM.empty?
-
- #属性有効度を描写する。
-
- B_CONFIRM::ELEM.each_with_index do |elem, i|
- next if !actor.actor? && !elem[2]
- change_color(system_color)
- name = $data_system.elements[elem[0]]
- data = (actor.element_rate(elem[0]) * 100).to_i
- data = (elem[3] ? (100 - data) : data).to_s
- draw_text(x, y + line_height * (5 + i), 120, line_height, name + elem[1])
- change_color(normal_color)
- draw_text(x + 110, y + line_height * (5 + i), 56, line_height, data + (B_CONFIRM::ELP ? "%" : ""), 2)
- end
- end
- #--------------------------------------------------------------------------
- # ステート有効度
- #--------------------------------------------------------------------------
- def ex_state_draw(actor, x, y)
-
- #ステート有効度の描写対象がない場合は飛ばす。
-
- return if B_CONFIRM::STAT.empty?
-
- #ステート有効度を描写する。
-
- B_CONFIRM::STAT.each_with_index do |state, i|
- next if !actor.actor? && !state[2]
- change_color(system_color)
- x_data = i < B_CONFIRM::MAX ? 170 : 344
- if state[0] > 0
- name = $data_states[state[0]].name
- data = (actor.state_rate(state[0]) * 100).to_i
- data = (state[3] ? (100 - data) : data).to_s
- else
- state_id = state[0].abs
- name = Vocab.param(state_id)
- data = (actor.debuff_rate(state_id) * 100).to_i
- data = (state[3] ? (100 - data) : data).to_s
- end
- draw_text(x + x_data, y + line_height * (5 + i - (i < B_CONFIRM::MAX ? 0 : B_CONFIRM::MAX)), 120, line_height, name + state[1])
- change_color(normal_color)
- 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)
- end
- end
- end
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # パーティコマンドウィンドウの作成
- #--------------------------------------------------------------------------
- alias create_party_command_window_b_confirm create_party_command_window
- def create_party_command_window
-
- #本来の処理を実行。
-
- create_party_command_window_b_confirm
-
- #状況確認コマンド用のハンドラを追加。
-
- @party_command_window.set_handler(:b_confirm, method(:command_b_confirm))
- end
- #--------------------------------------------------------------------------
- # コマンド[状況確認]
- #--------------------------------------------------------------------------
- def command_b_confirm
-
- #状況確認コマンドの処理内容を実行。
-
- b_confirm_execute
- end
- #--------------------------------------------------------------------------
- # 状況確認開始
- #--------------------------------------------------------------------------
- def b_confirm_execute
-
- #状況確認ウィンドウを作成。
-
- @b_confirm_window = Window_B_Confirm.new(0, 0, 0)
-
- #処理をループで処理。
-
- loop do
-
- #とりあえずアップデートは行う。
-
- update
-
- #状況確認ウィンドウがアクティブであり
- #なおかつ操作終了フラグが有効な場合は分岐。
-
- if @b_confirm_window.active && @b_confirm_window.end_flag
-
- #表示モードが2の時、ループを終了する。
-
- break if @b_confirm_window.display_mode == 2
-
- #操作終了フラグをfalseにする。
-
- @b_confirm_window.end_flag = false
-
- #最後にキャラクターを選択している場合
-
- if @b_confirm_window.last_actor != nil
-
- #状況確認ウィンドウのアクティブ状態を解除し
- #詳細ウィンドウを作成する。
-
- @b_confirm_window.deactivate
- @b_confirm_detail_window = Window_B_Confirm_Detail.new(@b_confirm_window)
-
- #最後にキャラクターを選択していない場合
-
- else
-
- #状況確認ウィンドウを解放する。
-
- @b_confirm_window.dispose
-
- #状況確認ウィンドウを作り直す。
-
- @b_confirm_window = Window_B_Confirm.new(0, 0, (@b_confirm_window.display_mode == 0 ? 0 : 1))
-
- end
-
- #詳細ウィンドウが存在し、なおかつ終了フラグが有効な場合。
-
- elsif @b_confirm_detail_window != nil && @b_confirm_detail_window.end_flag
-
- #詳細ウィンドウを解放し、nil扱いとする。
-
- @b_confirm_detail_window.dispose
- @b_confirm_detail_window = nil
-
- #最後に選択したアクターをnilとする。
-
- @b_confirm_window.last_actor = nil
-
- #状況確認ウィンドウをアクティブ化する。
-
- @b_confirm_window.activate
- end
- end
-
- #状況確認ウィンドウを解放する。
-
- @b_confirm_window.dispose
-
- #パーティコマンドウィンドウをアクティブにする。
-
- @party_command_window.activate
- end
- end
- end
复制代码 [/fold]
37、战斗菜单添加一个更换装备选项。
[fold=战斗中更换装备][/fold]
38、一个改了很久才完成的饥饿值系统,每个角色头像下面都有自己的变量显示槽,由于打开默认状态显示会乱坐标,要配合第二个详细状态脚本使用。
[fold=饥饿值显示]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- #==============================================================================
- # *饥饿变量显示槽 *
- #==============================================================================
- module Freya
- QWE = Color.new(192,128,255)
- QWE = Color.new(-255,255,-255)
- end
- #==============================================================================
- # ■ Window_Base
- #------------------------------------------------------------------------------
- # 游戏中所有窗口的父类
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● 绘制饥饿
- #--------------------------------------------------------------------------
- def draw_actor_level(actor, x, y)
- a = 100 #显示每个角色最大变量数值
- b = b = a-$game_variables[actor.id+20] #显示角色附加变量ID(角色1id+28=29)
- rate = 1 - (b.to_f / a)
- draw_gauge(x - 106, y + 40, 94, rate,Freya::QWE, Freya::QWE)
- change_color(system_color)
- draw_text(x - 106, y + 36, 26, line_height, "")
- change_color(normal_color)
- draw_text(x + 22, y, 24, line_height, actor.level, 2)
- draw_icon(10, x - 110, y + 42, true) #10是显示10号图标
- end
- end
复制代码 [/fold]
39、一个不错的技能,魔法师可以牺牲MP来抵挡伤害。
[fold=魔法盾]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- class Game_Battler < Game_BattlerBase
-
- STATE_ID = 25 #魔法盾状态的id号
- MP_RATE = 1 #魔法盾吸收伤害的比率0.4就是10点伤害hp6点mp4点
-
- #--------------------------------------------------------------------------
- # ● 计算伤害
- #--------------------------------------------------------------------------
- def make_damage_value(user, item)
- value = item.damage.eval(user, self, $game_variables)
- value *= item_element_rate(user, item)
- value *= pdr if item.physical?
- value *= mdr if item.magical?
- value *= rec if item.damage.recover?
- value = apply_critical(value) if @result.critical
- value = apply_variance(value, item.damage.variance)
- value = apply_guard(value)
- if item.damage.to_hp? and self.state?(STATE_ID)
- mp_value = [(value * MP_RATE).to_i , self.mp].min
- value -= mp_value
- self.mp -= mp_value
- end
- @result.make_damage(value.to_i, item)
- end
- end
复制代码 [/fold]
40、失去一件装备换取一次重生,建议这件装备是饰品。
[fold=生命石]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- #脚本默认100护甲ID,可自行在下面修改。
- class Game_Actor
- def add_state(state_id)
- item = $data_armors[100] # 100 为护甲ID
- if state_id == death_state_id && armors.include?(item)
- discard_equip(item)
- recover_all
- else
- super
- end
- end
- end
复制代码 [/fold]
41、装备界面添加几项能力显示。
[fold=装备界面扩展]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- #encoding:utf-8
- #==============================================================================
- # ■ Window_EquipStatus
- #------------------------------------------------------------------------------
- # 装备画面中,显示角色能力值变化的窗口。
- #==============================================================================
- class Window_EquipStatus < Window_Base
- # 0 最大HP Maximum Hit Point
- # 1 最大MP Maximum Magic Point
- # 2 物理攻击 ATtacK power
- # 3 物理防御 DEFense power
- # 4 魔法攻击 Magic ATtack power
- # 5 魔法防御 Magic DeFense power
- # 6 敏 捷 值 AGIlity
- # 7 幸 运 值 LUcK
- # x0 成功几率 HIT rate
- # x1 闪避几率 EVAsion rate
- # x2 必杀几率 CRItical rate
- # x3 闪避必杀几率 Critical EVasion rate
- # x4 闪避魔法几率 Magic EVasion rate
- # x5 反射魔法几率 Magic ReFlection rate
- # x6 反击几率 CouNTer attack rate
- # x7 HP再生速度 Hp ReGeneration rate
- # x8 MP再生速度 Mp ReGeneration rate
- # x9 TP再生速度 Tp ReGeneration rate
- # s0 受到攻击的几率 TarGet Rate
- # s1 防御效果比率 GuaRD effect rate
- # s2 恢复效果比率 RECovery effect rate
- # s3 药理知识 PHArmacology
- # s4 MP消费率 Mp Cost Rate
- # s5 TP消耗率 Tp Charge Rate
- # s6 物理伤害加成 Physical Damage Rate
- # s7 魔法伤害加成 Magical Damage Rate
- # s8 地形伤害加成 Floor Damage Rate
- # s9 经验获得加成 EXperience Rate
- Params = [
- ["力量", "actor.param(2)"],
- ["防御", "actor.param(3)"],
- ["智慧", "actor.param(4)"],
- ["精神", "actor.param(5)"],
- ["速度", "actor.param(6)"],
- ["幸运", "actor.param(7)"],
- ["命中", "actor.xparam(0) * 100"],
- ["物避", "actor.xparam(1) * 100"],
- ["魔避", "actor.xparam(4) * 100"],
- ["恢复", "actor.sparam(3) * 100"],
- ["必杀", "actor.xparam(3) * -100"],
- ["反击", "actor.xparam(6) * 100"],
- ["反射", "actor.xparam(5) * 100"],
- ["伤害", "(actor.sparam(6) + actor.sparam(7) + actor.sparam(8)) / 3.0 * 100"],
- ["受敌", "actor.sparam(0) * 100"],
- ]
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize(x, y, height)
- super(x, y, window_width, height)
- @actor = nil
- @temp_actor = nil
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 获取显示行数
- #--------------------------------------------------------------------------
- def visible_line_number
- return Params.size
- end
- #--------------------------------------------------------------------------
- # ● 获取行高
- #--------------------------------------------------------------------------
- def line_height
- return contents.font.size
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- y = 0
- contents.clear
- contents.font.size = 24
- if @actor
- draw_actor_name(@actor, 4, 0)
- y += line_height
- end
- contents.font.size = 20 #字体大小
- Params.each {|i| draw_item(0, y, i); y += line_height }
- end
- #--------------------------------------------------------------------------
- # ● 绘制能力值的名字
- #--------------------------------------------------------------------------
- def draw_param_name(x, y, param_name)
- change_color(system_color)
- draw_text(x, y, 80, line_height, param_name)
- end
- #--------------------------------------------------------------------------
- # ● 计算能力值 by orzFly
- #--------------------------------------------------------------------------
- def calc_param(actor, param_formal)
- Kernel.eval(param_formal).to_i rescue 0
- end
- #--------------------------------------------------------------------------
- # ● 绘制当前能力值
- #--------------------------------------------------------------------------
- def draw_current_param(x, y, param_id)
- change_color(normal_color)
- draw_text(x, y, 32, line_height, calc_param(@actor, param_id), 2)
- end
- #--------------------------------------------------------------------------
- # ● 绘制更换装备后的能力值
- #--------------------------------------------------------------------------
- def draw_new_param(x, y, param_id)
- new_value = calc_param(@temp_actor, param_id)
- change_color(param_change_color(new_value - calc_param(@actor, param_id)))
- draw_text(x, y, 32, line_height, new_value, 2)
- end
- #--------------------------------------------------------------------------
- # ● 绘制项目
- #--------------------------------------------------------------------------
- def draw_item(x, y, param)
- draw_param_name(x + 4, y, param[0])
- draw_current_param(x + 94, y, param[1]) if @actor
- draw_right_arrow(x + 126, y)
- draw_new_param(x + 150, y, param[1]) if @temp_actor
- end
- end
- #==============================================================================
- # ■ Window_EquipItem
- #------------------------------------------------------------------------------
- # 装备画面中,显示可替换装备的窗口。
- #==============================================================================
- class Window_EquipItem < Window_ItemList
- def col_max
- return 1
- end
- end
- #==============================================================================
- # ■ Scene_Equip
- #------------------------------------------------------------------------------
- # 装备画面
- #==============================================================================
- class Scene_Equip < Scene_MenuBase
- #--------------------------------------------------------------------------
- # ● 生成状态窗口
- #--------------------------------------------------------------------------
- def create_status_window
- @status_window = Window_EquipStatus.new(0, @help_window.height,
- Graphics.height - @help_window.height)
- @status_window.viewport = @viewport
- @status_window.actor = @actor
- end
- #--------------------------------------------------------------------------
- # ● 生成物品窗口
- #--------------------------------------------------------------------------
- def create_item_window
- wx = @status_window.width
- wy = @slot_window.y + @slot_window.height
- ww = Graphics.width - @status_window.width
- wh = Graphics.height - wy
- @item_window = Window_EquipItem.new(wx, wy, ww, wh)
- @item_window.viewport = @viewport
- @item_window.help_window = @help_window
- @item_window.status_window = @status_window
- @item_window.actor = @actor
- @item_window.set_handler(:ok, method(:on_item_ok))
- @item_window.set_handler(:cancel, method(:on_item_cancel))
- @slot_window.item_window = @item_window
- end
- end
复制代码 [/fold]
42、动态敌人,虽然看起来很变扭!但的确动了。
[fold=动态敌人]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- #==============================================================================
- # ★ RGSS3_バトラー表示拡張 Ver1.02
- #==============================================================================
- =begin
-
- 作者:tomoaky
- webサイト:ひきも記 ([url]http://hikimoki.sakura.ne.jp/[/url])
-
- 戦闘シーンにおいてエネミーのスプライトに以下の効果を適用します。
- ・ランダムに左右反転
- ・Y座標を元に拡大縮小をおこない遠近感を演出
- ・一定間隔で拡大縮小をおこない息遣いを演出
-
- 行動不可状態のエネミーは息遣いが自動的に一時停止します
-
- 2012.04.05 Ver1.02
- ・アクターグラフィックに効果を適用しないように修正
- デフォルトの戦闘シーンでは特に意味はありません
-
- 2011.12.20 Ver1.01
- ・解像度に合わせて遠近効果の基準となるY座標を自動計算するように修正
-
- 2011.12.15 Ver1.0
- 公開
-
- =end
-
- #==============================================================================
- # □ 設定項目
- #==============================================================================
- module TMBSPREX
- # 不适用镜像翻转的小队IDで指定
- NO_MIRROR_TROOP = []
-
- # 不适用镜像翻转的敌人IDで指定
- NO_MIRROR_ENEMY = []
-
- # 遠近効果不适用的小队をIDで指定
- NO_ZOOM_TROOP = []
-
- # 遠近効果不适用的敌人をIDで指定
- NO_ZOOM_ENEMY = []
-
- # 呼吸效果不适用的小队をIDで指定
- NO_BREATH_TROOP = []
-
- # 呼吸效果不适用的敌人をIDで指定
- NO_BREATH_ENEMY = []
- end
- # 【目前1/3的几率镜像翻转】
- #==============================================================================
- # ■ Sprite_Battler
- #==============================================================================
- class Sprite_Battler < Sprite_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- alias tmbsprex_sprite_battler_initialize initialize
- def initialize(viewport, battler = nil)
- tmbsprex_sprite_battler_initialize(viewport, battler)
- if battler && !battler.actor?
- unless TMBSPREX::NO_MIRROR_TROOP.include?($game_troop.troop.id)
- unless TMBSPREX::NO_MIRROR_ENEMY.include?(battler.enemy.id)
- self.mirror = (rand(0) == 0) # 1/3的几率镜像翻转
- end
- end
- unless TMBSPREX::NO_ZOOM_TROOP.include?($game_troop.troop.id)
- unless TMBSPREX::NO_ZOOM_ENEMY.include?(battler.enemy.id)
- border_y = Graphics.height * 65 / 100
- self.zoom_x = (battler.screen_y - border_y) * 0.005 + 1.0
- end
- end
- unless TMBSPREX::NO_BREATH_TROOP.include?($game_troop.troop.id)
- unless TMBSPREX::NO_BREATH_ENEMY.include?(battler.enemy.id)
- @zoom_max = rand(30) + 150
- @zoom_count = rand(@zoom_max)
- end
- end
- @use_tmbsprex = true
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- alias tmbsprex_sprite_battler_update update
- def update
- tmbsprex_sprite_battler_update
- if @use_tmbsprex
- self.zoom_y = self.zoom_x
- self.z = 50 + self.y
- if @zoom_max && @battler.movable?
- @zoom_count += 1
- @zoom_count = 0 if @zoom_count == @zoom_max
- f = Math.sin(Math::PI * @zoom_count / (@zoom_max / 2))
- self.zoom_y += f * 0.015 + 0.015
- end
- end
- end
- end
复制代码 [/fold]
43、简单易懂的物品制造系统,但不能制造装备。
[fold=物品制造1]- #打开脚本编辑器,将“物品制造1”“物品制造2”脚本插入到main上。
- #encoding:utf-8
- #==============================================================================
- # 本腳本來自www.66RPG.com,使用和轉載請保留此信息
- #==============================================================================
- #==============================================================================
- #使用说明:
- #每添加一个制造的类型,最上面的类别菜单就会多一项。
- #
- #添加类型的方法是运行:
- #$game_party.add_cook_type("合成","合成药品", true)
- #$game_party.add_cook_type("烹饪","烹饪食物", true)
- #
- #添加配方的方法:
- #$game_party.add_cookbook(配方名称, 配方介绍, 配方类别名称,材料的二维数组,产出物的二维数组,配方状态)
- #
- #举例:
- #$game_party.add_cookbook("初级补血药水", "制作初级补血药水", "制药",[[18,2]],[[1,1]],true)
- #
- #调用窗口的方法:SceneManager.call(Scene_Cook)
- #
- #
- #==============================================================================
- #==============================================================================
- # ■ Cookbook_Type
- #------------------------------------------------------------------------------
- # 食谱类型类。
- #==============================================================================
- class Cookbook_Type
- attr_reader :index
- attr_reader :name
- attr_reader :description
- attr_reader :enabled
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize(index, name, description, enabled = false)
- @index = index
- @name = name
- @description = description
- @enabled = enabled
- end
-
- def enable(en)
- @enabled = en
- end
- end
- #==============================================================================
- # ■ Cookbook
- #------------------------------------------------------------------------------
- # 食谱类。本类在 Game_Task 类的内部使用。
- # 食谱属性:食谱序号,食谱名称,食谱类型,食谱介绍,原料,成品
- #==============================================================================
- class Cookbook
- attr_reader :index
- attr_reader :name
- attr_reader :description
- attr_reader :type
- attr_reader :input
- attr_reader :output
- attr_reader :enabled
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize(index, name, description, type, input, output, enabled = true)
- @index = index
- @name = name
- @description = description
- @type = type
- @input = input
- @output = output
- @enabled = enabled
- end
-
- def enable(en)
- @enabled = en
- end
-
- #--------------------------------------------------------------------------
- # ● 查询列表中的物品
- #--------------------------------------------------------------------------
- def in_list?(item, list)
- list.each do |arr|
- return true if arr[0] == item.id
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 查询是否是材料列表中的物品
- #--------------------------------------------------------------------------
- def resource?(item)
- in_list?(item, @input)
- end
- #--------------------------------------------------------------------------
- # ● 查询是否是产出列表中的物品
- #--------------------------------------------------------------------------
- def output?(item)
- in_list?(item, @output)
- end
- #--------------------------------------------------------------------------
- # ● 查询材料需求量
- #--------------------------------------------------------------------------
- def amount(item, i)
- if i == 0
- @input.each do |arr|
- return arr[1] if arr[0] == item.id
- end
- else
- @output.each do |arr|
- return arr[1] if arr[0] == item.id
- end
- end
- return 0
- end
- #--------------------------------------------------------------------------
- # ● 查询材料是否足够
- #--------------------------------------------------------------------------
- def enough?
- input.each do |arr|
- return false if $data_items[arr[0]] && arr[1] > $game_party.item_number($data_items[arr[0]])
- end
- return true
- end
- #--------------------------------------------------------------------------
- # ● 查询某件材料是否足够
- #--------------------------------------------------------------------------
- def item_enough?(item)
- input.each do |arr|
- return false if arr[0] == item.id && arr[1] > $game_party.item_number(item)
- end
- return true
- end
- end
- #==============================================================================
- # ■ Game_Party
- #==============================================================================
- class Game_Party < Game_Unit
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- alias old_init initialize
- def initialize
- old_init
- @cook_types = []
- @cookbooks = []
- end
- #--------------------------------------------------------------------------
- # ● 添加新的制造类型
- #--------------------------------------------------------------------------
- def add_cook_type(n, d, en)
- @cook_types.push(Cookbook_Type.new(@cook_types.size, n, d, en)) if !have_cook_type?(n)
- end
- #--------------------------------------------------------------------------
- # ● 添加新的食谱
- #--------------------------------------------------------------------------
- def add_cookbook(n, d, type, input, output, en)
- if !have_cookbook?(n) && have_cook_type?(type)
- @cookbooks.push(Cookbook.new(@cookbooks.size, n, d, type, input, output, en))
- end
- end
- #--------------------------------------------------------------------------
- # ● 判断名称为n的制造类型是否存在
- #--------------------------------------------------------------------------
- def have_cook_type?(n)
- @cook_types.each do |x|
- return true if x.name == n
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 判断名称为n的食谱是否存在
- #--------------------------------------------------------------------------
- def have_cookbook?(n)
- @cookbooks.each do |x|
- return true if x.name == n
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 返回制造类型列表
- #--------------------------------------------------------------------------
- def cook_types
- return @cook_types
- end
- #--------------------------------------------------------------------------
- # ● 返回食谱列表
- #--------------------------------------------------------------------------
- def cookbooks(type = nil)
- return @cookbooks if type == nil
- arr = []
- @cookbooks.each do |x|
- arr.push(x) if x.type == type
- end
- return arr
- end
- #--------------------------------------------------------------------------
- # ● 更改序号为i的制造类型的使用状态
- #--------------------------------------------------------------------------
- def set_cook_type(i, en)
- @cook_types[i].enable(en)
- end
- #--------------------------------------------------------------------------
- # ● 更改序号为i的食谱的使用状态
- #--------------------------------------------------------------------------
- def set_cookbook(i, en)
- @cookbooks[i].enable(en)
- end
- #--------------------------------------------------------------------------
- # ● 返回制造类型数目
- #--------------------------------------------------------------------------
- def cook_types_size
- return @cook_types.size
- end
- #--------------------------------------------------------------------------
- # ● 查询名称为n的制造类型的描述
- #--------------------------------------------------------------------------
- def cook_type_description(n)
- @cook_types.each do |x|
- return x.description if x.name == n
- end
- return ""
- end
- end
- #==============================================================================
- # ■ Scene_Cook
- #------------------------------------------------------------------------------
- # 制造画面
- #==============================================================================
- class Scene_Cook < Scene_ItemBase
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- def start
- super
- create_category_window
- create_cookbook_window
- create_description_window
- create_needs_window
- end
- #--------------------------------------------------------------------------
- # ● 生成分类窗口
- #--------------------------------------------------------------------------
- def create_category_window
- @category_window = Window_CookCategory.new
- @category_window.viewport = @viewport
- @category_window.y = 0
- @category_window.set_handler(:ok, method(:on_category_ok))
- @category_window.set_handler(:cancel, method(:return_scene))
- end
- #--------------------------------------------------------------------------
- # ● 生成食谱窗口
- #--------------------------------------------------------------------------
- def create_cookbook_window
- wy = @category_window.height
- wh = Graphics.height - wy
- @item_window = Window_CookList.new(0, wy, Graphics.width*0.5 , wh)
- @item_window.viewport = @viewport
- @item_window.set_handler(:ok, method(:on_item_ok))
- @item_window.set_handler(:cancel, method(:on_item_cancel))
- @category_window.item_window = @item_window
- end
- #--------------------------------------------------------------------------
- # ● 生成描述窗口
- #--------------------------------------------------------------------------
- def create_description_window
- wy = @category_window.height
- @help_window = Window_Description.new(Graphics.width*0.5, wy)
- @help_window.viewport = @viewport
- @item_window.help_window = @help_window
- @category_window.help_window = @help_window
- end
- #--------------------------------------------------------------------------
- # ● 生成材料窗口
- #--------------------------------------------------------------------------
- def create_needs_window
- wy = @category_window.height + @help_window.height
- wh = Graphics.height - wy
- @needs_window = Window_NeedsList.new(Graphics.width*0.5, wy, Graphics.width*0.5 , wh)
- #@item_window.viewport = @viewport
- @item_window.needs_window = @needs_window
-
- end
- #--------------------------------------------------------------------------
- # ● 分类“确定”
- #--------------------------------------------------------------------------
- def on_category_ok
- @item_window.activate
- @item_window.select_last
- end
- #--------------------------------------------------------------------------
- # ● 食谱“确定”
- #--------------------------------------------------------------------------
- def on_item_ok
- #$game_party.last_item.object = item
- cook
- end
- #--------------------------------------------------------------------------
- # ● 食谱“取消”
- #--------------------------------------------------------------------------
- def on_item_cancel
- @item_window.unselect
- @category_window.activate
- end
- #--------------------------------------------------------------------------
- # ● 制造
- #--------------------------------------------------------------------------
- def cook
- if item.enough?
- play_se_for_item
- use_item
- @needs_window.refresh
- @item_window.refresh
- activate_item_window
- end
- end
- #--------------------------------------------------------------------------
- # ● 播放制作声效
- #--------------------------------------------------------------------------
- def play_se_for_item
- Sound.play_recovery
- end
- #--------------------------------------------------------------------------
- # ● 使用食谱
- #--------------------------------------------------------------------------
- def use_item
- #super
- #@item_window.redraw_current_item
- $data_items.each do |it|
- if it && !it.name.empty?
- $game_party.gain_item(it,-item.amount(it,0)) if item.resource?(it)
- $game_party.gain_item(it,item.amount(it,1)) if item.output?(it)
- end
- end
- end
- end
- #==============================================================================
- # ■ Window_CookCategory
- #------------------------------------------------------------------------------
- # 制造画面中,显示制造类型的窗口。
- #==============================================================================
- class Window_CookCategory < Window_HorzCommand
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_reader :item_window
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0)
- end
- #--------------------------------------------------------------------------
- # ● 获取窗口的宽度
- #--------------------------------------------------------------------------
- def window_width
- Graphics.width
- end
- #--------------------------------------------------------------------------
- # ● 获取列数
- #--------------------------------------------------------------------------
- def col_max
- return $game_party.cook_types_size
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- #@item_window.category = current_symbol if @item_window
- @item_window.category = current_data[:name] if @item_window
- end
- #--------------------------------------------------------------------------
- # ● 生成制造列表
- #--------------------------------------------------------------------------
- def make_command_list
- $game_party.cook_types.each do |t|
- add_command(t.name, t.index, t.enabled)
- end
- end
- #--------------------------------------------------------------------------
- # ● 设置制造列表窗口
- #--------------------------------------------------------------------------
- def item_window=(item_window)
- @item_window = item_window
- update
- end
- #--------------------------------------------------------------------------
- # ● 更新帮助内容
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text($game_party.cook_type_description(current_data[:name]))
- end
- end
- #==============================================================================
- # ■ Window_CookList
- #------------------------------------------------------------------------------
- # 任务画面中,显示已获得任务的窗口。
- #==============================================================================
- class Window_CookList < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_reader :needs_window
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize(x, y, width, height)
- super
- @data = []
- @category = $game_party.cook_types_size > 0 ? $game_party.cook_types[0].name : nil
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 设置分类
- #--------------------------------------------------------------------------
- def category=(category)
- return if @category == category
- @category = category
- refresh
- self.oy = 0
- end
- #--------------------------------------------------------------------------
- # ● 设置材料窗口
- #--------------------------------------------------------------------------
- def needs_window=(needs_window)
- @needs_window = needs_window
- update
- end
- #--------------------------------------------------------------------------
- # ● 获取列数
- #--------------------------------------------------------------------------
- def col_max
- return 1
- end
- #--------------------------------------------------------------------------
- # ● 获取项目数
- #--------------------------------------------------------------------------
- def item_max
- @data ? @data.size : 1
- end
- #--------------------------------------------------------------------------
- # ● 获取食谱
- #--------------------------------------------------------------------------
- def item
- @data && index >= 0 ? @data[index] : nil
- end
- #--------------------------------------------------------------------------
- # ● 获取选择食谱的有效状态
- #--------------------------------------------------------------------------
- def current_item_enabled?
- enable?(@data[index])
- end
- #--------------------------------------------------------------------------
- # ● 查询此食谱是否可用
- #--------------------------------------------------------------------------
- def enable?(item)
- item.enabled && item.enough?
- end
- #--------------------------------------------------------------------------
- # ● 生成食谱列表
- #--------------------------------------------------------------------------
- def make_item_list
- @data = $game_party.cookbooks(@category)
- end
- #--------------------------------------------------------------------------
- # ● 返回上一个选择的位置
- #--------------------------------------------------------------------------
- def select_last
- select(0)
- end
- #--------------------------------------------------------------------------
- # ● 绘制项目
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- if item
- rect = item_rect(index)
- rect.width -= 4
- draw_item_name(item, rect.x, rect.y, enable?(item))
- end
- end
- #--------------------------------------------------------------------------
- # ● 绘制名称
- # enabled : 有效的标志。false 的时候使用半透明效果绘制
- #--------------------------------------------------------------------------
- def draw_item_name(item, x, y, enabled = true, width = 300)
- return unless item
- text = item.name
- text += "[材料不足]" if !item.enough?
- change_color(normal_color, enabled)
- draw_text(x, y, width, line_height, text)
- end
- #--------------------------------------------------------------------------
- # ● 更新帮助内容
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_item(item)
- end
- #--------------------------------------------------------------------------
- # ● 更新食谱清单
- #--------------------------------------------------------------------------
- def update_needslist
- @needs_window.set_item(item)
- end
- #--------------------------------------------------------------------------
- # ● 调用帮助窗口的更新方法
- #--------------------------------------------------------------------------
- def call_update_help
- update_help if @help_window
- update_needslist if @needs_window
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- make_item_list
- create_contents
- draw_all_items
- end
- end
- #==============================================================================
- # ■ Window_Description
- #------------------------------------------------------------------------------
- # 显示食谱的说明的窗口
- #==============================================================================
- class Window_Description < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize(x, y)
- super(x, y, Graphics.width*0.5, fitting_height(4))
- end
- #--------------------------------------------------------------------------
- # ● 设置内容
- #--------------------------------------------------------------------------
- def set_text(text)
- if text != @text
- @text = text
- refresh
- end
- end
- #--------------------------------------------------------------------------
- # ● 清除
- #--------------------------------------------------------------------------
- def clear
- set_text("")
- end
- #--------------------------------------------------------------------------
- # ● 设置食谱的介绍
- #--------------------------------------------------------------------------
- def set_item(item)
- set_text(item ? item.description : "")
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_text_ex(4, 0, @text)
- end
- end
- #==============================================================================
- # ■ Window_NeedsList
- #------------------------------------------------------------------------------
- # 制造画面中,显示食谱所需材料的窗口。
- #==============================================================================
- class Window_NeedsList < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize(x, y, width, height)
- super
- @category = :item
- @cookbook = nil
- @data = []
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 获取列数
- #--------------------------------------------------------------------------
- def col_max
- return 1
- end
- #--------------------------------------------------------------------------
- # ● 获取项目数
- #--------------------------------------------------------------------------
- def item_max
- @data ? @data.size : 1
- end
- #--------------------------------------------------------------------------
- # ● 获取物品
- #--------------------------------------------------------------------------
- def item
- @data && index >= 0 ? @data[index] : nil
- end
- #--------------------------------------------------------------------------
- # ● 查询列表中是否含有此物品
- #--------------------------------------------------------------------------
- def include?(item)
- item.is_a?(RPG::Item) && !item.key_item?
- end
- #--------------------------------------------------------------------------
- # ● 获取选择食谱的有效状态
- #--------------------------------------------------------------------------
- def current_item_enabled?
- enable?(@data[index])
- end
- #--------------------------------------------------------------------------
- # ● 查询此食谱是否可用
- #--------------------------------------------------------------------------
- def enable?(item)
- $game_party.usable?(item) && @cookbook.item_enough?(item)
- end
- #--------------------------------------------------------------------------
- # ● 生成物品列表
- #--------------------------------------------------------------------------
- def make_item_list
- @data = []
- return if @cookbook== nil
- tmp1 = []
- tmp2 = []
- $data_items.each do |item|
- tmp1.push([item, 0]) if item && !item.name.empty? && @cookbook.resource?(item)
- tmp2.push([item, 1]) if item && !item.name.empty? && @cookbook.output?(item)
- end
- if tmp1.size > 0 && tmp2.size > 0
- @data.push(["需要材料:",0])
- @data += tmp1
- @data.push(["可以获得:",1])
- @data += tmp2
- end
- end
- #--------------------------------------------------------------------------
- # ● 返回上一个选择的位置
- #--------------------------------------------------------------------------
- def select_last
- select(0)
- end
- #--------------------------------------------------------------------------
- # ● 绘制项目
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- if item
- rect = item_rect(index)
- rect.width -= 4
- if item[0].is_a?(RPG::Item)
- draw_item_name(item, rect.x, rect.y, enable?(item[0]))
- draw_item_number(rect, item[0])
- else
- draw_input_output(item, rect.x, rect.y)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 绘制物品名称
- # enabled : 有效的标志。false 的时候使用半透明效果绘制
- #--------------------------------------------------------------------------
- def draw_item_name(item, x, y, enabled = true, width = 172)
- return unless item
- text = item[0].name + "*" + String(@cookbook.amount(item[0], item[1]))
- draw_icon(item[0].icon_index, x, y, enabled)
- change_color(normal_color, enable?(item[0]))
- draw_text(x + 24, y, width, line_height, text)
- end
- #--------------------------------------------------------------------------
- # ● 绘制输入和产出
- #--------------------------------------------------------------------------
- def draw_input_output(item, x, y, enabled = false, width = 172)
- return unless item
- if item[1] == 0
- text = "[需要]"
- else
- text = "[可以获得]"
- end
- change_color(normal_color, @cookbook.enough?)
- draw_text(x , y, width, line_height, text)
- end
- #--------------------------------------------------------------------------
- # ● 绘制物品个数
- #--------------------------------------------------------------------------
- def draw_item_number(rect, item)
- draw_text(rect, sprintf("现有%2d", $game_party.item_number(item)), 2)
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- make_item_list
- create_contents
- draw_all_items
- end
- #--------------------------------------------------------------------------
- # ● 设置食谱的材料
- #--------------------------------------------------------------------------
- def set_item(item)
- @cookbook = item
- refresh
- end
- end
- #==============================================================================
- # 本腳本來自www.66RPG.com,使用和轉載請保留此信息
- #==============================================================================
- # add by Sion 2013.12.17
- # 作者修改了原范例的菜单,但是在原系统脚本里改的。
- # 整理出来写在这里, 不需要改菜单的同学把这些删掉就可以。
- class Scene_Menu
- def command_cook
- SceneManager.call(Scene_Cook)
- end
- alias_method :s20131217_create_command_window, :create_command_window
- def create_command_window
- s20131217_create_command_window
- @command_window.set_handler(:cook, method(:command_cook))
- end
- end
- class Window_MenuCommand
- alias_method :s20131217_add_main_commands, :add_main_commands
- def add_main_commands
- s20131217_add_main_commands
- add_command("合成", :cook, main_commands_enabled)
- end
- end
复制代码 [/fold]
[fold=物品制造2]- class Game_Party < Game_Unit
- #--------------------------------------------------------------------------
- # ● 添加新的制造类型
- #--------------------------------------------------------------------------
- def add_cook_type(n, d, en)
- cook_types.push(Cookbook_Type.new(cook_types.size, n, d, en)) if !have_cook_type?(n)
- end
- #--------------------------------------------------------------------------
- # ● 添加新的食谱
- #--------------------------------------------------------------------------
- def add_cookbook(n, d, type, input, output, en)
- if !have_cookbook?(n) && have_cook_type?(type)
- cookbooks.push(Cookbook.new(cookbooks.size, n, d, type, input, output, en))
- end
- end
- #--------------------------------------------------------------------------
- # ● 判断名称为n的制造类型是否存在
- #--------------------------------------------------------------------------
- def have_cook_type?(n)
- cook_types.each do |x|
- return true if x.name == n
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 判断名称为n的食谱是否存在
- #--------------------------------------------------------------------------
- def have_cookbook?(n)
- cookbooks.each do |x|
- return true if x.name == n
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 返回制造类型列表
- #--------------------------------------------------------------------------
- def cook_types
- @cook_types = [] if @cook_types.nil?
- return @cook_types
- end
- #--------------------------------------------------------------------------
- # ● 返回食谱列表
- #--------------------------------------------------------------------------
- def cookbooks(type = nil)
- @cookbooks = [] if @cookbooks.nil?
- return @cookbooks if type == nil
- arr = []
- @cookbooks.each do |x|
- arr.push(x) if x.type == type
- end
- return arr
- end
- #--------------------------------------------------------------------------
- # ● 更改序号为i的制造类型的使用状态
- #--------------------------------------------------------------------------
- def set_cook_type(i, en)
- cook_types[i].enable(en)
- end
- #--------------------------------------------------------------------------
- # ● 更改序号为i的食谱的使用状态
- #--------------------------------------------------------------------------
- def set_cookbook(i, en)
- cookbooks[i].enable(en)
- end
- #--------------------------------------------------------------------------
- # ● 返回制造类型数目
- #--------------------------------------------------------------------------
- def cook_types_size
- return cook_types.size
- end
- #--------------------------------------------------------------------------
- # ● 查询名称为n的制造类型的描述
- #--------------------------------------------------------------------------
- def cook_type_description(n)
- cook_types.each do |x|
- return x.description if x.name == n
- end
- return ""
- end
- end
复制代码 [/fold]
44、如果有不想在战斗中显示的技能选项,那就用这个脚本来隐藏吧。
[fold=战斗中隐藏技能]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- class Window_ActorCommand
- Hide_Skill_Id = [15,16] # 不显示在战斗选项列表的技能类型ID
- def add_skill_commands
- @actor.added_skill_types.sort.each do |stype_id|
- name = $data_system.skill_types[stype_id]
- unless Hide_Skill_Id.include?(stype_id)
- add_command(name, :skill, true, stype_id)
- end
- end
- end
- end
复制代码 [/fold]
45、给对话添加声效,可改变对话速度。
[fold=对话声效]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- #==============================================================================
- # ★ RGSS3_メッセージ効果音 Ver1.1
- #==============================================================================
- =begin
- 作者:tomoaky
- webサイト:ひきも記 (http://hikimoki.sakura.ne.jp/)
- 文章の表示コマンド実行時、文字の表示と一緒に効果音を鳴らします。
- 制御文字 \B を使って効果音を再生するかどうかを設定できます。
- \B が出てくるたびに切り替わりますが AUTO_SE が true の場合は
- 最初から効果音が鳴る状態になっています。
- おまけ機能として文章の表示速度を変更することができます。
- 設定したゲーム変数(初期設定では8番)の値が大きければ大きいほど
- 表示速度は遅くなります。1 がデフォルトの速度で最低値です。
- 使用するゲーム変数(初期設定)
- 0008
-
- 2012.01.22 Ver1.1
- おまけ機能の文章表示速度変更を追加
-
- 2012.01.21 Ver1.0
- 公開
- =end
- #==============================================================================
- # □ 設定項目
- #==============================================================================
- module TMMESSAGESE
- MESSAGE_SE = RPG::SE.new("Cursor2", 70, 150) # Cursor2是声效文件名。
- AUTO_SE = true # true で自動的に再生、false で制御文字があったときのみ再生
-
- VN_MESSAGE_WAIT = 200 # 字显示速度变量控制ID
- end
- #==============================================================================
- # ■ Window_Message
- #==============================================================================
- class Window_Message
- #--------------------------------------------------------------------------
- # ● フラグのクリア
- #--------------------------------------------------------------------------
- alias tmmessagese_window_message_clear_flags clear_flags
- def clear_flags
- tmmessagese_window_message_clear_flags
- @se_flag = TMMESSAGESE::AUTO_SE
- end
- #--------------------------------------------------------------------------
- # ● 一文字出力後のウェイト
- #--------------------------------------------------------------------------
- alias tmessagese_window_message_wait_for_one_character wait_for_one_character
- def wait_for_one_character
- [$game_variables[TMMESSAGESE::VN_MESSAGE_WAIT], 1].max.times do |i|
- tmessagese_window_message_wait_for_one_character
- end
- end
- #--------------------------------------------------------------------------
- # ● 通常文字の処理
- #--------------------------------------------------------------------------
- alias tmmessagese_window_message_process_normal_character process_normal_character
- def process_normal_character(c, pos)
- tmmessagese_window_message_process_normal_character(c, pos)
- TMMESSAGESE::MESSAGE_SE.play if @se_flag
- end
- #--------------------------------------------------------------------------
- # ● 制御文字の処理
- # code : 制御文字の本体部分(「\C[1]」なら「C」)
- # text : 描画処理中の文字列バッファ(必要なら破壊的に変更)
- # pos : 描画位置 {:x, :y, :new_x, :height}
- #--------------------------------------------------------------------------
- alias tmmessage_window_message_process_escape_character process_escape_character
- def process_escape_character(code, text, pos)
- case code.upcase
- when 'B'
- @se_flag ^= true
- else
- tmmessage_window_message_process_escape_character(code, text, pos)
- end
- end
- end
复制代码 [/fold]
46、非常不错的脚本,就是有点鸡肋!每次更新游戏添加新装备读档得到装备是空白的,要重新开档才能显示。所以这个脚本留着等游戏制作完结再放上去。
[fold=随机属性装备]- #使用方法:打开脚本编辑器,将脚本插入到main上。
- #encoding:utf-8
- #==============================================================================
- # ■ 随机属性装备 By wyongcan
- #==============================================================================
- #说明性注释
- #==============================================================================
- # FEATURE_ELEMENT_RATE = 11 # 属性抗性
- # FEATURE_DEBUFF_RATE = 12 # 弱化抗性
- # FEATURE_STATE_RATE = 13 # 状态抗性
- # FEATURE_STATE_RESIST = 14 # 状态免疫
- # FEATURE_PARAM = 21 # 普通能力
- # FEATURE_XPARAM = 22 # 添加能力
- # FEATURE_SPARAM = 23 # 特殊能力
- # FEATURE_ATK_ELEMENT = 31 # 攻击附带属性
- # FEATURE_ATK_STATE = 32 # 攻击附带状态
- # FEATURE_ATK_SPEED = 33 # 修正攻击速度
- # FEATURE_ATK_TIMES = 34 # 添加攻击次数
- # FEATURE_STYPE_ADD = 41 # 添加技能类型
- # FEATURE_STYPE_SEAL = 42 # 禁用技能类型
- # FEATURE_SKILL_ADD = 43 # 添加技能
- # FEATURE_SKILL_SEAL = 44 # 禁用技能
- # FEATURE_EQUIP_WTYPE = 51 # 可装备武器类型
- # FEATURE_EQUIP_ATYPE = 52 # 可装备护甲类型
- # FEATURE_EQUIP_FIX = 53 # 固定装备
- # FEATURE_EQUIP_SEAL = 54 # 禁用装备
- # FEATURE_SLOT_TYPE = 55 # 装备风格
- # FEATURE_ACTION_PLUS = 61 # 添加行动次数
- # FEATURE_SPECIAL_FLAG = 62 # 特殊标志
- # FEATURE_COLLAPSE_TYPE = 63 # 消失效果
- # FEATURE_PARTY_ABILITY = 64 # 队伍能力
- #--------------------------------------------------------------------------
- # ● 特殊标志
- #--------------------------------------------------------------------------
- # 自动战斗 0 # 擅长防御 1 # 保护弱者 2 # 特技专注 3
- #--------------------------------------------------------------------------
- # ● 各种能力值的简易访问方法
- #--------------------------------------------------------------------------
- # ——普通能力——
- # 物理攻击 2 # 物理防御 3 # 魔法攻击 4 # 魔法防御 5 # 敏捷值 6 # 幸运值 7
- # ——添加能力——
- # 成功几率 1 # 必杀几率 2 # 闪避必杀几率 3 # 闪避魔法几率 4
- # 反射魔法几率 5 # 反击几率 6 # HP再生速度 7 # MP再生速度 8 # TP再生速度 9
- # ——特殊能力——
- #(0) 受到攻击的几率
- #(1) 防御效果比率
- #(2) 恢复效果比率
- #(3) 药理知识
- #(4) MP消费率
- #(5) TP消耗率
- #(6) 物理伤害加成
- #(7) 魔法伤害加成
- #(8) 地形伤害加成
- #(9) 经验获得加成
- #————————————————————————————————————————
- module Equipplus
- #得到随机属性装备方法:gainequip(装备ID,属性数)
- #~ 前缀结构:
- #~ ①权重(1-100) 越大越重要
- #~ ②名称(多个名称用","分开,会随机取其中一个添加到武器名前)
- #~ ③属性数组 提供两种方式:
- #~ 1.[属性ID,增加值] 属性ID参考说明增强脚本 增加了9号属性“极品出现率” ID为8,影响前缀的好坏 1 - 100
- #~ 2.与装备特性相同[code,data_id,value] code,data_id参考说明增强脚本
- @maxparamplus = 3 #最大前缀数
- @moneyrate = 15 #物品价格计算公式为:原价格 + 前缀权重 * @moneyrate
- @transpose = [*1..100].reverse #用于把1变成100,100变成1
- @paramsplus = [ #暂时写了三个前缀,可以自己添加,参照前缀结构
- [16,"",[[0,10]]],# 附加10HP
- [16,"",[[1,10]]],# 附加10MP
- [22,"",[[0,15]]],# 附加15HP
- [22,"",[[1,15]]],# 附加15MP
- [28,"",[[0,20]]],#附加20HP
- [28,"",[[1,20]]],# 附加20MP
- [18,"",[[2,4]]], #附加4点物理攻击
- [18,"",[[3,4]]], #附加4点防御攻击
- [18,"",[[4,4]]],#附加4魔法攻击
- [18,"",[[5,4]]],#附加4魔法防御
- [18,"",[[6,4]]], #附加4速度
- [26,"",[[2,8]]], #物理攻击
- [26,"",[[3,8]]], #防御攻击
- [26,"",[[4,8]]],#魔法攻击
- [26,"",[[5,8]]],# 魔法防御
- [26,"",[[6,8]]], #速度
- [34,"",[[2,12]]], #物理攻击
- [34,"",[[3,12]]], #防御攻击
- [34,"",[[4,12]]],#魔法攻击
- [34,"",[[5,12]]],# 魔法防御
- [34,"",[[6,12]]], #速度
- [17,"",[[22,0,0.06]]],# 命中
- [17,"",[[22,1,0.06]]],# 物理躲避
- [17,"",[[22,2,0.06]]],# 必杀
- [17,"",[[22,3,0.06]]],# 必杀躲避
- [17,"",[[22,4,0.06]]],# 魔法躲避
- [17,"",[[22,5,0.06]]],# 魔法反射
- [17,"",[[22,6,0.06]]],# 物理反击
- [31,"",[[22,0,0.1]]],# 命中
- [31,"",[[22,1,0.1]]],# 物理躲避
- [31,"",[[22,2,0.1]]],# 必杀
- [31,"",[[22,3,0.1]]],# 必杀躲避
- [31,"",[[22,4,0.1]]],# 魔法躲避
- [31,"",[[22,5,0.1]]],# 魔法反射
- [31,"",[[22,6,0.1]]],# 物理反击
- [24,"",[[22,0,0.08]]],# 命中
- [24,"",[[22,1,0.08]]],# 物理躲避
- [24,"",[[22,2,0.08]]],# 必杀
- [24,"",[[22,3,0.08]]],# 必杀躲避
- [24,"",[[22,4,0.08]]],# 魔法躲避
- [24,"",[[22,5,0.08]]],# 魔法反射
- [24,"",[[22,6,0.08]]],# 物理反击
- [16,"",[[0,10]]],# HP
- [16,"",[[1,10]]],# MP
- [22,"",[[0,15]]],# HP
- [22,"",[[1,15]]],# MP
- [28,"",[[0,20]]],# HP
- [28,"",[[1,20]]],# MP
- [18,"",[[2,4]]], #物理攻击
- [18,"",[[3,4]]], #防御攻击
- [18,"",[[4,4]]],#魔法攻击
- [18,"",[[5,4]]],# 魔法防御
- [18,"",[[6,4]]], #速度
- [26,"",[[2,8]]], #物理攻击
- [26,"",[[3,8]]], #防御攻击
- [26,"",[[4,8]]],#魔法攻击
- [26,"",[[5,8]]],# 魔法防御
- [26,"",[[6,8]]], #速度
- [34,"",[[2,12]]], #物理攻击
- [34,"",[[3,12]]], #防御攻击
- [34,"",[[4,12]]],#魔法攻击
- [34,"",[[5,12]]],# 魔法防御
- [34,"",[[6,12]]], #速度
- [17,"",[[22,0,0.06]]],# 命中
- [17,"",[[22,1,0.06]]],# 物理躲避
- [17,"",[[22,2,0.06]]],# 必杀
- [17,"",[[22,3,0.06]]],# 必杀躲避
- [17,"",[[22,4,0.06]]],# 魔法躲避
- [17,"",[[22,5,0.06]]],# 魔法反射
- [17,"",[[22,6,0.06]]],# 物理反击
- [31,"",[[22,0,0.1]]],# 命中
- [31,"",[[22,1,0.1]]],# 物理躲避
- [31,"",[[22,2,0.1]]],# 必杀
- [31,"",[[22,3,0.1]]],# 必杀躲避
- [31,"",[[22,4,0.1]]],# 魔法躲避
- [31,"",[[22,5,0.1]]],# 魔法反射
- [31,"",[[22,6,0.1]]],# 物理反击
- [24,"",[[22,0,0.08]]],# 命中
- [24,"",[[22,1,0.08]]],# 物理躲避
- [24,"",[[22,2,0.08]]],# 必杀
- [24,"",[[22,3,0.08]]],# 必杀躲避
- [24,"",[[22,4,0.08]]],# 魔法躲避
- [24,"",[[22,5,0.08]]],# 魔法反射
- [24,"",[[22,6,0.08]]],# 物理反击
- [19,"",[[22,7,0.01]]],# HP再生
- [19,"",[[22,8,0.01]]],# MP再生
- [19,"",[[22,9,0.1]]],# SP再生
- [13,"",[[23,2,0.05]]],# 恢复效果
- [16,"",[[23,2,0.1]]],# 恢复效果
- [19,"",[[23,2,0.15]]],# 恢复效果
- [12,"",[[23,3,0.1]]],# 药物恢复效果
- [14,"",[[23,3,0.15]]],# 药物恢复效果
- [16,"",[[23,3,0.20]]],# 药物恢复效果
- [23,"",[[13,1,0.1]]],# 抗性
- [23,"",[[13,2,0.1]]],#
- [23,"",[[13,3,0.1]]],#
- [23,"",[[13,4,0.1]]],#
- [23,"",[[13,5,0.1]]],#
- [23,"",[[13,6,0.1]]],#
- [23,"",[[13,7,0.1]]],# 抗性
- [36,"",[[14,2,0.1]]],# 免疫
- [36,"",[[14,3,0.1]]],#
- [36,"",[[14,4,0.1]]],#
- [36,"",[[14,5,0.1]]],#
- [36,"",[[14,6,0.1]]],#
- [36,"",[[14,7,0.1]]],# 免疫
- [35,"",[[51,1,0.1]]],#武器
- [35,"",[[51,2,0.1]]],
- [35,"",[[51,3,0.1]]],
- [35,"",[[51,4,0.1]]],
- [35,"",[[51,5,0.1]]],
- [35,"",[[51,9,0.1]]],
- [35,"",[[51,10,0.1]]],
- [35,"",[[51,11,0.1]]],
-
- ]
- $商店随机 = false #商店买装备时出随机属性false
- $战斗随机 = true #战斗后获得随机属性装备
- def self.getname(paramsplus)
- name = ""
- 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(","){}}
- name += @temp[rand(@temp.size)] if paramsplus.is_a?(Array) != true
- name += ""
- end
- def self.getluck #获得极品出现率
- luck = 0
- $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}}
- luck
- end
- def self.getnewequip(xequip,params = nil) #提供两个参数 装备(RPG::Equip类下的)和附加前缀数,不填则为随机
- return unless xequip.is_a?(RPG::EquipItem)
- #xparamplus为前缀数
- xequip.paramsplus = [] if xequip.paramsplus == nil
- return if xequip.paramsplus.size >= @maxparamplus
- params != nil ? xparamplus = params : xparamplus = rand(@maxparamplus * 110) / 100
- xparamplus = xparamplus.to_int
- return xequip if xparamplus == 0
- equip = xequip.dup
- paramsplus = equip.paramsplus.dup #无奈的方法,不这样改一个装备所有同父装备的装备都会变
- newparams = equip.params.dup
- newfeatures = equip.features.dup
- aparamsplus = @paramsplus.collect{|a| [a[0] = @transpose[a[0]-1],a[1],a[2]]}.sort_by{|a| a[0]}
- while paramsplus.size < xparamplus
- temp = rand(aparamsplus[-1][0])
- temp = [temp - getluck,0].max
- x = []
- for i in aparamsplus
- x.push i if i[0] >= temp && paramsplus.include?(i) != true
- end
- if x != []
- a = [(x.size-1)*100 - getluck,0].max
- a = (rand(a)/100).to_int
- paramsplus.push x[a]
- end
- end
- equip.name = getname(paramsplus) + equip.name #更新名称
- paramsplus.each{|a| equip.price += @transpose[a[0] - 1] * @moneyrate} #更新价格
- paramsplus.select{|a| a[2].select{|a| a.size == 2}.each{|a| newparams[a[0]] += a[1]}} #更新属性
- #以下为更新特性
- features = []
- paramsplus.each{|a| a[2].each{|a| features.push a if a.size == 3}}
- while features.size > 0
- i = features.pop
- 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]}
- end
- if equip.is_a?(RPG::Weapon)
- equip.id = $data_weapons.size
- $data_weapons.insert $data_weapons.size,equip
- $data_weapons[equip.id].paramsplus = paramsplus
- $data_weapons[equip.id].params = newparams
- $data_weapons[equip.id].features = newfeatures
- else
- equip.id = $data_armors.size
- $data_armors.insert $data_armors.size,equip
- $data_armors[equip.id].paramsplus = paramsplus
- $data_armors[equip.id].params = newparams
- $data_armors[equip.id].features = newfeatures
- end
- equip
- end
- def self.gainequip(id,params = nil)
- $game_party.gain_item(Equipplus.getnewequip($data_weapons[id],params),1,true)
- end
- end
- if $商店随机 == true
- class Scene_Shop < Scene_MenuBase
- def do_buy(number)
- $game_party.lose_gold(number * buying_price)
- if @item.is_a?(RPG::EquipItem)
- x = number
- loop do
- break if x <= 0
- x -= 1
- $game_party.gain_item(Equipplus.getnewequip(@item), 1)
- end
- else
- $game_party.gain_item(@item, number)
- end
- end
- end
- end
- if $战斗随机 == true
- module BattleManager
- def self.gain_drop_items
- $game_troop.make_drop_items.each do |item|
- item.is_a?(RPG::EquipItem) ? xitem = Equipplus.getnewequip(item) : xitem = item
- $game_party.gain_item(xitem, 1)
- $game_message.add(sprintf(Vocab::ObtainItem, xitem.name))
- end
- wait_for_message
- end
- end
- end
- class RPG::EquipItem < RPG::BaseItem
- alias old initialize
- def initialize
- old
- @paramsplus #前缀
- end
- attr_accessor :paramsplus
- end
- # ■ 强化系统DataManager
- #------------------------------------------------------------------------------
- # 将武器和防具数据保存入存档
- #==============================================================================
- module DataManager
- #--------------------------------------------------------------------------
- # ● 生成存档内容
- #--------------------------------------------------------------------------
- def self.make_save_contents
- contents = {}
- contents[:system] = $game_system
- contents[:timer] = $game_timer
- contents[:message] = $game_message
- contents[:switches] = $game_switches
- contents[:variables] = $game_variables
- contents[:self_switches] = $game_self_switches
- contents[:actors] = $game_actors
- contents[:party] = $game_party
- contents[:troop] = $game_troop
- contents[:map] = $game_map
- contents[:player] = $game_player
- contents[:weapons] = $data_weapons
- contents[:armors] = $data_armors
- contents
- end
- #--------------------------------------------------------------------------
- # ● 展开存档内容
- #--------------------------------------------------------------------------
- def self.extract_save_contents(contents)
- $game_system = contents[:system]
- $game_timer = contents[:timer]
- $game_message = contents[:message]
- $game_switches = contents[:switches]
- $game_variables = contents[:variables]
- $game_self_switches = contents[:self_switches]
- $game_actors = contents[:actors]
- $game_party = contents[:party]
- $game_troop = contents[:troop]
- $game_map = contents[:map]
- $game_player = contents[:player]
- $data_weapons = contents[:weapons]
- $data_armors = contents[:armors]
- end
- end
复制代码 [/fold]
47、战斗时会跳动镜头接近放大目标。
[fold=战斗动态镜头]- #打开脚本编辑器,将脚本插入到main上。
- #==============================================================================
- # F14 - 战斗镜头 - By芙蕾娅
- #------------------------------------------------------------------------------
- # ★ - 新增 ☆ - 修改 ■ - 删除 ● - 无变更
- #==============================================================================
- module Freya
- # 镜头帧速,数字越小越快
- Camera_Frame_Speed = 12
- # 镜头放大率,正常大小1.0,默认放大1.2
- Take_Zoom = 1.2
- # 背景增大率,默认0.1
- # 避免默认素材背景在镜头移动后出现黑边所做的处理
- Back_Zoom = 0.3
- end
- #==============================================================================
- # ■ Battle_Camera
- #------------------------------------------------------------------------------
- # 保存着战斗镜头的讯息
- #==============================================================================
- class Battle_Camera
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_accessor :x
- attr_accessor :y
- attr_accessor :zoom
- attr_accessor :new_zoom
- attr_reader :center_width
- attr_reader :center_height
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize
- @x = @new_x = @center_width = Graphics.width / 2
- @y = @new_y = @center_height = Graphics.height / 1.5
- @zoom = @new_zoom = 1.0
- @frame_speed = Freya::Camera_Frame_Speed
- end
- #--------------------------------------------------------------------------
- # ● 初始化帧率
- #--------------------------------------------------------------------------
- def reset_frame_speed
- @frame_speed = Freya::Camera_Frame_Speed
- end
- #--------------------------------------------------------------------------
- # ● 设置镜头瞄准对象
- #--------------------------------------------------------------------------
- def look(target,zoom=nil,speed=nil)
- if target.is_a?(Game_Enemy)
- reset_frame_speed
- @new_x = target.screen_x
- @new_y = target.screen_y
- @new_zoom = zoom unless zoom.nil?
- @frame_speed = speed unless speed.nil?
- end
- end
- #--------------------------------------------------------------------------
- # ● 将镜头移至中心
- #--------------------------------------------------------------------------
- def center(zoom = 1.0)
- @new_x = @center_width
- @new_y = @center_height
- @new_zoom = zoom
- end
- #--------------------------------------------------------------------------
- # ● 计算x坐标
- #--------------------------------------------------------------------------
- def battler_x(battler)
- distance = battler.screen_x - @x
- value = distance * (@zoom - 1.0)
- pos = battler.screen_x - (@x - @center_width)
- return pos + value
- end
- #--------------------------------------------------------------------------
- # ● 计算y坐标
- #--------------------------------------------------------------------------
- def battler_y(battler)
- distance = battler.screen_y - @y
- value = distance * (@zoom - 1.0)
- pos = battler.screen_y - (@y - @center_height)
- return pos + value
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- if @x != @new_x
- @x = (@new_x - @x > 0) ?
- [@x + move_speed_x, @new_x].min : [@x - move_speed_x, @new_x].max
- end
- if @y != @new_y
- @y = (@new_y - @y > 0) ?
- [@y + move_speed_y, @new_y].min : [@y - move_speed_y, @new_y].max
- end
- if @zoom != @new_zoom
- @zoom = (@new_zoom - @zoom > 0) ?
- [@zoom + zoom_speed, @new_zoom].min : [@zoom - zoom_speed, @new_zoom].max
- end
- end
- #--------------------------------------------------------------------------
- # ● 镜头x坐标与指定点x坐标的距离
- #--------------------------------------------------------------------------
- def dis_x
- (@x - @new_x).abs
- end
- #--------------------------------------------------------------------------
- # ● 镜头y坐标与指定点y坐标的距离
- #--------------------------------------------------------------------------
- def dis_y
- (@y - @new_y).abs
- end
- #--------------------------------------------------------------------------
- # ● 镜头放大率与指定放大率的差距
- #--------------------------------------------------------------------------
- def dis_zoom
- (@zoom - @new_zoom).abs
- end
- #--------------------------------------------------------------------------
- # ● 镜头x坐标移动速度
- #--------------------------------------------------------------------------
- def move_speed_x
- return [(dis_x / @frame_speed).to_i, 1].max
- end
- #--------------------------------------------------------------------------
- # ● 镜头y坐标移动速度
- #--------------------------------------------------------------------------
- def move_speed_y
- return [(dis_y / @frame_speed).to_i, 1].max
- end
- #--------------------------------------------------------------------------
- # ● 镜头缩放速度
- #--------------------------------------------------------------------------
- def zoom_speed
- return [(dis_zoom / @frame_speed), 0.01].max
- end
- end
- #==============================================================================
- # ■ Sprite_Battler
- #------------------------------------------------------------------------------
- # 显示战斗者的精灵。根据 Game_Battler 类的实例自动变化。
- #==============================================================================
- class Sprite_Battler < Sprite_Base
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_accessor :hp_gauge
- #--------------------------------------------------------------------------
- # ☆ 设置动画的精灵
- #--------------------------------------------------------------------------
- def animation_set_sprites(frame)
- cell_data = frame.cell_data
- set_animation_origin
- @ani_sprites.each_with_index do |sprite, i|
- next unless sprite
- pattern = cell_data[i, 0]
- if !pattern || pattern < 0
- sprite.visible = false
- next
- end
- sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2
- sprite.visible = true
- sprite.src_rect.set(pattern % 5 * 192,
- pattern % 100 / 5 * 192, 192, 192)
- if @ani_mirror
- sprite.x = @ani_ox - cell_data[i, 1]
- sprite.y = @ani_oy + cell_data[i, 2]
- sprite.angle = (360 - cell_data[i, 4])
- sprite.mirror = (cell_data[i, 5] == 0)
- else
- sprite.x = @ani_ox + cell_data[i, 1]
- sprite.y = @ani_oy + cell_data[i, 2]
- sprite.angle = cell_data[i, 4]
- sprite.mirror = (cell_data[i, 5] == 1)
- end
- sprite.z = self.z + 300 + i
- sprite.ox = 96
- sprite.oy = 96
- sprite.zoom_x = cell_data[i, 3] / 100.0 * self.zoom_x
- sprite.zoom_y = cell_data[i, 3] / 100.0 * self.zoom_y
- sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
- sprite.blend_type = cell_data[i, 7]
- end
- end
- end
- #==============================================================================
- # ■ Spriteset_Battle
- #------------------------------------------------------------------------------
- # 处理战斗画面的精灵的类。本类在 Scene_Battle 类的内部使用。
- #==============================================================================
- class Spriteset_Battle
- #--------------------------------------------------------------------------
- # ★ 定义实例变量
- #--------------------------------------------------------------------------
- attr_accessor :battle_camera
- #--------------------------------------------------------------------------
- # ☆ 初始化对象
- #--------------------------------------------------------------------------
- alias initialize_freya_camera initialize
- def initialize
- create_camera
- initialize_freya_camera
- end
- #--------------------------------------------------------------------------
- # ★ 创建镜头
- #--------------------------------------------------------------------------
- def create_camera
- @battle_camera = Battle_Camera.new
- end
- #--------------------------------------------------------------------------
- # ☆ 更新画面
- #--------------------------------------------------------------------------
- alias update_freya_camera update
- def update
- update_freya_camera
- update_camera
- end
- #--------------------------------------------------------------------------
- # ● 刷新镜头
- #--------------------------------------------------------------------------
- def update_camera
- @battle_camera.update
- update_battleback_position
- update_enemy_position
- end
- #--------------------------------------------------------------------------
- # ● 刷新背景坐标
- #--------------------------------------------------------------------------
- def update_battleback_position
- zom = Freya::Take_Zoom + Freya::Back_Zoom
- zoom = @back1_sprite.zoom_x = @back2_sprite.zoom_x = @battle_camera.zoom * zom
- zoom = @back1_sprite.zoom_y = @back2_sprite.zoom_y = @battle_camera.zoom * zom
- x = @back1_sprite.ox
- y = @back1_sprite.oy
- bbx = (x - (@battle_camera.x - @battle_camera.center_width))
- bby = (y - (@battle_camera.y - @battle_camera.center_height))
- @back1_sprite.x = @back2_sprite.x = bbx
- @back1_sprite.y = @back2_sprite.y = bby
- end
- #--------------------------------------------------------------------------
- # ● 刷新敌人坐标
- #--------------------------------------------------------------------------
- def update_enemy_position
- for sprite in @enemy_sprites
- next if sprite.nil? || sprite.battler.nil?
- sprite.zoom_x = @battle_camera.zoom
- sprite.zoom_y = @battle_camera.zoom
- sprite.x = @battle_camera.battler_x(sprite.battler)
- sprite.y = @battle_camera.battler_y(sprite.battler)
- unless sprite.hp_gauge.nil?
- sprite.hp_gauge.x = sprite.x - sprite.hp_gauge.width / 2
- sprite.hp_gauge.y = sprite.y
- end
- end
- end
- end
- #==============================================================================
- # ■ Scene_Battle
- #------------------------------------------------------------------------------
- # 战斗画面
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # ★ 获取镜头
- #--------------------------------------------------------------------------
- def camera
- return @spriteset.battle_camera
- end
- #--------------------------------------------------------------------------
- # ☆ 使用技能/物品
- #--------------------------------------------------------------------------
- def use_item
- camera.look(@subject,Freya::Take_Zoom)
- wait(Freya::Camera_Frame_Speed)
- item = @subject.current_action.item
- @log_window.display_use_item(@subject, item)
- @subject.use_item(item)
- refresh_status
- targets = @subject.current_action.make_targets.compact
- camera.look(targets,Freya::Take_Zoom)
- wait(Freya::Camera_Frame_Speed)
- show_animation(targets, item.animation_id)
- targets.each {|target| item.repeats.times { invoke_item(target, item) } }
- camera.center
- end
- #--------------------------------------------------------------------------
- # ☆ 应用技能/物品效果
- #--------------------------------------------------------------------------
- alias apply_item_effects_freya_camera apply_item_effects
- def apply_item_effects(target, item)
- camera.look(target, Freya::Take_Zoom)
- wait(Freya::Camera_Frame_Speed)
- apply_item_effects_freya_camera(target, item)
- end
- #--------------------------------------------------------------------------
- # ☆ 发动反击
- #--------------------------------------------------------------------------
- alias invoke_counter_attack_freya_camera invoke_counter_attack
- def invoke_counter_attack(target, item)
- camera.look(target, Freya::Take_Zoom)
- wait(Freya::Camera_Frame_Speed)
- invoke_counter_attack_freya_camera(target, item)
- end
- #--------------------------------------------------------------------------
- # ☆ 发动反射魔法攻击
- #--------------------------------------------------------------------------
- alias invoke_magic_reflection_freya_camera invoke_magic_reflection
- def invoke_magic_reflection(target, item)
- camera.look(target, Freya::Take_Zoom)
- wait(Freya::Camera_Frame_Speed)
- invoke_magic_reflection_freya_camera(target, item)
- end
- #--------------------------------------------------------------------------
- # ☆ 显示普通动画
- #--------------------------------------------------------------------------
- def show_normal_animation(targets, animation_id, mirror = false)
- animation = $data_animations[animation_id]
- if animation
- camera.center if animation.to_screen?
- targets.each do |target|
- camera.look(target, Freya::Take_Zoom) unless animation.to_screen?
- target.animation_id = animation_id
- target.animation_mirror = mirror
- abs_wait_short unless animation.to_screen?
- end
- abs_wait_short if animation.to_screen?
- end
- end
- end
复制代码 [/fold] |
评分
-
查看全部评分
|