Problem with small Condition branch

This forum is currently in read-only mode.
From the Asset Store
Various Bell Sounds (from small to huge) / 35 Unique Clips / 2:46 minutes of audio
  • Hello! More or less brand new here.

    I haven't any idea how to fix a problem I'm having; I have two conditions set-up, one for adding a large number to a text box when an object is clicked and only if doing so would not bring the total to greater than 99999 (as doing so would cause the text to be larger than the window it's being displayed in), and one for simply brining the total up to 99999 if the amount being added would exceed it.

    With both Conditions in place, though, when I click the object that adds the number the value simply gets set to 99999. Oddly, if I disable either one of the conditions, the other seems to work just fine.

    The cap file for the game is here

    It's condition #7 and #8, under Resources, that are giving me trouble.

    Any help would b appreciated.

    (Technically, this particular issue wouldn't realistically be a problem in the game, but more broadly I'd like to understand what is wrong in case of a future conflict dealing with a similar circumstance)

  • That's a bit messy way you've got there... I'd suggest to only have one trigger, but two subevents with separate conditions. Also, there is no point giving 99999-55555 as a value, that is a simple arithmetic operation, just give 44444.

    Like this (+ is an event condition, ++ is a subevent condition, > is action):

    +On left clicked on Sprite3
    ++ 'Amount of water' greater than 44444
       > set 'Amount of water' to 99999
    ++ 'Amount of water' less or equal than 44444
       > set 'Amount of water' to 55555  [/code:1x8m8mfm]
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hm. Nope, that didn't work.

    Here's the cap file with your suggested changes made.

    Thanks for trying to help, though.

    ...I think what is happening is that the first condition is triggering the other one. If that's the case, I'm not sure how to prevent that from happening.

  • Oops! I had the Conditions in the wrong order. The check for the value cap has to come first (as you had set-up).

    All fixed & working as planned. Thanks a pile.

  • Ah yes, forgot to mention that Construct processes events and conditions from top to bottom, if it changes the value in a way that it meets the next condition within the same tick, it will process that as well.

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