Pick by UID change question

Discussion and feedback on Construct 2

Post » Thu Apr 25, 2013 5:11 pm

Hello everyone, loving the new patch. One quick question though.

The new patch has the following change:
'Pick by UID' is now not invertible (use 'Object UID exists' system condition instead)

Can we still use ELSE events after it and would they enter if the Pick by UID failed to pick an object with that UID?

Thanks, again loving the change. I am a big Pick by UID user (I use this to do event inheritances in families and better modularize my code).
B
19
S
4
G
4
Posts: 70
Reputation: 3,896

Post » Thu Apr 25, 2013 6:03 pm

It should do, just make a quick test and see if it works. It was just specifically that if you inverted the condition, that condition itself would never be true.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,630

Post » Thu Apr 25, 2013 6:21 pm

Just did, I can confirm that it works.

Thanks Ashley
B
19
S
4
G
4
Posts: 70
Reputation: 3,896

Post » Thu Apr 25, 2013 6:50 pm

@Ashley

It's sad but there's no real equivalent to [code]Sprite: [invert] pick by UID [/code]anymore.

I was actually using it a lot for connecting nodes (spliting games, node base system, etc)

The basic pattern I was using was:

[code]// create a new edge and save the UID of first node
+ Mouse: on left click on node
   -> System: create object edge at node.X,node.Y
   -> edge: set new to true
   -> edge: set firstNode to node.UID

// a new edge as been created
+ Edge: Is new
   // a close node other than the first Node -> we snap the edge to it
   + node: [invert] pick instance with UID edge.firstNode // so I pick every other
   + node: Pick nearest to (mouse.X, mouse.Y) // amongst every other node, the closest to the mouse
   + distance(mouse.X,mouse.Y,node.X,node.Y) < SNAP_RADIUS
      -> edge: Set angle toward(node.X, node.Y)
      -> edge: set width to distance(self.X,self.Y,node.X,node.Y)
      -> edge: set secondNode to node.UID

   // no close second node -> we follow the mouse
   + else
      -> edge: set secondNode to -1
      -> edge: set angle toward(Mouse.X,Mouse.Y)
      -> edge: set width to distance(self.X,self.Y,Mouse.X,Mouse.Y)
....[/code]

Now, to be able to do the same I'll probably have to foreach through all the node, flag them with a boolean and then pick using this boolean, and to the nearest thing.
That's kinda sad (:


Also it seems that [invert] pick by UID does... the same as without inversion
Test capxYann2013-04-25 18:57:48
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Thu Apr 25, 2013 7:39 pm

Whilst I love this update, It's broken my whole clothing engine, along with my combat system in my project. I'll work with it though, it's better in the long run :P

EDIT: Actually, No, this is so difficult to work around. Rolling back to previous update :(Jase002013-04-25 19:46:42
B
45
S
19
G
10
Posts: 562
Reputation: 9,543

Post » Thu Apr 25, 2013 11:51 pm

@Jase00

Maybe you could show a sample of the code that is breaking.
I'm wondering if removing the ability to invert pick by UID is a problem or not.

In my situation explained above, I could solve the problem with a boolean.
So it's less "sad" as I thought at first.

But if you really found a case where the work around is messy, it would be a good argument to convince @Ashley of the necessity of it (:

also, I don't really understand how using Object UID exists is really equivalent to Pick by UID as suggested in the changelog.[quote]'Pick by UID' is now not invertible (use 'Object UID exists' system condition instead)[/quote]Unless Ash meant it as "now you don't need to use Pick by UID to check if an object's UID exists" But I don't think it was the principal use of this action.Yann2013-04-25 23:53:12
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Fri Apr 26, 2013 12:10 am

Using "Object UID exists" isn't good as I can't refer to the specific object. There's probably a way round it but I'm failing to figure it out in my mind.
@Yann I am pretty much having the same problem as you with your nodal system; I NEED to "Unpick" an object. My combat system requires the attacker to be unpicked from being attacked. Now all the characters just hit themselves since they are no longer "unpicked", rather than hitting the character in front of them. :(
B
45
S
19
G
10
Posts: 562
Reputation: 9,543

Post » Fri Apr 26, 2013 12:37 am

@Jase00
Can't you add a boolean like attacker.ignored and switch it to true (somehow), and then use attacker: [invert] is ignored instead of attacker: [invert] pick by UID someUID ?
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Fri Apr 26, 2013 12:50 am

@Yann
Hmm, that sounds like it might work actually. However, I'm currently on the version below and don't really feel like tampering with this just yet XD Thanks!
B
45
S
19
G
10
Posts: 562
Reputation: 9,543

Post » Fri Apr 26, 2013 12:46 pm

I didn't know anyone used 'Pick by UID' inverted, it seems like a strange thing to do. But since people used it I'll try and get it working again for the next beta.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,630

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 6 guests