families bugged?

Get help using Construct 2

Post » Mon Jun 13, 2016 11:12 pm

I was trying to get a function to select objects in a family that did not have the (UID) in the param, and I couldn't get it to work.

I have 2 families, which both holds the same objects. With a function i wanted to pick objects in Group 1 with UID 1, that worked, but when I tried to pick objects with or without UID 1, from Group 2 it didn't work.

Image

None of the conditions above worked for picking objects in Group 2. Is this a bug or am I missing something. It doesn't make sense.

edit, this didnt work either.
Image


Capx.
https://dl.dropboxusercontent.com/u/20560446/Scirra/family_error.capx
Follow my progress on Twitter
or in this thread Archer Devlog
B
38
S
15
G
17
Posts: 949
Reputation: 12,320

Post » Mon Jun 13, 2016 11:39 pm

Event 9 picks by Group 2, but alters Group 1. All of Group 1 are picked.
ImageImageImage
B
71
S
21
G
233
Posts: 3,696
Reputation: 130,368

Post » Tue Jun 14, 2016 1:39 am

@blackhornet , so you can't pick UID by one group and alter by another. Felt like it shouldn't make any difference, since an UID is always same no matter what family the object is in. Oh well... :) back to the drawing board.
Follow my progress on Twitter
or in this thread Archer Devlog
B
38
S
15
G
17
Posts: 949
Reputation: 12,320

Post » Tue Jun 14, 2016 4:48 am

Say the uids of all the objects in the groups are 0,1,2,3,4,5.
Then right before event 8 the "selected object list" or sol is all the instances in both:
group1= 0.1,2,3,4,5
group2= 0,1,2,3,4,5

Then in event 8 the condition "group1:pick by uid 1" modifies the sol to:
group1= 1
group2= 0,1,2,3,4,5

and the action "group1: set opacity to 50" takes the picked group1 or instance 1 and makes it's opacity 50.

Next consider event 9.
Right before it runs the sol is:
group1= 0.1,2,3,4,5
group2= 0,1,2,3,4,5

Then in event 9 the condition "group2:pick by uid 1" modifies the sol to:
group1= 0,1,2,3,4,5
group2= 1

but then the action "group1: set opacity to 50" is the same as in event 8. It takes the picked group1 or all the instances (0 to 5) and makes their opacity 50.
B
92
S
32
G
107
Posts: 5,280
Reputation: 69,971

Post » Tue Jun 14, 2016 8:48 am

@R0J0hound So what's the best way if I want to use Group1 for picking UID's and Applying them To Changes by those picked UID's to Group 2? I have to load all the UID's to an array? use for each X of the array to pick UID's in Group2 and apply to group2?

I thought I could be smart to Pick objects by UID in one family, then make changes to objects in another family based on the UID's picked from the first family.
Follow my progress on Twitter
or in this thread Archer Devlog
B
38
S
15
G
17
Posts: 949
Reputation: 12,320

Post » Tue Jun 14, 2016 1:58 pm

tunepunk wrote:@blackhornet , so you can't pick UID by one group and alter by another. Felt like it shouldn't make any difference, since an UID is always same no matter what family the object is in. Oh well... :) back to the drawing board.


So if you filter out (is on screen, is moving) ONE object in group 1, and you feed the UID of that one object to the function, then all you got to do in the function is pick by comparisation > object = group 1 or 2 (does not matter) expression = group.UID ... value is the parameter .. operator ><. And do your stuff in the actions. Because all but that one with that UID will be in the picklist in the function. A function ALWAYS starts picking from scratch.

But, i suppose 'is on screen & is moving" does not pick ONE object, but a bunch of objects. So in the picklist there are more objects. Looping trough those and it feed them one by one to the function will not solve it. Because the first index in the loop will select other objects then the next index in the loop, and in the end you see only what happend compared to the last object in that bunch of objects.

The solution here is not use a function. But think the other way arround. Pick straight.
Condition > invert the 'on screen'
Condition > invert the 'is moving'

Now you have everything picked that you wanted to pick. Do your stuff in actions.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue Jun 14, 2016 6:34 pm

So basically you want to copy a sol from one family to the other. Typically there is better logic than doing that but if you must i can think of a few ways:
https://dl.dropboxusercontent.com/u/542 ... _copy.capx

If only one object is picked of group1 then "group2: pick by uid group1.uid"

If multiple objects are picked in group1 copying it over will take two events. One to mark the instances so that group2 can pick then and a second to make group2 pick them.
B
92
S
32
G
107
Posts: 5,280
Reputation: 69,971

Post » Tue Jun 14, 2016 9:22 pm

R0J0hound wrote:So basically you want to copy a sol from one family to the other. Typically there is better logic than doing that but if you must i can think of a few ways:
https://dl.dropboxusercontent.com/u/542 ... _copy.capx

If only one object is picked of group1 then "group2: pick by uid group1.uid"

If multiple objects are picked in group1 copying it over will take two events. One to mark the instances so that group2 can pick then and a second to make group2 pick them.


Great example, thanks R0j0. The visibility solution was genius, as I've stumbled across similar problems before where instance variables don't work. The other solution I will study further as it's a bit above my level, as i didn't even knew you could do that.
Follow my progress on Twitter
or in this thread Archer Devlog
B
38
S
15
G
17
Posts: 949
Reputation: 12,320


Return to How do I....?

Who is online

Users browsing this forum: NN81 and 25 guests