[SOLVED]Why doesn't this event work?

Get help using Construct 2

Post » Fri Jan 08, 2016 11:43 pm

Hello World,

Check the event below please, everything seems to work fine except set size, the size never changes. For some reason C2 just ignores that part of the event, why?

Image

Thank you.
Last edited by VIKINGS on Sat Jan 09, 2016 3:15 pm, edited 1 time in total.
B
21
S
11
G
6
Posts: 414
Reputation: 5,335

Post » Sat Jan 09, 2016 1:05 am

You're comparing the string "JustSpawned" to the number 0. They'll never be equal.

I guess JustSpawned is an instance variable on MonstersNoSigns. If so, use the "MonsterNoSigns: Compare instance variable" condition.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,610

Post » Sat Jan 09, 2016 1:30 am

Yes, it is a instance variable of monsters. But if that comparison is never true then how come the other parts of the event work as intended?
First thing I tried is "compare instance variable" but that doesn't work, it's very buggy...
LE: And I just tried changing the numbers from 0 to 1 and 2, if I do that nothing happens anymore at all... so what gives? I'm very confused...:(
B
21
S
11
G
6
Posts: 414
Reputation: 5,335

Post » Sat Jan 09, 2016 10:17 am

VIKINGS wrote:Yes, it is a instance variable of monsters. But if that comparison is never true then how come the other parts of the event work as intended?
First thing I tried is "compare instance variable" but that doesn't work, it's very buggy...
LE: And I just tried changing the numbers from 0 to 1 and 2, if I do that nothing happens anymore at all... so what gives? I'm very confused...:(


As stated, the string "Justspawned" can never be the same as 0

You are trying to see if a word is the same as a number, but you could also be trying to compare if 54 is the same as 100, which will never be true..

What you want to do is compare if the instance variable on the object is equal to 0

Why the rest of the actions work?
Well event 7 is true every time, because "justspawned" is never the same as 0, so it's actions are executed..
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 » Sat Jan 09, 2016 11:53 am

I see, I think... Could you please show me how you would use pick by comparison correctly in that situation @LittleStain ?
B
21
S
11
G
6
Posts: 414
Reputation: 5,335

Post » Sat Jan 09, 2016 12:20 pm

I guess you'd want:

Pick MonstersNoSigns where MonstersNoSigns.JustSpawned = 0

Or

MonstersNoSigns compare variable Justspawned = 0

These are basically the same..
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 » Sat Jan 09, 2016 1:35 pm

LittleStain wrote:I guess you'd want:

Pick MonstersNoSigns where MonstersNoSigns.JustSpawned = 0


Well that's exactly what I tried to do by using that "pick by comparison"... Compare if that variable is equal to 0 and pick only those for which that is true. But you just said that it can never be 0 @LittleStain , what am I missing....?

And as for "compare instance variable" I tried it, but it's all buggy, it skips a row, overlaps the sprites, etc.

LE: Nevermind, I manage to get it done by using "pick all" and "compare instance variable" combined. I still don't really get why pick by comparison didn't work, but anyway, it's done. Thank you.
B
21
S
11
G
6
Posts: 414
Reputation: 5,335

Post » Sat Jan 09, 2016 2:35 pm

VIKINGS wrote:I still don't really get why pick by comparison didn't work, but anyway, it's done. Thank you.


Your comparison:

"JustSpawned" = 0

Is comparing if the text "JustSpawned" is the same as the number 0

My comparison

MonstersNoSigns.JustSpawned = 0

Is comparing if the instance variable JustSpawned of the object (in this case family) MonstersNoSigns is the same as the number 0

As a text can never be the same as a number (and everyone can see "JustSpawned" isn't the same as 0), your event can never be true..
The instance variable JustSpawned however is a number, so that number could be 0..
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 » Sat Jan 09, 2016 3:00 pm

Ahhh, now I see, it's because of the "". I thought I had entered a variable there.;) K, thank you for clearing that up.
B
21
S
11
G
6
Posts: 414
Reputation: 5,335


Return to How do I....?

Who is online

Users browsing this forum: CJacobsSA, R0J0hound and 7 guests