Pick by Family IID

0 favourites
  • 3 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.
  • I have a Family of enemies who will all have line-of-sight characteristics. Given certain circumstances which can be true for ANY of the enemy types, I want to Pick Nth Instance of the Family instance. However, this doesn't seem to be working as I thought it would. And I theorize that it's because the Nth instnace might refer to the Nth EnemyOne or the Nth EnemyTwo. Same "N", but two different enemies despite being the in the same family.

    I just want to ask if this theory is on par with how Families do (or don't) work. If my theory is correct, then I'm gonna have to learn how to use Functions...

    Input?

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, I didn't know the answer so I tried out a little example with debug just to see the order. 3 objectTypes, 6 objects, 1 family, and a forEach on the family. : capx

    The result seems to prove that :

    • elements UID in the family is correct
    • elements IID in family are not the "family IID", but the different IID of the objects, as if there was 3 pack of items, classed by object type.

    So using the IID in your case can be tricky, and using the UID and function instead could help, yes.

    Here is a function that could do the trick, simulating a "pick Nth object" for a family. Problem is you have to rewrite it for every family...

    <img src="https://photos-3.dropbox.com/t/0/AAAEfxtcRQmfJerPEgeVZvytQb3pJEaZXoQQ7euyTl2Vrw/12/113235847/jpeg/1024x768/3/1372237200/0/2/pickFamily.JPG/SEtxKiIgNsraMnJOeo4vY5ZMEqz69dchdmqkkXFQatI" border="0">

  • Guizmus - Ah! Thank you. So obvious yet I'm so "skilled" at missing it. LOL Thank you for the work to check on that.

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