Pick Instance by comparisson On Created?

0 favourites
  • 6 posts
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • Heya fellas!

    My quest on getting the handle of this fine software continues. I have a seemingly trivial matter I can't seem to resolve.

    I create these Node Objects and I want upon creating every Node Object to set the position of a specific Unit object to the Node object that was just created. For the task at hand the Unit has a Name var and the Node has a Owner var which he gets through other means but that's not important right now. The var is set to the proper value - that much i'm certain.

    Now, what comes to my mind is that with a On Created condition, all actions and sub conditions should take the context of the object that was just created in amy comparisson whatsoever. But this does not seem to be the case. Please take a look and point out what im doing wrong. Much appreciated.

    CHeers!

  • Question.

    Is Unit created in the same tick as Node ?

  • No, it exists in the layout.

  • You can not Pick (select) Node yet at that point.

    Newly created instances are selectable in the next top-level event. On creation acts as it is in the same event and on the same place as the creation/spawn action. So, it does not count as a top-level event.

    The same is true for functions.

    But. There is 1 pick event that always works, no matter where or when you use it. And that is sprite > Pick by unique ID.

    So this is how you can do this:

    https://www.dropbox.com/s/9tqv7j27zmodn ... .capx?dl=0

    What is the top-level event ? It just the next 'non sub event'.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just to clarify what 'the next top-level event' is.

    https://www.dropbox.com/s/gy5hk7hw80m3h ... .capx?dl=0

    Event 5 is, compared the event 3, the next top-level event.

    As you see, Node is perfect pickable at that point.

  • Thanks man, yet again. , This should do the trick.

    To answer your question, another object goes around and spawns Nodes upon colliding with certain objects and fills the Owner var. The ideas is that the Unit object happily waits for a node object to be spawned with the node's owner var corresponding to the Unit's name var, and then should start doing stuff with the nodes within that context...and because there are several unit objects which follow different nodes, it was important to pick the correct unit based on the owner var. So yeah, this should def get the job done. Thanks again.

    Cheers!

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