Select First / Last Instance of an Object

Get help using Construct 2

Post » Thu May 31, 2012 6:48 pm

Hello Friends

any way to do that?

Claim: to set the UID / IID of the first object instance up to the one, which was destroyed before.

Best regards xeed2012-05-31 18:56:45
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Thu May 31, 2012 6:56 pm

Use the condition System: Pick nth instance.

Example capx
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Thu May 31, 2012 7:03 pm

The last one is clear now, thanks.

But is instance 0 always the first instance?

PS: Did you read the update of my post up?
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Thu May 31, 2012 9:18 pm

Sorry to kick the thread, but i've read all stuff about this on scirra, and did not find a solution...just more questions coming up straight.

which ID is selected by picking an object instance? UID, or IID? And is there a way to re-sort them during runtime?

The aim is simple, but c2 seems it can not handle it without additional (instance or global) vars, which makes the events extra complicated:
i got multiple instances of an object. if one of them destroys, the index of them should keep without "holes".
But UID is static; IID's does not seem to auto-reindex ...so whats IID for, and how to access an object about it?

@Kyatric: Sorry, but picking instance 0 does not select the first instance of an object, once the first destroyed before.

So, any answers and ideas welcome
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Thu May 31, 2012 9:46 pm

IID does auto reindexing.

Anyway, things would be faster if you explained what your game is about and what you want to use IDs or ordering for ?
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Thu May 31, 2012 10:05 pm

Hey Yann,

the game is not that easy to describe in few sentences, but i'll try.

Imagine multiple "holdpoints" to collect, and through which multiple enemies are random auto-pathed until these points are destroyed after being collected. Also the enemies can be killed.

Both object types are preset to a route in a city layout (with solid objects etc). To not slowdown fps over the large map (with over 100 enemies+holdpoints+LOS+autopath movement), the limit of moving enemies is currently (the next) 4 along the route, and also they can also only move between (the next) 4 available holdpoints.

Hope this description helps to understand where it should go.

xeed2012-05-31 22:06:15
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Wed Oct 12, 2016 6:58 am

You can compare the IID with (object.Count-1)
B
10
S
1
Posts: 1
Reputation: 642


Return to How do I....?

Who is online

Users browsing this forum: Paradox and 5 guests