Show picture when crit or hit weakness

I need a script that shows a picture in battle whenever an actor gets a critical hit or hits an enemy weakness. I want the pic to show up before the action happens.
Bump
Bump
Now that I need this again... BUMP!
I need a script that shows a picture in battle whenever an actor gets a critical hit or hits an enemy weakness. I want the pic to show up before the action happens.
This is a modification of MOG Hunters Ougi Animation script. It does not overwrite the original script so they can be used together, but everything here is basically a copy, just adjusted for your request.
There are still improvements that can be done to the script such as having one animation class, but I'm not sure this will do what you want to test this first before any changes are made.
Spoiler: MOG Ougi Animation Addon
Ruby:
#==============================================================================
# +++ MOG - Ougi Animation  (v1.8) +++
# +++ Roninator2 Addon Mod  (v1.9) +++
#==============================================================================
# By Moghunter
# https://atelierrgss.wordpress.com/
#==============================================================================
# Displays an animation in pictures when any action is a critical hit.
#==============================================================================
# You will need the following files in Graphics/Pictures/.
#
# Actor + ID.png
# Actor + ID + _Crit.png
# Actor + ID + _Elem.png
#
#==============================================================================
# EXAMPLE
#==============================================================================
# Actor1.png
# Actor1_Crit.png
# Actor1_Elem.png
#
# Enemy7.png
# Enemy7_Crit.png
# Enemy7_Elem.png
#
#==============================================================================

#==============================================================================
# ● Histórico (Version History)
#==============================================================================
# v 3.7 - Improved script compatibility.
#==============================================================================

$imported = {} if $imported.nil?
$imported[:r2_crit_animation] = true

module R2_CRIT_ANIMATION
  # Sound definition when activating the animation. 
  CRIT_SOUND_FILE = "Flash2" 
  ELEM_SOUND_FILE = "Flash1" 
end

#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Game_Battler < Game_BattlerBase
 
  #--------------------------------------------------------------------------
  # * Apply Effect of Skill/Item
  #--------------------------------------------------------------------------
  def item_apply(user, item)
    @result.clear
    @result.used = item_test(user, item)
    @result.missed = (@result.used && rand >= item_hit(user, item))
    @result.evaded = ([email protected] && rand < item_eva(user, item))
    if @result.hit?
      unless item.damage.none?
        @result.critical = (rand < item_cri(user, item))
        SceneManager.scene.update_crit_animation if @result.critical
        make_damage_value(user, item)
        execute_damage(user)
      end
      item.effects.each {|effect| item_effect_apply(user, item, effect) }
      item_user_effect(user, item)
    end
  end
  #--------------------------------------------------------------------------
  # * Calculate Damage
  #--------------------------------------------------------------------------
  alias r2_element_make_damage_critial_animation  make_damage_value
  def make_damage_value(user, item)
    ovars = Marshal.load(Marshal.dump($game_variables))
    oswitchs = Marshal.load(Marshal.dump($game_switches.clone))
    value = item.damage.eval(user, self, $game_variables)
    base = 0
    base = value.to_i
    value *= item_element_rate(user, item)
    $game_variables = ovars
    $game_switches = oswitchs
    SceneManager.scene.update_element_animation if value > base
    r2_element_make_damage_critial_animation(user, item)
  end

end

class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # ● Update Critical Animation
  #-------------------------------------------------------------------------- 
  def update_crit_animation
  end
  #--------------------------------------------------------------------------
  # ● Update Element Animation
  #-------------------------------------------------------------------------- 
  def update_element_animation
  end
end

class Scene_Menu < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● Update Critical Animation
  #-------------------------------------------------------------------------- 
  def update_crit_animation
  end
  #--------------------------------------------------------------------------
  # ● Update Element Animation
  #-------------------------------------------------------------------------- 
  def update_element_animation
  end
end

class Scene_Item < Scene_ItemBase
  #--------------------------------------------------------------------------
  # ● Update Critical Animation
  #-------------------------------------------------------------------------- 
  def update_crit_animation
  end
  #--------------------------------------------------------------------------
  # ● Update Element Animation
  #-------------------------------------------------------------------------- 
  def update_element_animation
  end
end

