UID from created object? And Array Issue [SOLVED]

  • How the I get the UID of an object that was placed at runtime using the Create Object command?

    EDIT: Also, I have the following Command setup:

    *Keyboard: A is down

    -Array: Set Size to (Array.Width+1,0,0)

    *System: Every tick

    -Text: Set text to (Array.Width)

    But when I press A the size of the array never increases it just remains at zero. I even tried adding on the start of a layout to change the array size to (2,0,0) and the text still says that the array width is 0.

  • I'm not sure what you mean. The .UID expression returns the UID of the currently picked object. So if you use the .UID expression after a create object action, it returns the UID of the object you just created. Does that do what you want?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes, you're right! Thank you once again, and could you assist me with the array issue? I'm not sure if it's ignorance on my part or a bug.

  • Works fine for me. It's helpful to always post a .capx showing what you're doing. That file I just linked to shows it working just fine so I'd have to see your file to be able to tell what's wrong.

  • haha Ashley you saved that file with r56 ;P

  • Woops :P well... if you could show me a .capx of it not working then that would be handy :)

    (p.s. not long now...)

  • I get an error saying that yours was saved in the r56 version and I can't open it because I'm running r55 even though it's the most up-to-date version available on the website. I'm going to guess it's because you're using a slightly more advanced dev version of Scirra.

    EDIT: And someone beat me to the punchline, one sec I'm uploading.

    EDIT EDIT: Here's the full project since when I tried to replicate the situation in a blank project it worked fine. Run the Combat_Test layout.

    Link

  • Bump

  • I'm looking at your .capx but I'm not sure what it's supposed to be doing so I can't tell if anything's broken or working. Please read tips for posting.

    Are you aware: an array sized N by 0 by 0 has a total of N x 0 x 0 elements, which is 0 elements, which means you can never read or write any values in the array. It has no elements! If you want a one dimensional array, you must size it N x 1 x 1.

  • And there's the source of the problem, thanks again :D

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