How do I Picked Count

Get help using Construct 2

Post » Wed Dec 24, 2014 11:32 pm

It's basically a 2d tower and I'm counting on the y coordinates of each room to measure the amount of current staff on that floor however I'm getting wacky numbers sometimes. For instances I'll get a staff count of 1 if there is no one on the floor, so I assume its not picking correctly.

Goal: To get an accurate count of instances of different types for each floor. The instances I refer to are staff, for example the valet.

Note: The Staff_Valet family instances are also part of two other families which I'm using for movement and things so perhaps that's what is affecting things. Other times I'll get a picked count of 5 and no one is on the floor so I assume this has something to do with it

Anyway I feel like I'm missing something obvious, I'm not narrowing the pick well enough so I thought I'd ask for a suggestion.
Image
The sub event where CurrentValet = 1 is because regardless of whether or not there are any staff on that floor it would set the picked count to 1 so I tried to counter it.
B
10
S
2
Posts: 80
Reputation: 995

Post » Thu Dec 25, 2014 9:35 am

Hi, could you create a sample capx to show the problem?

edit: never mind, have a look and see if this is close to what you want. I notice you are comparing absolute Y values which will not often match up exactly.. Here I'm just using an offset of 10 above and 10 below.
rooms_pickedcount.png

(I'm just setting a textbox with the picked count of each floor).

rooms_pickedcount.capx


The I Must Be Bored version
rooms_pickedcount_2.capx
You do not have the required permissions to view the files attached to this post.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Fri Dec 26, 2014 1:46 am

Hey there! Thank you for responding and with examples!

So I was watching yours for a while and when all the valets finally left a floor floor the picked count was still 1 (on the room instance) which doesn't make sense if its tied to the text.
Image

(it cut the full image but the bottom right in the debugger shows current valet = 1 here's the direct link)
http://i.imgur.com/b2AFRTM.png

It seems that if any instance ever enters a floor the picked count will always be at least 1. I'm guessing it's something behind construct. Anyway the text picked count seems to be correct. I tried to take a recount of floors whose staff count was 1 even if it was zero thinking it might change but to no avail. I'm going to keep playing with it
B
10
S
2
Posts: 80
Reputation: 995

Post » Fri Dec 26, 2014 1:56 am

Centra wrote:Hey there! Thank you for responding and with examples!

So I was watching yours for a while and when all the valets finally left a floor floor the picked count was still 1 (on the room instance)


No problem. hmm I'm not entirely what you mean the picked count (on the room instance) still being 1. The text just displays the rooms.current_valet value, which is set from staff_valet.picketCount. Yea my demo is a bit rough but I thought it was enough to show the relevent info. Anyway good luck with it :)[/quote]
You do not have the required permissions to view the files attached to this post.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Fri Dec 26, 2014 1:59 am

Updated my original post with an example picture, the debugger shows it as still having a value of 1 which is curious

http://i.imgur.com/11DaKyN.png

another picture with the text at 0 and the room instance at 1

Anyway, thank you for looking into it XD
B
10
S
2
Posts: 80
Reputation: 995


Return to How do I....?

Who is online

Users browsing this forum: tarek2 and 27 guests