how does rexrainbow Function call work with pick?

Get help using Construct 2

Post » Mon Feb 13, 2012 7:11 am

If I have the following code:

Event 1
-- Subevent 1
---- Call Function("CreateObjectA")
---- Set ObjectA.Val = bla bla bla


And CreateObjectA() is a rexrainbow function (in a separate event sheet), which has:

On Function CreateObjectA
-- System Create ObjectA


Will the following calls that act on sprites of type "ObjectA" only act on the one that was created? As I understand it, when a sprite is created, the SOL (for sprites of ObjectA) is only set to that particular instance.

I just want to make sure I don't have to do a subsequent Pick by the created objects UID. Anyone have any ideas about this? I've got a lot of object A being created on the fly, so it's very important that the following Set value call only act on the latest created instance of ObjectA.

Thanks,
-- cacotigon
B
30
S
6
G
8
Posts: 232
Reputation: 6,119

Post » Mon Feb 13, 2012 8:35 am

I think it won't. Well it's not very hard to check that, just instead of setting a variable set some random size and you'll see if all the already created object are affected or not.

To simulate picking you could set a boolean named 'picked' to true on creation inside the function, and then add a "is picked" after the call to set your value and directly set this boolean to false to somehow lock it.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Mon Feb 13, 2012 8:36 am

I will summon Rex now...

up, up, down, down, left, right, left, right, B, A, START.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Mon Feb 13, 2012 10:03 am

@cacotigon

My function plugin does not touch/change SOL. The SOL will be changed by event sheet itself.

From my testing,
[code]-- Subevent 1
---- Call Function("CreateObjectA")
---- Set ObjectA.Val = bla bla bla[/code]
the SOL in [code]Set ObjectA.Val[/code] will not equal to created ObjectA. So @Yann is right.
B
97
S
22
G
177
Posts: 4,111
Reputation: 103,525

Post » Tue Feb 14, 2012 4:53 pm

Thanks! In that case, I'd better stick to a subsequent pick call of the Function.Result which I set to the created object's UID.
B
30
S
6
G
8
Posts: 232
Reputation: 6,119


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 8 guests