How can I break a loop once a player leaves the volume of a certain area?

Hi! I’m relatively new to Blueprint (or game making in general xD) and I think I’m starting to get the hang of it. However, I’m being troubled by a few problems. The first one that I’m trying to fix is looping.

I’m using the Rolling Ball template, and inside it there’s a variable that turns on (CanJump) and it enables the player to jump. By default it’s enabled when the player hits something. What I’m trying to do is make it so that when the player steps into a certain area (A physics volume) the player can jump an unlimited number of times (it loops every 2 seconds).

Now, all that works. The issue that I’m facing is that I would like to break the loop as soon as the player leaves the volume.

Here’s what I did:


It’s most likely something trivial that I overlooked, but please help me solve this issue. What I tried doing was making a custom variable with a Boolean that turned on whenever the player steps into the physics volume, and I made the WhileLoop use that as the condition. Whenever I try playing it crashes, so I’m a bit confused.

Thank you for your time!

Oh. Could you explain why?

The WhileLoop is executing itself into an infinite loop?

You can put the Completed into your Set node and it will be fine, but the loop body is probably what is getting you.

Thank you for the reply. Unfortunately, it still crashes.


Is that what you meant?

Hello,

"EndOverlap "Event for that physics volume will help you :slight_smile:

try to break the loop when “EndOverlap” fires

Hey, thanks for the reply. Unfortunately, it still doesn’t work. It doesn’t crash anymore, but if I exit the volume I can still keep jumping.


Is that what you meant? I looked at the flow of the nodes and I noticed that when it overlaps and it sends the signal to break the loop keeps going.

Were you able to figure this out ?

Yeah, I believe so.

What did you do? Can you post the solution?

Sorry, I worked this out a while ago, and I got a new computer/project while I was at it. I honestly don’t remember what I did :frowning:

That’s fine. :slight_smile: