Enemy Kill Counter MZ

Plugin Name: Enemy Kill Counter MZ Version: 1.1 Developer: ToshaAngel

is a plugin for RPG Maker MZ that allows you to keep track of the number of enemies killed in your game. You can associate each enemy with a variable, and whenever the player kills an enemy, the associated variable is automatically incremented by 1. The plugin also provides a way to reset the value of the specified variable to 0.

Spoiler: V 1.1
v 1.1 - I modified the updateEnemyVariable function of the plugin to increase the enemy kill count only when the enemy is defeated by the player, and not when it is first initialized.
Now it only works for the opponent you killed.
That is, if you escape, the enemy will not count. If the enemy is reincarnated, the opponent you killed last will be counted.
Spoiler: V 2.0
V 2.0
New features:
The ability to assign actions when a set kill threshold is reached: Now you can set specific reactions, such as triggering an event, increasing a variable, or activating a switch.
Advanced action settings:
Added parameters to specify the actions to be performed after reaching the kill threshold. This includes selecting a general event, a variable to increase, and a switch to activate.
Improved reset control:
The "Reset after execution" parameter has been introduced, which allows you to automatically reset the kill counter and delete the setting after reaching the threshold, or stop the counter if reset is disabled.
More detailed integration with the combat system:
Changes have been made to the function that handles the death of an enemy to take into account the murders committed directly by the player, excluding cases of enemy death during initialization or resurrection.


Download - Download

It seems this plugin will increment the number of enemies killed at the start of battle.

What happens if you escape without killing the enemy? In that case it looks like the counter will be incremented, but I wouldn't want it to be, as I didn't kill the enemy.

What happens if I have it set up to count two types of enemy, each with their own variable, and enemy 1 transforms into enemy 2 before I kill it? It looks like the counter for enemy 1 would be incremented, but I'd want the counter for enemy 2 to go up. (or maybe they both go up, which I also wouldn't want)

Finally, what happens if I'm counting an enemy that's set to "appear halfway", and the battle ends before the enemy appears? I think it might increment the counter, but I wouldn't want it to.

I think it'd be better to put the variable change in the logic that handles enemy defeat, rather than enemy initialization.
It seems this plugin will increment the number of enemies killed at the start of battle.

What happens if you escape without killing the enemy? In that case it looks like the counter will be incremented, but I wouldn't want it to be, as I didn't kill the enemy.

What happens if I have it set up to count two types of enemy, each with their own variable, and enemy 1 transforms into enemy 2 before I kill it? It looks like the counter for enemy 1 would be incremented, but I'd want the counter for enemy 2 to go up. (or maybe they both go up, which I also wouldn't want)

Finally, what happens if I'm counting an enemy that's set to "appear halfway", and the battle ends before the enemy appears? I think it might increment the counter, but I wouldn't want it to.

I think it'd be better to put the variable change in the logic that handles enemy defeat, rather than enemy initialization.
Thank you for your advice!
I have updated the plugin!
Hi. I'm new to all this and just getting to know it all. I would love to use your plugin in my project, but unfortunately I don't know where to add the command. I've already tried in the "Enemy" and "Troops" sections, and also as a separate Event on the map that activates when the player touches it. Unfortunately, none of this worked. I'm testing it on Wolf (Enemy 1), I've made Veriable for it ( \v[2] ).
I'm sure I marked everything correctly in the command, so it turns out that I put the command itself in the wrong place. Please Help <3
Hi. I'm new to all this and just getting to know it all. I would love to use your plugin in my project, but unfortunately I don't know where to add the command. I've already tried in the "Enemy" and "Troops" sections, and also as a separate Event on the map that activates when the player touches it. Unfortunately, none of this worked. I'm testing it on Wolf (Enemy 1), I've made Veriable for it ( \v[2] ).
I'm sure I marked everything correctly in the command, so it turns out that I put the command itself in the wrong place. Please Help <3
1. Download the Enemy Kill Counter MZ plugin in .js format.

2. Move the downloaded file to the plugins folder of your RPG Maker MZ project.

