Fetch UID of objects in same container

Get help using Construct 2

Post » Wed Jan 06, 2016 10:58 pm

Hi,

Is there a way to retrieve the UID of an object in the same container in runtime?
B
13
S
6
Posts: 222
Reputation: 1,859

Post » Wed Jan 06, 2016 11:12 pm

Object.uid, if any part of the container was picked.
Image ImageImage
B
169
S
50
G
174
Posts: 8,328
Reputation: 110,800

Post » Thu Jan 07, 2016 3:14 pm

makes sense, thanks.
B
13
S
6
Posts: 222
Reputation: 1,859

Post » Thu Jan 07, 2016 7:22 pm

@newt what if I addressed my original object through its family and the other object is only specified on family level too?
E.g. Imagine you have different tank setups made up of a base family and a turret family.
One tank (container) might contain base X and turret Y from those families.
All are controlled through family events.
Say my tank base family goes into Idle state, I need to tell the according turret to stop shooting. How do I address the actual turret object?
My event might say:
Family_TankBase | on LOS broken: Family_TankBase -> set state "idle"
+ Family_TankTurret -> turret disabled

But it seems that Family_TankTurret does not know what turret to talk to.
Any suggestions?
B
13
S
6
Posts: 222
Reputation: 1,859

Post » Thu Jan 07, 2016 8:15 pm

facecrime wrote:@newt what if I addressed my original object through its family and the other object is only specified on family level too?
E.g. Imagine you have different tank setups made up of a base family and a turret family.
One tank (container) might contain base X and turret Y from those families.
All are controlled through family events.
Say my tank base family goes into Idle state, I need to tell the according turret to stop shooting. How do I address the actual turret object?
My event might say:
Family_TankBase | on LOS broken: Family_TankBase -> set state "idle"
+ Family_TankTurret -> turret disabled

But it seems that Family_TankTurret does not know what turret to talk to.
Any suggestions?


Couldn't you just set a variable on the turret to the uid of the tankbase on created?
Than you could compare family.uid to turret.variable, right?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jan 07, 2016 8:51 pm

Yeah.
Containers only work in the parent-child association.
Calling the any part using the family is unrecognised.
It's a known issue, but not likely addressed officially.
LittleStain's workaround is pretty solid, but I think there are a few plugs, Ala Rex that can deal with it.
Image ImageImage
B
169
S
50
G
174
Posts: 8,328
Reputation: 110,800

Post » Thu Jan 07, 2016 8:54 pm

Ok, it's actually what I resorted to, storing child and parent UIDs, but it's a pain.
Not sure what the Rex part is about, will research.
Thanks guys.
B
13
S
6
Posts: 222
Reputation: 1,859


Return to How do I....?

Who is online

Users browsing this forum: PROxMTswatTR, sean080 and 40 guests