Galv’s Timed Button Attacks V.1.7

Demo – Version 1.7 >

#------------------------------------------------------------------------------#
#  Galv's Timed Button Attacks
#------------------------------------------------------------------------------#
#  For: RPGMAKER VX ACE
#  Version 1.7
#------------------------------------------------------------------------------#
#  2013-04-25 - Version 1.7 - Added compatibility with Yanfly's cast animation
#  2013-04-17 - Version 1.6 - Fixed a pretty big bug with ending battle.
#  2013-04-17 - Version 1.5 - Fixed evaded popup appearing in Yanfly's engine
#                           - when hitting using 'guarantee hit' option. Added
#                           - fix for if battle ends early while indicator live
#  2013-04-08 - Version 1.4 - Fixed bug with defend indicator not showing on
#                           - correct actor.
#  2013-03-15 - Version 1.3 - Fixed animation option
#  2013-03-15 - Version 1.2 - Fixed a bug with not pressing button at all
#  2013-03-15 - Version 1.1 - added option to turn off battle log messages
#                           - disabled hit indicator when actor is confused
#                           - fixed yanfly battle engine compatability bug
#  2013-03-11 - Version 1.0 - release
#------------------------------------------------------------------------------#
#  Adds a graphical indicator to selected attacks that allows the player to
#  press a button at a certain time for the attack to do extra damage or apply
#  a state. Different attacks can use different buttons, graphics and have
#  varied speeds and difficulty.
#
#  NOTES: Put this script below any battle scripts. Tested in default battle
#  system as well as Yanfly's default battle script.
#
#  MORE NOTES: If the indicator disappears too soon, increase the frames of the
#  skill's animation in the Database Animations tab.
#
#------------------------------------------------------------------------------#
 
#------------------------------------------------------------------------------#
#  NOTE TAGS for SKILLS or ITEMS
#------------------------------------------------------------------------------#
#
#  <btnpress>     # Enables the btn press with flash and SE when successful
#      OR
#  <btnpress n>   # Enables the btn press and plays animation n when successful
#                 # This animation cancels the current skill's animation.
#
#   # NOTE: Only one of these is required for a skill.
#
#------------------------------------------------------------------------------#
#  NOTE TAGS for SKILLS or ITEMS (Leaving any of these out will use defaults)
#------------------------------------------------------------------------------#
#
#  <btn x>                 # Use a different button to press (default :X)
#  <btnmsg x>              # Use a different message number when hit successful
#
#  <btnmultiply x>         # Multiply the damage/healing by x (default 2)
#
#  <btnstates x,x,x>       # Apply states with id x when timing is hit.
#  <btnrstates x,x,x>      # Remove states with id x when timing is hit.
#
#  <btnopt a,b,c,d>        # a = start time (delay before indicator moves)
#                          # b = target time (when button should be pressed)
#                          # c = indicator image number to use
#                          # d = difficulty number. Higher is easier to hit
#
#   # The indicator will appear at the start time (a) and shrink down to meet
#   # the target circle at the target time (b) when the player should press
#   # the button.
#   # DEFAULTS: a = 0   b = 31   c = 1   d = 0
#------------------------------------------------------------------------------#
#  EXAMPLES:
#
#  <btnpress 4>               # Enables script and uses animation 4 on success
#  <btn Y>                    # Use the :Y ("s" on the keyboard) button instead
#  <btnmultiply 3>            # 3 x damage
#  <btnstates 2,3>            # Applies states 2 and 3
#  <btnrstates 5,6,7>         # Removes states 5, 6 and 7
#  <btnopt 10,61,2,0>         # Indicator runs from 10-61 frames using image 2
#                             # and no change in difficulty
#
#------------------------------------------------------------------------------#
 
#------------------------------------------------------------------------------#
#  NOTE TAGS for ACTORS or EQUIPS - These determine a defending timed hit
#------------------------------------------------------------------------------#
#
#  <btnpress>     # Enables an actor or equip defending timed hit.
#      OR
#  <btnpress n>   # Enables def timed hit and plays animation n when successful
#                 # Only use this if you are using a sideview battle script.
#                 # Only works with battle scripts that show animations on actors
#
#  # NOTE: Only one of these is required for an equip or actor.
#
#------------------------------------------------------------------------------#
#  Optional NOTE TAGS for ACTORS or EQUIPS (Leaving any out will use defaults)
#------------------------------------------------------------------------------#
 
#  <btn x>                 # Use a different button to press (default :Z)
#  <btnmsg x>              # Use a different message number when hit successful
#
#  <btnmultiply x>         # Multiply the damage/healing by x (default 0.5)
#
#  <btnstates x,x,x>       # Apply states with id x when timing is hit.
#  <btnrstates x,x,x>      # Remove states with id x when timing is hit.
#
#  <btnopt a,b,c,d>        # a = start time (delay before indicator moves)
#  # DEFAULTS: a = 0   b = 31   c = 3   d = 0
#
#------------------------------------------------------------------------------#
 
($imported ||= {})["Galv_BtnPress_Hit"] = true
module Galv_BtnAtk
 
