Is there a way to trigger a battle event when an enemy has an exact amount of HP? On RPGMV troops section there is only "Enemy hp % or below" condition.
Battle event when enemy has exactly X HP?
RPG Maker MV SupportMaybe not with straight eventing. You'll likely need a script or plugin to pull it off. But I may need more information to help. What is the exact effect you're going for?
Let's say for example that I wanted to create an enemy that dies only when it has exactly 21 / 300 HP left. If you tried killing it normally (getting HP to 0) it would revive instead.
It's fairly easy to make an event where the engine stores the HP of an enemy into a variable, followed by a conditional branch where that variable is compared to the specified number.
The difficulty here of course is when such an event would run. You could put it in a battle event that runs at the end of every turn, but I don't think that's quite what you want.
The difficulty here of course is when such an event would run. You could put it in a battle event that runs at the end of every turn, but I don't think that's quite what you want.
My experience with variables has been limited so far. I have seen a few tutorial videos, but they showed mostly messages as an example. Can you explain how to define enemy HP as a variable? I think I can solve the rest from there.
Control Variables and choose the Game Data option at the bottom. You'll find Enemies in there, and can select from a number of different stats. Then a conditional branch.
You could use the "Enemy HP % or below" as the trigger to your troop event, so the check won't be done throughout the entire battle, and then put your control variables and conditional branch in there to fine-tune it.
You could use the "Enemy HP % or below" as the trigger to your troop event, so the check won't be done throughout the entire battle, and then put your control variables and conditional branch in there to fine-tune it.
the reduction of HP is not sequencial unless the damage done to X enemy can be calculated to 1.
if you can't guarantee that, there's no point on looking for *the moment when an enemy has exactly a given number of HP* because you'll overshoot it at every loop of the turn sequence.
maybe one time you'll nail it, by pure luck, using standard values.
but most of the time, you'll be damaging an enemy by the equivalent of several units of the total of their HP, never by one single unit.
if you can't guarantee that, there's no point on looking for *the moment when an enemy has exactly a given number of HP* because you'll overshoot it at every loop of the turn sequence.
maybe one time you'll nail it, by pure luck, using standard values.
but most of the time, you'll be damaging an enemy by the equivalent of several units of the total of their HP, never by one single unit.
It won't even check right now because the condition is set to "Don't run". It needs to be changed to something else.
I got it almost working now, the condition was indeed wrong, I changed it to "Actor health 100% or below" and now it works with "turn: span". It is a bit clunky still since after you get the enemy to the specific hp, you still need end your next turn for the effect to activate. "Turn: moment" doesn't work at all, the battle begins without command selection with that.
EDIT: Got it working 100%. I added one last battle event: at the end of each actor/enemy turn they lose a turn, so you no longer need to manually end turn. Thanks a bunch!
EDIT: Got it working 100%. I added one last battle event: at the end of each actor/enemy turn they lose a turn, so you no longer need to manually end turn. Thanks a bunch!
You should set the condition to 'turn end' and the span to 'turn'. This way it will check at the end of every turn without having to hassle with everyone skipping a turn.
As an aside, setting the span to 'moment' essentially turns it into an autorun event.
As an aside, setting the span to 'moment' essentially turns it into an autorun event.
Original thread: https://forums.rpgmakerweb.com/threads/battle-event-when-enemy-has-exactly-x-hp.86058/
