What's a good way to do and/or within the same event?

Get help using Construct 2

Post » Fri Feb 19, 2016 1:48 am

As everyone who's tried it knows, events can't take and/or conditions within the same block. I thought a good way to circumvent this might be to create a local variable that I set to '1' whenever the 'A and B' event comes true and then further down set the main event block up like this...

| C = 1 | Do stuff...
- or -
D = 1
- or -
LocalVar = 1

... but it doesn't work. LocalVar gets set to 1 when I want it to be, but the next event block doesn't seem to catch it. How do you all handle this kind of situation?
B
32
S
13
G
2
Posts: 492
Reputation: 5,040

Post » Fri Feb 19, 2016 1:52 am

I use subevents to simulate and/or.
Mistakes were made.
B
47
S
23
G
101
Posts: 1,531
Reputation: 57,053

Post » Fri Feb 19, 2016 2:10 am

Yeah, I do that sometimes myself. But in this case I have a whole laundry-list of stuff I want to happen if either A, B, C is true *or* D and E are both true. I don't see a way around that unless I do the event twice, which means heaps of excess code. Maybe I'm just too tired right now...
B
32
S
13
G
2
Posts: 492
Reputation: 5,040

Post » Fri Feb 19, 2016 2:22 am

Are you familiar with functions? Use a function for your action, and have two events call the same function.
Code: Select all
-------------+ ----------------------+
A is True    | Call Function
- Or -       |
B is True    |
- Or -       |
C is True    |
-------------+

-------------+ ----------------------+
D is True    | Call Function
E is True    |
-------------+

-------------+ ----------------------+
On Function  | Actions ect...
Mistakes were made.
B
47
S
23
G
101
Posts: 1,531
Reputation: 57,053


Return to How do I....?

Who is online

Users browsing this forum: MAVERICK and 8 guests