Pick by Family IID

Get help using Construct 2

Post » Wed Jun 26, 2013 7:11 am

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!
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
127
S
21
G
8
Posts: 759
Reputation: 14,327

Post » Wed Jun 26, 2013 8:24 am

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...
Guizmus2013-06-26 08:34:58
B
17
S
8
G
4
Posts: 461
Reputation: 6,077

Post » Thu Jun 27, 2013 1:33 am

@Guizmus - Ah! Thank you. So obvious yet I'm so "skilled" at missing it. LOL Thank you for the work to check on that.
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
127
S
21
G
8
Posts: 759
Reputation: 14,327


Return to How do I....?

Who is online

Users browsing this forum: alextro, christina, Kyatric, omnipaws and 10 guests