Zero94

Villager
Member
Joined
Mar 28, 2023
Messages
21
Reaction score
1
First Language
Polish
Primarily Uses
RMMZ
Hello Everyone! At begginig, sorry for my bad english.
I'm just starting my adventure with RPG Maker. I've learned a lot over the last few days, but I still have a lot to learn. Currently I am in the process of creating a project which I call "Avalon". It's supposed to be a simple RPG game with mechanics that I like the most in this type of games. Without going into details, I need to introduce the mechanics of counting the enemies I have defeated.

I already tried via "Battle Event"
Condition: Enemy(1) HP <= 0% than Control Veriables +1
Unfortunately, when there is only one enemy, this event does not work. However, if there are more of them (of the same type) the event works, but it always scores 1 less than there are enemies. (example: if there is 3 wolves it count only 2)

I found the plugin "Enemy Kill Counter MZ" by @ToshaAngel, unfortunately it also doesn't work even though I did everything step by step as the author instructed me and after sending him all the screenshots, he said he has no idea why the plugin is not working for me. Here I will note that it does not work even on a new "clean" project without any other plugins.

I also found another solution that I thought might work.
I found the plugin "End Phase Triggers" by HIME. It says "by enabling plugin, the game will perform a check to see if
there are any events that can be run before the battle finishes
."
The plugin was made for RPG Maker MV, but I read that many plugins for MV also work for MZ.
At first I thought it finally worked. However, it turned out that as long as there is 1 enemy everything works fine. But everything gets complicated when there are more enemies. For example, if there are 2 wolves, it counts as 3. If there is 1 wolf and 1 wasp, it counts as 2 wolves and 0 wasps, etc. And the more enemies and more of their types, the weirder it gets.

So please... if anyone have any idea how can i make Enemy Kill Counter or know any free plugin that may work for me just tell me.

Thanks!
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,718
Reaction score
6,540
First Language
English
Primarily Uses
RMMV
You can use VisuStella's Skills and States plugin along with the Battle Core.

Give each of your actors a passive state.

In that state, give it the notetag:
Code:
<JS Post-Damage as User>
if (target.hp<=0)
    $gameVariables.setValue(1, $gameVariables.value(1)+1);
</JS Post-Damage as User>

That notetag is evaluated before the skill finishes, so the code will get executed when a common or troop event would not.
 

Zero94

Villager
Member
Joined
Mar 28, 2023
Messages
21
Reaction score
1
First Language
Polish
Primarily Uses
RMMZ
I'll give it a try, but beeing totally honest idk. how to set it up. Can you please explain me this step by step? 'Cuz i don't know if this Code is universal for all enemies and veriables? Do i need to make each passive state for each actor/enemy/veriable?
 

Shaz

Keeper of the Nuts
Global Mod
Joined
Mar 2, 2012
Messages
45,994
Reaction score
16,804
First Language
English
Primarily Uses
RMMV

I've moved this thread to Plugin Requests. Thank you.

 

ScorchedGround

Blizzards most disappointed fan (They keep going)
Veteran
Joined
Apr 12, 2020
Messages
809
Reaction score
1,261
First Language
German
Primarily Uses
RMMV
@ATT_Turan
That's probably the most straightforward and clean 'plugin route'.

However, depending on what the OP's battle mechanics are, wouldn't this solution be susceptible to
enemy deaths that do not occur directly via actors skill? Most notably, what about dots like poison?

Edit:
So the way I did it in my game is basically I took the death state (e.g. the first state in the database)
and added this notetag:

JavaScript:
<Custom Apply Effect>
if (user.isEnemy()) {$gameVariables.setValue(1, $gameVariables.value(1)+1);}
</Custom Apply Effect>
*Note that this notetag is for MV, and I don't know the VS MZ equivalent.

This way, the counter goes up if the enemy is defeated by any means, or as long as the defeated state was actually applied.
 
Last edited:

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
4,614
Reaction score
3,723
First Language
EN
Primarily Uses
RMMZ
With Hime's plugin, I wonder whether you just mixed up your variables & troop event conditions. The plugin didn't ought to cause weird effects like you describe. :kaoswt:

Alternatively, I have a plugin named Cae_AutoSwitchVars. It has options for automatically setting/incrementing switches & variables on various triggers, including battler death. This will trigger regardless of what caused the death. With it, you can just add a tag like this to an enemy's Note box:

<death var: 123, 1>
This will increase variable ID 123 by +1 whenever that enemy dies (tied to the die method). It can be found on my main MZ plugin thread:
(If you try it and it doesn't work, make sure you've downloaded it correctly - there should be a download button displayed on the page, it shows in the top-right for me. I tested this specific feature very recently and it works A-OK for me.)
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,718
Reaction score
6,540
First Language
English
Primarily Uses
RMMV
However, depending on what the OP's battle mechanics are, wouldn't this solution be susceptible to
enemy deaths that do not occur directly via actors skill? Most notably, what about dots like poison?
Good call.

*Note that this notetag is for MV, and I don't know the VS MZ equivalent.
JS On Apply, I believe. It's in the instructions for the OP to easily find :wink:
 

Zero94

Villager
Member
Joined
Mar 28, 2023
Messages
21
Reaction score
1
First Language
Polish
Primarily Uses
RMMZ
OMG! Caethyril you are AWESOME! Thank you so much! <3
At first i had some weird bug. But after disable VisuStella - Skill States Core plugin everythink i working fine!
Here is screen:
error.png
Do you think it is possible to make this two plugins work together in the future?
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
4,614
Reaction score
3,723
First Language
EN
Primarily Uses
RMMZ
Huh, it looks like the error is some kind of loop related to the maximum parameter formula. Does max HP depend on the value of a variable? Unfortunately I don't write compatibility patches for obfuscated plugins like VisuStella's. :kaoslp:

You could try changing the load order (save your project to apply Plugin Manager changes before testing), but if that doesn't work I think you'll have to pick one or the other. I'd suggest keeping Skills & States Core, particularly if you're using other VisuStella plugins.

In fact, you can probably replicate my plugin's <death var: X> with Skills & States Core. Try putting this tag in the Note box of state ID 1:

<JS On Add State> if (user.isEnemy()) { const vId = parseInt(user.enemy().meta["death var"], 10); if (vId) { $gameVariables.setValue(vId, $gameVariables.value(vId) + 1); } } </JS On Add State>
...then when an enemy tagged with <death var: X> dies, that should give +1 to variable X. Hopefully. :kaophew:
 

Zero94

Villager
Member
Joined
Mar 28, 2023
Messages
21
Reaction score
1
First Language
Polish
Primarily Uses
RMMZ
Thank you so much! I really appreciate that <3 I'll try what you suggest about changing load order and adding JS into note but if that won't work I'm sure that i want to use your Plugin 'cuz one of my main quest req. to kill x amount of some monsters :)

Once again, THANK YOU A LOT <3
 

Latest Threads

Latest Posts

Latest Profile Posts

Alright got a video of a review of a fake PS5 here. I've decided I'm only going to do maybe 10 videos about bootleg consoles, and then I think I'm going to move on, and post YouTube videos of old video game TV advertisements for franchises like Mario and Sonic and Spyro and all that for a little nostalgia. :cool:

Two solid days and I still have four slots left in my custom A2 tilesheet I am drawing.
i really love spaghetti
Who cleaned the cat room, vacuumed and shampoo’d all the area rugs, cleaned the bathrooms, did three loads of laundry ALL BEFORE NOON?! ME!!! I have earned a third espresso shot.

Forum statistics

Threads
131,524
Messages
1,220,479
Members
173,223
Latest member
ZecaVn
Top