KaseyFisher's Forum Posts

  • 5 posts
  • Thank you, both of you, I supper appreciate the help! It's a lot clearer how this works now and yeah, just giving the destroyed objects a variable or something that makes them unpickable is super simple. Don't know how I didn't think of that.

  • I forgot to mention it repeats 4 times again, because there can be a maximum of 4 units on each row.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Because my problem isn't with picking created instances, it's with trying not to pick instances that have already been destroyed. I don't know how to explain my specific problem, but I'm making a battle system that involves 4 symmetrical rows. On each turn, opposing units will deal damage to each other, in order based on their speed and I'm calculating it with one event that repeats 4 times and effects each row sequentially. It works perfectly if no units die, but if one is destroyed, the entire event just stops somehow, even if it hasn't repeated yet. I added wait 0 and it fixed the problem but introduced a bunch of new ones that I don't understand.

    "Action" takes the picked fish, calculates it's target and deals the damage, while "Update" checks all fish to see if they have below 1 hp and kills them. I have tried Wait 0 in every way I can think of and there's always bizarre seemingly erratic results. I might try custom actions instead of functions.

  • I appreciate the help, but pick by uid isn't relevant to my project, and Wait 0 seems to mess everything else up. It seems simple but in execution, it never seems to work in a predictable way.

  • There's something strange about how creating and destroying objects work in relation to functions, and I would really like clarification about what's happening in the examples below.

    Obviously in this example, If the layout had no sprites before the trigger, than the sprite count would be 1. Makes perfect sense, but if you count the sprites with a function, something completely different happens

    Even though it should be the same sequence of events in the same frame, the text will display 0 this time. And what's really confusing to me, is that this only happens if there are no sprites on the layout at the time of the trigger.

    This same concept also seems to apply destroying objects. In this example, the function will count the sprites before they are destroyed instead of after.

    One more thing is that if you put Wait 0 in-between the creating/destroying and the function, then everything works as you would expect.

    So basically this phenomenon seems to be a very frequent issue in a project I'm working on, (the examples have nothing to do with the project) and I would really like to understand exactly how and why this works so I can work with it better. Specifically, why does this happen in the first place, and why does Wait 0 fix it?

  • 5 posts