Critical Hit Always Damages

Hello! I am hoping someone can help me. When the characters in my game score a critical hit, there is still a chance no damage happens. I come from D&D mentality where critical means automatic hit and damage multiplied.

I got the impression from a number of sources that the only way to fix this is in the damage formula. If so, here is my normal attack formula:

((4 * a.atk ** 2) / (a.atk + b.def)) / 2

How do I update this to make it so a critical hit will always get through and do the damage it is supposed to do?

Alternatively, is there a different way to make criticals always hit and always do damage?
Go to your class's or actors screen, Traits, Param tab, Ex-Parameter, Critical rate 100%, there is also



Which gives you more control over how crit works but it's a paid plugin.
there is still a chance no damage happens
does that skill have any damage variation?

also, the /2 at the end of the formula may give a float value that ends up rounded to 0.
Which gives you more control over how crit works but it's a paid plugin.
Except the request is for vx ace.

That's a very interesting formula. I've never seen anyone use exponent calculation for the damage.
At least I think the ** is exponent.
So you have the exact values for the actor attack and enemy defense?
And as gstv87 said, what is the variance?
A critical simple increases the damage
Ruby:
  def make_damage_value(user, item)
    value = item.damage.eval(user, self, $game_variables)
    value *= item_element_rate(user, item)
    value *= pdr if item.physical?
    value *= mdr if item.magical?
    value *= rec if item.damage.recover?
    value = apply_critical(value) if @result.critical
    value = apply_variance(value, item.damage.variance)
    value = apply_guard(value)
    @result.make_damage(value.to_i, item)
  end
  def apply_critical(damage)
    damage * 3
  end
So the damage is multiplied by 3. But as suggested if the damage is calculated to 0 * 3 then there is no damage.
Go to your class's or actors screen, Traits, Param tab, Ex-Parameter, Critical rate 100%
The question is how to make sure critical hits deal damage, not how to make critical hits always happen. 😉

there is also
RPG Maker VX Ace can't use RPG Maker MV plugins.

The answer to @Timothius is:
I come from D&D mentality where critical means automatic hit and damage multiplied.
That is how it works.

The problem is that, as @Roninator2 described, your formula can produce 0-value results.
Oh wow, I hadn't thought about it might end up zero and thus multiply zero. Good catch and thank you guys for pointing that out! In that case, is there a quick and easy to make a minimum dmg (and minimum critical damage (such as atk*2 or such) )?

Hmm. So I tested it out and it it actually says "Missed! (enemy) took no damage!" when I crit. It doesn't happen often (had to do test battle about 3 times), but it does happen. I'm not sure why a critical hit would miss, but I thought there was an ex-parameter for it.

Then I saw the enemy had this 5% Evasion. I tested it out by raising evasion to 50% (100 just made criticals not even occur) and when I crit, it said "(enemy) evaded the attack", so it isn't evasion that is making me get that "missed" message. Apparently, I can somehow miss the enemy with a critical and I can't figure out why. :\
"Missed! (enemy) took no damage!"
If it misses then the damage formula has nothing to do with it. But instead the calculation that is done here.
Ruby:
  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))
        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
The critical should only apply if it is a hit.
So now I have to ask, what scripts do you have that works with damage calculations?
I think the question is - if the attack is missing, what evidence do you have that it was a critical?
Thanks guys, you are definitely helping me get somewhere.

To Roninator2, the only script I have that alters damage is Victor's Critical Hit Effects:


To answer ATT_Turan, I have a script called "Crit Graphics and Sound" (and I cannot find the original author) which shows some graphics and plays some sounds just as a critical is about to happen.

So it may be that my problem is that the script knows a critical is about to happen should I hit, but doesn't know yet if the attack is going to hit. I don't know how to script, but I am guessing that is decided at the very start of the script. Here is the script:

