Limit to Push-To-Array per cycle?

Get help using Construct 2

Post » Fri Mar 24, 2017 12:50 pm

Hi everyone,

I'm having object instances push their UID to an array upon spawning (muitiple within a single cycle). But I sem to be getting irregular results, with only two of the instances making it into the array.

Any idea why that might happen, is there some limitation to the number of pushes or some overwriting issue when doing multiple pushes in a single cycle?
B
12
S
5
Posts: 216
Reputation: 1,692

Post » Fri Mar 24, 2017 1:23 pm

No limit, when your loop iterates to much, the cycle just gets prolonged (drop in FPS).

Must be your logic. Probably forgot to pick them by UID in the same sub events as the creation sub event. That is ,by the way, the only pick that works before the next root event.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Mar 24, 2017 8:52 pm

I'm seeing that each object type only appears once in the array but there are multiple instances of each type.
So that points toward what you said, somewhat although I'm not sure I get it:

To specifiy a little, I have triggers that look up their connected spawn points (SPs hold UID of connected trigger).
The spawn points then spawn the actual enemy, the enemy registers to that array and the spawn point is destroyed.
All in a single event:

Event - On touch of trigger:
Subevent - Pick SP by comparing SPvar to triggerUID
Action - spawn enemy (of type of SP)
Action - register enemy UID to array
Action - destroy SP

Trigger and array share a container so AFAIK no picking is required
Now i see that I'm not specifically picking the instance of the enemy i just created, but should that be necessary, when it's the succeeding action within the same event anyway?
B
12
S
5
Posts: 216
Reputation: 1,692

Post » Fri Mar 24, 2017 9:05 pm

Here's the image of the event

Image
B
12
S
5
Posts: 216
Reputation: 1,692

Post » Fri Mar 24, 2017 9:27 pm

Yup, needed a For Each SpawnLocator_S_Rifle below to run all the actions
could have guessed, I suppose ...

thanks @99Instances2Go
B
12
S
5
Posts: 216
Reputation: 1,692


Return to How do I....?

Who is online

Users browsing this forum: rayolf and 16 guests