Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

make animated batter script work with counter attack script

okey.i'm using counter attack script with minkoff's animated battler.they both work but,when the char counters he doesn't play attack animation.
is it possible to fix that ?
here is the counter attack script
and thanks in advance
#==========================================================================
# ** SG Counter Attack
#==========================================================================
# sandgolem
# Version 2
# 2.07.06
#==========================================================================

Scene_Battle::SG_Counter_States = { 17 => [100,200], 2 => [90,90], 22 => [100,50] }
Scene_Battle::SG_Counter_Messages = ['\m Counter!','\m strikes back!']

#==========================================================================
#
# To check for updates or find more scripts, visit:
# http://www.gamebaker.com/rmxp/scripts/
#
# 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:
http://forums.gamebaker.com/showthread.php?t=129
#
#==========================================================================

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)
        if SG_Counter_States[sg_temp][0] > rand(99)
          @sg_counter = SG_Counter_States[sg_temp][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
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top