[Help] Object Picking Not Working with Tokenat?

0 favourites
  • 4 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • After a looooong and frustrating gloss over the math functions in my program, I realized finally that picking objects by IIDs using, say Sprite(0).X does not work when I try to get the data using Sprite(int(tokenat(Sprite.string, 1, ","))).X by running the below events with more than one object at the same time.

    So I'm fairly sure that either nothing is happening, or it is picking incorrectly, because the expected results when I just do it by hand never occur.

    Here is an illustrative example:

    Basically, the reticle sprite is created as expected when I activate and populate my "actionQue" one at a time. However, when I populate both at the same time, it can suddenly not correctly pick the data of the object with an IID of 0.

  • You need at least a "For each" right after your pick so you can iterate over each instance.

  • Hello friend.

    Lets assume your first picking picks 10 out of 100 objects. And your second pick in a sub event is trying to pick another instance which was NOT amongst the picked 10. It won't work. The second picking conditions apply only the first picked batch of objects.

    You could put "pick all" condition somewhere between. This might be the case here.

    Maybe this is the case maybe not, this is what just came to my mind.

    You could also run with f6, pause, and run step by step with debugger. Choosing objects from the list show their places and their instance variables, maybe you can figure out what's going on from there.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You need at least a "For each" right after your pick so you can iterate over each instance.

    blackhornet Yup! That solved it:

    Though I'm still really stumped. Basically picking in an event and then picking again in a sub-event requires you to tell it to look through the instances again?

    Windwalker yeah that's the same thing my friend suggested when I showed him what I had done in the top screenshot.

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