[SOLVED]Why doesn't this event work?

0 favourites
  • 9 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • 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?

    Thank you.

  • 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.

  • 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...

  • 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 see, I think... Could you please show me how you would use pick by comparison correctly in that situation LittleStain ?

  • I guess you'd want:

    Pick MonstersNoSigns where MonstersNoSigns.JustSpawned = 0

    Or

    MonstersNoSigns compare variable Justspawned = 0

    These are basically the same..

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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..

  • Ahhh, now I see, it's because of the "". I thought I had entered a variable there. K, thank you for clearing that up.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)