The already made RPG maker VX multi attack only allows you to attack 3 times, but with this script you can customize the number of attack of your enemy or character by many times as you want!
Start Copying here:
# by mizzl
# This script adds an extra option to any UsableItem(Item or Skill)
# namely the ability to say how many times the attack strikes
# just insert [multi (number)] into the notes box eg. [multi 2] will attack 2 times
# only works on enemies, c'mon, you're not going to multi attack your allies!
module MultiAttack
REGEXP = /\[multi\s+(\d+)\]/
end
class RPG::UsableItem < RPG::BaseItem
def read_multi_attack
@multi_attack = 0
self.note.split(/[\r\n]+/).each do |line|
if line =~ MultiAttack::REGEXP
@multi_attack = $1.to_i
end
end
end
def multi_attack
read_multi_attack if @multi_attack == nil
return @multi_attack
end
end
class Game_BattleAction
def make_obj_targets(obj)
targets = []
temp_targets = []
if obj.for_opponent?
if obj.for_random?
if obj.for_one? # One random enemy
number_of_targets = 1
elsif obj.for_two? # Two random enemies
number_of_targets = 2
else # Three random enemies
number_of_targets = 3
end
number_of_targets.times do
temp_targets.push(opponents_unit.random_target)
end
if obj.multi_attack > 1
obj.multi_attack.times do targets += temp_targets end
else
targets = temp_targets
end
elsif obj.multi_attack > 1 and obj.for_one? # Multiple attacks
target = opponents_unit.smooth_target(@target_index)
obj.multi_attack.times do targets.push(target) end
elsif obj.dual? # One enemy, dual (useless because of MultiAttack)
targets.push(opponents_unit.smooth_target(@target_index))
targets += targets
elsif obj.for_one? # One enemy
targets.push(opponents_unit.smooth_target(@target_index))
else # All enemies
temp_targets += opponents_unit.existing_members
if obj.multi_attack > 1
obj.multi_attack.times do targets += temp_targets end
else
targets = temp_targets
end
end
elsif obj.for_user? # User
targets.push(battler)
elsif obj.for_dead_friend?
if obj.for_one? # One ally (incapacitated)
targets.push(friends_unit.smooth_dead_target(@target_index))
else # All allies (incapacitated)
targets += friends_unit.dead_members
end
elsif obj.for_friend?
if obj.for_one? # One ally
targets.push(friends_unit.smooth_target(@target_index))
else # All allies
targets += friends_unit.existing_members
end
end
return targets.compact
end
end