class Scene_Skill < Scene_ItemBase
  #--------------------------------------------------------------------------
  # ● Update Critical Animation
  #-------------------------------------------------------------------------- 
  def update_crit_animation
  end
  #--------------------------------------------------------------------------
  # ● Update Element Animation
  #-------------------------------------------------------------------------- 
  def update_element_animation
  end
end

class Scene_Battle < Scene_Base

  #--------------------------------------------------------------------------
  # ● Update Critical Animation
  #-------------------------------------------------------------------------- 
  def update_crit_animation
    special_animation = R2_Critical_Animation.new(@subject, 0)
    loop do
      special_animation.update ; Graphics.update ; Input.update
      break if special_animation.phase == 3
    end
    special_animation.dispose
  end
  #--------------------------------------------------------------------------
  # ● Update Element Animation
  #-------------------------------------------------------------------------- 
  def update_element_animation
    special_animation = R2_Critical_Animation.new(@subject, 1)
    loop do
      special_animation.update ; Graphics.update ; Input.update
      break if special_animation.phase == 3
    end
    special_animation.dispose
  end

end

#==============================================================================
# ■ Critical Animation
#==============================================================================
class R2_Critical_Animation
 
  include R2_CRIT_ANIMATION
  attr_accessor :phase
 
  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------   
  def initialize(subject, anim)
    @anim = anim
    @phase = 0 ; create_battler(subject) ; create_background(subject)
    Audio.se_play("Audio/SE/" + CRIT_SOUND_FILE.to_s, 100, 100) rescue nil if @phase != 3
  end   
 
  #--------------------------------------------------------------------------
  # ● Create Background
  #--------------------------------------------------------------------------     
  def create_background(subject)
    @background_sprite = Sprite.new
    if subject.is_a?(Game_Actor)
       battler_id = "Actor" + subject.id.to_s
    else   
       battler_id = "Enemy" + subject.enemy_id.to_s
    end
    if @anim == 0
      bname = battler_id.to_s + "_Crit" if bname == nil
    else
      bname = battler_id.to_s + "_Elem" if bname == nil
    end
    @background_sprite.bitmap = Cache.picture(bname) rescue nil     
    @background_sprite.z = 11000 ; @background_sprite.opacity = 0
    @background_sprite.zoom_x = 1.00 ; @background_sprite.zoom_y = 1.00
    if @background_sprite.bitmap != nil
       @background_sprite.ox = @background_sprite.bitmap.width / 2
       @background_sprite.oy = @background_sprite.bitmap.height / 2
       @background_sprite.x = @background_sprite.ox
       @background_sprite.y = @background_sprite.oy
    end
    @phase = @background_sprite.bitmap != nil ? 0 : 3
  end
 
  #--------------------------------------------------------------------------
  # ● Create Battler
  #--------------------------------------------------------------------------     
  def create_battler(subject)
    @battler_sprite = Sprite.new
    if subject.is_a?(Game_Actor)
       bname = "Actor" + subject.id.to_s
    else   
       bname = "Enemy" + subject.enemy_id.to_s
    end 
    @battler_sprite.bitmap = Cache.picture(bname) rescue nil
    @battler_sprite.z = 12000 ; @battler_org = [0,0]
    if @battler_sprite.bitmap != nil
       @battler_sprite.ox = @battler_sprite.bitmap.width / 2
       @battler_sprite.oy = @battler_sprite.bitmap.height / 2
       px = @battler_sprite.ox  + ((Graphics.width / 2) - (@battler_sprite.bitmap.width / 2))
       @battler_sprite.y = @battler_sprite.oy + (Graphics.height - @battler_sprite.bitmap.height)
       @battler_org = [px - 130,px]
       @battler_sprite.x = @battler_org[0]
   end
   @battler_sprite.zoom_x = 2 ; @battler_sprite.zoom_y = 2
   @battler_sprite.opacity = 0
   @phase = @battler_sprite.bitmap != nil ? 0 : 3     
  end       
 
  #--------------------------------------------------------------------------
  # ● Dispose
  #--------------------------------------------------------------------------   
  def dispose
    dispose_battler_sprite ; dispose_background_sprite
  end
 
  #--------------------------------------------------------------------------
  # ● Dispose Battler Sprite
  #--------------------------------------------------------------------------     
  def dispose_battler_sprite
    return if @battler_sprite == nil
    if @battler_sprite.bitmap != nil
       @battler_sprite.bitmap.dispose ; @battler_sprite.bitmap = nil
    end
    @battler_sprite.dispose ; @battler_sprite = nil   
  end 
 
  #--------------------------------------------------------------------------
  # ● Dispose Background Sprite
  #--------------------------------------------------------------------------       
  def dispose_background_sprite
    return if @background_sprite == nil
    if @background_sprite.bitmap != nil
       @background_sprite.bitmap.dispose ; @background_sprite.bitmap = nil
    end 
    @background_sprite.dispose ; @background_sprite = nil
  end 
 
  #--------------------------------------------------------------------------
  # ● Update
  #--------------------------------------------------------------------------   
  def update
    return if @phase == 3
    case @phase
      when 0; update_start
      when 1; update_slide
      when 2; update_end 
   end
   @background_sprite.zoom_x += 0.004
   @background_sprite.zoom_y = @background_sprite.zoom_x
  end 
 
  #--------------------------------------------------------------------------
  # ● Update Start
  #--------------------------------------------------------------------------     
  def update_start
    @battler_sprite.zoom_x -= 0.03 ; @battler_sprite.opacity += 5
    @background_sprite.opacity += 10 ; @battler_sprite.x += 3
    if @battler_sprite.zoom_x <= 1.00
       @battler_sprite.zoom_x = 1.00 ; @battler_sprite.opacity = 255
       @background_sprite.opacity = 255 ; @phase = 1
    end   
    @battler_sprite.zoom_y = @battler_sprite.zoom_x
  end 
      
  #--------------------------------------------------------------------------
  # ● Update Slide
  #--------------------------------------------------------------------------       
  def update_slide
    @battler_sprite.x += 1 ; @phase = 2 if @battler_sprite.x >= @battler_org[1]
  end

  #--------------------------------------------------------------------------
  # ● Update End
  #--------------------------------------------------------------------------       
  def update_end
    @battler_sprite.zoom_x += 0.03
    @battler_sprite.zoom_y = @battler_sprite.zoom_x
    @battler_sprite.opacity -= 5 ; @background_sprite.opacity -= 5
    @phase = 3 if @battler_sprite.opacity <= 0
  end 
 
