[Suggestion] "Wait" to not run when conditions are invalid?

0 favourites
  • 10 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • Guys, do you agree with the action "Wait" in it's current function?

    I realized that the "Wait" action still runs even when it's condition is already invalid or no longer meet.

    I understand that it works like a trigger that it will finish it's tasks no matter what but

    still, running an action that is already over will make a lot of unexpected events to happen in some cases.

    (for example)

    *Shoot variable == 1

    -->Wait(3.0 seconds)

    --> Shoot()

    //what if In the next line I change the Shoot variable to 2?

    -->Shoot = 2

    What will happen here is that the gun will still shoot... regardless...

    And the event ended 2.99 seconds ago.

    This is only a suggestion so calm down guys.

    Feel free to tell any downfalls of my suggestion if I missed something... Remember I'm not an experienced programmer...

    Ashley is this feature intended from the start?

  • All wait does is delay the following events from running. To make it conditional it's probably simpler to use something else like a variable used as a timer or the timer behavior.

  • R0J0hound - Well, I sure messed up on my game... But I think I found a way to remake it using the timer behavior as you said, though it will be messy. I easily misunderstood it's use, because of the word "wait".


  • ........ So i'll just close this now .........

  • For many use cases it's important to run even if the event is no longer true. For example:

    + On pressed spacebar

    -> Shoot a laser

    -> Wait 0.5 seconds

    -> Shoot a laser

    In this case the user wants a "double shot" every time the player presses space. Space may not be down for the second shot but it still definitely should run the action. In fact it doesn't make sense to ask if a trigger is still true after the event has fired, because triggers are one-off events.

    You could just wait then call a function which checks if the condition is still true, so you can have it both ways.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In lots of events i need to add a "wait 0 second" between two actions, sometime it's not enough then i add twice.

  • It's a bit off topic, but I find "Wait 0 seconds" to be a hacky solution in most cases. It's used in cases where new objects aren't pickable yet and when used multiple times it makes the game logic very hard to debug.

  • Wait 0 is not only useful for getting new created object.

    For example, official text object only calculate text width when rendering, so the text width is only available at next tick.

  • Suggestion - Add a disclaimer to the Wait tutorial that mentions it is a very special action that completely breaks from how the event sheet system normally works.

    I'd even want to suggest it should probably be something for beginners to avoid, as it seems to be subject to a fair amount of misuse (most commonly in loops). Or maybe make a mention of it in the common mis-used events and gotchas article?

  • To wait for the next tick especially to select just created objects on the current tick, just use wait dt second.

    You don't need to do so however if your actions are below of the creation action on the same or sub loop.

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