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
39
S
16
G
6
Posts: 542
Reputation: 7,617

Post » Fri Feb 19, 2016 1:52 am

I use subevents to simulate and/or.
Mistakes were made.
B
52
S
26
G
110
Posts: 1,619
Reputation: 62,159

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
39
S
16
G
6
Posts: 542
Reputation: 7,617

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
52
S
26
G
110
Posts: 1,619
Reputation: 62,159


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 29 guests

cron