Spoiler: Critical Graphics and Sound script
module PC27
module CrAn
DEFAULT_CRITICAL_CALC = true
# If this switch is not equal to 0, this switch can be used to turn the
# animation ON or OFF.
Switch = 0
# The two picture id's the script uses to draw the animation. Do not use
# them for other "Show Pictures" events.
ActorPicture = 2
BackPicture = 1
# Number of frames the image needs to slide in/out
SlideInTime = 20
SlideOutTime = 20
# Number of frames the image stays and distance it moves in that time
LingerTime = 60
LingerDistance = 100
# This is the sound played at the begin of the animation and the number
# of frames you want to wait before the picture shows up.
InitSound = "Crit_04"
InitWait = 30
# Those are actor specific sounds. It plays one random sound.
ActorSounds = {
# Actor_ID => [ "sound1", "sound2", ...],
1 => [ "Emerald_battle_transition"],
2 => [ "MavCrit_beginning_of_the_end", "MavCrit_gotchya"],
3 => [ "Pan_Battle_Transition", "Fire1", "Fire2"],
4 => [ "Tim_Battle_Transition", "CritTim_Prayers", "Fire2"],
# 3 => [...
}
end
end

class Scene_Battle
include PC27::CrAn
alias pc27_crit_effect_show_animation show_animation
def show_animation(targets, animation_id)
item = @subject.current_action.item
if item.damage.none?
targets.each { |target| target.set_crit_to_false }
else
targets.each { |target| target.eval_crit(@subject, item) }
end
show_critical_animation if actor_crit?(targets)
pc27_crit_effect_show_animation(targets, animation_id)
end

def show_critical_animation
lo = LingerDistance * 0.5
play_initial_sound
show_crit_background
show_crit_actor
move_crit_actor(Graphics.width * 0.5 - lo, SlideInTime)
play_random_actor_sound(@subject)
move_crit_actor(Graphics.width * 0.5 + lo, LingerTime)
move_crit_actor(Graphics.width + 50, SlideOutTime)
erase_crit_actor
erase_crit_background
end

def play_initial_sound
RPG::SE.new(InitSound).play
wait(InitWait)
end

def play_random_actor_sound(subject)
RPG::SE.new(ActorSounds[subject.id].sample).play
end

def show_crit_actor
name = @subject.name + "CritImg"
y = Graphics.height * 0.5
pic = $game_troop.screen.pictures[ActorPicture]
pic.show(name, 1, -50, y, 100, 100, 255, 0)
end

def move_crit_actor(x, time)
y = Graphics.height * 0.5
pic = $game_troop.screen.pictures[ActorPicture]
pic.move(1, x, y, 100, 100, 255, 0, time)
wait(time)
end

def erase_crit_actor
$game_troop.screen.pictures[ActorPicture].erase
end

def show_crit_background
x = Graphics.width * 0.5
y = Graphics.height * 0.5
pic = $game_troop.screen.pictures[BackPicture]
pic.show("CritBG", 1, x, y, 100, 100, 255, 0)
end

def erase_crit_background
$game_troop.screen.pictures[BackPicture].erase
end

def actor_crit?(targets)
return false unless Switch == 0 || $game_switches[Switch]
return false unless @subject.is_a?(Game_Actor)
targets.any? {|target| target.result.critical }
end
end

class Game_Battler
def eval_crit(user, item)
@result.critical = (rand < item_cri(user, item))
end

def set_crit_to_false
@result.critical = false
end

def item_apply(user, item)
default_crit = PC27::CrAn:😀EFAULT_CRITICAL_CALC
crit = @result.critical unless default_crit
@result.success = false
@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 = default_crit ? (rand < item_cri(user, item)) : crit
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
end

(Side note, if anyone happens to know who the author is, I would like to know.)
(Side note, if anyone happens to know who the author is, I would like to know.)
PencilCase27
Here is an earlier version of that script.
And please use code tags for code not just the spoiler.

So I think the culprit that is showing the critical when it misses is Victor Sant's script.
Line 193
Code:
  def make_damage_value(user, item)
    critical_effects(user, item) if @result.critical && @result.hit?
    make_damage_value_ve_make_damage_value(user, item)
  end
add on && @result.hit?

That should stop it from showing when the attack is a miss
I would think that would work. Alas, it is still showing that message.

HoC_Critical_Miss.png


