Displaying recoil damage knockout

I've implemented a state that causes the afflicted character to take 1/3 of the damage they inflict with each attack, via playing around with the base scripts:

#-------------------------------------------------------------------------- # * Damage Processing # @result.hp_damage @result.mp_damage @result.hp_drain # @result.mp_drain must be set before call. #-------------------------------------------------------------------------- def execute_damage(user) on_damage(@result.hp_damage) if @result.hp_damage > 0 self.hp -= @result.hp_damage user.hp -= @result.hp_damage / 3 if user.state?(35) self.mp -= @result.mp_damage user.hp += @result.hp_drain user.mp += @result.mp_drain endHowever, I cannot figure out how to make the game do the "actor got dead" bit (make the sound, give the text) if the recoil damage knocks them out, as it would if they were killed by an attack or slip damage. How would I do that? (Or, alternatively, if the problem is that doing it this way is incredibly stupid, what would be a not-incredibly-stupid way of doing it?)
Hmmm...I know Yanfly's lunatic states and add-ons can do this. Maybe look at how those scripts did it, and mimic it?
Hmmm...I know Yanfly's lunatic states and add-ons can do this. Maybe look at how those scripts did it, and mimic it?
Unfortunately, Yanfly's "Backfire" states can't reduce HP below 1.
I would do the recoil damage the last in that method. That would save some extra condition checks and, in my opinion, would make more sense.

Assuming you will do it last:

def execute_damage(user) on_damage(@result.hp_damage) if @result.hp_damage > 0 self.hp -= @result.hp_damage self.mp -= @result.mp_damage user.hp += @result.hp_drain user.mp += @result.mp_drain if user.state?(35) user.hp -= @result.hp_damage / 3 user.die if user.hp <= 0 end endThis will display the KO message in the log window, and will play the SE on KO too.If you would like to display the recoil damage too in the log window, I suggest you move all of these into another method which runs after the default stuffs related to damage dealing (including the log window message displays), because if you try to display the recoil damage in the method you edited now, the recoil damage will be displayed first, and the damage dealt on the enemy will display only after that, which may look weird.
It does show the message and make the noise, but it doesn't do so until the end of the turn. The character's HP goes to zero, everyone left to act goes, and then it does the message/noise.

Original thread: https://forums.rpgmakerweb.com/threads/displaying-recoil-damage-knockout.55085/