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

Project1

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

[已经解决] 请问能把战斗记录脚本修改成按某键打开吗

[复制链接]

Lv2.观梦者

梦石
0
星屑
374
在线时间
61 小时
注册时间
2009-9-4
帖子
32
跳转到指定楼层
1
发表于 2020-2-11 22:59:09 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
请问能把队伍指令里的战斗记录改成在战斗中按某键打开吗,谢谢

RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - 战斗信息记录 v1.02
  4. # -- 最后更新: 2012.01.24
  5. # -- 使用难度: 简单
  6. # -- 需要脚本: 无
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-CombatLogDisplay"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.01.24 - Bug Fixed: Confirm window crash with Battle Command List.
  17. # 2012.01.16 - Prevented subsequent line inserts.
  18. # 2011.12.10 - Started Script and Finished.
  19. #
  20. #==============================================================================
  21. # ▼ 介绍
  22. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  23. # 有时候战斗信息跳的太快了,玩家根本来不及看,很可能错过重要的战斗信息。
  24. # 本脚本提供战斗信息记录的功能,玩家可以在角色行动时在"战斗/撤退"窗口中点击
  25. # 相应指令来回顾之前的全部战斗信息.
  26. #
  27. #==============================================================================
  28. # ▼ 安装方式
  29. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  30. # 打开脚本编辑器,将本脚本拷贝/复制到一个在▼ 插件脚本之下▼ Main之上的新
  31. # 脚本页/槽中.记得保存你的工程以使脚本生效.
  32. #
  33. #==============================================================================
  34. # ▼ 兼容性
  35. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  36. # 本脚本仅为RPG Maker VX Ace编写.极不可能在无任何修改的情况下运行于RPG Maker VX.
  37. #
  38. #==============================================================================
  39.  
  40. module YEA
  41.   module COMBAT_LOG
  42.  
  43.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  44.     # - 战斗信息设置 -
  45.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  46.  
  47.     COMMAND_NAME      = "记录"         # 战斗信息记录的指令名.
  48.     LINE_COLOUR       = 0              # 拆分动作行的颜色.
  49.     LINE_COLOUR_ALPHA = 48             # 拆分动作行的不透明度.
  50.     TEXT_BATTLE_START = "\\c[4]战斗开始!"           # 战斗开始的文本.
  51.     TEXT_TURN_NUMBER  = "\\c[4]回合数: \\c[6]%d"    # 回合数的文本.
  52.  
  53.   end # COMBAT_LOG
  54. end # YEA
  55.  
  56. #==============================================================================
  57. # ▼ 编辑以下内容可能会出现电脑损坏、死机,电脑主人脑袋爆炸、昏迷、死亡或口臭
  58. # 所以编辑了后果自负。
  59. #==============================================================================
  60.  
  61. #==============================================================================
  62. # ■ Window_BattleLog
  63. #==============================================================================
  64.  
  65. class Window_BattleLog < Window_Selectable
  66.  
  67.   #--------------------------------------------------------------------------
  68.   # new method: combatlog_window=
  69.   #--------------------------------------------------------------------------
  70.   def combatlog_window=(window)
  71.     @combatlog_window = window
  72.   end
  73.  
  74.   #--------------------------------------------------------------------------
  75.   # new method: combatlog
  76.   #--------------------------------------------------------------------------
  77.   def combatlog(text)
  78.     return if @combatlog_window.nil?
  79.     return if text == ""
  80.     @combatlog_window.add_line(text)
  81.   end
  82.  
  83.   #--------------------------------------------------------------------------
  84.   # alias method: add_text
  85.   #--------------------------------------------------------------------------
  86.   alias window_battlelog_add_text_cld add_text
  87.   def add_text(text)
  88.     combatlog(text)
  89.     window_battlelog_add_text_cld(text)
  90.   end
  91.  
  92.   #--------------------------------------------------------------------------
  93.   # alias method: replace_text
  94.   #--------------------------------------------------------------------------
  95.   alias window_battlelog_replace_text_cld replace_text
  96.   def replace_text(text)
  97.     combatlog(text)
  98.     window_battlelog_replace_text_cld(text)
  99.   end
  100.  
  101.   #--------------------------------------------------------------------------
  102.   # Start Ace Battle Engine Compatibility
  103.   #--------------------------------------------------------------------------
  104.   if $imported["YEA-BattleEngine"]
  105.  
  106.   #--------------------------------------------------------------------------
  107.   # alias method: display_current_state
  108.   #--------------------------------------------------------------------------
  109.   alias window_battlelog_display_current_state_cld display_current_state
  110.   def display_current_state(subject)
  111.     window_battlelog_display_current_state_cld(subject)
  112.     return if YEA::BATTLE::MSG_CURRENT_STATE
  113.     return if subject.most_important_state_text.empty?
  114.     combatlog(subject.name + subject.most_important_state_text)
  115.   end
  116.  
  117.   #--------------------------------------------------------------------------
  118.   # alias method: display_use_item
  119.   #--------------------------------------------------------------------------
  120.   alias window_battlelog_display_use_item_cld display_use_item
  121.   def display_use_item(subject, item)
  122.     window_battlelog_display_use_item_cld(subject, item)
  123.     return if YEA::BATTLE::MSG_CURRENT_ACTION
  124.     if item.is_a?(RPG::Skill)
  125.       combatlog(subject.name + item.message1)
  126.       unless item.message2.empty?
  127.         combatlog(item.message2)
  128.       end
  129.     else
  130.       combatlog(sprintf(Vocab::UseItem, subject.name, item.name))
  131.     end
  132.   end
  133.  
  134.   #--------------------------------------------------------------------------
  135.   # alias method: display_counter
  136.   #--------------------------------------------------------------------------
  137.   alias window_battlelog_display_counter_cld display_counter
  138.   def display_counter(target, item)
  139.     window_battlelog_display_counter_cld(target, item)
  140.     return if YEA::BATTLE::MSG_COUNTERATTACK
  141.     combatlog(sprintf(Vocab::CounterAttack, target.name))
  142.   end
  143.  
  144.   #--------------------------------------------------------------------------
  145.   # alias method: display_reflection
  146.   #--------------------------------------------------------------------------
  147.   alias window_battlelog_display_reflection_cld display_reflection
  148.   def display_reflection(target, item)
  149.     window_battlelog_display_reflection_cld(target, item)
  150.     return if YEA::BATTLE::MSG_REFLECT_MAGIC
  151.     combatlog(sprintf(Vocab::MagicReflection, target.name))
  152.   end
  153.  
  154.   #--------------------------------------------------------------------------
  155.   # alias method: display_substitute
  156.   #--------------------------------------------------------------------------
  157.   alias window_battlelog_display_substitute_cld display_substitute
  158.   def display_substitute(substitute, target)
  159.     window_battlelog_display_substitute_cld(substitute, target)
  160.     return if YEA::BATTLE::MSG_SUBSTITUTE_HIT
  161.     combatlog(sprintf(Vocab::Substitute, substitute.name, target.name))
  162.   end
  163.  
  164.   #--------------------------------------------------------------------------
  165.   # alias method: display_failure
  166.   #--------------------------------------------------------------------------
  167.   alias window_battlelog_display_failure_cld display_failure
  168.   def display_failure(target, item)
  169.     window_battlelog_display_failure_cld(target, item)
  170.     return if YEA::BATTLE::MSG_FAILURE_HIT
  171.     if target.result.hit? && !target.result.success
  172.       combatlog(sprintf(Vocab::ActionFailure, target.name))
  173.     end
  174.   end
  175.  
  176.   #--------------------------------------------------------------------------
  177.   # alias method: display_critical
  178.   #--------------------------------------------------------------------------
  179.   alias window_battlelog_display_critical_cld display_critical
  180.   def display_critical(target, item)
  181.     window_battlelog_display_critical_cld(target, item)
  182.     return if YEA::BATTLE::MSG_CRITICAL_HIT
  183.     if target.result.critical
  184.       text = target.actor? ? Vocab::CriticalToActor : Vocab::CriticalToEnemy
  185.       combatlog(text)
  186.     end
  187.   end
  188.  
  189.   #--------------------------------------------------------------------------
  190.   # alias method: display_miss
  191.   #--------------------------------------------------------------------------
  192.   alias window_battlelog_display_miss_cld display_miss
  193.   def display_miss(target, item)
  194.     window_battlelog_display_miss_cld(target, item)
  195.     return if YEA::BATTLE::MSG_HIT_MISSED
  196.     if !item || item.physical?
  197.       fmt = target.actor? ? Vocab::ActorNoHit : Vocab::EnemyNoHit
  198.     else
  199.       fmt = Vocab::ActionFailure
  200.     end
  201.     combatlog(sprintf(fmt, target.name))
  202.   end
  203.  
  204.   #--------------------------------------------------------------------------
  205.   # alias method: display_evasion
  206.   #--------------------------------------------------------------------------
  207.   alias window_battlelog_display_evasion_cld display_evasion
  208.   def display_evasion(target, item)
  209.     window_battlelog_display_evasion_cld(target, item)
  210.     return if YEA::BATTLE::MSG_EVASION
  211.     if !item || item.physical?
  212.       fmt = Vocab::Evasion
  213.     else
  214.       fmt = Vocab::MagicEvasion
  215.     end
  216.     combatlog(sprintf(fmt, target.name))
  217.   end
  218.  
  219.   #--------------------------------------------------------------------------
  220.   # alias method: display_hp_damage
  221.   #--------------------------------------------------------------------------
  222.   alias window_battlelog_display_hp_damage_cld display_hp_damage
  223.   def display_hp_damage(target, item)
  224.     window_battlelog_display_hp_damage_cld(target, item)
  225.     return if YEA::BATTLE::MSG_HP_DAMAGE
  226.     return if target.result.hp_damage == 0 && item && !item.damage.to_hp?
  227.     combatlog(target.result.hp_damage_text)
  228.   end
  229.  
  230.   #--------------------------------------------------------------------------
  231.   # alias method: display_mp_damage
  232.   #--------------------------------------------------------------------------
  233.   alias window_battlelog_display_mp_damage_cld display_mp_damage
  234.   def display_mp_damage(target, item)
  235.     window_battlelog_display_mp_damage_cld(target, item)
  236.     return if YEA::BATTLE::MSG_MP_DAMAGE
  237.     combatlog(target.result.mp_damage_text)
  238.   end
  239.  
  240.   #--------------------------------------------------------------------------
  241.   # alias method: display_tp_damage
  242.   #--------------------------------------------------------------------------
  243.   alias window_battlelog_display_tp_damage_cld display_tp_damage
  244.   def display_tp_damage(target, item)
  245.     window_battlelog_display_tp_damage_cld(target, item)
  246.     return if YEA::BATTLE::MSG_TP_DAMAGE
  247.     combatlog(target.result.tp_damage_text)
  248.   end
  249.  
  250.   #--------------------------------------------------------------------------
  251.   # alias method: display_added_states
  252.   #--------------------------------------------------------------------------
  253.   alias window_battlelog_display_added_states_cld display_added_states
  254.   def display_added_states(target)
  255.     window_battlelog_display_added_states_cld(target)
  256.     return if YEA::BATTLE::MSG_ADDED_STATES
  257.     target.result.added_state_objects.each do |state|
  258.       state_msg = target.actor? ? state.message1 : state.message2
  259.       next if state_msg.empty?
  260.       combatlog(target.name + state_msg)
  261.     end
  262.   end
  263.  
  264.   #--------------------------------------------------------------------------
  265.   # alias method: display_removed_states
  266.   #--------------------------------------------------------------------------
  267.   alias window_battlelog_display_removed_states_cld display_removed_states
  268.   def display_removed_states(target)
  269.     window_battlelog_display_removed_states_cld(target)
  270.     return if YEA::BATTLE::MSG_REMOVED_STATES
  271.     target.result.removed_state_objects.each do |state|
  272.       next if state.message4.empty?
  273.       combatlog(target.name + state.message4)
  274.     end
  275.   end
  276.  
  277.   #--------------------------------------------------------------------------
  278.   # alias method: display_buffs
  279.   #--------------------------------------------------------------------------
  280.   alias window_battlelog_display_buffs_cld display_buffs
  281.   def display_buffs(target, buffs, fmt)
  282.     window_battlelog_display_buffs_cld(target, buffs, fmt)
  283.     return if YEA::BATTLE::MSG_CHANGED_BUFFS
  284.     buffs.each do |param_id|
  285.       combatlog(sprintf(fmt, target.name, Vocab::param(param_id)))
  286.     end
  287.   end
  288.  
  289.   #--------------------------------------------------------------------------
  290.   # End Ace Battle Engine Compatibility
  291.   #--------------------------------------------------------------------------
  292.   end # $imported["YEA-BattleEngine"]
  293.  
  294. end # Window_BattleLog
  295.  
  296. #==============================================================================
  297. # ■ Window_CombatLog
  298. #==============================================================================
  299.  
  300. class Window_CombatLog < Window_Selectable
  301.  
  302.   #--------------------------------------------------------------------------
  303.   # initialize
  304.   #--------------------------------------------------------------------------
  305.   def initialize
  306.     @data = []
  307.     super(0, 0, Graphics.width, Graphics.height-120)
  308.     deactivate
  309.     hide
  310.   end
  311.  
  312.   #--------------------------------------------------------------------------
  313.   # add_line
  314.   #--------------------------------------------------------------------------
  315.   def add_line(text)
  316.     return if text == "-" && @data[@data.size - 1] == "-"
  317.     @data.push(text)
  318.   end
  319.  
  320.   #--------------------------------------------------------------------------
  321.   # refresh
  322.   #--------------------------------------------------------------------------
  323.   def refresh
  324.     create_contents
  325.     draw_all_items
  326.   end
  327.  
  328.   #--------------------------------------------------------------------------
  329.   # item_max
  330.   #--------------------------------------------------------------------------
  331.   def item_max; return @data.size; end
  332.  
  333.   #--------------------------------------------------------------------------
  334.   # draw_item
  335.   #--------------------------------------------------------------------------
  336.   def draw_item(index)
  337.     text = @data[index]
  338.     return if text.nil?
  339.     rect = item_rect_for_text(index)
  340.     if text == "-"
  341.       draw_horz_line(rect.y)
  342.     else
  343.       draw_text_ex(rect.x, rect.y, text)
  344.     end
  345.   end
  346.  
  347.   #--------------------------------------------------------------------------
  348.   # draw_horz_line
  349.   #--------------------------------------------------------------------------
  350.   def draw_horz_line(y)
  351.     line_y = y + line_height / 2 - 1
  352.     contents.fill_rect(4, line_y, contents_width-8, 2, line_colour)
  353.   end
  354.  
  355.   #--------------------------------------------------------------------------
  356.   # line_colour
  357.   #--------------------------------------------------------------------------
  358.   def line_colour
  359.     colour = text_color(YEA::COMBAT_LOG::LINE_COLOUR)
  360.     colour.alpha = YEA::COMBAT_LOG::LINE_COLOUR_ALPHA
  361.     return colour
  362.   end
  363.  
  364.   #--------------------------------------------------------------------------
  365.   # show
  366.   #--------------------------------------------------------------------------
  367.   def show
  368.     super
  369.     refresh
  370.     activate
  371.     select([item_max-1, 0].max)
  372.   end
  373.  
  374.   #--------------------------------------------------------------------------
  375.   # hide
  376.   #--------------------------------------------------------------------------
  377.   def hide
  378.     deactivate
  379.     super
  380.   end
  381.  
  382. end # Window_CombatLog
  383.  
  384. #==============================================================================
  385. # ■ Window_PartyCommand
  386. #==============================================================================
  387.  
  388. class Window_PartyCommand < Window_Command
  389.  
  390.   #--------------------------------------------------------------------------
  391.   # alias method: make_command_list
  392.   #--------------------------------------------------------------------------
  393.   alias window_partycommand_make_command_list_cld make_command_list
  394.   def make_command_list
  395.     window_partycommand_make_command_list_cld
  396.     return if $imported["YEA-BattleCommandList"]
  397.     add_command(YEA::COMBAT_LOG::COMMAND_NAME, :combatlog)
  398.   end
  399.  
  400. end # Window_PartyCommand
  401.  
  402. #==============================================================================
  403. # ■ Scene_Battle
  404. #==============================================================================
  405.  
  406. class Scene_Battle < Scene_Base
  407.  
  408.   #--------------------------------------------------------------------------
  409.   # alias method: create_log_window
  410.   #--------------------------------------------------------------------------
  411.   alias scene_battle_create_log_window_cld create_log_window
  412.   def create_log_window
  413.     scene_battle_create_log_window_cld
  414.     create_combatlog_window
  415.   end
  416.  
  417.   #--------------------------------------------------------------------------
  418.   # new method: create_combatlog_window
  419.   #--------------------------------------------------------------------------
  420.   def create_combatlog_window
  421.     @combatlog_window = Window_CombatLog.new
  422.     @log_window.combatlog_window = @combatlog_window
  423.     @combatlog_window.set_handler(:cancel, method(:close_combatlog))
  424.     @combatlog_window.add_line("-")
  425.     @combatlog_window.add_line(YEA::COMBAT_LOG::TEXT_BATTLE_START)
  426.     @combatlog_window.add_line("-")
  427.   end
  428.  
  429.   #--------------------------------------------------------------------------
  430.   # new method: open_combatlog
  431.   #--------------------------------------------------------------------------
  432.   def open_combatlog
  433.     @combatlog_window.show
  434.   end
  435.  
  436.   #--------------------------------------------------------------------------
  437.   # new method: close_combatlog
  438.   #--------------------------------------------------------------------------
  439.   def close_combatlog
  440.     @combatlog_window.hide
  441.     if $imported["YEA-BattleCommandList"]
  442.       if !@confirm_command_window.nil? && @confirm_command_window.visible
  443.         @confirm_command_window.activate
  444.       else
  445.         @party_command_window.activate
  446.       end
  447.     else
  448.       @party_command_window.activate
  449.     end
  450.   end
  451.  
  452.   #--------------------------------------------------------------------------
  453.   # alias method: create_party_command_window
  454.   #--------------------------------------------------------------------------
  455.   alias create_party_command_window_cld create_party_command_window
  456.   def create_party_command_window
  457.     create_party_command_window_cld
  458.     @party_command_window.set_handler(:combatlog, method(:open_combatlog))
  459.   end
  460.  
  461.   #--------------------------------------------------------------------------
  462.   # alias method: turn_start
  463.   #--------------------------------------------------------------------------
  464.   alias scene_battle_turn_start_cld turn_start
  465.   def turn_start
  466.     scene_battle_turn_start_cld
  467.     @combatlog_window.add_line("-")
  468.     text = sprintf(YEA::COMBAT_LOG::TEXT_TURN_NUMBER, $game_troop.turn_count)
  469.     @combatlog_window.add_line(text)
  470.     @combatlog_window.add_line("-")
  471.   end
  472.  
  473.   #--------------------------------------------------------------------------
  474.   # alias method: execute_action
  475.   #--------------------------------------------------------------------------
  476.   alias scene_battle_execute_action_cld execute_action
  477.   def execute_action
  478.     @combatlog_window.add_line("-")
  479.     scene_battle_execute_action_cld
  480.     @combatlog_window.add_line("-")
  481.   end
  482.  
  483.   #--------------------------------------------------------------------------
  484.   # alias method: turn_end
  485.   #--------------------------------------------------------------------------
  486.   alias scene_battle_turn_end_cld turn_end
  487.   def turn_end
  488.     scene_battle_turn_end_cld
  489.     @combatlog_window.add_line("-")
  490.   end
  491.  
  492. end # Scene_Battle
  493.  
  494. #==============================================================================
  495. #
  496. # ▼ End of File
  497. #
  498. #==============================================================================

