Help with pick nth instance (Failing)

Discussion and feedback on Construct 2

Post » Thu Oct 10, 2013 1:02 am

Hi! I'm a newcomer, have somewhat experience with Construct2. Today I just found an error I can't get rid of.

The game consist in a turn-based app, where you can eat 1, 2, or 3 strawberries per turn and then CPU makes his turn (doing the same, eating 1, 2 or 3). The end is not scripted yet, since I can't reach it!!

Everything is just fine until the last strawberries remain. Then, everything hangs.

There are 20 strawberries, but some of them seem to be "bugged/jammed".

In order to debug this, I tried calling the strawberries like this:
- For every one, put its own UID in an array
- In a textbox, for every UID in the array, append that ID, thus making me able to read them.

I found that I only could see 10 UIDs, the other were marked as 0.

I did the same but with IID, I could only see 10 in the textbox, other 10 marked as 0.

Deleting those instances (strawberries) didn't either work. It just hang again.

Construct2 does not seems to be able to pick them either (using pick nth instance in my final source)

Can someone take a look and see what I'm doing wrong?

Link to my source:

Thanks in advance.
Posts: 1
Reputation: 127

Post » Thu Oct 10, 2013 1:37 am

Your 'Counter' mechanism doesn't work. It keeps increasing, and then you are telling the script to pick the Counter instance, but once the Counter value gets over 10, there aren't 10 strawberries to pick from. You need to devise a better mechanism for picking random strawberries to delete. Try: int(random(0,Rock.Count))

Oh, and the default size of the Array is 10! Increase the number of elements.blackhornet2013-10-10 01:38:40
Posts: 3,686
Reputation: 128,336

Return to Construct 2 General

Who is online

Users browsing this forum: fearfulelephants, Refeuh and 13 guests