Someone explain what is going on in custom battle

So I have 3 characters that cycle through, and when the first one dies it goes to the next. After the first one dies I give him 100% hp back, and when the third one dies or triggers a cutscene I switch back to the full hp first one and set the hp of the other 2 to 0, which it tells me in game will "knock out them out". But instead of both of them being dead and the first one being alive and switching to him, it instead switches to the second character with 1hp left even tho i literally manually set those to 0 and gave the first one 100% hp but hes dead.

That makes no sense, how do i fix this shit