3. Open your project in RPG Maker MZ and select the "Plugins" menu item from the main menu.

4. Find the Enemy Kill Counter MZ plugin in the list of plugins and activate it by clicking on the switch to the left of its name.

5. Add the SetEnemyVariable plugin command to the map event to bind the enemy to a variable that will increase when the enemy is killed. You can do this by selecting "Add Command" in the event editor and selecting "SetEnemyVariable" from the list of plugin commands.

6. Enter the enemy ID and variable ID in the appropriate fields. The enemy id is the number of the enemy you want to associate with the variable and it must match the enemy number in the game database. The variable identifier is the number of the variable that will increase when the enemy is killed.

7. Repeat steps 5 and 6 for each enemy that needs to be counted.

8. When a player kills an enemy, the plugin automatically increases the corresponding variable by 1.

9. To reset the variable value to 0, add the ResetEnemyVariable plugin command to the map event. You can do this by selecting "Add command" in the event editor and selecting "ResetEnemyVariable" from the list of plugin commands.

10. Enter the ID of the variable you want to reset to 0 in the corresponding field.
I did everything as you mentioned. Unfortunately it still doesn't work. I set the event as "parallel" and also "player tuch" and put it in the place where the player will go through. As I mentioned before, I'm testing this on a wolf (its id is 1). I also set "Veriable" which I named "Wolf Bestiary" (id 2).
In the event map command, I added your plugin and set Monster id 1 and veriable id 2 there... For the test, I put an NPC next to it that informs the player how many Wolves he killed. (Text: You've killed \v[2] Wolves) - And all the time, no metter how many wolves i kill he always say 0...
I did everything as you mentioned. Unfortunately it still doesn't work. I set the event as "parallel" and also "player tuch" and put it in the place where the player will go through. As I mentioned before, I'm testing this on a wolf (its id is 1). I also set "Veriable" which I named "Wolf Bestiary" (id 2).
In the event map command, I added your plugin and set Monster id 1 and veriable id 2 there... For the test, I put an NPC next to it that informs the player how many Wolves he killed. (Text: You've killed \v[2] Wolves) - And all the time, no metter how many wolves i kill he always say 0...
Spoiler: specially for you
I did literally everything like you in the video with the difference that the enemy id is 1 and the veriable id is 2... it still doesn't work.
I did literally everything like you in the video with the difference that the enemy id is 1 and the veriable id is 2... it still doesn't work.
Show me screenshots of Enemies, squads, how you cause the variable to be shown.
Here you go...
I did literally everything like you in the video with the difference that the enemy id is 1 and the veriable id is 2... it still doesn't work.
Аnd show me the console.
I think it's a plugin conflict.
manager.png
The console opens with the f8 button when the game window is running.
Ohh Sorry - my bad. Here it is:
1680035512256.png
Ohh Sorry - my bad. Here it is: View attachment 257359
choose a CONSOLE!
You can see it in previous screen
You can see it in previous screen
I can't figure out what the problem is...
Could you test the plugin on a new (clean) project?
Still doesn't work :/
I created a new project and added ONLY your plugin. I didn't change or add anything else. I created 2 events on the map - One with plugin command, the other telling how many enemy (id 1) I killed on veriable (also id1).
Released version 2.0
Spoiler: Version 2.0
New features:
The ability to assign actions when a set kill threshold is reached: Now you can get specific actions, such as triggering an event, increasing a variable, or activating a switch.
Advanced action settings:
Added parameters to specify the actions to be performed after reaching the kill threshold. This includes selecting a general event, a variable to increase, and a switch to activate.
Improved reset control:
The "Reset after execution" parameter has been introduced, which allows you to automatically reset the kill counter and delete the setting after reaching the threshold, or stop the counter if reset is disabled.
More detailed integration with the combat system:
Changes have been made to the function that handles the death of an enemy to take into account the murders committed directly by the player, excluding cases of enemy death during initialization or resurrection.

Original thread: https://forums.rpgmakerweb.com/threads/enemy-kill-counter-mz.154962/