Storing IIDs to matching array index

Get help using Construct 2

Post » Thu May 16, 2013 12:06 am

.CAPX: https://www.sugarsync.com/pf/D6025908_4317202_6734583

UPDATE: Thanks to @arcadEd for helping me discover that the problem was in my debug...not my actual Events/Actions.

In the .capx file, you'll notice in the "LO LVL 1" layout that there are two red dots (object NodePatrol) and seven black dots (object NodeDirection). There is an array dubbed NodeCompass which has a X-length of 4.

I'm working on setting up an enemy patrol system that can be adapted to any level, regardless of how many of each type of Node objects there are. The NodePatrol objects denote intersections, while the NodeDirection objects identify available directions to choose from. This way, regardless of the level, I only need to place the nodes wherever I please and all that's left is to set up the instructions on how to choose which route to take next when the enemy reaches a NodePatrol object instance.

Here's my problem...
I'll try to break it down clearly.

Look up line three of the "ES CharEnemy" Event sheet.

Using the For loop for a duration of 0 to NodeDirection.Count-1 (the -1 because the loop starts at zero and because the loopindex expression will be of use next), pick each instance of NodeDirection according to the loopindex value. Per each instance, check if it's overlapping any instance of the NodePatrol object (presumably, this will simultaneously pick that instance of NodePatrol, as well).

Because the NodeCompass array is part of the container with the NodePatrol object, this should also pick the array instance associated with the NodePatrol instance. The following action should push the IID of the current NodeDirection instance (again, based on the loopindex value) into the array contained with the NodePatrol instance being overlapped.

Here's where the problem creeps in...
You'll notice on the layout that I have two NodePatrol instances and seven NodeDirection instances. I have debug text objects to highlight the IIDs of each NodeDirection instance, 0 through 6. The "A | A | A | A" text are the values in each instance of the NodeCompass array ("A" serves as a place holder so not to be confused with instance 0 or just simply having no other value).

What seems to be happening is that, as each instance of NodeDirection is checked, the switching between interrupts the process. You'll notice that one instance of NodePatrol has instances 0, 1, and 3 of NodeDirection next to it. The other instance has IIDs 2, 4, 5, and 6. However, when you look at each text display showing the IIDs stored into the related array, instances 3 and 6 (the last of each group of NodeDirection instances surrounding each NodePatrol) are not stored in the array. Only 5 of the 7 IIDs are accounted for. This is what leads me to believe that there is a hic-up in the process. I've even tried using Pick nearest NodePatrol but that doesn't help any.Rhindon2013-05-16 23:54:21
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
112
S
20
G
8
Posts: 741
Reputation: 13,636

Post » Thu May 16, 2013 10:52 pm

*bump* ...this got pushed to page four REAL fast...
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
112
S
20
G
8
Posts: 741
Reputation: 13,636

Post » Fri May 17, 2013 12:04 am

3 and 6 are being added but you're updating the text before you add the value to the array instead of after so you don't see the last value added.
B
54
S
28
G
18
Posts: 1,520
Reputation: 24,990

Post » Fri May 17, 2013 5:33 am

ramones - Yeah, @arcadEd helped me figure that out earlier today. *facepalm to the max* I THOUGHT I checked for that very thing but totally overlooked it anyway. Thank you for confirming it. :)
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
112
S
20
G
8
Posts: 741
Reputation: 13,636


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 28 guests