看来number_of_targets只能调用不能赋值,你把这段脚本插入到main前试试
=begin =============================================================================== 使用:在SET_SKILL数组中添加需要设置目标数的技能id,在SET中添加对应的目标数。 例如: SET_SKILL = [5, 6, 7] SET_TARGET = [1, 2, 3] 设置5号技能目标数1, 6号技能目标数2, 7号技能目标数3。 =============================================================================== =end SET_SKILL = [5, 6, 7] SET_TARGET = [2, 2, 3] class Game_Action #-------------------------------------------------------------------------- # ● 目标为敌人 #-------------------------------------------------------------------------- def targets_for_opponents if item.for_random? SET_SKILL.size.times do |i| if item.id == SET_SKILL[i] @n_target = SET_TARGET[i] end end Array.new(@n_target ? @n_target : item.number_of_targets) { opponents_unit.random_target } elsif item.for_one? num = 1 + (attack? ? subject.atk_times_add.to_i : 0) if @target_index < 0 [opponents_unit.random_target] * num else [opponents_unit.smooth_target(@target_index)] * num end else opponents_unit.alive_members end end end
=begin
===============================================================================
使用:在SET_SKILL数组中添加需要设置目标数的技能id,在SET中添加对应的目标数。
例如:
SET_SKILL = [5, 6, 7]
SET_TARGET = [1, 2, 3]
设置5号技能目标数1, 6号技能目标数2, 7号技能目标数3。
===============================================================================
=end
SET_SKILL = [5, 6, 7]
SET_TARGET = [2, 2, 3]
class Game_Action
#--------------------------------------------------------------------------
# ● 目标为敌人
#--------------------------------------------------------------------------
def targets_for_opponents
if item.for_random?
SET_SKILL.size.times do |i|
if item.id == SET_SKILL[i]
@n_target = SET_TARGET[i]
end
end
Array.new(@n_target ? @n_target : item.number_of_targets) { opponents_unit.random_target }
elsif item.for_one?
num = 1 + (attack? ? subject.atk_times_add.to_i : 0)
if @target_index < 0
[opponents_unit.random_target] * num
else
[opponents_unit.smooth_target(@target_index)] * num
end
else
opponents_unit.alive_members
end
end
end
|