end
Good, but I'd like it to show up before the text, also get rid of the zoomin
Good, but I'd like it to show up before the text, also get rid of the zoomin
In my test the text says Eric attacks. then the animations plays then it shows the damage.
That seems appropriate to me. but you want it to show before Eric attacks text is shown?
If that is not the case then you have something that is changing the default and you need to explain what that is.

The zoom part was part of the default script. I'll try to remove it.
Spoiler: MOG Ougi Animation Addon V2
Ruby:
#==============================================================================
# +++ MOG - Ougi Animation  (v1.8) +++
# +++ Roninator2 Addon Mod  (v1.9) +++
#==============================================================================
# By Moghunter
# https://atelierrgss.wordpress.com/
#==============================================================================
# Displays an animation in pictures when any action is a critical hit.
#==============================================================================
# You will need the following files in Graphics/Pictures/.
#
# Actor + ID.png
# Actor + ID + _Crit.png
# Actor + ID + _Elem.png
#
#==============================================================================
# EXAMPLE
#==============================================================================
# Actor1.png
# Actor1_Crit.png
# Actor1_Elem.png
#
# Enemy7.png
# Enemy7_Crit.png
# Enemy7_Elem.png
#
#==============================================================================

#==============================================================================
# ● Histórico (Version History)
#==============================================================================
# v 3.7 - Improved script compatibility.
#==============================================================================

$imported = {} if $imported.nil?
$imported[:r2_crit_animation] = true

module R2_CRIT_ANIMATION
  # Sound definition when activating the animation. 
  CRIT_SOUND_FILE = "Flash2" 
  ELEM_SOUND_FILE = "Flash1" 
end

