Project1
标题:
如何让某角色/状态下一回合可以多次进行使用道具的行动?
[打印本页]
作者:
骷髅岛遗老
时间:
2019-9-20 01:56
标题:
如何让某角色/状态下一回合可以多次进行使用道具的行动?
大佬们好,本菜鸡又来想法了
事情大概是,有一个剧情设定上比较弱的角色,我不想让他有太强的技能砍出跟主角同一梯队的爆炸伤害,但又不希望他因为战五渣永远坐冷板凳,于是想了想怎样才能让这位选手在弱的同时又有用……
废话说完了,总之求问一下,怎样让特定的角色/职业/状态下,一回合可以连续使用多个道具(类似多次行动机会,但只限于使用道具,技能还是只能放一次)
默认的药理知识貌似只增强回复效果,道具里有些更复杂的效果没有影响,也不能一回合使用多次
作者:
真の玛娜君
时间:
2019-9-20 20:31
本帖最后由 真の玛娜君 于 2019-9-20 20:43 编辑
在物品or技能 备注栏输入 <即时使用> 即可,可以不消耗回合
详情请看脚本介绍
#==============================================================================
#
# ▼ Yanfly Engine Ace - 即时使用 v1.03
# -- 最后更新: 2012.07.17
# -- 使用难度: 普通
# -- 需要脚本: 无
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-InstantCast"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.07.17 - Instant doesn't take up a turn if a characterh as additional
# actions/can attack twice.
# 2012.01.12 - Anti-crash methods implemented.
# 2011.12.26 - Bug Fixed: If actor gets stunned while doing an instant cast,
# the actor will not be reselected.
# 2011.12.21 - Started Script and Finished.
#
#==============================================================================
# ▼ 介绍
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 即时使用技能/物品的效果为:角色可以立即使用该技能/武器,并且不会消耗本回合的
# 行动次数。只要该角色有足够的释放条件(例如mp、tp)就可以无限使用.
# 即时使用功能重回RPG Maker VX Ace.以下为即时使用的一些改动:
#
# 1) 对于多行动数的角色,例如连续技,只有在第一个动作是即时使用时才会成功使用即
# 时使用效果.就算第二个或之后的行动为即时使用,该技能也不会触发即时使用效果.
#
# 2) 任何即时使用的技能/物品都会自动瞬时触发,包括即时使用技能中的连锁技能.
#
# 3) 如果敌人使用了一个即时使用的技能,其在使用后会额为获得一次行动机会.
#
#==============================================================================
# ▼ 安装方式
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 打开脚本编辑器,将本脚本拷贝/复制到一个在▼ 插件脚本之下▼ Main之上的新
# 脚本页/槽中.记得保存你的工程以使脚本生效.
#
# -----------------------------------------------------------------------------
# 技能备注 - 在数据库-技能中可以使用的备注.
# -----------------------------------------------------------------------------
# <即时使用>
# 使该技能变成即时使用技能.使用后在战斗阶段开始前会立即使用该技能.
#
# -----------------------------------------------------------------------------
# 物品备注 - 在数据库-物品中可以使用的备注.
# -----------------------------------------------------------------------------
# <即时使用>
# 使该物品变成即时使用物品.使用后在战斗阶段开始前会立即使用该技能.
#
#==============================================================================
# ▼ 兼容性
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 本脚本仅为RPG Maker VX Ace编写.极不可能在无任何修改的情况下运行于RPG Maker VX.
#
# 本脚本和 Yanfly Engine Ace - 战斗系统 v1.00+ 互相兼容.
# 请将本脚本放在其之下.
#
#==============================================================================
# ▼ 编辑以下内容可能会出现电脑损坏、死机,电脑主人脑袋爆炸、昏迷、死亡或口臭
# 所以编辑了后果自负。
#==============================================================================
module YEA
module REGEXP
module USABLEITEM
INSTANT = /<(?:INSTANT|即时使用)>/i
end # USABLEITEM
end # REGEXP
end # YEA
#==============================================================================
# ¡ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_instant load_database; end
def self.load_database
load_database_instant
load_notetags_instant
end
#--------------------------------------------------------------------------
# new method: load_notetags_instant
#--------------------------------------------------------------------------
def self.load_notetags_instant
groups = [$data_skills, $data_items]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_instant
end
end
end
end # DataManager
#==============================================================================
# ¡ RPG::UsableItem
#==============================================================================
class RPG::UsableItem < RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :instant
#--------------------------------------------------------------------------
# common cache: load_notetags_instant
#--------------------------------------------------------------------------
def load_notetags_instant
@instant = false
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::USABLEITEM::INSTANT
@instant = true
#---
end
} # self.note.split
#---
end
end # RPG::UsableItem
#==============================================================================
# ¡ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# new method: check_instant_action
#--------------------------------------------------------------------------
def check_instant_action
@backup_actions_instant = []
@actions.each { |action|
next unless action
if action.item.nil?
@backup_actions_instant.push(action.dup)
next
end
unless action.item.instant
@backup_actions_instant.push(action.dup)
action.clear
end
}
end
#--------------------------------------------------------------------------
# new method: restore_instant_action
#--------------------------------------------------------------------------
def restore_instant_action
@backup_actions_instant.each_index { |i|
@actions[i] = @backup_actions_instant[i]
}
@backup_actions_instant.clear
i = 0
@actions.each { |action| if action.item.nil?; break; end; i += 1 }
@action_input_index = i
end
end # Game_Actor
#==============================================================================
# ¡ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# new method: add_extra_action
#--------------------------------------------------------------------------
def add_extra_action
action_list = enemy.actions.select {|a| action_valid?(a) }
return if action_list.empty?
rating_max = action_list.collect {|a| a.rating }.max
rating_zero = rating_max - 3
action_list.reject! {|a| a.rating <= rating_zero }
action = Game_Action.new(self)
action.set_enemy_action(select_enemy_action(action_list, rating_zero))
@actions.push(action)
end
end # Game_Enemy
#==============================================================================
# ¡ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# alias method: next_command
#--------------------------------------------------------------------------
alias scene_battle_next_command_instant next_command
def next_command
if instant_action?
perform_instant_action
else
scene_battle_next_command_instant
end
end
#--------------------------------------------------------------------------
# new method: instant_action?
#--------------------------------------------------------------------------
def instant_action?
return false if BattleManager.actor.nil?
return false if BattleManager.actor.input.nil?
action = BattleManager.actor.input.item
return false if action.nil?
return action.instant
end
#--------------------------------------------------------------------------
# new method: perform_instant_action
#--------------------------------------------------------------------------
def perform_instant_action
hide_instant_action_windows
@subject = BattleManager.actor
@subject.check_instant_action
execute_action if @subject.current_action.valid?
process_event
loop do
@subject.remove_current_action
break if $game_troop.all_dead?
break unless @subject.current_action
@subject.current_action.prepare
execute_action if @subject.current_action.valid?
end
process_action_end
@subject.make_actions
@subject.restore_instant_action
@subject = nil
show_instant_action_windows
end
#--------------------------------------------------------------------------
# new method: hide_instant_action_windows
#--------------------------------------------------------------------------
def hide_instant_action_windows
if $imported["YEA-BattleEngine"]
@info_viewport.visible = true
@status_aid_window.hide
@status_window.show
@actor_command_window.show
end
end
#--------------------------------------------------------------------------
# new method: show_instant_action_windows
#--------------------------------------------------------------------------
def show_instant_action_windows
if $imported["YEA-BattleEngine"]
@info_viewport.visible = true
end
start_actor_command_selection
status_redraw_target(BattleManager.actor)
next_command unless BattleManager.actor.inputable?
end
#--------------------------------------------------------------------------
# new method: status_redraw_target
#--------------------------------------------------------------------------
def status_redraw_target(target)
return unless target.actor?
@status_window.draw_item($game_party.battle_members.index(target))
end
#--------------------------------------------------------------------------
# alias method: execute_action
#--------------------------------------------------------------------------
alias scene_battle_execute_action_instant execute_action
def execute_action
scene_battle_execute_action_instant
enemy_add_actions
end
#--------------------------------------------------------------------------
# new method: enemy_add_actions
#--------------------------------------------------------------------------
def enemy_add_actions
return if @subject.actor?
return if @subject.current_action.nil?
return if @subject.current_action.item.nil?
return unless @subject.current_action.item.instant
@subject.add_extra_action
end
end # Scene_Battle
#==============================================================================
#
# ▼ End of File
#
#==============================================================================
复制代码
VA默认的药理知识只对使用效果里的3种恢复效果有效,且只是物品使用者的效果变化,虽然能用来做医生等职业,但是没法做抗药性,不够完善
如果你想增强这个角色的话,我还有个思路,那就是用我下面这个脚本做几个技能,比如消耗只能对一个人用的生命药水,来造成对全体人员生效
的生命药水喷雾。在技能备注输入 Spec:Shoot|Numb:消耗物品数量|Binx:消耗物品ID
#===============================================================================
#
# 简版子弹射击系统 For RMVA
#
# 版本:0.1
# 说明:直接在你的射击系统的备注中加入:Spec:Shoot|Numb:AA|Binx:BB
# 其中:AA为要消耗子弹的数量;BB为子弹的物品编号,
# Shoot、Numb和Binx为标志,如果出现冲突可以在下面修改标志符号(很难用到)
# 没有子弹的提示语也可以在下面修改 喵~
#===============================================================================
class Scene_Battle < Scene_Base
def on_skill_ok
#===========================================================================
# 设置技能备注中的标志以及提示语
shoot_s = "Shoot" # 设置作为射击技能的标志
@numb_s = "Numb" # 设置需要子弹数量的标志
@binx_s = "Binx" # 设置作为子弹的物品编号
#@nohb_s = "子弹数量已不足,无法射击!" # 设置子弹不足时的提示语
#===========================================================================
@skill = @skill_window.item
if !$data_skills[@skill.id].note.empty?
if $data_skills[@skill.id].note.downcase.include?shoot_s.downcase
notes = $data_skills[@skill.id].note
if !shoot_skill(notes)
@skill = nil
@skill_window.activate
return 0
end
BattleManager.actor.input.set_skill(@skill.id)
BattleManager.actor.last_skill.object = @skill
end
end
BattleManager.actor.input.set_skill(@skill.id)
BattleManager.actor.last_skill.object = @skill
if
[email protected]
_selection?
@skill_window.hide
next_command
elsif @skill.for_opponent?
select_enemy_selection
else
select_actor_selection
end
end
def shoot_skill(note)
note_s = $data_skills[@skill.id].note.to_s
note_s = note_s[0,note_s.length].to_s
note_s1 = note_s
nindex = note_s.downcase.index(@numb_s.downcase)
note_s[0,nindex] = ""
note_s = (note_s.split("|"))[0] if note_s.include?"|"
num = note_s.split(":")[1]
nindex = note_s1.downcase.index(@binx_s.downcase)
note_s1[0,nindex] = ""
note_s1 = (note_s1.split("|"))[1] if note_s1.include?"|"
itnum = note_s1.split(":")[1].to_i
if $game_party.item_number($data_items[itnum]).to_i >= num.to_i
$game_party.lose_item($data_items[itnum],num.to_i)
else
@log_window.add_text @nohb_s if @log_window.last_text != @nohb_s
Sound.play_buzzer
return nil
end
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1