#------------------------------------------------------------------------------#
#  SETUP OPTIONS
#------------------------------------------------------------------------------#
 
  #---------------#
  #  PREFERENCES  #
  #---------------#
 
  GUARANTEE_HIT = true   # If player hits the timing, the attack cannot miss
  SHOW_AS_CRIT = true   # Displays hits on enemy as critical hits.
 
  ATK_MULTIPLIER = 2     # Default damage/healing multipliers if the timing is
  DEF_MULTIPLIER = 0.5   # successful for attacking and defending.
 
  DIFFICULTY = 1         # The higher this number, the further away from the
                         # center circle will score a success. 0 is extremely
                         # difficult, the higher this number the easier.
 
  DISABLE_SWITCH = 194   # Turn swith ON to disable this
 
  ATK_BTN = :X           # Default attack button to press. :X is "a"
  DEF_BTN = :Z           # Default defend button to press. :Z is "d"
 
  Y_OFFSET = -50         # 0 is positioned at bottom of a battler.
 
  Y_FRONT_OFFSET = 0     # x and y offset for targeting your party when using a
  X_FRONT_OFFSET = 0     # battle system with no actor x,y locations. By default
                         # it centers at the top of the battle status window.
 
  #---------------#
  #     VOCAB     #
  #---------------#
 
  BATTLE_LOG_TXT = true     # Display battle log text (below) true or false
                             # Displaying battle messages slows down multi-hit
                             # skills in some battle systems.
 
  # Below is a list of battlelog vocab that you can add to and use for timed hit
  TXT = [ # don't touch
 
      "A perfect hit!",      # 0) Default attacking timed hit success
      "Super effective!",    # 1) Default allied spell timed hit success
      "A great block!",      # 2) Default defending timed hit success
 
      "CUSTOM TEST!",        # 3) When <btnmsg 3> notetag
 
      #"Another one",        # 4) Add as many as you need
      #"Another one",        # 5) Add as many as you need
      #"Another one",        # 6) Add as many as you need
      #"Another one",        # 7) Add as many as you need
 
  ] # don't touch
 
  #---------------#
  #   GRAPHICS    #
  #---------------#
 
  TARGET_IMG = "hit_target"         # The inner target that the indicator meets
  INDICATOR_IMG = "hit_indicator"   # The indicator that shrinks to the target
 
  # NOTE: These are the base image names for the graphics. The actual files will
  # have a number appended to them. By default this number is 1, so the file
  # names by default would be: "hit_target1.png", "hit_indicator1.png"
  # This number can be changed using the option notetag so different skills can
  # use a different graphic. Images go in /Graphics/System/ folder.
 
  COLOR_HIT = [0, 255, 0]    # [R,G,B] indicator turns this color when success
  COLOR_MISS = [255, 0, 0]   # [R,G,B] indicator turns this color when fail
 
  #---------------#
  #    SOUNDS     #
  #---------------#
  SE_HIT = ["Flash1",100,100]    # "SE_Name", volume, pitch when hit timing
  SE_MISS = ["Buzzer1",85,100]   # "SE_Name", volume, pitch when missed timing
 
#------------------------------------------------------------------------------#
#  END SETUP OPTIONS
#------------------------------------------------------------------------------#
 
end
 
class RPG::BaseItem
  def btnpress
    if @btnpress.nil?
      if @note =~ /<btnpress>/i
        @btnpress = 0
      elsif @note =~ /<btnpress[ ](.*)>/i
        @btnpress = $1.to_i
      else
        @btnpress = -1
      end
    end
    @btnpress
  end
  def btnmultiply
    if @btnmultiply.nil?
      if @note =~ /<btnmultiply[ ](.*)>/i
        @btnmultiply = $1.to_f
      else
        if self.is_a?(RPG::Actor) || self.is_a?(RPG::EquipItem)
          @btnmultiply = Galv_BtnAtk::DEF_MULTIPLIER
        else
          @btnmultiply = Galv_BtnAtk::ATK_MULTIPLIER
        end
      end
    end
    @btnmultiply
  end
  def btn
    if @btn.nil?
      if @note =~ /<btn[ ](.*)>/i
        @btn = $1.to_sym
      else
        if self.is_a?(RPG::Actor) || self.is_a?(RPG::EquipItem)
          @btn = Galv_BtnAtk::DEF_BTN
        else
          @btn = Galv_BtnAtk::ATK_BTN
        end
      end
    end
    @btn
  end
  def btnmsg
    if @btnmsg.nil?
      if @note =~ /<btnmsg[ ](.*)>/i
        @btnmsg = $1.to_i
      else
        @btnmsg = nil
      end
    end
    @btnmsg
  end
  def btnstates
    if @btnstates.nil?
      if @note =~ /<btnstates[ ](.*)>/i
        @btnstates = $1.to_s.split(",").map {|i| i.to_i}
      else
        @btnstates = []
      end
    end
    @btnstates
  end
  def btnrstates
    if @btnrstates.nil?
      if @note =~ /<btnrstates[ ](.*)>/i
        @btnrstates = $1.to_s.split(",").map {|i| i.to_i}
      else
        @btnrstates = []
      end
    end
    @btnrstates
  end
  def btnopt
    if @btnopt.nil?
      if @note =~ /<btnopt[ ](.*)>/i
        @btnopt = $1.to_s.split(",").map {|i| i.to_i}
      else
        if self.is_a?(RPG::Actor) || self.is_a?(RPG::EquipItem)
          @btnopt = [0,31,3,0]
        else
          @btnopt = [0,31,1,0]
        end
      end
    end
    @btnopt
  end