#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Game_Battler < Game_BattlerBase
 
  #--------------------------------------------------------------------------
  # * Apply Effect of Skill/Item
  #--------------------------------------------------------------------------
  def item_apply(user, item)
    @result.clear
    @result.used = item_test(user, item)
    @result.missed = (@result.used && rand >= item_hit(user, item))
    @result.evaded = ([email protected] && rand < item_eva(user, item))
    if @result.hit?
      unless item.damage.none?
        @result.critical = (rand < item_cri(user, item))
        SceneManager.scene.update_crit_animation if @result.critical
        make_damage_value(user, item)
        execute_damage(user)
      end
      item.effects.each {|effect| item_effect_apply(user, item, effect) }
      item_user_effect(user, item)
    end
  end
  #--------------------------------------------------------------------------
  # * Calculate Damage
  #--------------------------------------------------------------------------
  alias r2_element_make_damage_critial_animation  make_damage_value
  def make_damage_value(user, item)
    ovars = Marshal.load(Marshal.dump($game_variables))
    oswitchs = Marshal.load(Marshal.dump($game_switches.clone))
    value = item.damage.eval(user, self, $game_variables)
    base = 0
    base = value.to_i
    value *= item_element_rate(user, item)
    $game_variables = ovars
    $game_switches = oswitchs
    SceneManager.scene.update_element_animation if value > base
    r2_element_make_damage_critial_animation(user, item)
  end

end

class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # ● Update Critical Animation
  #-------------------------------------------------------------------------- 
  def update_crit_animation
  end
  #--------------------------------------------------------------------------
  # ● Update Element Animation
  #-------------------------------------------------------------------------- 
  def update_element_animation
  end
end

class Scene_Menu < Scene_MenuBase
  #--------------------------------------------------------------------------
  # ● Update Critical Animation
  #-------------------------------------------------------------------------- 
  def update_crit_animation
  end
  #--------------------------------------------------------------------------
  # ● Update Element Animation
  #-------------------------------------------------------------------------- 
  def update_element_animation
  end
end

class Scene_Item < Scene_ItemBase
  #--------------------------------------------------------------------------
  # ● Update Critical Animation
  #-------------------------------------------------------------------------- 
  def update_crit_animation
  end
  #--------------------------------------------------------------------------
  # ● Update Element Animation
  #-------------------------------------------------------------------------- 
  def update_element_animation
  end
end

class Scene_Skill < Scene_ItemBase
  #--------------------------------------------------------------------------
  # ● Update Critical Animation
  #-------------------------------------------------------------------------- 
  def update_crit_animation
  end
  #--------------------------------------------------------------------------
  # ● Update Element Animation
  #-------------------------------------------------------------------------- 
  def update_element_animation
  end
end

class Scene_Battle < Scene_Base

  #--------------------------------------------------------------------------
  # ● Update Critical Animation
  #-------------------------------------------------------------------------- 
  def update_crit_animation
    special_animation = R2_Critical_Animation.new(@subject, 0)
    loop do
      special_animation.update ; Graphics.update ; Input.update
      break if special_animation.phase == 3
    end
    special_animation.dispose
  end
  #--------------------------------------------------------------------------
  # ● Update Element Animation
  #-------------------------------------------------------------------------- 
  def update_element_animation
    special_animation = R2_Critical_Animation.new(@subject, 1)
    loop do
      special_animation.update ; Graphics.update ; Input.update
      break if special_animation.phase == 3
    end
    special_animation.dispose
  end

end

