Hi. I need a small script to put into a conditional branch to check whether an enemy's HP is 0 or not. I need this because during a battle i'm making an enemy will be change every time he reaches 0Hp and then heals. I'm gona make this conditional branch check every turn of the battle. I can't use the event to check HP because it only does it once and then no more.
Thanks :)
If IS kinda weird that this isn't possible through events.
Use this to get the enemy HP:
$game_troop.enemies[INDEX].hp
And this is obviously how you check the HP value:
if $game_troop.enemies[INDEX].hp <= 0
Doesn't that check the HP of the entire troop? I need the HP of one specific enemy only.
How do I use this code? :P
No, it just checks one enemy in the troop. Hence the INDEX parameter. You use it just like I wrote it down above and change INDEX to the index number of the enemy. e.g. 0 is the first, 1 is the second, etc.
I'm not sure I'm doing this right...
if $game_troop.enemies[2].hp <= 0 should be in the conditional branch, right? When I put it there I get an error that says "The script is hanging"
EDIT: Nevermind, I got it to work. Thanks a lot :)
If you are putting it in the conditional branch, it goes with the "if".