end # RPG::BaseItem
 
class Game_Temp
  attr_accessor :btncrit
  attr_accessor :btndata
  alias galv_btnhit_gt_initialize initialize
  def initialize
    galv_btnhit_gt_initialize
    @btncrit = false
    @btndata = [2,nil]  # [multipler,vocab]
  end
end # Game_Temp
 
class Game_Actor < Game_Battler
  if !$imported["YEA-BattleEngine"]
    attr_accessor :screen_x
    attr_accessor :screen_y
  end
end # Game_Actor < Game_Battler
 
class Game_ActionResult
  # Cannot miss if hit button at right time
  alias galv_btnhit_gar_hit? hit?
  def hit?
    if $game_temp.btncrit && Galv_BtnAtk::GUARANTEE_HIT
      @missed = false
      @evaded = false
      @used
    else
      galv_btnhit_gar_hit?
    end
  end
 
  # Modify damage if button is hit and make it show critical
  alias galv_btnhit_gar_make_damage make_damage
  def make_damage(value, item)
    if $game_temp.btncrit
      value = (value * $game_temp.btndata[0]).to_i
      @critical = true if @battler.is_a?(Game_Enemy) && Galv_BtnAtk::SHOW_AS_CRIT
    end
    galv_btnhit_gar_make_damage(value, item)
  end
 
end # Game_ActionResult
 
class Window_BattleLog < Window_Selectable
  alias galv_btnhit_wblog_display_critical display_critical
  def display_critical(target, item)
    if $game_temp.btncrit && Galv_BtnAtk::BATTLE_LOG_TXT
      if $game_temp.btndata[1]
        text = $game_temp.btndata[1]
      else
        text = target.actor? ? Galv_BtnAtk::TXT[1] : Galv_BtnAtk::TXT[0]
      end
      add_text(text)
      wait
    else
      galv_btnhit_wblog_display_critical(target, item)
    end
  end
end # Window_BattleLog < Window_Selectable
 
class Scene_Battle < Scene_Base
  attr_accessor :btnactive
 
  alias galv_btnhit_sb_update_basic update_basic
  def update_basic
    if @btnactive
      btn_pressed
      @hit_indicator.update if @hit_indicator
    end
    galv_btnhit_sb_update_basic
  end
 
  def hskill
    if @def_opts
      @def_opts
    else
      @subject.current_action.item
    end
  end
 
  def btn_pressed
    return if $game_switches[Galv_BtnAtk::DISABLE_SWITCH] || $game_troop.all_dead?
    if Input.trigger?(hskill.btn) && @hit_indicator.hit?
      $game_temp.btncrit = true
      $game_temp.btndata[0] = hskill.btnmultiply
      btn_addstate if hskill.btnstates
      btn_remstate if hskill.btnrstates
      @hit_indicator.success
      if hskill.btnpress > 0
        show_hit_success_anim(@current_inditargets, hskill.btnpress)
      else
        $game_troop.screen.start_flash(Color.new(255,255,255,255),25)
        RPG::SE.new(Galv_BtnAtk::SE_HIT[0],Galv_BtnAtk::SE_HIT[1],Galv_BtnAtk::SE_HIT[2]).play
      end
      @btnactive = nil
    elsif Input.trigger?(hskill.btn)
      $game_temp.btncrit = false
      @hit_indicator.fail
      RPG::SE.new(Galv_BtnAtk::SE_MISS[0],Galv_BtnAtk::SE_MISS[1],Galv_BtnAtk::SE_MISS[2]).play
      @btnactive = nil
    end
  end
 
  def btn_addstate
    @current_inditargets.each { |t|
      already_dead = t.dead?
      hskill.btnstates.each { |state| t.add_state(state) if !already_dead }
      t.perform_collapse_effect if t.dead? && !already_dead
    }
  end
 
  def btn_remstate
    @current_inditargets.each { |t|
      already_dead = t.dead?
      hskill.btnrstates.each { |state| t.remove_state(state) }
      t.perform_collapse_effect if t.dead? && !already_dead
    }
  end
 
  def show_hit_success_anim(targets, animation_id, mirror = false)
    if $data_animations[animation_id]
      targets[0].animation_id = animation_id
      targets[0].animation_mirror = mirror
    end
  end
 
  alias galv_btnhit_sb_use_item use_item
  def use_item
    galv_btnhit_sb_use_item
    $game_temp.btncrit = false
  end
 
  def do_indicator(targets)
    return if targets.nil? || targets.empty? || @castanim
    @def_opts = nil
    item = @subject.current_action.item
    target = targets[0]
    if @subject.is_a?(Game_Actor) && !@subject.confusion? && item.btnpress >= 0
      $game_temp.btndata[1] = item.btnmsg ? Galv_BtnAtk::TXT[item.btnmsg] : nil
      @current_inditargets = targets
      setup_hit_indicator(item.btnopt)
      @btnactive = true
    elsif target && defender?(target)
      $game_temp.btndata[1] = @def_opts.btnmsg ?
          Galv_BtnAtk::TXT[@def_opts.btnmsg] : Galv_BtnAtk::TXT[2]
      @current_inditargets = targets
      setup_hit_indicator(@def_opts.btnopt)
      @btnactive = true
    end
    update_for_wait
  end
 
  alias galv_btnhit_sb_show_animation show_animation
  def show_animation(targets, animation_id)
    do_indicator(targets)
    galv_btnhit_sb_show_animation(targets, animation_id)
  end
 
  def defender?(target)
    return false if !target.is_a?(Game_Actor)
    return false if @subject.is_a?(Game_Actor)
    defend = -1
    defend = $data_actors[target.id].btnpress
    @def_opts = $data_actors[target.id]
    target.equips.each { |i|
    next if i.nil?
    if i.btnpress > defend
      defend = i.btnpress
      @def_opts = i
    end
    }
    return true if defend >= 0
  end
 
  def setup_hit_indicator(array)
    return if @current_inditargets[0].nil? ||
      $game_switches[Galv_BtnAtk::DISABLE_SWITCH] || $game_troop.all_dead?
 
    if !@current_inditargets.empty? && @current_inditargets[0].screen_x
      x = @current_inditargets[0].screen_x
      y = @current_inditargets[0].screen_y + Galv_BtnAtk::Y_OFFSET
    else
      x = Graphics.width / 2 + Galv_BtnAtk::X_FRONT_OFFSET
      y = Graphics.width / 1.7 + Galv_BtnAtk::Y_FRONT_OFFSET
    end
    @hit_indicator = Timed_Hits.new(x,y,array)
  end
 
  alias galv_btnhit_sb_invoke_item invoke_item
  def invoke_item(target, item)
    if !$imported["YEA-BattleEngine"]
      @btnactive = nil
      @hit_indicator.dispose if @hit_indicator
    end
    galv_btnhit_sb_invoke_item(target, item)
    if $imported["YEA-BattleEngine"]
      @btnactive = nil
      @hit_indicator.dispose if @hit_indicator
    end
  end
 
  alias galv_btnhit_sb_terminate terminate
  def terminate
    galv_btnhit_sb_terminate
    @hit_indicator.dispose if @hit_indicator
  end
 
  if $imported["YEA-CastAnimations"]
    alias galv_btnhit_sb_process_casting_animation process_casting_animation
    def process_casting_animation
      @castanim = true
      item = @subject.current_action.item
      cast_ani = item.cast_ani
      return if cast_ani <= 0
      show_animation([@subject], cast_ani)
      @castanim = false
    end
  end
 