#==============================================================================
# ■ Critical Animation
#==============================================================================
class R2_Critical_Animation
 
  include R2_CRIT_ANIMATION
  attr_accessor :phase
 
  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------   
  def initialize(subject, anim)
    @anim = anim
    @phase = 0 ; create_battler(subject) ; create_background(subject)
    Audio.se_play("Audio/SE/" + CRIT_SOUND_FILE.to_s, 100, 100) rescue nil if @phase != 3
  end   
 
  #--------------------------------------------------------------------------
  # ● Create Background
  #--------------------------------------------------------------------------     
  def create_background(subject)
    @background_sprite = Sprite.new
    if subject.is_a?(Game_Actor)
       battler_id = "Actor" + subject.id.to_s
    else   
       battler_id = "Enemy" + subject.enemy_id.to_s
    end
    if @anim == 0
      bname = battler_id.to_s + "_Crit" if bname == nil
    else
      bname = battler_id.to_s + "_Elem" if bname == nil
    end
    @background_sprite.bitmap = Cache.picture(bname) rescue nil     
    @background_sprite.z = 11000 ; @background_sprite.opacity = 0
    if @background_sprite.bitmap != nil
       @background_sprite.ox = @background_sprite.bitmap.width / 2
       @background_sprite.oy = @background_sprite.bitmap.height / 2
       @background_sprite.x = @background_sprite.ox
       @background_sprite.y = @background_sprite.oy
    end
    @phase = @background_sprite.bitmap != nil ? 0 : 3
  end
 
  #--------------------------------------------------------------------------
  # ● Create Battler
  #--------------------------------------------------------------------------     
  def create_battler(subject)
    @battler_sprite = Sprite.new
    if subject.is_a?(Game_Actor)
       bname = "Actor" + subject.id.to_s
    else   
       bname = "Enemy" + subject.enemy_id.to_s
    end 
    @battler_sprite.bitmap = Cache.picture(bname) rescue nil
    @battler_sprite.z = 12000 ; @battler_org = [0,0]
    if @battler_sprite.bitmap != nil
       @battler_sprite.ox = @battler_sprite.bitmap.width / 2
       @battler_sprite.oy = @battler_sprite.bitmap.height / 2
       px = @battler_sprite.ox  + ((Graphics.width / 2) - (@battler_sprite.bitmap.width / 2))
       @battler_sprite.y = @battler_sprite.oy + (Graphics.height - @battler_sprite.bitmap.height)
       @battler_org = [px - 130,px]
       @battler_sprite.x = @battler_org[0]
   end
   @battler_sprite.opacity = 0
   @phase = @battler_sprite.bitmap != nil ? 0 : 3     
  end       
 
  #--------------------------------------------------------------------------
  # ● Dispose
  #--------------------------------------------------------------------------   
  def dispose
    dispose_battler_sprite ; dispose_background_sprite
  end
 
  #--------------------------------------------------------------------------
  # ● Dispose Battler Sprite
  #--------------------------------------------------------------------------     
  def dispose_battler_sprite
    return if @battler_sprite == nil
    if @battler_sprite.bitmap != nil
       @battler_sprite.bitmap.dispose ; @battler_sprite.bitmap = nil
    end
    @battler_sprite.dispose ; @battler_sprite = nil   
  end 
 
  #--------------------------------------------------------------------------
  # ● Dispose Background Sprite
  #--------------------------------------------------------------------------       
  def dispose_background_sprite
    return if @background_sprite == nil
    if @background_sprite.bitmap != nil
       @background_sprite.bitmap.dispose ; @background_sprite.bitmap = nil
    end 
    @background_sprite.dispose ; @background_sprite = nil
  end 
 
  #--------------------------------------------------------------------------
  # ● Update
  #--------------------------------------------------------------------------   
  def update
    return if @phase == 3
    case @phase
      when 0; update_start
      when 1; update_slide
      when 2; update_end 
   end
  end 
 
  #--------------------------------------------------------------------------
  # ● Update Start
  #--------------------------------------------------------------------------     
  def update_start
    @battler_sprite.opacity += 5
    @background_sprite.opacity += 10
    @battler_sprite.x += 3
    if @battler_sprite.opacity >= 250
      @battler_sprite.opacity = 255
      @phase = 1
    end   
  end 
      
  #--------------------------------------------------------------------------
  # ● Update Slide
  #--------------------------------------------------------------------------       
  def update_slide
    @battler_sprite.x += 1 ; @phase = 2 if @battler_sprite.x >= @battler_org[1]
  end

  #--------------------------------------------------------------------------
  # ● Update End
  #--------------------------------------------------------------------------       
  def update_end
    @battler_sprite.opacity -= 5 ; @background_sprite.opacity -= 5
    @phase = 3 if @battler_sprite.opacity <= 0
  end 
 
end
What I mean is that I want the picture to show up before the animation plays.
What I mean is that I want the picture to show up before the animation plays.
Seen. I'll look into it

*update. That is not possible from what I know.
In order to call the animation for critical hits or element hits, it has to be done in the methods that calculate it.
The use item method is where the attack animation is run. This is long before the check if the hit was a critical.
To do this would require a significant rewrite of the battle system. So no it's not worth the effort. and it would also likely not be compatible with other battle scripts.

Original thread: https://forums.rpgmakerweb.com/threads/show-picture-when-crit-or-hit-weakness.166246/