Timed Attack + Cast Animation ?

● ARCHIVED · READ-ONLY
Started by Rokazulu 3 posts View original ↗
  1. I was wondering if it was possible to edit the timed attack script to allow both of these scripts to work in conjunction:

    Galv's timed button attacks:
    https://galvs-scripts.com/galvs-timed-button-attacks/
    Code:
    #  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 = 10   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 = 1.5    # Default damage/healing multipliers if the timing is
      DEF_MULTIPLIER = 0.1      # successful for attacking and defending.
     
      DIFFICULTY = 0         # 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 = 500   # Turn swith ON to disable this
     
      ATK_BTN = :C           # Default attack button to press. :X is "a"
      DEF_BTN = :C           # 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
     
          "CRITICAL HIT",      # 0) Default attacking timed hit success
          "CRITICAL HIT",    # 1) Default allied spell timed hit success
          "CRITICAL 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",30,75]    # "SE_Name", volume, pitch when hit timing
      SE_MISS = ["Buzzer1",0,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

    and Yanfly's Cast Animation
    (can't find link)
    Code:
    #==============================================================================
    #
    # ▼ Yanfly Engine Ace - Cast Animations v1.00
    # -- Last Updated: 2011.12.18
    # -- Level: Easy, Normal
    # -- Requires: n/a
    #
    #==============================================================================
    
    $imported = {} if $imported.nil?
    $imported["YEA-CastAnimations"] = true
    
    #==============================================================================
    # ▼ Updates
    # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    # 2011.12.18 - Started Script and Finished.
    #
    #==============================================================================
    # ▼ Introduction
    # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    # Casting animations are actually great visual tools to help players recognize
    # and acknowledge which battler on the screen is currently taking an action.
    # The other thing is that casting animations also provide eye candy. This
    # script provides easy access to generate cast animations and to allow even
    # separate animations for each individual skill.
    #
    #==============================================================================
    # ▼ Instructions
    # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    # To install this script, open up your script editor and copy/paste this script
    # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
    #
    # -----------------------------------------------------------------------------
    # Skill Notetags - These notetags go in the skills notebox in the database.
    # -----------------------------------------------------------------------------
    # <cast ani: x>
    # Sets the casting animation for this skill to be x. This animation will always
    # be played before this skill is used. If this tag isn't used, the default cast
    # animation will be the one set by the script's module.
    #
    # <no cast ani>
    # Sets the casting animation for this skill to be 0, making it so that no cast
    # animation will be played before this skill is used.
    #
    # -----------------------------------------------------------------------------
    # Item Notetags - These notetags go in the items notebox in the database.
    # -----------------------------------------------------------------------------
    # <cast ani: x>
    # Sets the casting animation for this item to be x. This animation will always
    # be played before this item is used. If this tag isn't used, the default cast
    # animation will be the one set by the script's module.
    #
    # <no cast ani>
    # Sets the casting animation for this item to be 0, making it so that no cast
    # animation will be played before this item is used.
    #
    #==============================================================================
    # ▼ Compatibility
    # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
    # it will run with RPG Maker VX without adjusting.
    #
    #==============================================================================
    
    module YEA
      module CAST_ANIMATIONS
     
        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
        # - Default Settings -
        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
        # These settings set the default casting animations for all skills that do
        # not use a unique casting animation. If you don't want any of the settings
        # below to have a cast animation, set it to 0 to disable it.
        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
        NORMAL_ATTACK_ANI  = 0     # Default animation for skill #1.
        DEFEND_ANIMATION   = 0     # Default animation for skill #2.
        PHYSICAL_ANIMATION = 81    # Default animation for physical skills.
        MAGICAL_ANIMATION  = 43    # Default animation for magical skills.
        ITEM_USE_ANIMATION = 0     # Default animation for using items.
     
      end # CAST_ANIMATIONS
    end # YEA
    
    #==============================================================================
    # ▼ Editting anything past this point may potentially result in causing
    # computer damage, incontinence, explosion of user's head, coma, death, and/or
    # halitosis so edit at your own risk.
    #==============================================================================
    
    module YEA
      module REGEXP
      module USABLEITEM
     
        CAST_ANI    = /<(?:CAST_ANI|cast ani|cast animation):[ ](\d+)>/i
        NO_CAST_ANI = /<(?:NO_CAST_ANI|no cast ani|no cast animation)>/i
     
      end # USABLEITEM
      end # REGEXP
    end # YEA
    
    #==============================================================================
    # ■ DataManager
    #==============================================================================
    
    module DataManager
     
      #--------------------------------------------------------------------------
      # alias method: load_database
      #--------------------------------------------------------------------------
      class <<self; alias load_database_cani load_database; end
      def self.load_database
        load_database_cani
        load_notetags_cani
      end
     
      #--------------------------------------------------------------------------
      # new method: load_notetags_cani
      #--------------------------------------------------------------------------
      def self.load_notetags_cani
        groups = [$data_items, $data_skills]
        for group in groups
          for obj in group
            next if obj.nil?
            obj.load_notetags_cani
          end
        end
      end
     
    end # DataManager
    
    #==============================================================================
    # ■ RPG::UsableItem
    #==============================================================================
    
    class RPG::UsableItem < RPG::BaseItem
     
      #--------------------------------------------------------------------------
      # public instance variable
      #--------------------------------------------------------------------------
      attr_accessor :cast_ani
     
      #--------------------------------------------------------------------------
      # common cache: load_notetags_cani
      #--------------------------------------------------------------------------
      def load_notetags_cani
        @cast_ani = 0
        if self.is_a?(RPG::Skill)
          if @id == 1
            @cast_ani = YEA::CAST_ANIMATIONS::NORMAL_ATTACK_ANI
          elsif @id == 2
            @cast_ani = YEA::CAST_ANIMATIONS::DEFEND_ANIMATION
          elsif self.physical?
            @cast_ani = YEA::CAST_ANIMATIONS::pHYSICAL_ANIMATION
          elsif self.magical?
            @cast_ani = YEA::CAST_ANIMATIONS::MAGICAL_ANIMATION
          end
        else
          @cast_ani = YEA::CAST_ANIMATIONS::ITEM_USE_ANIMATION
        end
        #---
        self.note.split(/[\r\n]+/).each { |line|
          case line
          #---
          when YEA::REGEXP::USABLEITEM::CAST_ANI
            @cast_ani = $1.to_i
          when YEA::REGEXP::USABLEITEM::NO_CAST_ANI
            @cast_ani = 0
          #---
          end
        } # self.note.split
        #---
      end
     
    end # RPG::UsableItem
    
    #==============================================================================
    # ■ Scene_Battle
    #==============================================================================
    
    class Scene_Battle < Scene_Base
     
      #--------------------------------------------------------------------------
      # alias method: use_item
      #--------------------------------------------------------------------------
      alias scene_battle_use_item_cani use_item
      def use_item
        process_casting_animation unless $imported["YEA-BattleEngine"]
        scene_battle_use_item_cani
      end
     
      #--------------------------------------------------------------------------
      # new method: process_casting_animation
      #--------------------------------------------------------------------------
      def process_casting_animation
        item = @subject.current_action.item
        cast_ani = item.cast_ani
        return if cast_ani <= 0
        show_animation([@subject], cast_ani)
      end
     
    end # Scene_Battle
    
    #==============================================================================
    #
    # ▼ End of File
    #
    #==============================================================================

    Right now they both technically function but, the timed attack script works two times.

    I want to see if I can edit one of these scripts so that cast animation doesn't trigger a 'timed attack'. Currently, whenever the player casts a spell with both scripts active, the cast animation will trigger a timed attack on the cast animation AND when attacking. I just want the attack to have a timed attack, but I believe that would require some editing.

    If it would require too much script editing or is impossible or I did not provide enough information, please kindly tell me.
  2. Looking at the scripts I see that both of them have the def process_casting_animation
    Code:
      if $imported["YEA-CastAnimations"]
        alias galv_btnhit_sb_process_casting_animation process_casting_animation
        def process_casting_animation
    I would try putting galv's script below yanfly and comment out the alias line.
    That should overwrite yanfly's code and stop the double animation.
  3. Perfect man. The two scripts seem to be working as I want them to now. Thanks!