Count enemies

hello everyone, I wanted to know if there is any way that when you eliminate an enemy in a battle, it adds a variable to you. What I want to get is a count of how many enemies you have eliminated of a certain species. I know how to do it if the enemy's battle is an event, but how would you do with a randomly spaced battle?
There are a couple of ways to do it without plugins, but I wrote this a few years ago:

Original thread: https://forums.rpgmakerweb.com/threads/count-enemies.139557/