How do I reference multiple instances within an event?

Get help using Construct 2

Post » Mon Aug 11, 2014 10:28 pm

So yeah, I want one specific instance to trigger stuff with another instance within an event. I tried this but it didn't work:

Image

Any ideas on how to do it?

Another question: Can we do local variables within functions? Don't think we can but thought I'd ask. EDIT: Yes we can, boyah! Need to check the manual more :oops:
B
39
S
16
G
6
Posts: 542
Reputation: 7,617

Post » Mon Aug 11, 2014 10:38 pm

You will never get Character with UID 45 picked, because you already picked 201. Other issues aside, you must do a 'System:Pick all Character' before the Pick instance with UID 45.

Edit:
ErekT wrote:Another question: Can we do local variables within functions?

Try it and see :) (I see you've already edited your post about this)
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Tue Aug 12, 2014 9:39 am

Thanks! I'm using local variables to check conditions of different instances right now and it works fine. Also just discovered I can pass variables to functions. So much stuff right beneath my nose that I'm missing :P
B
39
S
16
G
6
Posts: 542
Reputation: 7,617

Post » Tue Aug 12, 2014 9:42 am

I have to say, dealing with objects by UID is not normally recommended.. as they will usually be different every run.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Tue Aug 12, 2014 10:39 am

Yeh I know, I normally use an instance variable to identify separate instances. I just used the "pick instance" condition in this example for clarity :)
B
39
S
16
G
6
Posts: 542
Reputation: 7,617

Post » Tue Aug 12, 2014 12:16 pm

ErekT wrote:Also just discovered I can pass variables to functions.


And they can return a value too :)
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596


Return to How do I....?

Who is online

Users browsing this forum: DharmaOne, namaewayukidesu, Yahoo [Bot] and 12 guests