Weird thing happening with instace variables/Z index?

0 favourites
  • 5 posts
  • Hello!

    I'm trying to create a poison (fart) cloud that damages enemies every 0,6 seconds and it should affect a group of enemies at the same time.

    The thing is, it almost always leaves one enemy unaffected (from a group of any number of enemies) and it's always the one that as 0 / X as Z index. (I don't know what that could mean).

    Sometimes -although veeeery rarely- the cloud affects everyone. I've tried shooting from every angle but it doesn't seem to change anything.

    Here's a video showing the issue:

    i.gyazo.com/3a8a874e63021a47ebff3f3796607c02.mp4

    and here's a capture of my events:

    Do you have any idea what could it be?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That's pretty weird. Can you open the debug preview and see what's going on with the unaffected enemy? Check out it's timer variable, beingPoisoned variable, etc

  • When it's touched by the poison cloud, it triggers one tick and then it stops. The bool (beingPoisoned) is TRUE but the timer is at 0.

    Once that enemy suffers 1 tick and stops being affected, as long as he is overlapping a cloud (new or old), it stays unaffected. If I wait until he's no longer in touch with any cloud and poison him again, then it works.

    It's just so weird...

  • The code is a little wild anyway in one loop and with a trigger once present, that's why bugs happen. I would set them to poisoned on cloud overlap and then bring out the other logic into separate events. When poisoned have each enemy start their own timer.

  • You were right on the trigger once event! I removed it and that fixed it.

    In my head it made sense because I thought, if poisonTimer hits 0, then it'd subtract 1 from HP every tick while it's 0. But I just realized it instatly changes its value in that same event.

    Thank you!

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