Critical Effect Add-On: Play Animation on Critical

Panda_Artist

Humble RPG Fan
Veteran
Joined
Dec 22, 2018
Messages
241
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.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,090
Members
137,586
Latest member
Usagiis
Top