How do I exit an event prematurely?

Get help using Construct 2

Post » Sun Aug 31, 2014 6:48 pm

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) ?

Thanks :)
B
18
S
7
G
1
Posts: 160
Reputation: 1,934

Post » Fri Sep 05, 2014 3:24 am

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.
B
27
S
18
G
8
Posts: 331
Reputation: 6,164

Post » Fri Sep 05, 2014 7:51 pm

Thanks a lot for the effort fisholith, I ended up using a variable for this...
B
18
S
7
G
1
Posts: 160
Reputation: 1,934

Post » Sun Sep 07, 2014 3:17 pm

No problem, hope it works out. :)
B
27
S
18
G
8
Posts: 331
Reputation: 6,164


Return to How do I....?

Who is online

Users browsing this forum: AnD4D and 3 guests