Access to Specific Instance via UID Issue

0 favourites
  • 5 posts
From the Asset Store
Forget about default textbox restrictions, you can create sprites atop of the textbox
  • Hi,

    I'm trying to access a specific object instance (in this case a rocket) and position it depending on the position of my ship - Just for context this is to show that the ship is currently carrying the rocket.

    My understanding is that the first Rocket I create will be assigned a UID of 0. Currently I'm creating a single Instance of Rocket, when I position all Rocket objects over my ship the Rocket appears but if I specify the Rocket with a UID of 0 it doesn't appear. Note I'm not deleting any rockets at this point so this shouldn't be the issue.

    My Events look like this

    Works fine

    <font face="Courier New, Courier, mono">

       Player | Weapon = "Rocket"

       Action -> Rocket | Set position to (Player.X, Player.Y)


    Rocket not positioned on Ship

    <font face="Courier New, Courier, mono">

       Player | Weapon = "Rocket"

    && Rocket | Pick Instance with UID 0

       Action -> Rocket | Set position to (Player.X, Player.Y)


    Apologies if this has already been answered, I've been through everything I could find on Unique, Instance ID's in the forums and couldn't see what I am doing wrong.

    Many thanks


  • Hi Ben, I dont think the there is a UID with 0.

    Try to use the IID (Instance ID) instead which is proportional to the count of Objects in your scene.

    You picke a Object by its IID by using:

    System -> Pick Nth instance

    e.g If you have 2 Spaceships and 4 Rockets

    There are

    Spaceships IID 0 - 1

    Rockets IID 0 - 3

    but Spaceship with IID of 0 may have any random Unique ID (It's not totaly random but kind of)

  • UID means Unique ID

    IID means Instance ID

    UID are number assigned to all the object of your layout. Two objects will never have the same UID and if you create a Rocket you'll get the next UID of the whole project

    Thus UIDs are IDs in a per layout basis

    IID are IDs in a per instance basis and it looks like what you described.

    To pick an instance by its IID the proper expression is a system expression. System: pick nth instance

    (darn been ninja'd)

  • Thanks, that helps alot. Looks like I'd misread another forum and confused UID's and IID's.

    I've just found some really useful instance reference in this thread

    Thanks again for the help


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Might want to check out the relevant manual entry for UID and IID too.

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