Simplify redudancies from Trigger Once limitations

Get help using Construct 2

Post » Fri May 18, 2012 4:23 am

Is there a way to simplify the below so I don't have to create two huge event blocks? It seems redundant, but I can't think of how to make it simpler.

Event 1
---------------------------
|[Condition A ]:[Action A]|
|[Condition B ]:          |
|[Condition C ]:          |
|[Condition D ]:          |
|[Condition E ]:          |
|[Trigger Once]:          |
---------------------------

Event 2
---------------------------
|[Condition A ]:[Action B]|
|[Condition B ]:[Action C]|
|[Condition C ]:[Action D]|
|[Condition D ]:[Action E]|
|[Condition E ]:[Action F]|
---------------------------


Both event blocks have the exact same Conditions, except Event 1 triggers once on the first time with unique [Action A]Mulkaccino2012-05-18 04:26:36
B
51
S
13
G
8
Posts: 194
Reputation: 7,311

Post » Fri May 18, 2012 4:33 am

If I'm understanding this right, the first event block handles the first occurrence of those conditions, and the second block handles all subsequent occurrences of those conditions. Is that correct?

If so, could you get by with setting a Boolean from ON to OFF when these conditions are run, and include Action A in a sub-event of Condition A that only runs when this Boolean is ON? Likewise, include Action B in another sub-event for Condition A that only runs when the Boolean is OFF. Alternatively, use the new 'else' logic so you only have to test for the Boolean once. Does that work? And let me know if I need to elaborate.dalal2012-05-18 04:38:36
Image
B
10
S
3
G
2
Posts: 196
Reputation: 2,053

Post » Fri May 18, 2012 4:42 am

That's correct Dalal. For some reason I was hoping there would be a more elegant solution than creating a variable every time I have to do this. If not, it's okay, my curiosity was just getting the better of me.

Thanks for your response!
B
51
S
13
G
8
Posts: 194
Reputation: 7,311

Post » Fri May 18, 2012 5:08 am

A variable-less option might be to have a 'Trigger Once' 'Else' structure as sub-events for each condition. Still a bit repetitive, but now you only have one event block, have to define the conditions only once, and use no variables.

-------------------------------
|[Condition A ]:              |
|    [Trigger-Once]:[Action A]|
|    [Else]        :[Action B]|
|[Condition B ]:              |
|    [Trigger-Once]:          |
|    [Else]        :[Action C]|
|[Condition C ]:              |
|    [Trigger-Once]:          |
|    [Else]        :[Action D]|
|[Condition D ]:              |
|    [Trigger-Once]:          |
|    [Else]        :[Action E]|
|[Condition E ]:              |
|    [Trigger-Once]:          |
|    [Else]        :[Action F]|
-------------------------------

How's that?dalal2012-05-18 05:47:58
Image
B
10
S
3
G
2
Posts: 196
Reputation: 2,053

Post » Fri May 18, 2012 6:59 am

Perhaps I'm misunderstanding, but how I generally do it is:

Event:
5 conditions | actions to be performed each tick
     sub event:
     trigger once | actions to be performed onceArima2012-05-18 07:00:10
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Fri May 18, 2012 7:56 am

@dalal - Else doesn't really make much sense following a 'trigger once'...

@Arima has the best solution - simply put 'trigger once' in a subevent. However the action will be run after the other actions instead of before. If that makes a difference, you can use a blank subevent after 'trigger once' and move your actions there.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Fri May 18, 2012 5:02 pm

Thanks all. That works perfectly.

Under that logic, a solo "Trigger Once" at the top level basically functions the same as a "On Start of Layout" then? (wish I could Construct at work)
B
51
S
13
G
8
Posts: 194
Reputation: 7,311

Post » Fri May 18, 2012 5:50 pm

@Mulkaccino, oops, I actually misunderstood the question. I thought you wanted 'on A do B ONLY', and for all subsequent continuous occurrences of A 'do C ONLY'. In addition, I somehow thought you wanted separate actions for each condition. Sorry for the misunderstanding!

@Ashley, I'm curious to know why Else does not make sense after 'Trigger Once'? I thought that Else fires if the previous condition did not. Trigger Once will only fire once in a row, and Else will fire every OTHER time, right? So if you wanted something totally different to happened the first time in a series of repeated actions, this seems to me a viable solution. But perhaps there's logic better suited for this circumstance that I overlooked.
Image
B
10
S
3
G
2
Posts: 196
Reputation: 2,053


Return to How do I....?

Who is online

Users browsing this forum: LeFuji and 25 guests