Lv3.寻梦者

梦石
0
星屑
4881
在线时间
425 小时
注册时间
2019-10-22
帖子
666
2
发表于 2020-2-12 01:13:22 | 只看该作者
本帖最后由 坏数据 于 2020-2-12 11:10 编辑

核心思想  监听按键输入  按下某个键时  打开窗口
  1. alias badd021120_update update
  2.   def update
  3.     badd021120_update
  4.     listen2_log_call
  5.   end
  6.   
  7.   def listen2_log_call
  8.     open_combatlog if Input.trigger?(:SHIFT)
  9.   end
复制代码


如果你不想要在小队命令里面有【记录】这一项 把相关的删掉就行

我给你改好了 按住shift就可以显示
更新==》

猛戳代码

点评

楼主在3L更新了想要的效果喔~  发表于 2020-5-5 15:51

评分

参与人数 1星屑 +10 +1 收起 理由
寂静的夜里 + 10 + 1 认可答案

查看全部评分

















回复 支持 1 反对 0

使用道具 举报

Lv2.观梦者

梦石
0
星屑
374
在线时间
61 小时
注册时间
2009-9-4
帖子
32
3
 楼主| 发表于 2020-2-13 13:51:16 | 只看该作者
坏数据 发表于 2020-2-12 01:13
核心思想  监听按键输入  按下某个键时  打开窗口

你好,谢谢,不过能不能改成按下出现再按下消失,另外能不能在出现时把战斗指令给隐藏了,再次谢谢
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-25 21:21

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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