#============================================================================ # 战斗中使用物品查看敌人备注 for RMVA # by IndIX #---------------------------------------------------------------------------- #使用方法: #将该脚本插入Main之前,放插件脚本的位置。 #在数据库里添加一个物品,备注“<INVESTIGATE>”,效果范围设定“单个敌人”,使用场合 #设定为仅战斗中即可。然后在敌人的备注栏直接填写任意内容即可,战斗中使用该物品会自动 #读取写入的备注。 #可以用于设置一些可读取的敌人弱点,作为给玩家的过关提示。 #============================================================================ #---------------------------------------------------------------------------- # ● 脚本设定模块 #---------------------------------------------------------------------------- module Vocab Investigate = "分析出了%s的特性!" #定义使用探知道具的结果语句 end module TNWindow Line = 5 #显示内容的行数 Width = 380 #窗口的宽度 end #---------------------------------------------------------------------------- # ● 在战斗信息中显示使用的用语 #---------------------------------------------------------------------------- class Window_BattleLog < Window_Selectable def display_action_results(target, item) if target.result.used last_line_number = line_number display_critical(target, item) display_damage(target, item) display_affected_status(target, item) display_failure(target, item) investigate_result(target, item) wait if line_number > last_line_number back_to(last_line_number) end end def display_failure(target, item) if target.result.hit? && !target.result.success return if item.note.include?("<INVESTIGATE>") add_text(sprintf(Vocab::ActionFailure, target.name)) wait end end def investigate_result(target, item) if item.note.include?("<INVESTIGATE>") add_text(sprintf(Vocab::Investigate, target.name)) wait end end end #---------------------------------------------------------------------------- # ● 用于显示被探知者状态的窗口 #---------------------------------------------------------------------------- class Window_TargetNote < Window_Selectable #初始化 def initialize(line_number = TNWindow::Line) super(window_x, window_y(line_number), window_width, fitting_height(line_number)) end #设置窗口宽度和位置 def window_width return TNWindow::Width end def window_x return (Graphics.width - window_width)/2 end def window_y(line_number) return (Graphics.height - fitting_height(line_number)- 60)/2 end #设置文本 def set_text(text) if text != @text @text = text refresh end end #清除 def clear set_text("") end #设定目标 def set_target(target) set_text(target ? target.enemy.note : "") end #刷新 def refresh contents.clear draw_text_ex(4, 0, @text) end end #---------------------------------------------------------------------------- # ● 添加使用物品效果 #---------------------------------------------------------------------------- class Scene_Battle alias indix_apply_item_effects apply_item_effects def apply_item_effects(target, item) indix_apply_item_effects(target,item) use_investigate_item(target) if item.note.include?("<INVESTIGATE>") end def use_investigate_item(target) activate_targetnote_window(target) end end #---------------------------------------------------------------------------- # ● 在战斗场景中添加该窗口 #---------------------------------------------------------------------------- class Scene_Battle < Scene_Base alias indix_creat_all_windows create_all_windows def create_all_windows indix_creat_all_windows create_targetnote_window end def create_targetnote_window @targetnote_window = Window_TargetNote.new @targetnote_window.hide @targetnote_window.set_handler(:ok, method(:close_targetnote_window)) @targetnote_window.set_handler(:cancel, method(:close_targetnote_window)) end def activate_targetnote_window(target) @targetnote_window.show @targetnote_window.activate @targetnote_window.set_target(target) end def close_targetnote_window @targetnote_window.hide end #---------------------------------------------------------------------------- # ● 在战斗场景中等待该窗口关闭 #---------------------------------------------------------------------------- def update_for_only_tnwindow Graphics.update Input.update update_all_windows $game_timer.update $game_troop.update @spriteset.update end def wait_tnwindow(duration) duration.times {|i| update_for_only_tnwindow } end def update super if BattleManager.in_turn? process_event process_tnwindow process_action end BattleManager.judge_win_loss end def process_tnwindow return if @targetnote_window.visible == false while @targetnote_window.visible == true wait_tnwindow(10) break until Input.trigger?(:B) || Input.trigger?(:C) end end end
设置方法1.PNG (140.83 KB, 下载次数: 40)
物品的设置,可以加一些酷炫的动画
设置方法2.PNG (149.62 KB, 下载次数: 38)
敌人备注的设置
使用效果.PNG (735.98 KB, 下载次数: 38)
实际的效果!按空格键或X键都可以关掉
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |