Mismatched values from overlap and IID

Get help using Construct 2

Post » Thu Sep 05, 2013 5:57 am

New scenario...
Two objects, each has instances overlapping one of two instances of a third object.
Object1 and Object2 each has an instance variable called "Home".
At the start of the layout, it checks to see of Objects1 and Object2 instances are overlapping either instance of Object3.
If so, then it takes the IID of Object3 and stores it to the Home variable of the Object1 and Object2 instances overlapping them.
However, I'm seeing that instances 0 thru 3, while overlapping instance 0 of Object3, have a Home value of 0 or 1...even though all four instances are overlapping instance 0 of Object3.
The events look like this:
- If Object1 is overlapping Object3 | Set Object1.Home to Object3.IID
- If Object2 is overlapping Object3 | Set Object2.Home to Object3.IID

Why, then, do some instances of Object1 and Object2 receive an IID value of the second instance of Object3 even when they're overlapping the first instance?

In the CAPX, look up event sheet "ES Set-Up", lines 4 and 5.
https://www.sugarsync.com/pf/D6025908_4317202_6993144

Thank you for your input and help!
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
142
S
24
G
8
Posts: 791
Reputation: 15,148

Post » Thu Sep 05, 2013 9:29 pm

You need 'for each' there. Think about what instances are being picked in those events. For example, event 5 picks 12 NodePatrol instances and 2 NodeZone instances. Then the action basically says 'set the HomeZone variable of these 12 objects to the IID of these 2 objects'. It has no way to know which NodeZone goes with each NodePatrol.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,670

Post » Fri Sep 06, 2013 5:23 am

Thank you, @ramones. I discovered that later on but hadn't had a chance to update my post. Thank you for confirming that, though. :)
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
142
S
24
G
8
Posts: 791
Reputation: 15,148


Return to How do I....?

Who is online

Users browsing this forum: dop2000, t redeemed t and 18 guests