end # Scene_Battle < Scene_Base
 
#------------------------------------------------------------------------------#
#  Class Timed_Hits
#------------------------------------------------------------------------------#
class Timed_Hits
  def initialize(x,y,options)
    @x = x
    @y = y
    @opt = options
    @img = @opt[2].to_s
    @start_frame = @opt[0]
    @target_frame = @opt[1]
    @current_frame = 0
    @s = (3.to_f - 0.6) / (@target_frame - @start_frame)
    @d = (Galv_BtnAtk::DIFFICULTY + @opt[3]).to_f * 0.5
    create_hit_indicator
    create_target_indicator
  end
 
  def create_target_indicator
    @hittarget = Sprite.new(@viewport1)
    @hittarget.bitmap = Cache.system(Galv_BtnAtk::TARGET_IMG + @img)
    @hittarget.z = 100
    @hittarget.x = @x - (@hittarget.bitmap.width / 2)
    @hittarget.y = @y - (@hittarget.bitmap.height / 2)
    @hittarget.opacity = 130
  end
 
  def create_hit_indicator
    @hitindi = Sprite.new(@viewport1)
    @hitindi.bitmap = Cache.system(Galv_BtnAtk::INDICATOR_IMG + @img)
    @hitindi.x = @x
    @hitindi.y = @y
    @hitindi.z = 100
    @hitindi.opacity = 0
    @hitindi.zoom_x = 3
    @hitindi.zoom_y = 3
    @hitindi.color = Color.new(0, 0, 0, 0)
  end
 
  def hit?
    @current_frame.between?(@target_frame - @d,@target_frame + @d)
  end
 
  def success
    c = Galv_BtnAtk::COLOR_HIT
    @hitindi.color = Color.new(c[0],c[1],c[2],255)
  end
 
  def fail
    c = Galv_BtnAtk::COLOR_MISS
    @hitindi.color = Color.new(c[0],c[1],c[2],255)
  end
 
  def update
    update_indicators
  end
 
  def update_indicators
    return @current_frame += 1 if @current_frame < @start_frame
    @hitindi.opacity = 100
    @hitindi.zoom_x -= @s
    @hitindi.zoom_y -= @s
    @hitindi.x = @x - (@hitindi.bitmap.width / 2) * @hitindi.zoom_x
    @hitindi.y = @y - (@hitindi.bitmap.height / 2) * @hitindi.zoom_y
    @current_frame += 1
    if @hitindi.zoom_x <= 0
      fail
      SceneManager.scene.btnactive = nil
    end
  end
 
  def dispose
    @hitindi.dispose if @hitindi
    @hittarget.dispose if @hittarget
  end
end # Timed_Hits

