Can someone give me the "how to" on 'loop' and 'break loop' commands?

I have never used them and now it comes to the point where using one will likely be necessary for my game.

I want to create a loop where a character fights a Bengal tiger repeatedly until the character dies. When the character dies, the loop breaks and the story continues with his friends complaining that the fight was rigged.

I have the event set up like this:
Capture.JPG

The thing I do not understand is the "break loop". It makes sense that it would go somewhere in the loop but if it is in the loop, it seems that it would end the loop after the first run. It would not make sense to make loops work that way so there is something I obviously do not understand.

I plan on setting the troop to eat the character after so many turns to force a loss so that it does not endlessly loop. If push comes to shove, I will set up a variable reducing the number of turns required to force loss by one every battle.

It does not let me cut the 'repeat above' so I can place it in "if win" despite the fact that it makes sense that is where it would go.

So how do loops work and how do I set up this particular situation?
It's right there at the bottom of your screenshot - If Lose. That is when you would break the loop, then continue on to your friends complaining.
You never place the break loop without a condition - as you assumed that would break the loop on the first try.

what the condition is is up to you - you can use the branches of battleprocessing, you can use a conditional branch checking something or it could even be in a show choice that repeats the options until the exit is selected.
Is this correct?"

1689082019384.png


I am weary about the fact that "Repeat Above" is after "Branch End". In the PS1 version of RPG Maker, everything after a branch was ignored. You had to do all your commands within the branch. It will not let me move "Repeat Above" into the branch.
I think you're getting confused by the formatting. The "branch" is If Win/If Lose. Putting something inside of the branch is placing it after one of those two conditions.

You can't put the end of the loop there because that's all a part of the Battle Processing event command.
Are you saying that once all the event commands within a branch are completed, it then continues and does anything that is after the branch?

Is so, that is not how the PS1 version worked. In that version, if it eventually led to the same set of commands (like same dialogue after six or so different commands in each), you had to put them in both conditions because everything after the branch was ignored.
I have absolutely no idea how the PS1 software worked, and I have no idea whether you are correct in your understanding of it.

But yes, all that "branch end" does is serve as a visual indicator for you. It doesn't do anything to your event.

An event will do all of the commands you put in it unless it is prevented from doing so by Exit Event Processing, Erase Event, or redirected by the flow control commands (Loop, Jump to Label...).
I think you're getting confused by the formatting. The "branch" is If Win/If Lose. Putting something inside of the branch is placing it after one of those two conditions.

You can't put the end of the loop there because that's all a part of the Battle Processing event command.
You actually can. The Break Loop there will break out of the outer loop, I've tried it.
Battle processing isn't a loop but some battle conditional branch so yes, you can break loops inside at will.

No conditional branch will prevent you from executing the rest of the event by default. You gotta add a command to stop it at that point for any reason you can come up with.
Thanks for your help
You actually can. The Break Loop there will break out of the outer loop, I've tried it.
I meant there's no place to put the Break Loop command except inside the If Win or If Lose branch - there isn't any such thing as "outside those branches but inside the end branch line".

My first post told him to put the Break Loop in the If Lose condition.
I meant there's no place to put the Break Loop command except inside the If Win or If Lose branch - there isn't any such thing as "outside those branches but inside the end branch line".

My first post told him to put the Break Loop in the If Lose condition.
Ohh I missed the bit under the screenshot.
I have absolutely no idea how the PS1 software worked, and I have no idea whether you are correct in your understanding of it.

But yes, all that "branch end" does is serve as a visual indicator for you. It doesn't do anything to your event.

An event will do all of the commands you put in it unless it is prevented from doing so by Exit Event Processing, Erase Event, or redirected by the flow control commands (Loop, Jump to Label...).

Not completely true, branch end is pretty much an empty command but it does have a purpose. It tells the engine to indent out by 1 unit so to say, meaning the end of a branch but not the end of the event.
Not completely true, branch end is pretty much an empty command but it does have a purpose. It tells the engine to indent out by 1 unit so to say, meaning the end of a branch but not the end of the event.
Which is providing the visual indicator, as I described, yes? I don't see how that does anything to the event during the game.
The indent tells the system how many blocks or branches are still open and this was especially important in RGSS because I suspect there was a depth limit. Perhaps it also exists in the JS version.

Original thread: https://forums.rpgmakerweb.com/threads/can-someone-give-me-the-how-to-on-loop-and-break-loop-commands.159206/