Also to test this, I have the character set to critical hit rate of 100% and just fighting these bees a lot. Unsure if there is a better way to test things.
Ruby:
def make_damage_value(user, item)
  make_damage_value_ve_make_damage_value(user, item)
  critical_effects(user, item) if @result.critical
end
Actually try it with the line below the alias.
That's not the right order but I would like to see if it still does the critical message

I think the critical_effects should be in the item_apply then it will work. But that's a rewrite of the script functions.
I was getting very lucky on the RNG so I started to think it worked. But I thought "keep going" and on the fourth fight, 2 attacks in, I missed. :\
But at least reversing the lines didn't cause any errors.
Can you share a screen shot of the skills / actors setup so I can reproduce it?
Or a demo with the setup necessary to test this.
I'll work on something tomorrow and see if this can be sorted out.

But to what you said, did the critical message show up for the missed attack?
Wow! Thanks for the willingness to look that deep into it.

I deleted a bunch of music and sound in this copy so downloading it would go quicker, but anything and everything you would need should be in the start area. Talking to the slime lets you fight the bees. Though I was using the battle test option with the bottom-most troop (100: Bee). Keep in mind I have Maverick set to 100% critical chance via his class. Also, for the downloadable demo I have below, I did swap those lines of code back to what they were before because it did cause an error in-game (apparently didn't cause error for test play for some reason)

Here is the link:

After doing some testing I found that the PencilCase27 script for critical graphics and sound is
causing the issue.
It does a calculation to determine if the hit will be critical then when the damage is calculated it will recalculate the critical.

I think this script needs to be reworked.
But it can't be recalculated so it needs to have a second method of doing the critical calculation and then if the value is true for the default_crit then it will use the new calculation.
Something like that. And that needs to be done where it does the eval_crit.

Try this instead
Spoiler: Pencilcase27 critical hit and sound
Ruby:
# Critical Graphics and Sound by PencilCase27
module PC27
  module CrAn
    # use custom critical calculation
    DEFAULT_CRITICAL_CALC = true
    # modification to the critical hit calculation
    # random value * value below < item_cri calculation
    DEFAULT_CRITICAL_MOD = 0.45
    # If this switch is not equal to 0, this switch can be used to turn the
    # animation ON or OFF.
    Switch = 0
    # The two picture id's the script uses to draw the animation. Do not use
    # them for other "Show Pictures" events.
    ActorPicture = 2
    BackPicture = 1
    # Number of frames the image needs to slide in/out
    SlideInTime = 20
    SlideOutTime = 20
    # Number of frames the image stays and distance it moves in that time
    LingerTime = 60
    LingerDistance = 100
    # This is the sound played at the begin of the animation and the number
    # of frames you want to wait before the picture shows up.
    InitSound = "Crit_04"
    InitWait = 30
    # Those are actor specific sounds. It plays one random sound.
    ActorSounds = {
      # Actor_ID => [ "sound1", "sound2", ...],
      1 => [ "Emerald_battle_transition"],
      2 => [ "MavCrit_beginning_of_the_end", "MavCrit_fear_me",
      "MavCrit_gotchya", "MavCrit_lets_finish_this", "MavCrit_many_stars",
      "MavCrit_no_fear", "MavCrit_no_mercy_for_evil", "MavCrit_scatter_to_cosmos",
      "MavCrit_smash_into_space", "MavCrit_stop_wasting_my_time",
      "MavCrit_there", "MavCrit_theres_no_escape", "MavCrit_thisll_hurt_you_more",
      "MavCrit_time_for_final_blow", "MavCrit_unstoppable", "MavCrit_witness_your_demise",
      "MavCrit_you_cant_run_away", "MavCrit_youre_done_for"],
      3 => [ "Pan_Battle_Transition", "Fire1", "Fire2"],
      4 => [ "Tim_Battle_Transition", "CritTim_Prayers", "Fire2"],
    # 3 => [...
    }
  end
end

class Scene_Battle
  include PC27::CrAn
  alias pc27_crit_effect_show_animation show_animation
  def show_animation(targets, animation_id)
    item = @subject.current_action.item
    if item.damage.none?
      targets.each { |target| target.set_crit_to_false }
    else
      targets.each { |target| target.eval_crit(@subject, item) }
    end
    show_critical_animation if actor_crit?(targets)
    pc27_crit_effect_show_animation(targets, animation_id)
  end
    
  def show_critical_animation
    lo = LingerDistance * 0.5
    play_initial_sound
    show_crit_background
    show_crit_actor
    move_crit_actor(Graphics.width * 0.5 - lo, SlideInTime)
    play_random_actor_sound(@subject)
    move_crit_actor(Graphics.width * 0.5 + lo, LingerTime)
    move_crit_actor(Graphics.width + 50, SlideOutTime)
    erase_crit_actor
    erase_crit_background
  end
 
  def play_initial_sound
    RPG::SE.new(InitSound).play
    wait(InitWait)
  end
 
  def play_random_actor_sound(subject)
    RPG::SE.new(ActorSounds[subject.id].sample).play
  end
 
  def show_crit_actor
    name = @subject.name + "CritImg"
    y = Graphics.height * 0.5
    pic = $game_troop.screen.pictures[ActorPicture]
    pic.show(name, 1, -50, y, 100, 100, 255, 0)
  end
 
  def move_crit_actor(x, time)
    y = Graphics.height * 0.5
    pic = $game_troop.screen.pictures[ActorPicture]
    pic.move(1, x, y, 100, 100, 255, 0, time)
    wait(time)
  end
 
  def erase_crit_actor
    $game_troop.screen.pictures[ActorPicture].erase
  end
 
  def show_crit_background
    x = Graphics.width * 0.5
    y = Graphics.height * 0.5
    pic = $game_troop.screen.pictures[BackPicture]
    pic.show("CritBG", 1, x, y, 100, 100, 255, 0)
  end
 
  def erase_crit_background
    $game_troop.screen.pictures[BackPicture].erase
  end
 
  def actor_crit?(targets)
    return false unless Switch == 0 || $game_switches[Switch]
    return false unless @subject.is_a?(Game_Actor)
    targets.any? {|target| target.result.critical && !target.result.missed && !target.result.evaded}
  end
end
 
class Game_Battler
  def eval_crit(user, item)
    @result.critical = false
    @result.missed = (@result.used && rand >= item_hit(user, item))
    @result.evaded = ([email protected] && rand < item_eva(user, item))
    if [email protected] && [email protected]
      if PC27::CrAn::DEFAULT_CRITICAL_CALC
        @result.critical = (rand * PC27::CrAn::DEFAULT_CRITICAL_MOD < item_cri(user, item))
      else
        @result.critical = (rand < item_cri(user, item))
      end
    end
  end

  def set_crit_to_false
    @result.critical = false
    @result.missed = (@result.used && rand >= item_hit(user, item))
    @result.evaded = ([email protected] && rand < item_eva(user, item))
  end

  def item_apply(user, item)
    @result.success = false
    @result.used = item_test(user, item)
    if @result.hit?
      unless item.damage.none?
        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
end
I'm not sure how to write it in, but you could have crit hits drain 1% HP in addition to their normal formula.
Roninator2, you solved my problem! Thank you so much!

I did about 7 combats with just Maverick and then tested it with the whole team. No errors, and no misses. If I was going to miss an attack, I think it would have happened somewhere in the 42 critical hits I had from those combats.

I don't know how to thank you - now critical hits should not "miss" in my game. 🙂
I will be sure to credit you. Thanks again!
I'm not sure how to write it in, but you could have crit hits drain 1% HP in addition to their normal formula.
That is a fun idea, Zim. 🙂 I'm not sure how either, but will keep it in mind. Thanks for the suggestion!
Roninator2, you solved my problem! Thank you so much!

I did about 7 combats with just Maverick and then tested it with the whole team. No errors, and no misses. If I was going to miss an attack, I think it would have happened somewhere in the 42 critical hits I had from those combats.

I don't know how to thank you - now critical hits should not "miss" in my game. 🙂
I will be sure to credit you. Thanks again!
Just realized a small error on my part.
Updated the script above.

It was for if the item had no damage to apply, the missed and evaded were not calculated.
Fixed

Original thread: https://forums.rpgmakerweb.com/threads/critical-hit-always-damages.170314/