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

Project1

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

[原创发布] 【原创新手自用脚本】战斗中使用物品查看敌人备注

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1088
在线时间
91 小时
注册时间
2022-1-14
帖子
29
跳转到指定楼层
1
发表于 2022-2-22 14:02:06 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 IndigoIX 于 2022-2-22 14:39 编辑

因为很想要实现一个战斗中对某个敌人使用一个物品就能分析它的特点的效果……在p1找了一圈没找着,就干脆试试自己写了
可喜可贺,终于还是写出来了!(但是兼容性可能不是很好!我努力在用alias了呜呜 还是太菜)

如果加以改造应该还可以实现其他的效果!
比如战斗中查看队友备注(啊这……没什么用吧!)
或者能查看敌人的各项具体数值(理论上应该可以!但是我不会!)

用法是即插即用,然后在数据库里设置一下对应的几项就可以啦
对敌人附加一些伤害和状态大概也是可以的……反正我没试过(如果这样那这个道具也太逆天了吧!)

RUBY 代码复制
  1. #============================================================================
  2. # 战斗中使用物品查看敌人备注  for RMVA
  3. # by IndIX
  4. #----------------------------------------------------------------------------
  5.  
  6. #使用方法:
  7.  
  8. #将该脚本插入Main之前,放插件脚本的位置。
  9.  
  10. #在数据库里添加一个物品,备注“<INVESTIGATE>”,效果范围设定“单个敌人”,使用场合
  11. #设定为仅战斗中即可。然后在敌人的备注栏直接填写任意内容即可,战斗中使用该物品会自动
  12. #读取写入的备注。
  13.  
  14. #可以用于设置一些可读取的敌人弱点,作为给玩家的过关提示。
  15.  
  16. #============================================================================
  17.  
  18.  
  19. #----------------------------------------------------------------------------
  20. # ● 脚本设定模块
  21. #----------------------------------------------------------------------------
  22.  
  23. module Vocab
  24.  
  25.   Investigate = "分析出了%s的特性!"  #定义使用探知道具的结果语句
  26.  
  27. end
  28.  
  29.  
  30. module TNWindow
  31.  
  32.   Line = 5         #显示内容的行数
  33.   Width = 380      #窗口的宽度
  34.  
  35. end
  36.  
  37. #----------------------------------------------------------------------------
  38. # ● 在战斗信息中显示使用的用语
  39. #----------------------------------------------------------------------------
  40. class Window_BattleLog < Window_Selectable
  41.   def display_action_results(target, item)
  42.     if target.result.used
  43.       last_line_number = line_number
  44.       display_critical(target, item)
  45.       display_damage(target, item)
  46.       display_affected_status(target, item)
  47.       display_failure(target, item)
  48.       investigate_result(target, item)
  49.       wait if line_number > last_line_number
  50.       back_to(last_line_number)
  51.     end
  52.   end
  53.   def display_failure(target, item)
  54.     if target.result.hit? && !target.result.success
  55.       return if item.note.include?("<INVESTIGATE>")
  56.       add_text(sprintf(Vocab::ActionFailure, target.name))
  57.       wait
  58.     end
  59.   end
  60.   def investigate_result(target, item)
  61.     if item.note.include?("<INVESTIGATE>")
  62.       add_text(sprintf(Vocab::Investigate, target.name))
  63.       wait
  64.     end
  65.   end
  66. end
  67.  
  68. #----------------------------------------------------------------------------
  69. # ● 用于显示被探知者状态的窗口
  70. #----------------------------------------------------------------------------
  71. class Window_TargetNote < Window_Selectable
  72.   #初始化
  73.   def initialize(line_number = TNWindow::Line)
  74.     super(window_x, window_y(line_number), window_width, fitting_height(line_number))     
  75.   end
  76.  
  77.   #设置窗口宽度和位置
  78.   def window_width
  79.     return TNWindow::Width
  80.   end
  81.   def window_x
  82.     return (Graphics.width - window_width)/2
  83.   end
  84.   def window_y(line_number)
  85.     return (Graphics.height - fitting_height(line_number)- 60)/2
  86.   end
  87.  
  88.   #设置文本
  89.   def set_text(text)
  90.     if text != @text
  91.       @text = text
  92.       refresh
  93.     end
  94.   end
  95.  
  96.   #清除
  97.   def clear
  98.     set_text("")
  99.   end
  100.  
  101.   #设定目标
  102.   def set_target(target)
  103.     set_text(target ? target.enemy.note : "")
  104.   end
  105.  
  106.   #刷新
  107.   def refresh
  108.     contents.clear
  109.     draw_text_ex(4, 0, @text)
  110.   end
  111. end
  112.  
  113. #----------------------------------------------------------------------------
  114. # ● 添加使用物品效果
  115. #----------------------------------------------------------------------------
  116. class Scene_Battle
  117.   alias indix_apply_item_effects apply_item_effects
  118.   def apply_item_effects(target, item)
  119.     indix_apply_item_effects(target,item)
  120.     use_investigate_item(target) if item.note.include?("<INVESTIGATE>")
  121.   end
  122.   def use_investigate_item(target)
  123.     activate_targetnote_window(target)
  124.  
  125.   end
  126. end
  127.  
  128. #----------------------------------------------------------------------------
  129. # ● 在战斗场景中添加该窗口
  130. #----------------------------------------------------------------------------
  131. class Scene_Battle < Scene_Base
  132.   alias indix_creat_all_windows create_all_windows
  133.   def create_all_windows
  134.     indix_creat_all_windows
  135.     create_targetnote_window
  136.   end
  137.   def create_targetnote_window
  138.     @targetnote_window = Window_TargetNote.new
  139.     @targetnote_window.hide
  140.     @targetnote_window.set_handler(:ok,     method(:close_targetnote_window))
  141.     @targetnote_window.set_handler(:cancel, method(:close_targetnote_window))
  142.   end
  143.   def activate_targetnote_window(target)
  144.     @targetnote_window.show
  145.     @targetnote_window.activate
  146.     @targetnote_window.set_target(target)
  147.   end
  148.   def close_targetnote_window
  149.     @targetnote_window.hide
  150.   end
  151.  
  152.   #----------------------------------------------------------------------------
  153.   # ● 在战斗场景中等待该窗口关闭
  154.   #----------------------------------------------------------------------------
  155.   def update_for_only_tnwindow
  156.     Graphics.update
  157.     Input.update
  158.     update_all_windows
  159.     $game_timer.update
  160.     $game_troop.update
  161.     @spriteset.update
  162.   end
  163.   def wait_tnwindow(duration)
  164.     duration.times {|i| update_for_only_tnwindow }
  165.   end
  166.   def update
  167.     super
  168.     if BattleManager.in_turn?
  169.       process_event
  170.       process_tnwindow
  171.       process_action
  172.     end
  173.     BattleManager.judge_win_loss
  174.   end
  175.   def process_tnwindow
  176.     return if @targetnote_window.visible == false
  177.     while @targetnote_window.visible == true
  178.       wait_tnwindow(10)
  179.       break until Input.trigger?(:B) || Input.trigger?(:C)
  180.     end
  181.   end
  182. end

设置方法1.PNG (140.83 KB, 下载次数: 8)

物品的设置,可以加一些酷炫的动画

物品的设置,可以加一些酷炫的动画

设置方法2.PNG (149.62 KB, 下载次数: 9)

敌人备注的设置

敌人备注的设置

使用效果.PNG (735.98 KB, 下载次数: 10)

实际的效果!按空格键或X键都可以关掉

实际的效果!按空格键或X键都可以关掉

评分

参与人数 2星屑 +150 +2 收起 理由
天使说 + 1 虽然看不懂但是我很赞同
alexncf125 + 150 + 1 塞糖

查看全部评分

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

本版积分规则

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

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

GMT+8, 2024-4-29 14:37

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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