script to make a certain state be inflicted upon a critical hit

I'm looking for a script to add state #14 (Major Bleeding in my game) to the target of an attack if that attack is a critical hit.  If the target of the attack's resistance to that state is 100%, then a critical hit should add state #13 (Bleeding) to the target.  This includes both actor and enemy critical hits.

Thanks!
The Script Forum is for presenting finished scripts you wrote yourself, that's why topics need moderation before becoming visible.


I've moved this thread to Script Request. Please be sure to post your threads in the correct forum next time. Thank you.
Here you go.

(I'll assume you already know how to add scripts.)

Spoiler
class Game_Battler < Game_BattlerBase

alias crit_make_damage_value make_damage_value
def make_damage_value(user, item)

crit_make_damage_value(user, item)
if @result.critical
if self.state_resist?(14)
self.add_state(13)
else
self.add_state(14)
end
end
end
end

Original thread: https://forums.rpgmakerweb.com/threads/script-to-make-a-certain-state-be-inflicted-upon-a-critical-hit.42964/