How do I exit an event prematurely?

0 favourites
  • 4 posts
  • Hey All

    I want to enter an event, and conduct a series sub events, most of them should just quit the event (not process the rest of the sub events).

    Must I use "Else" for all of my sub events? or is there a way to just quit an event (same as "return;" in javascript) ?


  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hey, trueicecold

    I did find one way that works but it's a little derpy.

    I tried a few things, so I can also tell you what doesn't work.

    Local variable - (does work, but kind of inelegant)

    Take the set of events you want to break out of, and put them under a blank event, just to carve out a local scope for your set of events.

    At the top of the event set, create a local variable like "b_break" = 0, and add the condition " b_break == 0" to each of the events in your event set. Now, if you set b_break to 1 anywhere in your event set, all the following events will be skipped.

    Stop loop - (doesn't work)

    Take the set of events you want to break out of, and put them under a For Loop that runs for 1 loop. Then use System > Stop loop. Unfortunately, all the remaining events will complete regardless of where you try to stop the loop. So, "stop loop" just prevents the next loop from running.

    Deactivate group - (doesn't work)

    Deactivating a group from inside the group has a very similar effect as stop loop. The rest of the events in the group will continue to execute as normal after the group has been deactivated. However, after deactivating the group, the "Group is active?" condition will test as false even if you're doing the test from within the now deactivated group.

  • Thanks a lot for the effort fisholith, I ended up using a variable for this...

  • No problem, hope it works out.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)