Access any object using UID at any time?

This forum is currently in read-only mode.
From the Asset Store
Act on your instances, get/set their properties and variables only thanks to their UID. No more picking trouble! Plugin
  • Hello, all!

    A slightly technical question, can't really find anything similar here.

    Is there a way to access ANY object by its UID inside any expression?

    As an example, if we knew the UID of an object and needed to get its X coordinate from some event where this object never even comes up, could we do something like this:


    Maybe I'm just used to a similar approach from some macro programming, but if there was a way to access things using indexes easily that' d be awesome. If there isn't this is a nice feature to have

  • If I recall correctly there is a way to do this using Python. I'm no Python expert though, so I couldn't even begin to explain how . As for events, no... you'll have to pick the object by it's UID in a condition like everything else.

    + Sprite: Unique ID is whateverValue
        -> Set or Get Sprite.X
  • Yeah, that's a shame. A quick way would have been really handy.

  • If you catch Lucid in chat or he sees this thread he might be able to help. He knows lots about python.

  • Will have to do that. I was sort of hoping for, say, Ashley to say something like: "Ah, right, just do this...", though

  • From what I understand that would take a deal of rewriting within Construct. However Lucid did mention that it should be possible to make a plug that would do that for you.

    This defiantly something needed for C2.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Is it really that useful? All you need is a subevent - compare UID - then you do whatever you need in that event, and it affects the instance with the matched UID.

  • Guess that's an option. Limits it a bit to whatever gets picked in that subevent and needs the sub event itself.

    The direct route would be nice.

  • Well one of the problems with picking by uid is that you have no direct way to tell what a particular multiples uid is. Pythons sprite[index] makes that really easy, because the index is based on creation.

    Then if you wanted to use something like the Custom Movement Behavior's restrain distance from object, you still have no way to specify which instance you want it to choose.... Unless you use the family hack.

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