How to check for criticals in Yanfly Battle Engine?

ZServ

Veteran
Veteran
Joined
Jun 16, 2014
Messages
260
Reaction score
71
Primarily Uses
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. :)
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
You could try to replace that check with this one:

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.
 

ZServ

Veteran
Veteran
Joined
Jun 16, 2014
Messages
260
Reaction score
71
Primarily Uses
Thank you, Sixth! It works like a dream. You're a real savior~
 

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

Latest Threads

Latest Posts

Latest Profile Posts

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.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,074
Members
137,578
Latest member
JamesLightning
Top