What's wrong with this?

https://gyazo.com/f8e17aef959ac670a42d762b82fed885
https://gyazo.com/aa6725a84f57839401f013a585b5e454
https://gyazo.com/ba66b8d59ea66c1bfb7e4e296e21ab56

Even if you lose to the boss, the self switch still triggers. I need it so if they lose, they have to get back to this point and re-initiate the whole thing (battle it again).
Also, how would I make the second page occur directly after the boss (not needing to step off and on the tile again, but rather having it play directly after the boss automatically)

Thanks in advance.
If you want the switch to only be if you win, you need to check the can lose condition in the battle event, and put the self switch in the case if Win.

Also if you want that to play immediately after beating the boss, put the text in the if win case. Anything there will play only if you beat the boss.
I'm not well-versed on MV, but shouldn't there be a couple options (If win, if lose) in the battle processing before the self-switch command?

EDIT: Ninja'd by bgillisp.
Moderator note: Please give your topics a meaningful title, one which gives an indication of the type of query you have. Queries such as "Help plz!" or "I have a problem" or "Newcomer, & I'm stuck" does not provide enough information. It's quite possible that people will just skip by it in the New Posts/New Threads thinking that's what it is. It also means that if anyone in the future has the same sort of query, they will be unable to find this and (hopefully) the solution.

Original thread: https://forums.rpgmakerweb.com/threads/whats-wrong-with-this.108013/