"Trigger Once" and Families

0 favourites
  • 11 posts
From the Asset Store
Change the size and position of everything without calculating anything!
  • Hello,

    Consider the following:

    To save you the headache of deciphering those expressions the gist of it is:

    That's all fine and dandy. Without the "Trigger Once", an object is created every tick during that certain frame. That's too many. We just need 1 object. Sounds like the exact use case of Trigger Once While True, right?

    It works... until multiple CharacterAnimation family members are on that certain frame of that certain animation at the same time. Then, still only 1 object is created.

    Any ideas of how I can re-factor this event to calculate the Trigger Once for each instance? "For Each" just exacerbates the problem.

  • It works... until multiple CharacterAnimation family members are on that certain frame of that certain animation at the same time. Then, still only 1 object is created.

    Do you mean 1 object total or per instance? If you mean total I'm not sure how that would happen, it should pick all instances of family. This should work and even if they hit the frame at the same time it shouldn't be an issue.

  • Do you mean 1 object total or per instance?

    Total. It seems as if "Trigger Once" looks at a Family as one big entity, so the first time the condition is met by any Family member, "Trigger Once" is satisfied.

    There seems to be a workaround using variables detailed in https://www.construct.net/en/forum/construct-2/general-discussion-17/request-instanced-trigger-once-81102 and https://www.construct.net/en/forum/construct-2/how-do-i-18/trigger-once-per-instance-131777

  • No that shouldn't be the case, a family is treated as an object type and it should run through all instances of family when checking the animation frame. If it creates one object total then that means only one instance is true. I prefer to do it a bit differently so an event is not running every tick but what you describe should still work

  • lionz Can confirm that it does not work. Both instances are true at the same time but only one object is created.

    1drv.ms/u/s!AkmrWgxeuxlKhIg5Is2xK4KVxFZJ5w

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • OP you using system create? I think that doesn't work well with picking, I used spawn.

  • That's odd, the image in my original post vanished. Yes, I'm using system create, because I have to do it by name. (gotta have BadGuy1 spawn BadGuy1Projectile, and BadGuy2 spawn BadGuy2Projectile, and so on and so forth)

  • There was never an image on that post from what I saw. You wouldn't need to use create by object name there as described since you are picking one object type and spawning one object type, try using spawn as it will resolve the more general issue with instance picking.

  • I think "Trigger Once While True" is working as intended in this case. After all, it's called "Trigger Once While True", not "Trigger Once For Each Instance That's True"

    The first Family member that fulfills the condition, satisfies it.

    Logically, the solution would then seem to be some combination of "For Each" and "Trigger Once While True", however no arrangement of those two seems to work.

  • If you use the 3rd method in my image it works for all instances.

    On Family Frame Changed

    family.animation.frame=X - Create object

  • Wow, "frame changed" was exactly what I needed, I'm incredibly blind. Thanks!

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