How do I fix this issue with Layouts?

  • Heya all! I seem to be having a problem. I have a layout called World and every 5-10 seconds it's supposed to goto a layout called Battle.

    This works fine. When I click a button labeled "Flee" it's supposed to return to "World". Unfortunately it's just re-initializing combat.

    I use the variable init_combat to detect when combat should be fired and I reset it to 0 before switching layouts. Debugging shows it DOES change, but it's still consistently sending me back to Battle.

    In the event sheet for World:

    in the event sheet for Battle

  • 1. Try setting timescale as it may be making 5-10 seconds happen really fast. It is a system event.

    Note: Set the timescale first. Also during debugging try setting wait to 10 just so you don't get confused by the inconsistency of random.

    2. Why even have that init_combat variable in this case. You can remove "every random(5,10) seconds" and turn it into--

    "On start of Layout" -> Wait random(5,10) -> Go to Battle

  • 1: Alright I'll try that and get back to you. Thanks for the input!

    2: You're absolutely right. That was the way it was set up originally. It's only there as a remnant of code from where I was trying to figure out what was going wrong. I'll remove it immediately.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you are waiting 5-10 seconds to set init_combat to 1

    and then if inti_combat = 1

    then set it to 0 and go to battle

    i think you should do it like this

    at start of layout

    wait 10-5 seconds

    go to battle

    when clicked

    do all the neccesary actions

    and then go to world..

    i dont know what purpose init_combat has??

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