| 赞 | 20 |
| VIP | |
| 好人卡 | |
| 积分 | 17 |
| 经验 | |
| 最后登录 | 2026-9-14 |
| 在线时间 | 163 小时 |
- 梦石
- 0
- 星屑
- 1679
- 在线时间
- 163 小时
- 注册时间
- 2022-1-14
- 回帖
- 27
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 IndigoIX 于 2022-2-22 14:39 编辑
因为很想要实现一个战斗中对某个敌人使用一个物品就能分析它的特点的效果……在p1找了一圈没找着,就干脆试试自己写了
可喜可贺,终于还是写出来了!(但是兼容性可能不是很好!我努力在用alias了呜呜 还是太菜)
如果加以改造应该还可以实现其他的效果!
比如战斗中查看队友备注(啊这……没什么用吧!)
或者能查看敌人的各项具体数值(理论上应该可以!但是我不会!)
用法是即插即用,然后在数据库里设置一下对应的几项就可以啦
对敌人附加一些伤害和状态大概也是可以的……反正我没试过(如果这样那这个道具也太逆天了吧!)
[pre lang="ruby"]#============================================================================
# 战斗中使用物品查看敌人备注 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[/pre] |
-
物品的设置,可以加一些酷炫的动画
-
敌人备注的设置
-
实际的效果!按空格键或X键都可以关掉
评分
-
查看全部评分
|