标题: 搜索一下没找到类似的脚本,分享一个敌人召唤技能的脚本 [打印本页] 作者: shengfeng 时间: 2019-6-21 11:18 标题: 搜索一下没找到类似的脚本,分享一个敌人召唤技能的脚本 这是一个外来脚本,自己做了汉化! 脚本如下↓作者: shengfeng 时间: 2019-6-21 11:19
#===============================================================================
#
# Enemy Summon Skill (1.0)
# 30/1/12
# By modern algebra and (ported to VXA) Pacman
# This script allows you to make skills for enemies where they can summon or
# call additional enemies to the battlefield. This is NOT a summon skill that
# can be used by actors - it can ONLY be used by enemies.
# You can set up some basic configuration at line 44. Please check the comments
# to see what each option does.
#
# 要创建召唤技能(只能敌人可使用),只需将以下代码放入技能的备注栏中:
#
# \SUMMON_ENEMY[id, x, y, n]
#
# id : 召唤的敌人id.
# x : 召唤的敌人在召唤者所处的位置的x坐标
# 如果省略,则在脚本中使用设定的值
# y : 召唤的敌人在召唤者所处的位置的y坐标
# 如果省略,则在脚本中使用设定的值
# n : 召唤成功率
# 如果省略,则默认为1
#
# 正如你所知的那样,你可以在同一个备注栏放置一些这样的代码,
# 这样你就可以使同一技能可以召唤出不同的敌人,你可以通过几率控制它出现
#
#
# 例子:
#
# 像这样在技能备注栏设置的技能:
# \SUMMON_ENEMY[1, 35, 45, 3]
# \SUMMON_ENEMY[2, 25, 35, 1]
#
# 当它成功时(由技能的命中率直接控制)会在75%概率召唤ID为1(默认是:史莱姆)的敌人,
# 并且25%概率召唤ID为2的敌人(默认是:蝙蝠),如果它是召唤一个史莱姆,
# 位置将在召唤者的右侧35像素,向下45像素,或者如果它是召唤一个蝙蝠,
# 位置将在召唤者的右边25像素,向下35像素。召唤概率计算,因为3 + 1 = 4,
# 这意味着3/4概率召唤史莱姆,1/4概率召唤蝙蝠
#
#=です=です=です=です=です=です=です=です=です=です=です=です=です=です=です=です=です=です=です=です==
#
#
module MA_ESS
SUMMON_FAILURE = "%s 敌人好像还未到来!" # 召唤失败时显示的信息
MAX_TROOP_SIZE = 8 # 敌群的最大敌人数量(上限召唤)
DEFAULT_X_PLUS = 35 # 召唤者召唤的敌人的默认x坐标
# 如果您在备注栏中设置的,此项不会被使用
DEFAULT_Y_PLUS = 25 # 召唤者召唤的敌人的默认y坐标
# 如果您在备注栏中设置的,此项不会被使用
end
#
# 设置结束
#
#=です=です=です=です=です=です=です=です=です=です=です=です=です=です=です=です=です=です=です=です==
#==============================================================================
# ** RPG::Skill
#------------------------------------------------------------------------------
# Data class for skills. Subclass of RPG::UsableItem. Some Japanese twaddle.
#==============================================================================
class RPG::Skill < RPG::UsableItem
#--------------------------------------------------------------------------
# * 味方のスキルを呼んでいるのか?
#--------------------------------------------------------------------------
def ma_call_ally?
self.note[/\\SUMMON[_ ]?ENEMY\[\d+.*?\]/i] != nil
end
#--------------------------------------------------------------------------
# * 同盟国統計情報を呼び出す
#--------------------------------------------------------------------------
def ma_call_ally
miss = rand(100)
return nil if self.success_rate < miss
possibilities = []
note = self.note.dup
note.gsub!(/\\SUMMON[_ ]?ENEMY\[(\d+)[,;]?\s*(-?\d*)[,;]?\s*(-?\d*)[,;]?\s*(\d*)\]/i) { |match|
i = $1.to_i
x = $2.empty? ? MA_ESS::DEFAULT_X_PLUS : $2.to_i
y = $3.empty? ? MA_ESS::DEFAULT_Y_PLUS : $3.to_i
n = $4.empty? ? 1 : $4.to_i
(n).times do possibilities.push([i, x, y]) end
""
}
return *possibilities[rand(possibilities.size)]
end
end
class Spriteset_Battle
#--------------------------------------------------------------------------
# * コールの敵のスキル
#--------------------------------------------------------------------------
def ma_call_enemy(battler)
@enemy_sprites.push(Sprite_Battler.new(@viewport1, battler))
end
end
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# エイリアスのリスト
#--------------------------------------------------------------------------
alias maess_use_item use_item
#--------------------------------------------------------------------------
# * アイテムを使用してください
#--------------------------------------------------------------------------
def use_item(*args)
item = @subject.current_action.item
if item.is_a?(RPG::Skill)
skill = item
if skill.ma_call_ally?
id, x, y = skill.ma_call_ally
if id.nil?
text = sprintf(MA_ESS::SUMMON_FAILURE, @subject.name)
@log_window.add_text(text)
wait(30)
return
else
target = $game_troop.ma_call_ally(@subject, id, x, y)
@spriteset.ma_call_enemy(target)
show_animation([target], skill.animation_id)
end
end
end
maess_use_item(*args)
end
end