How to check for criticals in Yanfly Battle Engine?

Hey there! I'm using a version of Yanfly's Battle Engine, with small modifications for my project. Nothing that would change how this in particular would work, anyhow. So, what I'm curious about, is how can I check if a hit is critical? I've used his screen shake snippet for some minor stuff, like this snippet below:


def perform_damage_effect
$game_troop.screen.start_shake(3, 13, 10) if YEA::BATTLE::SCREEN_SHAKE
@sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
Sound.play_enemy_damage
end


But I'd like to potentially spruce up critical hits a bit by making it a more vigorous shake if a critical hit is done. I know that he pushes a critical flag, and I can only assume that's because whether or not a hit is critical is only kept in memory for so long. So, I tried this, to no avail:


def perform_damage_effect
if @flags.include?("critical")
$game_troop.screen.start_shake(3, 5, 200) if YEA::BATTLE::SCREEN_SHAKE
else
$game_troop.screen.start_shake(3, 5, 10) if YEA::BATTLE::SCREEN_SHAKE
@sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
Sound.play_enemy_damage
end


Here is a link To the YBE. Any help would be appreciated, but I'm aware that it's a lengthy script to comb through. 🙂
You could try to replace that check with this one:

Spoiler
def perform_damage_effect
if @result.critical
$game_troop.screen.start_shake(3, 5, 200) if YEA::BATTLE::SCREEN_SHAKE
else
$game_troop.screen.start_shake(3, 5, 10) if YEA::BATTLE::SCREEN_SHAKE
end
@sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
Sound.play_enemy_damage
end

You also had a syntax error, a missing end line, so I added that too.
If all you need is the critical indicator then TheoAllen has a script that adds that to Yanfly's battle engine.


http://theolized.blogspot.ca/2014/04/yea-critical-popup-fix.html
Thank you, Sixth! It works like a dream. You're a real savior~

Original thread: https://forums.rpgmakerweb.com/threads/how-to-check-for-criticals-in-yanfly-battle-engine.73633/