Project1
标题:
关于多体攻击脚本问题!
[打印本页]
作者:
an1ji1er1
时间:
2013-4-1 00:54
标题:
关于多体攻击脚本问题!
本帖最后由 hcm 于 2013-4-28 20:45 编辑
请问如何能够实现多个目标攻击,并且目标是随机的啊?我用的多体攻击脚本,虽然是可以增加多个目标,但是我发现目标是固定的,并非是随机的,比如说我的技能是秒5,8个敌人,我点6号敌人用的法术,而被秒的一定是6号敌人加上,1,2,3,4号敌人,如果我选8号敌人秒,那么被秒的就是8号加1,2,3,4。我希望是的随机选取敌人而并非是这样固定的。以下是我用的多体攻击脚本,哪位大神可以帮忙修改以下呀。
#==============================================================================
#[仿大话梦幻]多体攻击(俗称秒2~秒7,非全体攻击)Ver0.03b
#
#by SixRice = 66fan
#==============================================================================
#适用战斗系统:默认回合制,CP半即时;RTAB不适用
#
#很简单的脚本,不推荐作为外挂脚本来用。希望大家能看懂之后添加近自己的游戏中去。
#
#重定义部分:set_target_battlers,其余为新定义。
#
#上面三个XRXS的脚本不要删除,请尊重别人的版权。
#
#Ver0.03根据玩家的建议,追加范围变成按照对象的速度排序。
#
#Ver0.02新增随机范围
# 修正0.01中,如果什么范围都不选,会变成全体攻击的BUG
#
#==============================================================================
# 使用说明:
#1,单体目标的情况下,以下秒几的效果为追加范围
#2,全体目标的情况下,以下秒几的效果为固定范围
#3,如果附加了“随机”属性,
# 单体攻击追加范围变成 0 到 X,
# 全体攻击固定范围变成 1 到 X,
# 举例:单体攻击,追加范围“秒7”,“随机”,实际范围是 1 +(0 ~ 7)
# 全体攻击,固定范围“秒8”,“随机”,实际范围是 1 ~ 8
#
# 如有其他特殊要求,请看懂脚本自行设置。
#==============================================================================
module SXR
#==============================================================================
#属性名(同时存在的话,取最大值;同时包括多体范围和随机范围的话,取随机范围。)
#==============================================================================
ADD_TARGET2 = "秒2"#1体目标,追加1体序列
ADD_TARGET3 = "秒3"#1体目标,追加2体序列
ADD_TARGET4 = "秒4"#1体目标,追加3体序列
ADD_TARGET5 = "秒5"#1体目标,追加4体序列
ADD_TARGET6 = "秒6"#1体目标,追加5体序列
ADD_TARGET7 = "秒7"#1体目标,追加6体序列
ADD_TARGET8 = "秒8"#1体目标,追加7体序列
ARA_TARGET = "随机"#单选无效,配合上面才能产生效果,将追加改为随机追加
end
#==============================================================================
# ■ Game_BattleAction
#==============================================================================
class Game_BattleAction
attr_accessor :add_target
attr_accessor :ara_target
#------------------------------------------------------------------------------
# ○ clear
#------------------------------------------------------------------------------
alias sxr_clear clear
def clear
sxr_clear
clear_sxr_add_target
end
#------------------------------------------------------------------------------
# ○ 特殊效果clear
#------------------------------------------------------------------------------
def clear_sxr_add_target
self.add_target = 0
self.ara_target = 0
end
#------------------------------------------------------------------------------
# ○ 无效化特殊效果
#------------------------------------------------------------------------------
def nillize_sxr_add_target
self.add_target = nil
self.ara_target = nil
end
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
#------------------------------------------------------------------------------
# ○追加目标范围设定
#------------------------------------------------------------------------------
def set_sxr_add_target(set)
# 追加/固定目标范围强制值
self.current_action.add_target =
XRXS.element_include?(set, SXR::ADD_TARGET8) ? 8 :
XRXS.element_include?(set, SXR::ADD_TARGET7) ? 7 :
XRXS.element_include?(set, SXR::ADD_TARGET6) ? 6 :
XRXS.element_include?(set, SXR::ADD_TARGET5) ? 5 :
XRXS.element_include?(set, SXR::ADD_TARGET4) ? 4 :
XRXS.element_include?(set, SXR::ADD_TARGET3) ? 3 :
XRXS.element_include?(set, SXR::ADD_TARGET2) ? 2 :
0
# 是否随机目标范围
self.current_action.ara_target =
XRXS.element_include?(set, SXR::ARA_TARGET) ? 1 :
0
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
alias sxr_main main
def main
# recall
sxr_main
# 清空角色的特殊效果设置
for actor in $game_party.actors
actor.current_action.clear_sxr_add_target
actor.current_action.nillize_sxr_add_target
end
end
#--------------------------------------------------------------------------
# ● 设置物品或特技对像方的战斗者
# scope : 特技或者是物品的范围
#--------------------------------------------------------------------------
def set_target_battlers(scope)
# 行动方的战斗者是敌人的情况下
if @active_battler.is_a?(Game_Enemy)
# 效果范围分支
case scope
when 1 # 敌单体
for actor in $game_party.actors
if actor.exist?
@target_battlers.push(actor)
end
end
index = @active_battler.current_action.target_index
@target_battlers.push($game_party.smooth_target_actor(index))
@target_battlers.delete($game_party.smooth_target_actor(index))
@target_battlers.sort! {|a,b| b.agi - a.agi }#(0.03)
@target_battlers = @target_battlers[0, 0] if @active_battler.current_action.add_target == 0
@target_battlers = @target_battlers[0, 1] if @active_battler.current_action.add_target == 2
@target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 3
@target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 4
@target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 5
@target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 6
@target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 7
@target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 8
@target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
@target_battlers.push($game_party.smooth_target_actor(index))
when 2 # 敌全体
for actor in $game_party.actors
if actor.exist?
@target_battlers.push(actor)
@target_battlers.sort! {|a,b| b.agi - a.agi }#(0.03)
@target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 2
@target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 3
@target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 4
@target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 5
@target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 6
@target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 7
@target_battlers = @target_battlers[0, 8] if @active_battler.current_action.add_target == 8
@target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)+1] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
end
end
when 3 # 我方单体
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
end
end
index = @active_battler.current_action.target_index
@target_battlers.push($game_troop.smooth_target_enemy(index))
@target_battlers.delete($game_troop.smooth_target_enemy(index))
@target_battlers.sort! {|a,b| b.agi - a.agi }#(0.03)
@target_battlers = @target_battlers[0, 0] if @active_battler.current_action.add_target == 0
@target_battlers = @target_battlers[0, 1] if @active_battler.current_action.add_target == 2
@target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 3
@target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 4
@target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 5
@target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 6
@target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 7
@target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 8
@target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
@target_battlers.push($game_troop.smooth_target_enemy(index))
when 4 # 我方全体
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
@target_battlers.sort! {|a,b| b.agi - a.agi }#(0.03)
@target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 2
@target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 3
@target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 4
@target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 5
@target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 6
@target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 7
@target_battlers = @target_battlers[0, 8] if @active_battler.current_action.add_target == 8
@target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)+1] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
end
end
when 5 # 我方单体 (HP 0)
index = @active_battler.current_action.target_index
enemy = $game_troop.enemies[index]
if enemy != nil and enemy.hp0?
@target_battlers.push(enemy)
end
when 6 # 我方全体 (HP 0)
for enemy in $game_troop.enemies
if enemy != nil and enemy.hp0?
@target_battlers.push(enemy)
@target_battlers.sort! {|a,b| b.agi - a.agi } #(0.03)
@target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 2
@target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 3
@target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 4
@target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 5
@target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 6
@target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 7
@target_battlers = @target_battlers[0, 8] if @active_battler.current_action.add_target == 8
@target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)+1] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
end
end
when 7 # 使用者
@target_battlers.push(@active_battler)
end
end
# 行动方的战斗者是角色的情况下
if @active_battler.is_a?(Game_Actor)
@active_battler.set_sxr_add_target(@active_battler.skill_element_set(@skill))
# 效果范围分支
case scope
when 1 # 敌单体
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
end
end
index = @active_battler.current_action.target_index
@target_battlers.push($game_troop.smooth_target_enemy(index))
@target_battlers.delete($game_troop.smooth_target_enemy(index))
@target_battlers.sort! {|a,b| b.agi - a.agi }#(0.03)
@target_battlers = @target_battlers[0, 0] if @active_battler.current_action.add_target == 0
@target_battlers = @target_battlers[0, 1] if @active_battler.current_action.add_target == 2
@target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 3
@target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 4
@target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 5
@target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 6
@target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 7
@target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 8
@target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
@target_battlers.push($game_troop.smooth_target_enemy(index))
when 2 # 敌全体
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
@target_battlers.sort! {|a,b| b.agi - a.agi } #(0.03)
@target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 2
@target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 3
@target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 4
@target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 5
@target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 6
@target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 7
@target_battlers = @target_battlers[0, 8] if @active_battler.current_action.add_target == 8
@target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)+1] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
end
end
when 3 # 我方单体
for actor in $game_party.actors
if actor.exist?
@target_battlers.push(actor)
end
end
index = @active_battler.current_action.target_index
@target_battlers.push($game_party.smooth_target_actor(index))
@target_battlers.delete($game_party.smooth_target_actor(index))
@target_battlers.sort! {|a,b| b.agi - a.agi }#(0.03)
@target_battlers = @target_battlers[0, 0] if @active_battler.current_action.add_target == 0
@target_battlers = @target_battlers[0, 1] if @active_battler.current_action.add_target == 2
@target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 3
@target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 4
@target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 5
@target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 6
@target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 7
@target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 8
@target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
@target_battlers.push($game_party.smooth_target_actor(index))
when 4 # 我方全体
for actor in $game_party.actors
if actor.exist?
@target_battlers.push(actor)
@target_battlers.sort! {|a,b| b.agi - a.agi }#(0.03)
@target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 2
@target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 3
@target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 4
@target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 5
@target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 6
@target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 7
@target_battlers = @target_battlers[0, 8] if @active_battler.current_action.add_target == 8
@target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)+1] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
end
end
when 5 # 我方单体 (HP 0)
index = @active_battler.current_action.target_index
actor = $game_party.actors[index]
if actor != nil and actor.hp0?
@target_battlers.push(actor)
end
when 6 # 我方全体 (HP 0)
for actor in $game_party.actors
if actor != nil and actor.hp0?
@target_battlers.push(actor)
@target_battlers.sort! {|a,b| b.agi - a.agi } #(0.03)
@target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 2
@target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 3
@target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 4
@target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 5
@target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 6
@target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 7
@target_battlers = @target_battlers[0, 8] if @active_battler.current_action.add_target == 8
@target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)+1] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
end
end
when 7 # 使用者
@target_battlers.push(@active_battler)
end
end
end
#--------------------------------------------------------------------------
# ● 生成特技行动结果
#--------------------------------------------------------------------------
alias sxr_make_skill_action_result make_skill_action_result
def make_skill_action_result
# 获取特技
[url=home.php?mod=space&uid=260100]@skill[/url] = $data_skills[@active_battler.current_action.skill_id]
# 获取行动者特技附加的战斗特效
@active_battler.set_sxr_add_target(@active_battler.skill_element_set(@skill))
# recall
sxr_make_skill_action_result
end
end
复制代码
作者:
joe5491
时间:
2013-4-1 01:23
本帖最后由 joe5491 于 2013-4-1 01:25 编辑
这不用改阿,这脚本本来就已经写好啦~
你有没有发现个属性名为"随机"阿?
你就在加个名为"随机"的属性就好啦~
#==============================================================================
#属性名(同时存在的话,取最大值;同时包括多体范围和随机范围的话,取随机范围。)
#==============================================================================
ADD_TARGET2 = "秒2"#1体目标,追加1体序列
ADD_TARGET3 = "秒3"#1体目标,追加2体序列
ADD_TARGET4 = "秒4"#1体目标,追加3体序列
ADD_TARGET5 = "秒5"#1体目标,追加4体序列
ADD_TARGET6 = "秒6"#1体目标,追加5体序列
ADD_TARGET7 = "秒7"#1体目标,追加6体序列
ADD_TARGET8 = "秒8"#1体目标,追加7体序列
ARA_TARGET = "随机"#单选无效,配合上面才能产生效果,将追加改为随机追加
作者:
an1ji1er1
时间:
2013-4-3 19:39
joe5491 发表于 2013-4-1 01:23
这不用改阿,这脚本本来就已经写好啦~
你有没有发现个属性名为"随机"阿?
问题解决了,谢谢你的帮助。怪我没看仔细,里面说了是按照速度高的优先,我用的是封印技能,封的同时降低了敌人的敏捷,这样就不会重复封了。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1