Get object by UID ?

0 favourites
  • 7 posts
From the Asset Store
112 High-Quality destruction sounds for videogames
  • Hello, I know that the function "this.runtime.getObjectByUID(uid)" returns specific object.

    I want to know if exists way to pick not the specific object by his UID, but like if I pick it with "AddObjectParam" (In the edittime.js). And then I will be able to pick this object by IID (I know how to do this, this is not the problem).

    Why ? To pick object by his UID and his IID. So the UID permits me to pick the object "type" and the IID to pick instance of this object.

    It's difficult to explain... but I think that you understand me! Thanks

  • Or exists method to get all UID (in array?) of an object by one UID ?

    Or why not "this.runtime.getObjectByName(name)" ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Not sure what you need exactly, but there's a "trick" to pick by "instance name". Basically you add an instance variable (let's call it "instanceName") to your object/family and then you pick by System -> pick by comparison. As a first param you type object.instanceName and in second parameter you type the name of instance (it might be a groupd of course as well). This way you can pick any particular instance of an object or group of instances.

  • When you use an object as a parameter the runtime gives you an object type. From that you can get a list of picked instances or a list of all the instances of that type. Iid is just an index in the instance list. The sdk manual should have all the info needed to do that, and for examples on how to do it look at existing plugins to see how they do it.

  • Thanks for your reply. If I don't find solution in the runtime I use your method.

    R0J0hound Thanks also. I don't found plugin which does this thing...

    You can see here the steps :

    1. I add my action 'set text' :

    2. My code in the runtime:

    So logically, the text of all instances of the object type which has the instance with the UID 'uid' will change.

    3. I create project with the object text with three diferents instances with the UIDs : 0, 1, 2.

    So logically again, text of all instances will be set to : "set text in all instances"

    4. I get this error:

    Thanks for you help. I don't request any code, just links or a way...

  • in your code "obj" is a list of instances, not one instance. In which case obj.runtime is undefined, and thus the error.

  • THANKS A LOT !!!!!!!!!!!!!!!!!!!!!! ;D

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