Fetch UID of objects in same container

  • Hi,

    Is there a way to retrieve the UID of an object in the same container in runtime?

  • Object.uid, if any part of the container was picked.

  • makes sense, thanks.

  • 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?

  • 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?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)