Introduction
This script allows for skills/weapons/enemies/items to hit multiple times. This script is similiar to the KGC script of the same name, but isn't the same as it.
Instructions
All you have to do is edit the animation and add blank Timing events (no SE and no Flashes) (if you don't get what this is there are examples given in the demo) at the frame where you want damage to show if it is just one hit and you want it to show at the last frame of the animation don't do anything the script automatically takes care of it, but If you want two or more hits then and you want it to show damage at the last frame then you have to add a Blank Timing event at the end of the animation. You don't have to do any mods to anything else the script takes care of that for you.
Compatibility
SDK 2.x compliant
Requires Method and Class Library V1.5 or greater
Patches
Sg's Counter Attack Script (Outdated)
Script
The Actual Problem was that SG used a phase4_step value of 1337 which shuts off my script, He also placed it right after phase4_step5 (probably not enough time in between damage pops) so I moved this to phase4_step6 (common events will happen before the counter attack now).
I have also fixed the inaccurate damage problem, instead of giving back hp. doing the math after the damage is calculated and then lose hp again. the calculations are done while it is running (By aliasing hp= and checking if the difference was damage and if so apply the calculations and then deduct hp).
Patch SG Counter and My Multi-Attack
Code:
class Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :counter_power
attr_accessor :countered
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias multi_counter_initialize initialize
def initialize
# The Usual
multi_counter_initialize
# Counter Power Setup
@counter_power = 1.0
# Countered Flag
@countered = false
end
#--------------------------------------------------------------------------
# * Set Hp
#--------------------------------------------------------------------------
alias counter_hp= hp=
def hp=(hp)
# Get Old and New Hp
old_hp, new_hp = self.hp, hp
# If Damage is a Number and Difference is damage and counter flag
if (self.damage.is_a?(Numeric) and old_hp - new_hp == self.damage and
@countered)
# Get Damage
n = self.damage
# Multiply By Counter Power
damage_hp = (n * @counter_power).to_i
# The Usual with new Hp
self.counter_hp = old_hp - damage_hp
# Set Damage
self.damage = damage_hp
else
# The Usual
self.counter_hp = hp
end
end
end
class Scene_Battle
#--------------------------------------------------------------------------
# * Update Phase4 Step5
#--------------------------------------------------------------------------
def update_phase4_step5
# Disable Edits (The Usual)
sandgolem_counter_battle_up4s5
end
#--------------------------------------------------------------------------
# * Update Phase4 Step6
#--------------------------------------------------------------------------
alias sandgolem_counter_battle_up4s6 update_phase4_step6
def update_phase4_step6
# The Usual
sandgolem_counter_battle_up4s6
# Skip if no Counter Attack Target
return if @sg_countertarget == nil
# Set Phase4 Step to some value not used
@phase4_step = 1337
# Set Attack Counter Wait
@sg_atkcounter = 28
end
#--------------------------------------------------------------------------
# * Sg Counter Update (Rewrite)
#--------------------------------------------------------------------------
def sg_counter_update
# If Counter Target Dead or Counter is 0
if @sg_countertarget.dead? or @sg_atkcounter == 0
# Reset All
@sg_atkcounter, @sg_counter, @sg_countertarget = nil
# Phase 1
@phase4_step = 1
# Return
return
end
# Decrease Counter
@sg_atkcounter -= 1
# Skip ff Counter is not 10
return if @sg_atkcounter != 10
# Get Random Index
sg_temp = rand(SG_Counter_Messages.size)
# Get Message from Index
sg_temp = SG_Counter_Messages[sg_temp].clone
# Replace \m \M with with counter attackeers names
sg_temp.gsub!(/\\[Mm]/) { @sg_countertarget.name }
# Set Help Window Text
@help_window.set_text(sg_temp, 1)
# Set Counter Power
@active_battler.counter_power = @sg_counter / 100.0
# Set Counter Flag
@active_battler.countered = true
# Run Attack Effect
@active_battler.attack_effect(@sg_countertarget)
# Reset Counter Power
@active_battler.counter_power = 1.0
# Reset Counter Flag
@active_battler.countered = false
# If Damage is a Numeric Refresh Window
@status_window.refresh if @active_battler.damage.is_a?(Numeric)
# Set Animation IDs
@sg_countertarget.animation_id = @sg_countertarget.animation1_id
@active_battler.animation_id = @sg_countertarget.animation2_id
# Set Damage Pop Flag
@active_battler.damage_pop = true
end
end
module RPG
class Sprite < ::Sprite
#---------------------------------------------------------------------------
# ? Start Animation
# inputs: animation, battler or animation_hit
#---------------------------------------------------------------------------
def animation(*args)
# Dispose Old Animation
dispose_animation
# Return if Animation is nil (First Argument)
return if args[0].nil?
# Flag for Damage Popping
@damage_pop = false
# Animation is the first Argument
@_animation = args[0]
# If A Game_Battler Object was sent
if args[1].is_a?(Game_Battler)
# Save Battler
@_animation_battler = args[1]
# Get Animation Hit
@_animation_hit = @_animation_battler.animation_hit
# If Animation is Multi-Hit
if @_animation.multi
# Get all of the Damage and Critical Hits
@_animation_damage = @_animation_battler.damage_hits.to_a
@_animation_critical = @_animation_battler.critical_hits.to_a
# Recreate Animation Hit
@_animation_hit = []
# Run Through Each Damage
@_animation_damage.each do |damage|
# Push Hit State
@_animation_hit << (damage != "Miss")
end
end
else
# Hit is the second argument
@_animation_hit = args[1]
end
# No Damage Pop if After Second Animation Id Phase
@damage_pop = true if ($game_temp.in_battle and
[5,9, 1337].include?($scene.phase4_step))
# Setup Animation Like usual
@_animation_duration = @_animation.frame_max
animation_name = @_animation.animation_name
animation_hue = @_animation.animation_hue
bitmap = RPG::Cache.animation(animation_name, animation_hue)
if @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
else
@@_reference_count[bitmap] = 1
end
@_animation_sprites = []
if @_animation.position != 3 or not @@_animations.include?(@_animation)
16.times do
sprite = ::Sprite.new(self.viewport)
sprite.bitmap = bitmap
sprite.visible = false
@_animation_sprites << sprite
end
@@_animations << @_animation unless @@_animations.include?(@_animation)
end
update_animation
end
end
end
FAQ Note:Permission granted by Trickster to post:
Quote:And if you post what you have now of my stuff then you don't have the latest versions. I'm too lazy/busy to post stuff.
As this is his material, it is deletable upon his request. Due to his current absense, no support is available. Please do not PM or eMail him for support.
Credits and Thanks
Raziel for what little betatesting he did (lol just kidding Raz :P you did a great job helping)
Kurisu and Raven for betatesting as well.
Author's Notes
Enjoy
Terms and Conditions
Hey, I posted this publicly. You can use it. What do you expect? But if you do use it, I do expect you to spell my name correctly in your game. And yes you can use it in commercial games too.