Identify Objects with Pinned Object using UIDs didn't work

Get help using Construct 2

Post » Wed Aug 19, 2015 4:30 pm

i want to identify objects with pinned objects, i tried a lot of combinations and i cant find the solution, please help me! and explain me why this didn't works because i spend 3 days trying to solve this, i really want to understand.

Image
B
9
S
3
Posts: 142
Reputation: 1,108

Post » Wed Aug 19, 2015 4:36 pm

Scratch that
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Aug 19, 2015 4:53 pm

LittleStain wrote:Scratch that

Sorry, i don't understand, what i need to scratch?
B
9
S
3
Posts: 142
Reputation: 1,108

Post » Wed Aug 19, 2015 5:00 pm

Majinboo wrote:
LittleStain wrote:Scratch that

Sorry, i don't understand, what i need to scratch?


Sorry.. I gave a wrong solution so I edited my previous post..
Was a bit too quick with my answer..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Aug 19, 2015 5:48 pm

LittleStain wrote:
Majinboo wrote:
LittleStain wrote:Scratch that

Sorry, i don't understand, what i need to scratch?


Sorry.. I gave a wrong solution so I edited my previous post..
Was a bit too quick with my answer..


I cant see the solution :cry:
B
9
S
3
Posts: 142
Reputation: 1,108

Post » Wed Aug 19, 2015 7:25 pm

@Majinboo
I would do the UID instance variable the other way around:

instead of storing the names,UID in the PinName object, I would store the PinName.UID in the names object.

Then, anytime you pick a names object you can see if its PinNameUID variable is 0, then you know nothing is pinned to it. If there is a value in there, then you can pick the PinName object directly by that UID (rather than having go searching for PinName objects pointing back to the names object). That should simplify your code a lot.

(unless, of course, you want to have more than one PinName object pinned to the names object at a time... but it doesn't look that way to me)
B
97
S
34
G
20
Posts: 438
Reputation: 17,790

Post » Wed Aug 19, 2015 8:38 pm

AllanR wrote:@Majinboo
I would do the UID instance variable the other way around:
instead of storing the names,UID in the PinName object, I would store the PinName.UID in the names object.

Then, anytime you pick a names object you can see if its PinNameUID variable is 0, then you know nothing is pinned to it. If there is a value in there, then you can pick the PinName object directly by that UID (rather than having go searching for PinName objects pointing back to the names object). That should simplify your code a lot.

(unless, of course, you want to have more than one PinName object pinned to the names object at a time... but it doesn't look that way to me)


thank you for your help, now i can identify objects with pinned object, but i am trying to identify "duplicated" objects with the same type of pinned object and didn't work by this way:

Image

or

Image

Even i tried to pick Names object with the same UID and didn't worked.

Image

CAPX:

http://www.filedropper.com/identifypinn ... atedpins_1
B
9
S
3
Posts: 142
Reputation: 1,108

Post » Wed Aug 19, 2015 10:46 pm

This works only with individual objects and after destroying the pinned object i cant get the Boolean to false!, i want to set PinDuplicated "true" to all objects of the same type, for example if i have two pinned objects to two objects of the same type then all objects of the same type will have PinDuplicated "true", i dont why this is so hard to me, maybe i have low IQ? I was bad at math in high school :( .
Image
B
9
S
3
Posts: 142
Reputation: 1,108

Post » Thu Aug 20, 2015 5:47 am

@Majinboo

well, I am not sure I fully understand what you are trying to accomplish here, but I restructured your capx the way I think you want it to work... (it looked like you wanted to allow up to 2 of any name to be pinned, but after that no more of that name could be pinned).

I didn't use the HavePin and PinDuplicated variables because I was able to do it without them, and they were just complicating things (you were only marking pinned ones as duplicated but that was not stopping additional ones of that name from getting pinned because if they were unpinned they were not being told that name was already duplicated).

also, you were running the duplicate check on every tick - over and over again, even though most of the time nothing was changing. It is good practice to only check for things when something changes. So, now it only looks for duplicates before it tries to pin the current instance.

http://www.rieperts.com/games/forum/PinnedObjects.capx
B
97
S
34
G
20
Posts: 438
Reputation: 17,790

Post » Thu Aug 20, 2015 5:44 pm

AllanR wrote:@Majinboo

well, I am not sure I fully understand what you are trying to accomplish here, but I restructured your capx the way I think you want it to work... (it looked like you wanted to allow up to 2 of any name to be pinned, but after that no more of that name could be pinned).

I didn't use the HavePin and PinDuplicated variables because I was able to do it without them, and they were just complicating things (you were only marking pinned ones as duplicated but that was not stopping additional ones of that name from getting pinned because if they were unpinned they were not being told that name was already duplicated).

also, you were running the duplicate check on every tick - over and over again, even though most of the time nothing was changing. It is good practice to only check for things when something changes. So, now it only looks for duplicates before it tries to pin the current instance.

http://www.rieperts.com/games/forum/PinnedObjects.capx


You are awesome!!!, thank you so much!!! i will study this amazing example to understand more about construct 2, i never thought that a global variable can store values of different objects.
B
9
S
3
Posts: 142
Reputation: 1,108


Return to How do I....?

Who is online

Users browsing this forum: Kin and 34 guests