Is it possible for a SE to loop until a player interacts with an event?

Hi,

I was kind of stuck in making a SE loop continuously on a map till the player interacts with the even which is looping.

I was wondering if there was a way to make an SE to loop, and when the event is interacted with, it would break the loop and on a self switch? I tried to use the loop option but I'm new to it so I don't think I'm doing it right. What I've tried setting up is:

Opening Cutscene:
Controller event (Auto Run)
- Does some stuff
- Switches on Switch ABC
- Does more stuff
- Then moves to blank new page thanks to Self Switch
- Player can now move around freely and interact with stuff

Event on Map (Parallel)
- When Switch ABC is ON:
Loop
Play SE
Wait 180 frames

Repeat Above

The above command starts in the middle of the Controller event (Auto Run) and continues after the Controller event stops.

I'm not sure how to break the loop by interacting the Event on Map (maybe it's broken because it's on Parallel). I'm new to loops so any assistance would be great. I'd love to solve this using a minimum number of switches if at all possible.

Thanks for reading and any help in advance!
Perhaps when the player interacts with it a self switch is activated. New page condiltioned by that switch with no loop.
Perhaps when the player interacts with it a self switch is activated. New page condiltioned by that switch with no loop.

The issue is, I cannot interact with the event as either the Loop is repeating or the event trigger is marked Parallel and not Action Button, otherwise the Loop doesn't activate after the Switch is turned on.

Unless, is there is a way to use the action button in the Loop to break it?
I'm a little bit confused about why you need it to be *that* specific event that plays the sound. The player has no clue which event is playing a sound effect--they just hear sound coming out of their speakers. Why not just put an invisible parallel event right next to that one, and make the invisible event play the sound? Then the event that you're talking about won't need to be parallel anymore, and you can just make it turn switch ABC back off when the player interacts with it, which will then shut off the invisible event?

But to answer your question about how you *could* do it with the same event (which I don't really recommend): In the "Autonomous Movement" section of the event, set the type to "Custom" and then play your sound effect in the movement route (set to repeat). Then you no longer need your event to be Parallel, so you can set it back to Action Button, and just use the event command page to set a self switch (which will turn it to the next page). And make sure that on the next page, it has a Fixed movement route.
I think the solution is to not use a loop at all. Your parallel event should just play the sound and wait, nothing else.

You can definitely check if the action button is pressed in the parallel event, but I don't think that's the mechanic you're looking for.
I think the solution is to not use a loop at all. Your parallel event should just play the sound and wait, nothing else.
The loop isn't really the problem in this case. It's that the OP wants the same event to both be "Parallel" and "Action Button Trigger" at the same time.
I think the solution you posted would require a self switch plugin, by the way… although it could easily be done with regular switches instead.
I think the solution you posted would require a self switch plugin, by the way… although it could easily be done with regular switches instead.
There is no need for a self switch plugin. The OP already has a regular switch that is activating the sound. He/she just needs to turn that same switch back off when he wants to deactivate the sound.
I actually think your movement route solution is quite a neat one too… why don't you recommend it?
The sound event needs to be a separate even from the event you turn the switch on to disable the sound event, simple as that.

Event on Map (Parallel)
- When Switch ABC is ON:
Loop
Play SE
Condition: Switch "Playerhasinteractedwithwhateverneedstobeinteractedwithinordertodisablesound" = on / Disable sound (Either via self switching the sound event to a blank page, or turning off the switch that enabled the SE in the first place depending on how you set it up, else:
Wait 180 frames
Repeat Above
I actually think your movement route solution is quite a neat one too… why don't you recommend it?
Well, one reason is because it only works if the OP doesn't want the event to move. Since that solution stops you from being able to use a real movement route, it's not always viable.

The other reason is just based on my own personal preferences, so you can take it with a grain of salt. But basically, I just don't think it's a very "clean" thing to do, in terms of development. If you make a habit of repurposing movement routes in this way, then it can get harder to keep track of stuff. When you go around fixing bugs, or changing things, 6 months down the road, you might not remember that you stashed some logic in a movement route, and it's kind of an easy thing to accidentally overlook. I prefer to keep all of my code logic where it's supposed to be, so I can easily tell what's what at a glance.
Thank you everyone for your replies!

There is actually no need to have the event playing the sound, I just thought it would be easier to manage. But I really like the sound of your solution @Arthran and I'll give it a go! Thanks again everyone.

Original thread: https://forums.rpgmakerweb.com/threads/is-it-possible-for-a-se-to-loop-until-a-player-interacts-with-an-event.148725/