SOLVED "if defeated" conditional branch doesn't work in battle event.

Hello
I have stumbled upon an issue when after editing the Battle Processing "If Defeated" option and changing it to a "Conditional Branch" instead of "Game Over" the Event still does a Game Over upon my defeat. It was supposed to trigger a small animation before doing that anyways, so I even tried to simply removing the "Game Over" from the Conditional Branch to check if it triggers at all, but it changed nothing - it does not trigger. The thing is, this event is almost the same as another one (the only difference is the enemy troop), which actually works as intended.
I would like to hear if someone has any idea why one event works and the other doesn't even trigger the Conditonal Branch?Thank you for your support :^)

---------------------------------------------------EDIT------------------------------------------------
PROBLEM FOUND?

Apart from the battle Event, on the map on which the problem was occuring there were four Transfer Events and three obsolete event I used for testing some thing, all were tied to the Actors who currently only exist in the Database. All were set to "Parallel Process". Two of these were constantly checking if the Actors health was at 1, and if it was - kill them (I wanted to get around the poisons and bleeds not being lethal). These do not cause the problem.
The Event which was causing the problem was a one which gave a status to an Actor (not present on field). I have no idea how it interfered with the "If Defeated" (and only "If Defeated", won battles played out normally) part of the Battle Processing, but I tested it a few times now, and every time this Event exists on the same map with a Battle Process which uses my "If Defeated" cammands it results in an immediate Game Over.
I'll attach the screenshot of the problem causing event, the "If defeated" conditions and a current Initial Party below.

I'd like to thank everyone in this thread for your input :^))
1738332786910.png
Bez tytułu.png
1738332970285.png
So I definitely haven't used 2k/2k3 at all, so I have no clue what could be happening - mostly just posting to bump your thread so maybe other more helpful users could provide a better answer.

That said, in modern versions troop conditions will not trigger when the battle is complete; either when the last enemy is defeated or the party is defeated. So it may be that this conditional cannot be triggered because the battle has completed.

You may also want to check your troop conditions; posting screenshots would help others.
Are you sure it's even checking the conditional at all? In that same troop event, have you tried just setting a message box to make sure the troop event is actually triggering properly?
Maybe it's a translation issue, because I didn't quite understand what you're trying to do.

Anyway, I'll leave here a very basic example of how to use this option in the battle process:
Code:
@> Battle Processing: Normal, [Slimex3]
 : If Won
  @> Text: You need to get stronger to be able to defeat me.
  @>
 : If Defeated
  @> Text: I accept defeat, your master must be proud of you
  @>
 : Branch End
So I definitely haven't used 2k/2k3 at all, so I have no clue what could be happening - mostly just posting to bump your thread so maybe other more helpful users could provide a better answer.

That said, in modern versions troop conditions will not trigger when the battle is complete; either when the last enemy is defeated or the party is defeated. So it may be that this conditional cannot be triggered because the battle has completed.

You may also want to check your troop conditions; posting screenshots would help others.
Are you sure it's even checking the conditional at all? In that same troop event, have you tried just setting a message box to make sure the troop event is actually triggering properly?
Thank you for your input! I appreciate it ^w^

Hovewer I don't think the problem is with the fact that it has a conditional - it is something I can set in Battle Processing menu.
The combat with the Troop starts on touch with the event and is always the same, everything in battle works as intended.

Everything in "If Won" works as intended - the dialogue, switch and the item is added.

First page of the event has the battle and the conditional branch, second page is activated by the "If Won" condition (it works as intended), and the third page has the script activated by the switch in the "If lost" conditions.

The "Set Move Route" is there for the animation, every turn changes the sprite slighly. "Wait" is set for long enough so that the animation (all turns) complete before the "Game Over" sets in.
At least in the working event. In this one, even if i remove "Game Over" from the script, a lost fight still results in an immediate game over screen.
1738284313741.png
1738284043682.png

1738283391865.png


Maybe it's a translation issue, because I didn't quite understand what you're trying to do.

Anyway, I'll leave here a very basic example of how to use this option in the battle process:
Code:
@> Battle Processing: Normal, [Slimex3]
 : If Won
  @> Text: You need to get stronger to be able to defeat me.
  @>
 : If Defeated
  @> Text: I accept defeat, your master must be proud of you
  @>
 : Branch End
Thank you!
This is the battle process i'm using. Everythig here works in a nearly identical event (only the enemies fought are different) in a different location. I attach screenshots for clarity. (page two is irrelevant, it ties to the "If Won" and everything in the "If Won" works, so i don't include it.)
1738285334393.png
1738285314197.png
Why are you activating Switch 61 before the dialog is finished and before the Switch is added?
I don't know if this is the case in 2k/2k3 but if no party members are alive on the map the Game Over event auto-runs too. You may need to also heal the party short term to not get that Game Over.

I got around this in ACE by changing KO state to remove on battle end. Then the game had everyone with 1 HP so it could still run events. Could be worth looking into?\

Edit: Why not put all of those events under that switch in the if defeated command? It is also possible the engine is set up to auto KO you after that else runs no matter what. Test this by moving your custom death stuff there.
Why are you activating Switch 61 before the dialog is finished and before the Switch is added?
1738324677215.png

It activates Page Two of the event, both this and the dialogue work without issue. Can it cause problems if done this way?

I don't know if this is the case in 2k/2k3 but if no party members are alive on the map the Game Over event auto-runs too. You may need to also heal the party short term to not get that Game Over.

I got around this in ACE by changing KO state to remove on battle end. Then the game had everyone with 1 HP so it could still run events. Could be worth looking into?\

Edit: Why not put all of those events under that switch in the if defeated command? It is also possible the engine is set up to auto KO you after that else runs no matter what. Test this by moving your custom death stuff there.
Thank you for your help :^)

Just tested it in another part of the map, and i can still walk around without problem even at 0hp if i delete "Game Over" from the Battle End.

Putting the "If Won" and "If Defeated" in their own separate pages was the first way i thought of doing such event, it worked for me the first time so I just stuck to it... Just tested it and it works... just not i this one event. Tested it both in this and on another map.

So perhaps the issue lies not with the event itself, but theres something on this map that doesn't allow it to work?
1738325285412.png
I had a situation with similar symptoms back in 2016. Here's some excerpts from the Steam discussion in case it helps:
Spoiler
Caethyril said:
The Battle Processing command's If Defeated > Conditional Branch option does not seem to work.

Expected: on defeat, commands in branch should be executed instead of usual defeat handler.

Actual: on defeat, Game Over screen displays, regardless of Death Handler settings on the Database's Battle Screen tab.
CherryDT said:
Make sure you heal your party after the defeat and/or remove the status "Death". The event will continue running, but only for one frame (e.g. until you show a message or execute a wait or end the event), before the game will put you game over because all heroes in your party are dead. It sounds to me like this is happening to you. This is also the reason why the defeat handler is not used, because it applies only to death in battle - but here, you are exiting battle, and then not healing yourself, so you afterwards instantly die on the map (hence not triggering the normal handler).
Caethyril said:
So I thought the issue with Battle Processing was fixed by your suggestion, but I've recently run into it again. I should have been more careful in my testing. I've managed to solve it myself this time, though! Details below if it helps.

I have a common event called "Equip Fists". It equips a "Fists" weapon to any actor without a weapon equipped. I call it using a Turn [0] battle event in every troop. (There is also a parallel event running to unequip and remove these items after battle.) At first I tried just adding the item to any actor without a weapon. This was causing the defeat handler to not function. I have now added an extra branch per actor to check whether they are currently in the party or not, which has fixed the issue. I'd guess it was the parallel event causing the problem.
Link to Cherry's post in that thread:
Unfortunately I didn't share any specific example of a Battle Processing command that showed the issue. The key thing, however, seems to be the time limit Cherry mentioned: if you don't revive your party within 1 frame, the default Game Over will kick in because everyone's still dead. 👋
I had a situation with similar symptoms back in 2016. Here's some excerpts from the Steam discussion in case it helps:
Link to Cherry's post in that thread:
Unfortunately I didn't share any specific example of a Battle Processing command that showed the issue. The key thing, however, seems to be the time limit Cherry mentioned: if you don't revive your party within 1 frame, the default Game Over will kick in because everyone's still dead. 👋
Thank you for your help! ^w^

Unfortunately, that does not seem to be the issue... I just tested it, added the "Change HP: entire party +1" command at the very start of the "If Defeated" branch, and it changes nothing...
At the same time on another map if I delete the "Game Over" from the Battle Processing I can walk around with 0hp without problem. The script I'm using also works on other maps.

Now I'm quite certain that the issue is not with the event, but there is something on the map which prevents it from working properly. There are a few transfer event which I don't think will be the problem, but also a few monitoring Actors health which were supposed to kill them at 1hp (I wanted to get around the poisons and bleeds not killing in combat), but none are tied to the current actor. Maybe something there interferes. I'll try isolating the problematic event on a separate map and adding each of them separately to check. I'll post my findings in the main post.
This thread is closed due to being reported as solved. If you need it reopened, report it to let us know. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/solved-if-defeated-conditional-branch-doesnt-work-in-battle-event.175048/