How do I store a link to one object within another?

This forum is currently in read-only mode.
From the Asset Store
Firebase: Analytics, Dynamic Links, Remote Config, Performance, Crashlytics on Android, iOS & Web Browser
  • Here's an image of my event sheet:

    <img src="http://img502.imageshack.us/img502/811/screenshotdc9.png">

    I'm wondering if it's possible to retrieve an object by its Unique ID, so I can use it in the expression that sets the Soldier's angle (for bullet movement, it's the one I've circled in the screenshot) so it chases the correct RouteMarker.

    I know that I could just use the RouteMarker just created, but I'm planning on having a chain of RouteMarkers, each stores the UID of the next RouteMarker in the chain, which the Soldier reads and then heads towards... am I on the right track?

  • If you want the 'Soldier' to follow the 'Routemarker' created in the same event, that's easy: just use Routemarker.X, Routermarker.Y and it will refer to the one just created. When you create an object, for the rest of the event, all actions and expressions refer to the created instance.

    If later you want it to set its angle to the instance with the UID stored in its private variable, you can do something like:

    + For each Soldier

    + Routemarker Unique ID = Soldier('CurrentRouteMarker')

    : Soldier: set angle to Routemarker.X, Routemarker.Y

    This will check each soldier individually (instead of trying to do them all at once), find the correct routemarker, and use that to set the angle.

  • If later you want it to set its angle to the instance with the UID stored in its private variable

    Yes, that's what I was after, thanks.

    + For each Soldier

    + Routemarker Unique ID = Soldier('CurrentRouteMarker')

    : Soldier: set angle to Routemarker.X, Routemarker.Y

    Sorry, but I don't understand the bold part, how do I put this into the event list?

  • Right click, select your object. Under Misc, pick "Compare unique ID."

  • Sorry, right click where? I must be missing something obvious, the only thing under Misc is "Destroy".

  • It's the condition 'Compare unique ID' <img src="{SMILIES_PATH}/icon_razz.gif" alt=":P" title="Razz" /> You're trying to add an action.

    So right click an existing condition and Insert a new condition, or right click an empty space and insert a new event...

  • It worked! Thanks for the fast response.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sorry for bringing it a bit off-topic, but it sounds like the question was answered to the thread starters satisfaction. <img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" />

    How do I create and call functions?

    I cannot find anything inside 0.86.2 that let me define and call them.

    EDIT: nevermind! Found out that you can add a object called function. <img src="{SMILIES_PATH}/icon_razz.gif" alt=":P" title="Razz" /> Thanks anyway. <img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" />

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