Picking created objects

Get help using Construct 2

Post » Sat Mar 09, 2013 1:22 am

Quick question...

Why does this work...


...and this does not?


It seems like none of the volumebar objects get picked in the second instance.

I have tried adding a Pick All condition, but it still didn't work.

Also tried adding it as subevent of the creation loop, where it works for the "sound" type volumebars only. This is expected, as I understand construct picks only the last created object within an event.

Anyways, the situation first image works fine for my purposes, but I'd like to see if I can get an understanding of why the second one doesn't work. (Ideally I like to keep all my layout start events together, so this is really bugging me!)
Mistakes were made.
B
37
S
17
G
67
Posts: 1,041
Reputation: 38,211

Post » Sat Mar 09, 2013 1:34 am

There are some odd instances with object creation. The rule of thumb is that the object itself is not "fully" created until after the current "tick" is over, so it's not available to be picked again until the event sheet starts again.

What I don't get is why would the 1st one work either, unless start of layout is valid for more than run through the event sheet.

I'm as stumped as you are.
B
26
S
8
G
3
Posts: 210
Reputation: 5,973

Post » Sat Mar 09, 2013 2:07 am


Read this for the official explanation. It's not the next 'tick', it's the next 'top-level event'.
ImageImageImage
B
67
S
19
G
122
Posts: 3,207
Reputation: 73,401

Post » Sat Mar 09, 2013 2:22 am

It's the thing I still find most aggravating about C2, but the link explains why it's necessary. You get used to it, basically you just find ways to create your objects in one event then manipulate them in a new top-level event. 'On created' usually solves it but other methods, such as your top example also do the trick.
B
25
S
5
G
3
Posts: 446
Reputation: 5,633

Post » Sat Mar 09, 2013 2:24 am

Aha! Thanks for that. Maybe something can be added to the manual section for system-create object regarding this?

I guess I can split the creation event into two sub branches and have a sub event for each one setting the state.

Or I can have two sets of Layout Start events for my projects, one for creating instances and another for setting them en mass.

Anyways that clears it up. Thanks again!oosyrag2013-03-09 02:29:01
Mistakes were made.
B
37
S
17
G
67
Posts: 1,041
Reputation: 38,211

Post » Sat Mar 09, 2013 3:13 am

Thanks for that link! Clears a lot up.
B
26
S
8
G
3
Posts: 210
Reputation: 5,973

Post » Sat Mar 09, 2013 5:32 am

so the first one should work without the start of layout as well. Just make the volumebar statement the top level in 3
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,418

Post » Sat Mar 09, 2013 5:41 am

But then it runs every tick, continually setting Status=2.blackhornet2013-03-09 05:59:49
ImageImageImage
B
67
S
19
G
122
Posts: 3,207
Reputation: 73,401

Post » Sat Mar 09, 2013 5:45 am

run one time?
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,418

Post » Sat Mar 09, 2013 5:59 am

Do you mean 'Trigger once while true'? You may as well leave it as 'On start of layout'. Seems clearer.
ImageImageImage
B
67
S
19
G
122
Posts: 3,207
Reputation: 73,401

Next

Return to How do I....?

Who is online

Users browsing this forum: austinblackbelt, Matthew de, Skebab, spcsmrf and 6 guests