101 thoughts on “Galv’s Timed Button Attacks V.1.7

  1. chaos17 says:

    I need to try this! I loved this feature in a t-rpg and always wanted the same. Will it be possibible to combine it with a common event ?

  2. Galv says:

    Does t-rpg mean tactical RPG? This is for the normal style battles and can happen when you use skills, items or are being attacked so I’m not sure if that will be part of a t-rpg.

    • chaos17 says:

      Sorry, I didn’t say correctly what I was thinking. I tested your script with a skill that call an common event. Your script worked but it didn’t wait. I mean the common event was called right after the button to press appeared so I didn’t had to press press anything.

      What I am trying to do is to trigger a special attack that will work only if the player have pushed the button. Since I am not very good with english, I maybe missed something or didn’t understood well your script.

  3. Galv says:

    The script doesn’t do anything with common events, but if I understand correctly – that is a good idea. I will see if I can make a skill activate a common event if successful

    • chaos17 says:

      Maybe something more simple, like a skill will only happen if a button is pushed. If not, the hero loose its turn ? So that option can be enable for items too if player wish to use that option. That’s just an idea.

  4. Galv says:

    There is an option to guarantee the hit (which I couldn’t get to work in Yanfly’s battle, though…) so you could set the skill to always miss and with that option on, it’ll hit. The common event on hit option actually sounds easier to implement hehe

  5. Nosleinad says:

    I am using Yanfly Battle engine, and there seems to be an error in the multiplying of the attacks. I already tryed it a lot of times, notettagin the proper skill or letting it follo the default dmg multiplier set in the script and the results are the same as follows: i have a thunder skill that nomally does 450 max dmg, when i set it to 2x dmg, the dmg goes to a whooping 1800-2000 dmg; when i set it to 1.3 dmg, the dmg can reach 730 (should be around 585 max dmg).
    I only posted the max dmg of my observations, as they clearly go up the expected dmg increase from a button press. I also tryed it all wih skills that hits one or more than one enmy, and i didnt notice differences.

    • Nosleinad says:

      Sry for the repost:
      EDIT: the only value that seems to be working correctly for me is 1.1, if i put 1.12 the dmg goes up much more than it should.

  6. Galv says:

    I cannot seem to replicate this problem. By the sound of it, your skill is doing a critical hit as well as the success damage (which would to 4x instead of 2x). The ‘show critical’ setting only displays it as a critical when you hit, it doesn’t actually apply a critical hit (or stop one from happening). If your skills also have a chance to critical hit on top of that, then it would do 4x.

    Or you might have another script that changes the functionality around, causing it to always crit maybe? I’d test it with only YF core, YF battle and my script to make sure

  7. Nosleinad says:

    Unfortunatelly it wasn’t making a crit, i also setup ” SHOW_AS_CRIT = false “. I tested it again with a 100% crit to the actor and ” ATK_MULTIPLIER = 2 “.
    When i crit with one of my skills but make the wrong button press, it did a damage of around 480-570. When i hit the button press and crit with the same skill, it did 1800-2200 dmg (4x times more).
    I am pretty sure that one of my other scripts is messing with the multiplier, and for now i am using it as 1.1x, as its the one that’s not changing the dmg too much. I also tested it on a clean project with only YF core, YF battle and your script, and the dmg multiplier worked very well.
    There’s no need to use your time on this issue Galv, as i am using lots of other script ;). I will just keep testing with a 1.xxx multiplier to get the effect i want. Thanks for the feedback!!

  8. Fisherololol says:

    hello Galv

    ive seen that this script have to option to remove or add a state if the action has been successful

    l have some ideas that you could add as well from that

    1. make the button appear only when the actor have x state/dont have x state
    2. when the actor has pressed the button but has failed, x state gets removed/added too

    also you could make it so that when the actor ignore the button, x state dont get removed or added but as soon as he presses it it will be either a miss/skip turn/x state if he failed.

    if he is successful, well, its already in the script

    • Galv says:

      Thanks for the ideas, though I have no plans to change this one anytime soon. I’ll add them to my “might do later” list.

  9. Deathmask97 says:

    Hey man, just wanted to say this script is amazing, I’ve been looking for something like this for ages! You did a great job, and it works extremely well with Yanfly. I did a little extra editing and even got it to work with the volume options in Yanfly’s System Options script.

    Just wanted to let you know, there seems to be some kind of error that means the indicator doesn’t always appear on the right actor when there are multiple members in the party. It always appears over the correct enemy, the problem only exists with the actors.

    Anyways, great script man. I hope I see more great things from you in the future.

    • Galv says:

      Thanks. Not sure why it wouldn’t work with yanfly’s volume options. An error that makes the indicator appear on the incorrect actor will be a script conflict somewhere. If you can find out which one, I am happy to have a look and try to make it compatible

  10. Someone who are grateful to find this script says:

    Hi, Galv. Thanks a lot for making this nice script! I just want to inform you that I found a bug where if all the enemies somehow has been obliterated right before the btnpress notetagged skill activated, the game just crashed. I don’t remember which line of script got error, since I’ve already remove all the notetag on the skills and only use the defensive part of this script. But I remember it has something to do with the dumping/drawing picture (Similar message that appear when you tried to change actor’s portrait with the same portrait he/she had currently).

    I’m using Yanfly follow-up skill script and combo skill script. The crash usually happened when all the enemy has been killed by the initial skill ( it crashed when the follow up skill which has btnpress notetag in it tries to activate itself), and if they’re all killed right before the combo finisher (just the same like the follow up skill).
    Although I no longer use the offensive part of this script due to this problem (and it’s just fine by the way), I just feel that I need to inform this bug to you so you can work on it in the future.

    That’s all I can report for now. Other than this, I haven’t find any other error. Every other things seems to work just fine.
    Good work!

  11. Galv says:

    Thank you for reporting the bug. I’ve been trying to replicate this as I use all of yanfly’s combo scripts as well as this one in my own game but cannot seem to get it to crash at the point you mentioned. Maybe something else I am not doing? Or another script conflicting perhaps?

    • Someone who are grateful to find this script says:

      Here is a little demo along with the screenshot about the bug.
      http://www.mediafire.com/?demfvqf47v1k7wv
      Try executing the combo finisher even if you know the slime would die with a single shot.
      Apology for the late reply. I’m pretty busy with college work that I had forgotten to check every so often.
      Oh, the demo uses ver 1.3 of this script. I wonder if that would make any difference..

      • Galv says:

        It made a little but not much. I would actually say this is a problem with Yanfly’s script as it plays the skill and the skill-activation even when there’s no enemy. But I have updated my script to not draw the indicator if there are no enemies and done some tests and appears to work. Please update to v.1.5 (maybe grab the demo as my wordpress site is having issues that I am talking to the host to solve)

  12. Deathmask97 says:

    With the volume options, it may just be the load order of my scripts. Not sure, but it never worked correctly with other script-implemented sounds, so maybe that’s just me.

    The conflicting script seems to be Yanfly’s Battle Engine, sending you back a version of your Demo with the Yanfly Script installed and additional actors that can be added to the battle for demonstration purposes. http://www.mediafire.com/?843yp2fqlvlgz64

    I have to say man, thanks for all the help, I’m honestly impressed by the quick response. If you do manage to help you out, I’ll pay you for the use of this script. It would be well worth it.

    • Galv says:

      Hmm I see the bug now, I didn’t catch that during my tests in yanfly’s engine. This is an interesting one as I cannot see why it’s happening. I’ll try to crack it when I get some more time and post here when I do. Thanks for letting me know

    • Galv says:

      Aha… I see where I went wrong. Please get the latest version from this page and let me know if any trouble. I believe I have fixed the bug. Regarding the volume, I will look into it later but I think it’s the way I am creating the sounds that Yanfly’s script doesn’t recognise. Will have to see how he does his volume.

      • Deathmask97 says:

        Thanks a bunch, I will test this version right away. Sent you a small payment as a token of my gratitude.

        And yes, the script seems to have problems with any sound that is manually played through script commands, I found a workaround through another script that can very easily be implemented into most other scripts. I can send you my slightly modified version of the script to show you what I’ve done, or if you so prefer you could contact me via email and I could send you an unencrypted version of my work-in-progress that would let you see all the scripts under the hood for yourself.

  13. Galv says:

    Thanks, much appreciated. I don’t think I’ll have a problem working out the audio issue but I’ll take you up on that offer if I find I do, so thank you kindly for that as well :)

    • Deathmask97 says:

      Did some testing, all systems are go. Also, volume levels also functioning correctly without modification this time around, script is perfect. Thanks again for everything, keep up the good work.

  14. Mewgull says:

    Hey, great script! Used it right away.
    However, there is a bug when using custom formulas for damage.
    Whenever an actor attacks, the damage the enemy receives is 0, regardless of how it was timed and the power of the attack.
    My formulas, for example, are methods within the Game_Battler class that are called from the “Damage/Formula” section in the skills category within the database.
    What would be a way to fix it?

    • Galv says:

      Can you please post your custom forumla code here and I’ll test it out

      • Mewgull says:

        Sure. Here is what I have:

        In the “001: Attack” skill formula, I have “a.checkAttacker(a,b)” which will determine if the attacker is either an actor or enemy.

        And then I have the script:

        class Game_Battler < Game_BattlerBase
        #————————————————————————–
        # * Check who is attacking (Actor? OR Enemy?)
        #————————————————————————–
        def checkAttacker(a,b)
        if a.actor?
        regAttack(a,b)
        else
        eneAttack(a,b,0)
        end
        end #checkAttacker
        #————————————————————————–
        # * A regular actor attack
        #————————————————————————–
        def regAttack(a,b)
        (VARIABLES & CALCULATIONS)
        return (FORMULA)
        end #regAttack

        #————————————————————————–
        # * A regular enemy attack
        #————————————————————————–
        def eneAttack(a,b,pow)
        (VARIABLES & CALCULATIONS)
        return (FORMULA)
        end #eneAttack

        end #Game_Battler

        Hope that helps. Sorry if it's vague, but the script itself isn't all that complicated, and it's too long to post here…

  15. Galv says:

    Could you please send what is in your script so I can test what you are using including the formulas

  16. Mewgull says:

    You know what, I solved it. Turns out, there was a variable that became 0 that my formulas were multiplying with and in turn made every attack 0, so I fixed it up lol sorry for the trouble. This always seems to happen to me…
    Great script.

  17. Nosleinad says:

    Hello Galv,
    Your script isn’t being activated for me anymore (it was before a hiatus on my project), i put all the graphics in the system folder, notetagged the skills and mantained the disable switch to 0. I tryed to remove all my new scripts but unfortunatelly nothing is working. As there are no messages or errors to point you out, could you give me a few tips of what classes you modified or aliased for this script, so i can alt+shift+F for incompability issues, like the one i am having?

    • Galv says:

      Check for incompatibility. Duplicate your project and remove other scripts one by one, testing it until it works again.

      • Nosleinad says:

        After a bit more than 01 hour it was worth the time (they’re always the last ones hehe, and yes, i have quite a bit of installed scripts).
        Actually the script that is ceasing the effect of your script is the Battle Engine Symphony, and none of its plugins. It might have happened in a newer version of one of the scripts.
        Are you interested in doing a compability fix so it can work for symphony users? Here’s the direct link for the newest version of Symphony: https://dl.dropboxusercontent.com/u/38072264/Symphony/Build/Battle%20Symphony%20v1.15.txt

  18. Phonike the 2nd says:

    I would be willing to support the Symphony compatibility! Surely as a community we all contribute something for your efforts if you would be willing to take the job come on guys!

    • Galv says:

      That does sound nice. I do feel drained from the community asking me to do things for them for nothing all the time… and I have become too busy to keep it up. One day I will get around to looking at symphony compatibility but no idea when that will be.

      • Nosleinad says:

        In my humble opinion, you deserve to get donations from your original scripts AND for always responding and giving support for them, even regarding compability issues. More than deserved and i am doing it right now =).

      • Phonike the 2nd says:

        I will be the first to say I have 5-10 on it if you or maybe some steam gifts if you would prefer. Can I get some more people in on this to give some incentive?

  19. Nosleinad says:

    Ok i just donated 10 USD at jul 15, i hope you received it right Galv (My real name is Danielson)

  20. Someone says:

    I’ve tested the demo and I have two questions:
    -The 99% of the times I press the button the circle turns red and de attack doesn’t do any damage. ¿Is this a bug?
    -I can only set one button to press. ¿Is not possible to set several buttons to be pressed in certain order to make the ability sucess (like in Mario & Lugi games)

    • Galv says:

      If you read the battle messages, you will see they aren’t doing damage because they are missing. The demo is set up so battlers miss if you don’t hit the timing correctly. The circle turns red if you miss the timing.

      It is only possible to press one button in this script, yes.

  21. Kevin says:

    I am wondering if you were able to combine this with Symphony good sir? I have looked at all the other scripts and these two combined would have to be a pinnacle of scripting to me.

  22. Nosleinad says:

    Hello Galv,

    I don’t want to look like someone who is just asking for an update on this script (aka compability with symphony), i’d just like to ask if you would be willing to do this, and make this public, as a comissioned work from me.
    If you are interested, plz contact me through e-mail or through the rmvxace forums (Nosleinad).

  23. shingamix says:

    I was wanting to maker this more like the attacks in Mario RPG as in if you time the button press right the player can do multiple attacks and have multiple input presses to achieve a chain attack type effect. Is that possible with this script?

  24. Dudester says:

    Hey, sorry to ask this since you probably get it a lot, but is there any way to get this to work with victor’s animated battlers? I’m trying to make a Mario-like battle system, and this would solve all my issues, but it just doesn’t work…again, sorry to pester.

    • Galv says:

      Sorry, don’t have time for requests

      • even if its requested by multiple people? :P i was about to request the same things, your script is awesome, yet not compatible with one of the most popular animated battle script, having this timed combo in my game would open up so many ideas of skills that would improve the gameplay by a lot!

      • Galv says:

        Yeah unfortunately multiple people won’t help. I’m swamped with multiple projects and jobs haha

  25. Exin says:

    Hey, I noticed a bug in the script where if you correctly hit the timing it applies the bonus to all actors and enemies for as long as you don’t press the button again. Meaning if you hit the timing on the attack, all party members and enemies will receive the bonus damage and true hit for as long as you don’t attempt to hit the A or D button again. Is there way to reset the multiplier after each attack?

  26. Trace says:

    is it just me ?
    i can’t make a skill using timed hit fail when the player fail to hit in time.
    is that possible ?

  27. seth allison says:

    i was wondering can i make it to were only one charter does this because i want all charters in my game to play diffrent so can i do this thank you for the script

  28. James says:

    It’s not compatible with atb system 1.4 by mog, is there a way to make this script work with this version? I love your script but it just don’t work with atb…

  29. Salty says:

    Hi there!
    First off, thank you for making such a nice script and making it publicly available like this. I’m new to this program and yours has been the most intuitive to use and easiest to understand so far. So big thanks! You’re awesome!

    Second, a question: Is it possible/safe to change the x/y position of the Battlers on screen? In the code it says “don’t touch,” so I’m under the impression that if I change those there will be ramifications later on. (The monsters, of course, are figured out easily enough. It’s the player characters I would like to reposition.)

    Thank you for your time!

    • Galv says:

      The “don’t touch” is usually referring to just the code before it. Dont touch that line. Other settings can be changed. IF you need to know something, test it and see :)

      • Salty says:

        Ah, thank you very much for replying! I’ll mess around with it and see what I learn.
        (By the way, this was accidentally posted in the wrong section. I meant this to be in the Animated Battlers area. I’m sorry!)

  30. Grumpy says:

    I’m a noobler, forgive me, but everytime i’m in a battle a pop up message shows up saying it is unable to find graphic indicator.What do i do?

  31. bleachbummer says:

    Does this work with you animated battlers script? I’m trying to get this to work in a side battle view but having issues in making it appear. And I do have everything in the folders.

  32. Hello, Galv.

    I’m very intrigued by your Timed Hits script, but I can’t open the demo for some reason. Could you maybe explain what graphics are needed for this to work, as well as the pixel size?

  33. Thanks. I’ll be sure to give you full credit. :)

  34. CountBleck says:

    I set guaranteed hit to true, but my attacks will sometimes miss. Is there something I’m doing wrong, or is it a bug?

  35. crecievii says:

    I’d just like to report a quick bug and see if there’s any way to fix it. I’m encountering an issue when I’m defending against oncoming hits where the indicator vanishes way too quickly. I’ve done as you advised and added about 20 odd blank frames of padding to ensure there would be enough time, and it simply isn’t functioning. All other forms of attack are working, just not
    defending, which is really throwing off the balance of my game right now. Do you have any solutions to this issue?

  36. Tu says:

    Darn, I’m using rmxp not rmvxace!

  37. plasmatorture says:

    Is it possible to specify the % chance of a state applying when the timed button is pressed? Right now it’s 100%, but I’d love some control over it. I know you don’t have time to do the change yourself but would you be able to tell me what needs to be changed? It doesn’t seem like it would be that hard to add, in theory.

  38. mr B says:

    so how do i add this in to my game if want it. am new to this and just want to know

    • Galv says:

      I recommend asking in a forum for advice about how to use the script editor in rpgmaker :) One day I will do a write up about it and add to the site when I have time.

  39. jalewis206 says:

    Hey galv, thank you for making this amazing script. Would it be possible to add defend timing to a state? This could be a neat way of changing how a player defends based on the state they are in.

    • Galv says:

      Hey, sorry I don’t have time to add new stuff to old scripts I’m afraid. It is a great idea, though

      • jalewis206 says:

        Hey Galv, That’s okay. This actually made me try to do this myself… and I was able to code it! So thank you for that. One more question though, with this script are we able to use directional button inputs for atk and defend presses?

      • Galv says:

        Can’t remember. I had a quick look and it just turns the string into a symbol… so try using LEFT or RIGHT (I think they have to be capitals, but try lowercase as well)

        Test it out :D

  40. debousey says:

    Hey, this script is great and something I needed. However, whenever a battle closes, I get the message: Script ‘Window_Selectable line 61: ZeroDivisionError occured. Divided by 0. I am using Yanfly’s battle system (core, engine, visual) and my only other scripts are one that allows free player movement and one that enables/disables dash.

    There’s also no alterations to the Window_Selectable script where the error is apparently happened. Any ideas?

  41. I don’t get this.
    First of all I need an indicator and target for the system cus it wasn’t there.When I put some weird stuff as indicator and target which wouldn’t make sense in an actual game and put the notes in,it was no timer.
    Can you record a video to teach me how to do it?
    A timed attack is something I desperately need in my game and I looked all over the internet for them and I found yours and I don’t understand it at all!So a tutorial would greatly be appreciated.
    Thanks for reading.

    • Galv says:

      Unfortunately I am too busy to make a tutorial video. If you have downloaded the demo, spend some time looking at the skills note tags and see how they relate to the graphics in /Graphics/System/.

      Have a play around with the demo and change stuff to see how it effects it and make sure to read over the instructions

      • Sorry about that,I understand PERFECTLY how to do this.I told my brother about my timed attacks and I said it was from you so he done this.I am connected to my twitter account so it had my twitter account on there.
        So again sorry about that and THANK you for the script.
        Took 5 minutes to work out what to do and it was amazing!
        It took a little bit of adjusting to make sure you didn’t need an exact hit to actually land a hit but it worked great!I spent a while working on my OWN indicator and target though.

        Anyway,gl on the scripts.

  42. FLame Fletcher says:

    Galv, there is a bug.
    When I set the enemy to counterattack my move,. I first start my attack which is counterattacked by the enemy. The counterattack kills the player and then an error appears.

    line 422:NoMethodError Occured
    undefined method ‘item’ for nil:NIlClass

    • Galv says:

      Can you replicate this in a new project (or in the script demo)? Need to make sure it isn’t a script conflict before I add to my to-do list.

  43. SuperMarioKain says:

    The hit indicator things dont work.. It just says it cant be found. Help pls.

    • Galv says:

      If it says it cant be found then… you didn’t put them in.

      You need to copy them from the demo or create your own. Get the demo from the top of this page where it says “Demo – Version 1.7 >”

  44. KirbyStarSword says:

    Galv i have download the timed button script it was good but the missing part is when the button is hit early where it turn orange and yellow I saw some battle system that has close early timing were it turn orange and yellow example for undertale yellow i understand if you dont want add more updates. the script would be special for anyone to ask.

  45. guest says:

    No idea if you’re still looking at comments here, but I found an odd bug. The defensive indicator (for pressing the button to reduce an attack’s damage) and the skill indicator for a timed attack are off-centered. I don’t know what caused this, and I’m looking for a fix. Thanks in advance!

    • Galv says:

      Unfortunately I do not do updates to my Ace scripts anymore as they are 8 years old. If it doesn’t happen in the demo, it might be a script conflict or perhaps a script setting?

Leave a comment