Hello!
I am currently requesting a merge between two scripts. Trickster's Multi-Attack works but it causes a bug with Sandgolem's Counter-Attack.
Basically what happens is this.
When working correctly, when you are attacked by an enemy with the counter-attack state, you attack back and deal damage.
BUT, with Trickster's Multi-Attack, when you use a skill to enter a counter state, zero damage appears on your actor. Then when an enemy attacks, you still counter but the 'Counter' message screen appears for a quick second and no damage displays (yet the enemy still takes damage). When an enemy dies from a counter attack, they don't dissapear yet the battle report appears.
Trickster's Multi-Attack:
Sandgolem's Counter-Attack
If anyone could help me with this, I'll appreciate it greatly If not, then that's fine, I'll just have to take out the counter-attack script :\
~Shiro
I am currently requesting a merge between two scripts. Trickster's Multi-Attack works but it causes a bug with Sandgolem's Counter-Attack.
Basically what happens is this.
When working correctly, when you are attacked by an enemy with the counter-attack state, you attack back and deal damage.
BUT, with Trickster's Multi-Attack, when you use a skill to enter a counter state, zero damage appears on your actor. Then when an enemy attacks, you still counter but the 'Counter' message screen appears for a quick second and no damage displays (yet the enemy still takes damage). When an enemy dies from a counter attack, they don't dissapear yet the battle report appears.
Trickster's Multi-Attack:
Code:
=begin
#==============================================================================
# â—â— Multi-Attack
#------------------------------------------------------------------------------
# Trickster (tricksterguy@hotmail.com)
# Version 3.0
# Date 12/06/06
#
# Instructions:
# 1) Create your animation like usual
# 2) Determine how many hits you want the animation to do
# 3) What you will be doing now is adding blank SE/Timing Events
# That means a Timing that only has a frame nummber, no SE no Flash
# If you don't get what I mean there are examples
# 1) The Cross Cut Animation is one with a example of 2 attacks
# 2) The Slash 8x Animation is an example of one with 8 attacks
# 4) If only one hit determine where you want the damage to show
# note: if its at the last frame of the animation the script will
# automatically do this for you
# 5) If more than one hit determine where you want the damage to show
# note: if its at the last frame then you must put a blank at the end
# 6) Give the skill/weapon/item/enemy the animation and you are done the
# script takes care of the rest
#==============================================================================
=end
#--------------------------------------------------------------------------
# â— Begin SDK Log
#--------------------------------------------------------------------------
SDK.log('Multi-Attack', 'Trickster', 1.0, '5/27/06')
#--------------------------------------------------------------------------
# â— Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.state('Multi-Attack') == true
class Sprite_Battler < RPG::Sprite
#---------------------------------------------------------------------------
# â— Sprite Animation
#---------------------------------------------------------------------------
alias multi_sprite_animation sprite_animation
def sprite_animation
if $data_animations[@battler.animation_id.to_i] != nil
if $data_animations[@battler.animation_id].multi
@animation = $data_animations[@battler.animation_id]
animation(@animation, @battler)
@battler.animation_id = 0
@battler.damage_pop = false
else
multi_sprite_animation
end
else
@animation = nil
end
end
#---------------------------------------------------------------------------
# â— Sprite Damage
#---------------------------------------------------------------------------
def sprite_damage
if @battler.animation_id == 0 or (@animation.nil? or not @animation.multi)
if @battler.damage_pop
damage(@battler.damage, @battler.critical)
@battler.damage = nil
@battler.critical = false
@battler.damage_pop = false
end
end
end
#---------------------------------------------------------------------------
# â— Sprite Collaspe
#---------------------------------------------------------------------------
alias multi_sprite_collapse sprite_collapse
def sprite_collapse
if @animation.nil? or not @animation.multi
multi_sprite_collapse
end
end
#---------------------------------------------------------------------------
# â— Battler's Visibility
#---------------------------------------------------------------------------
def battler_visible=(bool)
@battler_visible = bool
end
end
#--------------------------------------------------------------------------
# End SDK Enabled Check
#--------------------------------------------------------------------------
end
#--------------------------------------------------------------------------
# â— Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.state('Multi-Attack') == true
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].dup
# If A Game_Battler Object was sent
if args[1].is_a?(Game_Battler)
# Make a Duplicate of the 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
hits = []
for damage in @_animation_damage
hits << ((damage != "Miss") | damage.nil?)
end
@_animation_hit = hits.dup
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 $scene.is_a?(Scene_Battle) and $scene.phase4_step == 5
# 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?(args[0])
for i in 0..15
sprite = ::Sprite.new(self.viewport)
sprite.bitmap = bitmap
sprite.visible = false
@_animation_sprites.push(sprite)
end
unless @@_animations.include?(args[0])
@@_animations.push(args[0])
end
end
update_animation
end
#---------------------------------------------------------------------------
# â— Update Animation (EDITED)
#---------------------------------------------------------------------------
def update_animation
if @_animation_duration > 0
frame_index = @_animation.frame_max - @_animation_duration
cell_data = @_animation.frames[frame_index].cell_data
position = @_animation.position
animation_set_sprites(@_animation_sprites, cell_data, position)
# If animation is a multi-hit and in battle
if @_animation.multi and $game_temp.in_battle
# Copy Damage Frames
damage_frames = @_animation.damage_frames.dup
# Set Union Add 0 and Max
damage_frames = damage_frames | [0, @_animation.frame_max]
# Sort Frames (Could be out of order)
damage_frames.sort!
# If on the frame set index
for i in 0...damage_frames.size
next if i+1 == damage_frames.size
range_start = damage_frames[i]
range_end = damage_frames[i+1]
range = range_start..range_end
index = i if range === frame_index
end
end
# Run Through all Timings
for timing in @_animation.timings
# If at a timing effect
if timing.frame == frame_index
# If Animation is a Multi-Hit And In Battle
if @_animation.multi and $game_temp.in_battle
# Send Animation Hit at Index
animation_process_timing(timing, @_animation_hit[index])
else
# Do Things Like normal
animation_process_timing(timing, @_animation_hit)
end
end
end
# If in Battle
if $game_temp.in_battle
# Run Through All Damage Frames
for frame in @_animation.damage_frames
# If At a Damage Effect
if frame == frame_index
# Get index
i = @_animation.damage_frames.index(frame_index)
# If Damage Pop is True
if @damage_pop
# Display Damage
damage(@_animation_damage.shift, @_animation_critical.shift)
end
end
end
end
else
# Id Damage Pop and In Battle
if @damage_pop and $game_temp.in_battle
# Reset Damage and Critical Flag
@_animation_battler.damage = nil
@_animation_battler.critical = false
# Handle Collaspe Effects here
if @_animation_battler.dead?
if @_animation_battler.is_a?(Game_Enemy)
$game_system.se_play($data_system.enemy_collapse_se)
else
$game_system.se_play($data_system.actor_collapse_se)
end
collapse
self.battler_visible = false
end
end
# Dispose Animation
dispose_animation
end
end
end
end
class Scene_Battle
attr_reader :phase4_step
end
#--------------------------------------------------------------------------
# â— End SDK Enabled Check
#--------------------------------------------------------------------------
end
#--------------------------------------------------------------------------
# â— Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.state('Multi-Attack') == true
module RPG
class Animation
#-------------------------------------------------------------------------
# â— Damage Popping Frames
#-------------------------------------------------------------------------
def damage_frames
set_damage_frames if @damage_frames.nil?
return @damage_frames
end
#-------------------------------------------------------------------------
# â— Set Damage Frames
#-------------------------------------------------------------------------
def set_damage_frames
damage_frames = []
for timing in @timings
if timing.damage?
damage_frames << timing.frame
@timings.delete(timing)
end
end
damage_frames << (self.frame_max-1) if damage_frames.empty?
@damage_frames = damage_frames.sort
end
#-------------------------------------------------------------------------
# â— Multi Hit Checking
#-------------------------------------------------------------------------
def multi
set_damage_frames if @damage_frames.nil?
return @damage_frames.empty? ? false : true
end
#---------------------------------------------------------------------------
# â— Animation Number of Hits
#---------------------------------------------------------------------------
def hits
self.set_damage_frames if self.damage_frames.nil?
return self.damage_frames.size
end
end
end
module RPG
class Animation
class Timing
#-------------------------------------------------------------------------
# â— Damage Pop Check
#-------------------------------------------------------------------------
def damage?
return (self.se.name.empty? and self.flash_scope == 0 and
self.flash_color == Color.new(255,255,255,255) and
self.flash_duration == 5 and self.condition == 0)
end
end
end
end
#--------------------------------------------------------------------------
# â— End SDK Enabled Check
#--------------------------------------------------------------------------
end
#--------------------------------------------------------------------------
# â— Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.state('Multi-Attack') == true
module RPG
class Weapon
#---------------------------------------------------------------------------
# â— Weapon Number of Hits
#---------------------------------------------------------------------------
def hits
animation = $data_animations[self.animation2_id]
return 1 if animation.nil?
animation.set_damage_frames if animation.damage_frames.nil?
return animation.damage_frames.size
end
end
class Skill
#---------------------------------------------------------------------------
# â— Skill Number of Hits
#---------------------------------------------------------------------------
def hits
animation = $data_animations[self.animation2_id]
return 1 if animation.nil?
animation.set_damage_frames if animation.damage_frames.nil?
return animation.damage_frames.size
end
end
class Item
#---------------------------------------------------------------------------
# â— Item Number of Hits
#---------------------------------------------------------------------------
def hits
animation = $data_animations[self.animation2_id]
return 1 if animation.nil?
animation.set_damage_frames if animation.damage_frames.nil?
return animation.damage_frames.size
end
end
end
class Game_Enemy < Game_Battler
#---------------------------------------------------------------------------
# â— Enemy Number of Hits
#---------------------------------------------------------------------------
def hits
animation = $data_animations[animation2_id]
return 1 if animation.nil?
animation.set_damage_frames if animation.damage_frames.nil?
return animation.damage_frames.size
end
end
#--------------------------------------------------------------------------
# â— End SDK Enabled Check
#--------------------------------------------------------------------------
end
#--------------------------------------------------------------------------
# â— Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.state('Multi-Attack') == true
class Game_Battler
attr_reader :damage_hits
attr_reader :critical_hits
#---------------------------------------------------------------------------
# â— Attack Effect
#---------------------------------------------------------------------------
alias multi_attack_effect attack_effect
def attack_effect(attacker)
animation = $data_animations[attacker.animation2_id]
times = animation.nil? ? 1 : animation.hits
@damage_hits = []
@critical_hits = []
total_damage = 0
times.times do
self.multi_attack_effect(attacker)
@damage_hits << self.damage
total_damage += self.damage if self.damage.is_a?(Numeric)
@critical_hits << self.critical
end
self.damage = total_damage
@damage_hits.flatten!
@critical_hits.flatten!
return true
end
#---------------------------------------------------------------------------
# â— Skill Effect
#---------------------------------------------------------------------------
alias multi_skill_effect skill_effect
def skill_effect(user, skill)
times = skill.hits
times = 1 if times.nil?
@damage_hits = []
@critical_hits = []
effective = []
total_damage = 0
times.times do
effective << self.multi_skill_effect(user, skill)
total_damage += self.damage if self.damage.is_a?(Numeric)
@damage_hits << self.damage
@critical_hits << self.critical
end
self.damage = total_damage
@damage_hits.flatten!
@critical_hits.flatten!
return effective.include?(true)
end
#---------------------------------------------------------------------------
# â— Item Effect
#---------------------------------------------------------------------------
alias multi_item_effect item_effect
def item_effect(item)
times = item.hits
times = 1 if times.nil?
@damage_hits = []
@critical_hits = []
effective = []
total_damage = 0
times.times do
effective << self.multi_item_effect(item)
@damage_hits << self.damage
total_damage += self.damage if self.damage.is_a?(Numeric)
@critical_hits << self.critical
end
self.damage = total_damage
@damage_hits.flatten!
@critical_hits.flatten!
return effective.include?(true)
end
end
#--------------------------------------------------------------------------
# â— End SDK Enabled Check
#--------------------------------------------------------------------------
end
Sandgolem's Counter-Attack
Code:
#==========================================================================
# ** SG Counter Attack
#==========================================================================
# sandgolem
# Version 2
# 2.07.06
#==========================================================================
Scene_Battle::SG_Counter_States = { 4 => [100,200], 5 => [100,200] }
Scene_Battle::SG_Counter_Messages = ['\m counters!','\m counters!']
#==========================================================================
#
# To check for updates or find more scripts, visit:
# [url]http://www.gamebaker.com/rmxp/scripts/[/url]
#
# To use this script, copy it and insert it in a new section above "Main",
# under the default scripts, and the SDK if you're using it.
#
# Have problems? Official topic:
# [url]http://forums.gamebaker.com/showthread.php?t=129[/url]
#
#==========================================================================
begin
SDK.log('SG Counter Attack', 'sandgolem', 2, '2.07.06')
if SDK.state('SG Counter Attack') != true
@sg_counterattack_disabled = true
end
rescue
end
if !@sg_counterattack_disabled
#--------------------------------------------------------------------------
class Game_Battler
alias sandgolem_counter_battler_atkeff attack_effect
def attack_effect(attacker)
sandgolem_counter_battler_atkeff(attacker)
if $scene.active_battler == attacker
$scene.sg_atkcounter_test(self)
end
end
end
class Scene_Battle
attr_accessor :active_battler
def sg_atkcounter_test(battler)
sg_temp = SG_Counter_States.keys
for i in 0...sg_temp.size
if battler.state?(sg_temp[i])
if SG_Counter_States[sg_temp[i]][0] > rand(99)
@sg_counter = SG_Counter_States[sg_temp[i]][1]
@sg_countertarget = battler
return
end
end
end
end
alias sandgolem_counter_battle_up4s5 update_phase4_step5
def update_phase4_step5
sandgolem_counter_battle_up4s5
if @sg_countertarget != nil
@phase4_step = 1337
@sg_atkcounter = 28
end
end
def sg_counter_update
if @sg_countertarget.dead? or @sg_atkcounter == 0
@sg_atkcounter = nil
@sg_counter = nil
@sg_countertarget = nil
@phase4_step = 6
return
end
@sg_atkcounter -= 1
if @sg_atkcounter == 10
@sg_countertarget.animation_id = @sg_countertarget.animation1_id
@active_battler.animation_id = @sg_countertarget.animation2_id
sg_temp = rand(SG_Counter_Messages.size)
sg_temp = SG_Counter_Messages[sg_temp].clone
sg_temp.gsub!(/\\[Mm]/) { @sg_countertarget.name }
@help_window.set_text(sg_temp, 1)
@active_battler.attack_effect(@sg_countertarget)
if !@active_battler.damage.is_a?(String)
@active_battler.hp += @active_battler.damage
@active_battler.damage = @active_battler.damage * @sg_counter / 100
@active_battler.hp -= @active_battler.damage
@status_window.refresh
end
@active_battler.damage_pop = true
end
end
alias sandgolem_counter_battle_update update
def update
if @sg_atkcounter != nil
sg_counter_update
end
sandgolem_counter_battle_update
end
end
#--------------------------------------------------------------------------
end
If anyone could help me with this, I'll appreciate it greatly If not, then that's fine, I'll just have to take out the counter-attack script :\
~Shiro