Critical Effect Add-On: Play Animation on Critical

Panda_Artist

Humble RPG Fan
Veteran
Joined
Dec 22, 2018
Messages
246
Reaction score
15
First Language
Portuguese
Primarily Uses
RMVXA
Good morning / afternoon / evening

Ruby:
#Critical Flash + Sound Effect v1.3
#----------#
#Features: Provides the ability to have the screen flash and a se to play
#          upon any critical strike
#
#Usage:    None! Plug and play.
#
#Customization follows in the script, can edit filename, volume and pitch of se
#   and color and duration of flash
#----------#
#-- Script by: V.M of D.T
#
#- Questions or comments can be:
#    given by email: sumptuaryspade@live.ca
#    provided on facebook: http://www.facebook.com/DaimoniousTailsGames
#   All my other scripts and projects can be found here: http://daimonioustails.weebly.com/
#
#--- Free to use in any project, commercial or non-commercial, with credit given
# - - Though a donation's always a nice way to say thank you~ (I also accept actual thank you's)


#class Scene_Battle < Scene_Base
class Game_Battler < Game_BattlerBase
  #---------#
  #PLAYSE to true to play SE. Filename (in quotes), Volume (0-100), Pitch, (0-150)
  #---------#
  PLAYSE       = false
  CSE_FILENAME = "Skill3"
  CSE_VOLUME   = 100
  CSE_PITCH    = 100

  #Here we go if you wish to have a random assortment of Se's play:
  USE_RANDOM   = false
  #Array format: [ [ "filename" , volume , pitch ] , ]
  RANDOM_SE    = [["Skill1",100,100],["Skill2",100,100],["Skill3",100,100]]
  #---------#
  #FLASH to true to execute flash
  #Color in (Red,Green,Blue,Alpha) format (0-255), Duration in frames
  #---------#
  FLASH        = true
  FLASHCOLOR   = Color.new(255,255,255,255)
  FLASHDURAT   = 15

  #Want to set it up so you have to time a button press to land a critical?
  #Well some people do, and for you people, there's this:
  #Total time is time to press button and min <> max is window to press it right
  PRESS_FOR_CRITICAL = false
  TOTAL_TIME_TO_PRESS = 30
  MIN_TIME_FOR_CRIT = 10
  MAX_TIME_FOR_CRIT = 20
  CRIT_INPUT_TRIGGER = :C
  #---------#END
  alias crit_item_apply item_apply
  def item_apply(user, item)
    if self.is_a?(Game_Actor)
      crit_item_apply(user,item)
    else
      @result.clear
      if PRESS_FOR_CRITICAL
        TOTAL_TIME_TO_PRESS.times do |i|
          Input.update
          Graphics.update
          if(Input.trigger?(CRIT_INPUT_TRIGGER))
            if i > MIN_TIME_FOR_CRIT && i < MAX_TIME_FOR_CRIT
              @result.critical = true
            end
            break
          end
        end
      end
      @result.used = item_test(user, item)
      @result.missed = (@result.used && rand >= item_hit(user, item))
      @result.evaded = (!@result.missed && rand < item_eva(user, item))
      if @result.hit?
        unless item.damage.none?
          @result.critical = (rand < item_cri(user, item)) unless PRESS_FOR_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
    play_critical_flash if @result.critical
  end
  def play_critical_flash
    $game_troop.screen.start_flash(FLASHCOLOR, FLASHDURAT) if FLASH
    play_critical_se if PLAYSE
  end
  def play_critical_se
    if !USE_RANDOM
      Audio.se_play('Audio/SE/' + CSE_FILENAME,CSE_VOLUME,CSE_PITCH)
    else
      id = rand(RANDOM_SE.size)
      Audio.se_play("Audio/SE/" + RANDOM_SE[id][0],RANDOM_SE[id][1],RANDOM_SE[id][2])
    end
  end
end

This cool script gives you nice critical hit effects.

However I would really like to have an option to play a battle animation as well.

Is this possible to achieve?

Any help would be appreciated.
 

Panda_Artist

Humble RPG Fan
Veteran
Joined
Dec 22, 2018
Messages
246
Reaction score
15
First Language
Portuguese
Primarily Uses
RMVXA
friendly bump
 

Latest Threads

Latest Profile Posts

Starting work on some stuff for the community. Hopefully it will be fun, and useful to somebody.
Searching what to play in my dead times, the nostalgia hit me hard and ended downloading the Patapon trilogy, hope I can avenge my child self and beating all the games hahaha
Finished the frontier and...I apologize to anyone who saw the trailer I posted and actually tried it. Technical marvel, crazy disjointed fetish story hidden inside a cheap milsim skin that has no idea what it's trying to be except sanctimonious and failing at even that. As much as I hate fallout 4's story, even it was better. I guess there just won't be another non-parody fallout after all.
Anyone else having trouble posting in the forum? I have no reply box in posts or in messages. This is the only place I can type. @Archeia?

Forum statistics

Threads
107,766
Messages
1,031,993
Members
139,911
Latest member
Katara
Top